You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

71 lines
2.4 KiB

<?php
//外購組裝單 (組裝申請單)
include "T8_Authorization.php";
?>
<script>
get_Auth();
window.addEventListener('message', function(event) {
if (event.origin === "http://localhost:3000" && (typeof event.data === "string")) {
var validation = event.data;
console.log(validation);
var apiurl = 'https://erp.masada.com.tw:780/twWebAPI/V1/STKASSY/PostERPData';
headerParam = {
CHI_Authorization: `${validation}`,
};
var body = [{
"name":"stkAssyMast",
"rows":[
{
"BillNo":"TEST02",
"OrgId":"1000",
"TypeId":"CA",
"MaterialId":"3MH00302",
"PersonId":"M0122",
"CompId":"1001",
"DeptId":"220",
"SQuantity":1,
"SUnitId":"SET",
"CurrentState":2,
"CreatorId":"M0122"
}
]
},{
"name":"stkAssySubMatInfo",
"rows":[
{
"BillNo":"TEST02",
"MaterialId":"3MH00302P",
"ComponentBaseQty":1,
"UnitQty":1,
"SUnitId":"SET",
"MarkerNo":"3MH00302",
"CU_MaterialId":"3MH00302"
},{
"BillNo":"TEST02",
"MaterialId":"MX00000001",
"ComponentBaseQty":1,
"UnitQty":3,
"SUnitId":"PCS",
"MarkerNo":"3MH00302",
"CU_MaterialId":"3MH00302"
}
]
}];
var json = JSON.stringify(body);
obj = {
type:'POST',
url:`${apiurl}`,
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>