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
include "T8_Authorization.php";
echo "ii";
?>
<script>
get_Auth();
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;
console.log("event");
console.log(validation);
var corsurl = 'http://cors-anywhere.herokuapp.com/';
var apiurl = 'http://60.244.87.101:880//twWebAPI/V1/SALSALESORDER/GetERPData?pkValue=T23080088';
// var corsurl = 'http://cors-anywhere.herokuapp.com/';
var apiurl = 'http://60.244.87.101:880/twWebAPI/V1/APCHECKBILL/PostERPData';
headerParam = {
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 = {
type: 'GET',
url: `${corsurl}${apiurl}`,
// url: `${apiurl}`,
type: 'POST',
// url: `${corsurl}${apiurl}`,
url: `${apiurl}`,
// dataType: 'json',
headers: headerParam,
// data: json,
// dataType: "json",
data: json,
dataType: "json",
success: function(res) {
console.log(res.Status);
console.log(res.ErrorMsg);

8
wms/T8_Authorization.php

@ -10,7 +10,7 @@ $sign = hash_hmac('SHA256', $data, '964C834F7BF2BB70', false);
function get_Auth() {
var api_key = '964C834F7BF2BB70';
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';
headerParam = {
UserId: 'M0000',
@ -20,13 +20,13 @@ $sign = hash_hmac('SHA256', $data, '964C834F7BF2BB70', false);
};
obj = {
type: 'get',
url: `${corsurl}${apiurl}`,
// url: `${apiurl}`,
// url: `${corsurl}${apiurl}`,
url: `${apiurl}`,
dataType: 'json',
headers: headerParam,
success: function(res) {
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');
}
};

2
wms/rib01-business-check.php

@ -187,7 +187,7 @@ $feetype = mysqli_fetch_all($feetype_query, MYSQLI_ASSOC);
<?php
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>
</a>

2
wms/rib01-business-create.php

@ -65,7 +65,7 @@ if ($MaxBillNo < 10) {
<div style="width: 90%;">
<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>
</a>
</div>

Loading…
Cancel
Save