5 changed files with 175 additions and 3 deletions
@ -0,0 +1,83 @@ |
|||
<?php |
|||
include "T8_Authorization.php"; |
|||
echo "收貨申請單"; |
|||
|
|||
?> |
|||
<script> |
|||
console.log(<?= $now ?>); |
|||
get_Auth(); |
|||
window.addEventListener('message', function(event) { |
|||
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/PURRECEIVINGORDER/PostERPData'; |
|||
headerParam = { |
|||
CHI_Authorization: `${validation}`, |
|||
}; |
|||
var body = [ |
|||
{ |
|||
"name": "purReceivingOrderMaster", |
|||
"rows": [ |
|||
{ |
|||
"BillNo": "Z001", |
|||
"BillDate": 20210420, |
|||
"ReceiveOrgId": "1000", |
|||
"OrgId": "1000", |
|||
"DemandOrgId": "1000", |
|||
"TypeId": "RC", |
|||
"BizPartnerId": "Z001", |
|||
"PersonId": "Z001", |
|||
"CurrId": "NTD", |
|||
"CurrOAmount": 1, |
|||
"CurrLAmount": 1, |
|||
"ReciveDate": 20210420, |
|||
"DueToId": "Z001", |
|||
"TaxId": "ST005", |
|||
"DebtorOrgId": "1000", |
|||
"DebtorCurrOAmount": 1, |
|||
"DebtorCurrLAmount": 1, |
|||
"ReceiveCompId": "1000", |
|||
"DebtorCompId": "1000", |
|||
"DemandCompId": "1000" |
|||
} |
|||
] |
|||
}, |
|||
{ |
|||
"name": "purReceivingOrderDetail", |
|||
"rows": [ |
|||
{ |
|||
"TaxId": "ST005", |
|||
"BillNo": "Z001", |
|||
"RowCode": "1", |
|||
"ItemType": 0, |
|||
"MaterialId": "Z001", |
|||
"ReceivingSQty": 1, |
|||
"SUnitId": "SET", |
|||
"SPrice": "100" |
|||
} |
|||
] |
|||
} |
|||
] |
|||
; |
|||
var json = JSON.stringify(body); |
|||
obj = { |
|||
type: 'POST', |
|||
// url: `${corsurl}${apiurl}`, |
|||
url: `${apiurl}`, |
|||
// dataType: 'json', |
|||
headers: headerParam, |
|||
data: json, |
|||
dataType: "json", |
|||
success: function(res) { |
|||
console.log(res.Status); |
|||
console.log(res.ErrorMsg); |
|||
console.log(res.Data); |
|||
} |
|||
}; |
|||
jQuery.ajax(obj); |
|||
} |
|||
}) |
|||
</script> |
@ -0,0 +1,89 @@ |
|||
<?php |
|||
include "T8_Authorization.php"; |
|||
echo "採購單"; |
|||
echo "111"; |
|||
?> |
|||
<script> |
|||
console.log(<?= $now ?>); |
|||
get_Auth(); |
|||
window.addEventListener('message', function(event) { |
|||
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/PURPURCHASEORDER/PostERPData'; |
|||
headerParam = { |
|||
CHI_Authorization: `${validation}`, |
|||
}; |
|||
var body = [{ |
|||
"name": "purBillOrderMaster", |
|||
"rows": [{ |
|||
"BillNo": "Z004", |
|||
"BillDate": 20210420, |
|||
"TypeId": "PO", |
|||
"OrgId": "1000", |
|||
"FOrgId": "1000", |
|||
"BizPartnerId": "33709933", |
|||
"CurrId": "TWD", |
|||
"CurrOAmount": 1.00000, |
|||
"CurrLAmount": 1.00000, |
|||
"PersonId": "M0122", |
|||
"DueToId": "33709933", |
|||
"TaxId": "ST005", |
|||
// "DebtorOrgId": "1000", |
|||
// "DebitorCurrId": "TWD", |
|||
// "DebtorCurrOAmount": 1.00000, |
|||
// "DebtorCurrLAmount": 1.00000, |
|||
"CompId": "1001", |
|||
// "DebtorCompId": "1001", |
|||
"CurrentState": 2, |
|||
"FlowState": 2, |
|||
"PermitState": 2, |
|||
"Remark":"testtest", |
|||
"CreatorId": "M0122", |
|||
"IsPriceWithTax":1 |
|||
|
|||
}] |
|||
}, |
|||
{ |
|||
"name": "purBillOrderDetail", |
|||
"rows": [{ |
|||
"DemandOrgId": "1000", |
|||
"TaxId": "ST005", |
|||
"DeliveryDate": 20210420, |
|||
"ReceiveOrgId": "1000", |
|||
"DebtorOrgId": "1000", |
|||
"ReceiveCompId": "1001", |
|||
"DemandCompId": "1001", |
|||
"BillNo": "Z004", |
|||
"RowCode": 1, |
|||
"ItemType": 0, |
|||
"MaterialId": "MX23010003", |
|||
// "MaterialSpec": "LY-08/紅光/1", |
|||
"SQuantity": 1.00000, |
|||
"PresentSQty":1, |
|||
"SPrice": 100 |
|||
}] |
|||
} |
|||
]; |
|||
var json = JSON.stringify(body); |
|||
obj = { |
|||
type: 'POST', |
|||
// url: `${corsurl}${apiurl}`, |
|||
url: `${apiurl}`, |
|||
// dataType: 'json', |
|||
headers: headerParam, |
|||
data: json, |
|||
dataType: "json", |
|||
success: function(res) { |
|||
console.log(res.Status); |
|||
console.log(res.ErrorMsg); |
|||
console.log(res.Data); |
|||
} |
|||
}; |
|||
jQuery.ajax(obj); |
|||
} |
|||
}) |
|||
</script> |
Loading…
Reference in new issue