7 changed files with 19297 additions and 4855 deletions
Binary file not shown.
File diff suppressed because it is too large
Binary file not shown.
File diff suppressed because it is too large
@ -1,77 +1,66 @@ |
|||||
<?php |
<?php |
||||
$now = gmdate("YmdHis"); |
require_once('../../T8_Authorization_from_bpm.php'); |
||||
$data = 'M0000.' . $now; |
require_once('../connt8.php'); |
||||
$sign = hash_hmac('SHA256', $data, 'B2D6395D2883E26C', false); |
|
||||
?> |
|
||||
|
|
||||
<script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script> |
$validation = get_Auth(); |
||||
<script> |
$data = [ |
||||
var body = [{ |
[ |
||||
"name": "salIncomeApplyMaster", |
"name" => "OtherStockOutMtable", |
||||
"rows": [{ |
"rows" => [ |
||||
"BillNo": "Z001", |
[ |
||||
"BillDate": 20160811, |
"BillNo" => "00850110", // 單據編號 varchar(20) |
||||
"OrgId": "1000", |
"BillDate" => 20210427, // 單據日期 int |
||||
"FOrgId": "1000", |
"OrgId" => "1000", //組織 varchar(20) |
||||
"TypeId": "RR", |
"FOrgId" => "1000", //核算組織 varchar(20) |
||||
"BpOrgId": "1000", |
"TypeId" => "OS", //單據類型 varchar(10) |
||||
"BizPartnerId": "C002", |
"BizPartnerId" => "", //往來對象(供應商) 可為空 |
||||
"CurrId": "RMB", |
"PersonId" => "C0003", // 經辦人員 varchar(20) |
||||
"CurrOAmount": 1, |
"DeptId" => "250", // 經辦部門 varchar(20) |
||||
"CurrLAmount": 1, |
"CompId" => "1001" // 公司 varchar(20) |
||||
"PersonId": "T001", |
] |
||||
"DtOrgId": "1000", |
] |
||||
"DueToId": "C002", |
], [ |
||||
"TaxId": "123", |
"name" => "OtherStockOutDetail", |
||||
"CompId": "1000" |
"rows" => [ |
||||
}] |
[ |
||||
}, |
"BillNo" => "00850110", //單據編號 varchar(20) |
||||
{ |
"RowCode" => 1, // 序號 int(10) |
||||
"name": "salIncomeApplyDetail", |
"MaterialId" => "MX00021003", // 產品代碼 -> 產品集成 varchar(40) |
||||
"rows": [{ |
"SupplyOrgId" => "1000", // 供貨組織代碼 varchar(20) |
||||
"BillNo": "Z001", |
"SQuantity" => 1, // 交易數量 numeric(19) |
||||
"IncomeId": "F203", |
"WarehouseId" => "100" // 倉庫代碼 varchar(20) |
||||
"TaxId": "ST003", |
] |
||||
"RowCode": 1, |
|
||||
"ItemType": "1", |
|
||||
"SPrice": 50, |
|
||||
"SQuantity": 1, |
|
||||
"FromSourceTag": 0, |
|
||||
"FromBillNo": "123" |
|
||||
}] |
|
||||
} |
|
||||
] |
] |
||||
|
] |
||||
|
]; |
||||
|
$api_url = 'https://erp.masada.com.tw:780/twWebAPI/V1/STKOTHERSTOCKOUT/PostERPData'; |
||||
|
$header = [ |
||||
|
"CHI_Authorization :" . $validation |
||||
|
]; |
||||
|
$ch = curl_init(); |
||||
|
curl_setopt($ch, CURLOPT_URL, $api_url); // 设置请求的URL |
||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); |
||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $header); |
||||
|
curl_setopt($ch, CURLOPT_POST, 1); |
||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); |
||||
|
|
||||
var json = JSON.stringify(body); |
$response = curl_exec($ch); |
||||
console.log(json); |
if ($response === false) { |
||||
// obj = { |
echo 'Curl error: ' . curl_error($ch); |
||||
// type: 'POST', |
} else { |
||||
// // url: `${corsurl}${apiurl}`, |
$result = json_decode($response, true); |
||||
// url: `${apiurl}`, |
if ($result['Status'] == 'Error') { |
||||
// dataType: 'json', |
echo '<pre>'; |
||||
// headers: headerParam, |
print_r($result); |
||||
// data: json, |
echo '</pre>'; |
||||
// // dataType: "json", |
echo 'API 傳入錯誤,' . $result['ErrorMsg']; |
||||
// success: function(res) { |
} else { |
||||
// console.log(res.Status); |
echo '<pre>'; |
||||
// console.log(res.ErrorMsg); |
print_r($result['Status']); |
||||
// console.log(res.Data); |
echo '</pre>'; |
||||
// } |
return $result; |
||||
// }; |
} |
||||
// jQuery.ajax(obj); |
|
||||
// // } |
|
||||
// }) |
|
||||
$.ajax({ |
|
||||
url: 'https://127.0.0.1:780/twWebAPI/V1/SALINCOMEAPPLY/PostERPData', |
|
||||
method: 'POST', |
|
||||
dataType: 'json', |
|
||||
// headers: headerParam, |
|
||||
data: body, |
|
||||
success: function(res) { |
|
||||
console.log('Success'); |
|
||||
}, |
|
||||
error: function(err) { |
|
||||
console.log(err); |
|
||||
} |
} |
||||
}) |
|
||||
</script> |
curl_close($ch); |
||||
|
Loading…
Reference in new issue