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.
134 lines
4.1 KiB
134 lines
4.1 KiB
<?php
|
|
ini_set('display_errors', 'on');
|
|
date_default_timezone_set('Asia/Taipei');
|
|
|
|
|
|
include "T8_Authorization_curl_ver.php";
|
|
|
|
$user_id = "M0117";
|
|
$user_password = "90493119";
|
|
$validation = get_Auth($user_id, $user_password);
|
|
|
|
// getDataSchemaDetails($validation);
|
|
// getSALDISPATCHLIST($validation);
|
|
|
|
|
|
$body = [
|
|
[
|
|
"name" => "salDispatchListMaster",
|
|
"rows" => [
|
|
[
|
|
"BillNo" => "SS20230208001",
|
|
"BillDate" => 20230208,
|
|
"SupplyFOrgId" => "1000",
|
|
"FOrgId" => "1000",
|
|
"TypeId" => "SS",
|
|
"OrgId" => "1000",
|
|
"CompId" => "A",
|
|
"ModeId" => "DS",
|
|
"BizPartnerId" => "A0000001",
|
|
"PersonId" => "POS001",
|
|
"CurrId" => "TWD",
|
|
"CurrOAmount" => 1,
|
|
"CurrLAmount" => 1,
|
|
"TrusteeWarehouseId" => "",
|
|
"SendGoodsDate" => 20230208,
|
|
"DueToId" => "A0000001",
|
|
"TaxId" => "ST005",
|
|
"CreditorOrgId" => "1000",
|
|
"CreditorCompId" => "A",
|
|
"CreditorCurrOAmount" => 1,
|
|
"CreditorCurrLAmount" => 1,
|
|
"TradeConditionId" => "",
|
|
"TrusteeWarehouseBPType" => 0
|
|
]
|
|
]
|
|
],
|
|
[
|
|
"name" => "salDispatchListDetail",
|
|
"rows" => [
|
|
"SupplyCompId" => "A",
|
|
"SupplyOrgId" => "1000",
|
|
"DispatchCompId" => "A",
|
|
"DispatchOrgId" => "1000",
|
|
"SQuantity" => "1",
|
|
"TaxId" => "ST005",
|
|
"BillNo" => "SS20230208001",
|
|
"RowCode" => 1,
|
|
"ItemType" => 0,
|
|
"MaterialId" => "POS01CF0001",
|
|
"SUnitId" => "CAP",
|
|
"SPrice" => "100"
|
|
]
|
|
]
|
|
];
|
|
createSALDISPATCHLIST($validation, $data);
|
|
|
|
// 新增發貨單
|
|
function createSALDISPATCHLIST($validation, $body)
|
|
{
|
|
// 新增
|
|
$apiurl = 'http://60.244.87.101:880/twWebAPI/V1/SALDISPATCHLIST/PostERPData';
|
|
// $apiurl = 'http://10.10.145.2:880/twWebAPI/V1/SALDISPATCHLIST/PostERPData';
|
|
// $apiurl = 'https://127.0.0.1:780/twWebAPI/V1/SALDISPATCHLIST/PostERPData';
|
|
$headerParam = [
|
|
'CHI_Authorization: ' . $validation,
|
|
'Content-Type: application/json'
|
|
];
|
|
$json = json_encode($body);
|
|
myCurl($apiurl, $headerParam, $json);
|
|
}
|
|
|
|
// 發貨單查詢
|
|
function getSALDISPATCHLIST($validation)
|
|
{
|
|
// 新增 刪除
|
|
$apiurl = 'http://60.244.87.101:880/twWebAPI/V1/SALDISPATCHLIST/GetERPData?pkValue=SS20231114001';
|
|
// $apiurl = 'http://10.10.145.2:880/twWebAPI/V1/SALDISPATCHLIST/GetERPData';
|
|
// $apiurl = 'https://127.0.0.1:780/twWebAPI/V1/SALDISPATCHLIST/GetERPData';
|
|
$headerParam = [
|
|
'CHI_Authorization: ' . $validation,
|
|
'Content-Type: application/json'
|
|
];
|
|
$body = [];
|
|
$json = json_encode($body);
|
|
myCurl($apiurl, $headerParam, $json);
|
|
}
|
|
|
|
// 發貨單資料表結構
|
|
function getDataSchemaDetails($validation)
|
|
{
|
|
// 取得資料表結構
|
|
$apiurl = 'http://60.244.87.101:880/twWebAPI/V1/SALDISPATCHLIST/GetTableSchema';
|
|
// $apiurl = 'http://10.10.145.2:880/twWebAPI/V1/SALDISPATCHLIST/GetTableSchema';
|
|
// $apiurl = 'https://127.0.0.1:780/twWebAPI/V1/SALDISPATCHLIST/GetTableSchema';
|
|
$headerParam = [
|
|
'CHI_Authorization: ' . $validation,
|
|
'Content-Type: application/json'
|
|
];
|
|
$body = [];
|
|
$json = json_encode($body);
|
|
myCurl($apiurl, $headerParam, $json);
|
|
}
|
|
|
|
function myCurl($apiurl, $headerParam, $json)
|
|
{
|
|
$ch = curl_init();
|
|
curl_setopt($ch, CURLOPT_URL, $apiurl);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $headerParam);
|
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
|
|
$response = curl_exec($ch);
|
|
if ($response === false) {
|
|
echo 'Curl error: ' . curl_error($ch);
|
|
} else {
|
|
$result = json_decode($response, true);
|
|
if ($result['Status'] == 'Success') {
|
|
echo json_encode($result['Data'], JSON_UNESCAPED_UNICODE);
|
|
} else {
|
|
echo $result['ErrorMsg'];
|
|
}
|
|
}
|
|
curl_close($ch);
|
|
}
|
|
|