Cheng 1 year ago
parent
commit
18aca7810f
  1. 40
      wms/T8_APItest.php
  2. 4
      wms/T8_Authorization_from_bpm.php
  3. 40
      wms/contract/api/postContractData.php
  4. 163
      wms/contract/api/testT8API.php
  5. 6
      wms/contract/js/alpine.js

40
wms/T8_APItest.php

@ -33,22 +33,40 @@ echo "ii";
"DtOrgId": "1000",
"DueToId": "B23100061",
"TaxId": "ST005",
"CompId": "1001"
"CompId": "1001",
"CreatorId": "M0225"
}]
},
{
"name": "salIncomeApplyDetail",
"rows": [{
"BillNo": "B23100061",
"IncomeId": "A40004",
"TaxId": "ST005",
"RowCode": 1,
"ItemType": "1",
"SPrice": 10000,
"SQuantity": 0,
"FromSourceTag": 0,
"FromBillNo": ""
}]
"BillNo": "B23100061",
"IncomeId": "A40004",
"TaxId": "ST005",
"RowCode": 1,
"RowNo": 1,
"ItemType": "1",
"SPrice": 10000,
"SQuantity": 2,
"ProjectId": "B23100061",
"FromSourceTag": 0,
"CU_MaterialId": "3MH00112"
},
{
"BillNo": "B23100061",
"IncomeId": "A40004",
"TaxId": "ST005",
"RowCode": 2,
"RowNo": 2,
"ItemType": "1",
"SPrice": 10000,
"SQuantity": 2,
"ProjectId": "B23100061",
"FromSourceTag": 0,
"CU_MaterialId": "3MH00112"
}
],
}
];
var json = JSON.stringify(body);

4
wms/T8_Authorization_from_bpm.php

@ -32,8 +32,8 @@ function get_Auth($user_id = "M0000", $user_password = "M012290493119")
if ($response === false) {
echo 'Curl error: ' . curl_error($ch);
} else {
// print_r($response);
// exit;
print_r($response);
exit;
$result = json_decode($response, true);
$validation = $result['Data']['CHI_Authorization'];
return $validation;

40
wms/contract/api/postContractData.php

@ -344,7 +344,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
function T8insert($data, $facilityno)
{
require_once("../connt8.php");
// include "../../T8_Authorization.php";
include "../../T8_Authorization.php";
$contractno = !empty($data['contractno']) ? $data['contractno'] : null; // 合約號
$address = !empty($data['address']) ? $data['address'] : null; // 客戶地址
@ -360,6 +360,7 @@ function T8insert($data, $facilityno)
$num = !empty($data['num']) ? $data['num'] : null; // 電梯數量
$elevators = !empty($data['elevators']) ? json_decode($data['elevators'], true) : []; //電梯
$area = !empty($data['area']) ? $data['area'] : null; //縣市 Ex. A->台北 , B-> ..。
$payType = !empty($data['payType']) ? $data['payType'] : null;
$user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null;
@ -372,7 +373,9 @@ function T8insert($data, $facilityno)
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
$date = date('Y-m-sH-s-i');
$date_1 = date('Y-m-sH-s');
$createTime = str_replace("-", '', $date);
$insertTime = str_replace('-', '', $date_1);
$beginDate = str_replace("-", '', $contract_begin_date);
$endDate = str_replace("-", '', $contract_end_date);
if ($contractno == '') {
@ -481,7 +484,6 @@ function T8insert($data, $facilityno)
$stmt->bindParam(':CreatorId', $user_id);
$stmt->execute();
// // 新增電梯數
foreach ($elevators as $index => $elevator) {
// echo '<pre>';
@ -515,36 +517,12 @@ function T8insert($data, $facilityno)
$stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':CreateTime', $createTime);
$stmt->execute();
}
?>
<!-- <script src="./js/axios/axios.min.js"></script>
<script>
const form = new FormData();
form.append('BillNo', <?php echo $contractno ?>);
form.append('BillDate', );
form.append('');
form.append('');
form.append('');
form.append('');
form.append('');
axios.post('https://127.0.0.1:780/twWebAPI/V1/SALINCOMEAPPLY/PostERPData', form).then(res => {
console.log(res.status);
if (res.status == 200) {
alert('成功');
}
}).catch(err => {
console.log(err);
let code = err.response.data;
if (code == 422) {
console.log(err);
}
if (code == 500) {
alert('儲存失敗!可能為下載錯誤:\n' + error.response.data);
}
})
</script> -->
<script>
</script>
<?php
}
$connT8->commit();
}

163
wms/contract/api/testT8API.php

@ -2,76 +2,107 @@
$now = gmdate("YmdHis");
$data = 'M0000.' . $now;
$sign = hash_hmac('SHA256', $data, 'B2D6395D2883E26C', false);
$test = [
"A40005" => 2,
"A40001" => 3,
"A40002" => 4,
];
echo '<pre>';
print_r($test['A40001']);
echo '</pre>';
$payType = 'A0005';
?>
<script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
<script>
var body = [{
"name": "salIncomeApplyMaster",
"rows": [{
"BillNo": "Z001",
"BillDate": 20160811,
"OrgId": "1000",
"FOrgId": "1000",
"TypeId": "RR",
"BpOrgId": "1000",
"BizPartnerId": "C002",
"CurrId": "RMB",
"CurrOAmount": 1,
"CurrLAmount": 1,
"PersonId": "T001",
"DtOrgId": "1000",
"DueToId": "C002",
"TaxId": "123",
"CompId": "1000"
}]
},
{
"name": "salIncomeApplyDetail",
"rows": [{
"BillNo": "Z001",
"IncomeId": "F203",
"TaxId": "ST003",
"RowCode": 1,
"ItemType": "1",
"SPrice": 50,
"SQuantity": 1,
"FromSourceTag": 0,
"FromBillNo": "123"
}]
}
]
// var body = [{
// "name": "salIncomeApplyMaster",
// "rows": [{
// "BillNo": "Z001",
// "BillDate": 20160811,
// "OrgId": "1000",
// "FOrgId": "1000",
// "TypeId": "RR",
// "BpOrgId": "1000",
// "BizPartnerId": "C002",
// "CurrId": "RMB",
// "CurrOAmount": 1,
// "CurrLAmount": 1,
// "PersonId": "T001",
// "DtOrgId": "1000",
// "DueToId": "C002",
// "TaxId": "123",
// "CompId": "1000"
// }]
// },
// {
// "name": "salIncomeApplyDetail",
// "rows": [{
// "BillNo": "Z001",
// "IncomeId": "F203",
// "TaxId": "ST003",
// "RowCode": 1,
// "ItemType": "1",
// "SPrice": 50,
// "SQuantity": 1,
// "FromSourceTag": 0,
// "FromBillNo": "123"
// }]
// }
// ]
var json = JSON.stringify(body);
console.log(json);
// 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);
// // }
// var json = JSON.stringify(body);
// console.log(json);
// // 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);
// // // }
// // })
// $.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);
// }
// })
$.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);
}
})
let No = 'B123';
let arr = [];
for (let i = 1; i < 5; i++) {
let obj = {
'No': No,
'name': '12344',
'mum': i
};
// let arr = [];
arr.push(obj);
}
console.log(JSON.stringify(arr));
let obj = {
'A0004': 3,
'A0005': 4
}
for (let i = 1; i <= obj.<?= $payType ?>; i++) {
console.log(i);
}
</script>

6
wms/contract/js/alpine.js

@ -964,7 +964,7 @@ const contractInput = () => {
num: '', //電梯數量
disabled: false, //資料庫是否有電梯數量資料
elevators: [], //機種、載重、人乘、樓停、樓層、速度、緯度、經度、開門方式、保養別、廠牌、竣檢日、許可證日期
payType: ''
payType: '' //付款方式
},
customize: false,
step: 1,
@ -1037,7 +1037,7 @@ const contractInput = () => {
this.data.disabled = (res.data.num > 0) ? true : false;
this.data.elevators = res.data.elevators
let cityIndex = this.data.address.indexOf('市');
console.log(cityIndex);
// console.log(cityIndex);
if (cityIndex == -1) {
// cityIndex = this.data.address.indexOf('縣');
}
@ -1122,7 +1122,7 @@ const contractInput = () => {
form.append('files[]', this.data.files[i]);
}
axios.post('./api/postContractData.php', form).then(res => {
console.log(res);
// console.log(res);
if (res.status === 200) {
alert('儲存成功');
this.step = 1

Loading…
Cancel
Save