Browse Source

測試應付確認單API

gary
Ellin 2 years ago
parent
commit
5d9db5b694
  1. 73
      wms/T8_APItest.php
  2. 8
      wms/T8_Authorization.php
  3. 2
      wms/rib01-business-check.php
  4. 2
      wms/rib01-business-create.php

73
wms/T8_APItest.php

@ -1,29 +1,82 @@
<?php <?php
include "T8_Authorization.php"; include "T8_Authorization.php";
echo "ii";
?> ?>
<script> <script>
get_Auth(); get_Auth();
window.addEventListener('message', function(event) { window.addEventListener('message', function(event) {
if (event.origin === "http://127.0.0.1" && (typeof event.data === "string")) { if (event.origin === "http://localhost:3000" && (typeof event.data === "string")) {
var validation = event.data; var validation = event.data;
console.log("event"); console.log("event");
console.log(validation); console.log(validation);
var corsurl = 'http://cors-anywhere.herokuapp.com/'; // var corsurl = 'http://cors-anywhere.herokuapp.com/';
var apiurl = 'http://60.244.87.101:880//twWebAPI/V1/SALSALESORDER/GetERPData?pkValue=T23080088'; var apiurl = 'http://60.244.87.101:880/twWebAPI/V1/APCHECKBILL/PostERPData';
headerParam = { headerParam = {
CHI_Authorization: `${validation}`, CHI_Authorization: `${validation}`,
}; };
// var json = JSON.stringify(body); var body = [{
"name": "MasterTable",
"rows": [{
"BillNo": "Z001",
"BillDate": 20230930,
"OrgId": "1000",
"TypeId": "OPV",
"BizPartnerId": "03051501",
"CurrId": "RMB",
"CurrLAmount":5,
"TaxId": "ST005",
"PersonId": "M0006",
"DeptId": "220",
"CompId": "1001",
"CreditAgeDate": 20230930,
"RecBizPartnerId": "03051501"
}]
},
{
"name": "DetailTable",
"rows": [{
"BillNo": "Z001",
"RowCode": 1,
"RowNo": 1,
"ItemType": 0,
"MaterialId": "MX00000001",
"UnitId": "PCS",
"MaterialSpec": "",
"SQuantity": 10,
"SPrice": 141.18,
"OAmount": 1344.57,
"OTax": 67.23,
"OAmountWithTax": 1411.8,
"TaxId": "ST005"
},
{
"BillNo": "Z001",
"RowCode": 2,
"RowNo": 2,
"ItemType": 0,
"MaterialId": "MX00000001",
"UnitId": "PCS",
"MaterialSpec": "",
"SQuantity": 15,
"SPrice": 141.18,
"OAmount": 2016.86,
"OTax": 100.84,
"OAmountWithTax": 2117.7,
"TaxId": "ST005"
}
]
}
];
var json = JSON.stringify(body);
obj = { obj = {
type: 'GET', type: 'POST',
url: `${corsurl}${apiurl}`, // url: `${corsurl}${apiurl}`,
// url: `${apiurl}`, url: `${apiurl}`,
// dataType: 'json', // dataType: 'json',
headers: headerParam, headers: headerParam,
// data: json, data: json,
// dataType: "json", dataType: "json",
success: function(res) { success: function(res) {
console.log(res.Status); console.log(res.Status);
console.log(res.ErrorMsg); console.log(res.ErrorMsg);

8
wms/T8_Authorization.php

@ -10,7 +10,7 @@ $sign = hash_hmac('SHA256', $data, '964C834F7BF2BB70', false);
function get_Auth() { function get_Auth() {
var api_key = '964C834F7BF2BB70'; var api_key = '964C834F7BF2BB70';
var validation = ""; var validation = "";
var corsurl = 'http://cors-anywhere.herokuapp.com/'; // var corsurl = 'http://cors-anywhere.herokuapp.com/';
var apiurl = 'http://60.244.87.101:880//twWebAPI/GetAuth'; var apiurl = 'http://60.244.87.101:880//twWebAPI/GetAuth';
headerParam = { headerParam = {
UserId: 'M0000', UserId: 'M0000',
@ -20,13 +20,13 @@ $sign = hash_hmac('SHA256', $data, '964C834F7BF2BB70', false);
}; };
obj = { obj = {
type: 'get', type: 'get',
url: `${corsurl}${apiurl}`, // url: `${corsurl}${apiurl}`,
// url: `${apiurl}`, url: `${apiurl}`,
dataType: 'json', dataType: 'json',
headers: headerParam, headers: headerParam,
success: function(res) { success: function(res) {
validation = res.Data['CHI_Authorization']; validation = res.Data['CHI_Authorization'];
window.parent.postMessage(validation,'http://127.0.0.1'); window.parent.postMessage(validation,'http://localhost:3000');
// window.parent.postMessage(validation,'https://masada.com.tw'); // window.parent.postMessage(validation,'https://masada.com.tw');
} }
}; };

2
wms/rib01-business-check.php

@ -187,7 +187,7 @@ $feetype = mysqli_fetch_all($feetype_query, MYSQLI_ASSOC);
<?php <?php
if ($state == 0) : if ($state == 0) :
?> ?>
<a href="rib02-create.php?id=<?php echo $data['rib_id'] ?>&RowCode=<?= $RowCode ?>&CurrId=<?= $CurrId ?>&<?= $token_link ?>" class="btn btn-info btn-lg pull-right" style="margin: 1 rem;"> <a href="rib02-business-create.php?BillNo=<?php echo $rib['BillNo'] ?>&RowCode=<?= $RowCode ?>&CurrId=<?= $CurrId ?>&<?= $token_link ?>" class="btn btn-info btn-lg pull-right" style="margin: 1 rem;">
<span class=" glyphicon glyphicon-plus"></span> <span class=" glyphicon glyphicon-plus"></span>
</a> </a>

2
wms/rib01-business-create.php

@ -65,7 +65,7 @@ if ($MaxBillNo < 10) {
<div style="width: 90%;"> <div style="width: 90%;">
<div style="padding-left: 2rem; padding-bottom: 1rem;"> <div style="padding-left: 2rem; padding-bottom: 1rem;">
<a href="rib-business-index.php?<?php echo $token_link; ?>" class="btn btn-default btn-lg"> <a href="rib01-business-index.php?<?php echo $token_link; ?>" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-home"></span> <span class="glyphicon glyphicon-home"></span>
</a> </a>
</div> </div>

Loading…
Cancel
Save