|
@@ -791,7 +791,24 @@ class DwyController extends BaseController
|
|
$param = $request->all();
|
|
$param = $request->all();
|
|
file_put_contents('dwy.txt', json_encode($param) . PHP_EOL, 8);
|
|
file_put_contents('dwy.txt', json_encode($param) . PHP_EOL, 8);
|
|
|
|
|
|
-
|
|
|
|
|
|
+ //单独的处理哪些口子不能用的逻辑
|
|
|
|
+ $url = 'https://tm.dwycloud.com/jbl/api/module-data/device/device/diy/device_code';
|
|
|
|
+ $token = $param['token'];
|
|
|
|
+ $json = ['device_code'=>$param['mac']];
|
|
|
|
+ $header = [
|
|
|
|
+ 'Content-Type:application/json',
|
|
|
|
+ 'Authorization: ' . $token,
|
|
|
|
+ ];
|
|
|
|
+ $box_data = $this->post_helper($url, json_encode($json), $header);
|
|
|
|
+ $box_data = json_decode($box_data, true);
|
|
|
|
+ $un_box = [];
|
|
|
|
+ if(isset($box_data['data'])){
|
|
|
|
+ foreach ($box_data['data'] as $d){
|
|
|
|
+ if(isset($d['status'])&&$d['status'] == 0){
|
|
|
|
+ $un_box[] = $d['box_code'] ?? '';
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
// $param = json_decode('{"token":"Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiI1OTAwNDY0ODg5NDAzODQyNTYiLCJhdXRoIjoiUk9MRV9VU0VfQlJBTkRfU1VQUExJRVIsUk9MRV9PVVRFUl9VU0VSLFJPTEVfQlJBTkRfU1VQUExJRVIsUk9MRV9JTk5FUl9VU0VSLFJPTEVfSU5URVJGQUNFLFJPTEVfU0VORF9CUkFORF9TVVBQTElFUiIsInRva2VuSWQiOiIzIiwiZXhwIjoxNzIxMzU1NDczfQ.BMRYPq_8TXaSE4isig-2hn3I6J25IeFe8_Z9_-LZZt41yGVRE0OQUlSO9zl93a1Lv7fW9D0BB8V9ZoHxvRfWhA","list":[{"title":"E0\u6279\u96f6\u514d\u6f06\uff08\u6d4b\u8bd5\u767d\u6807\uff09","num":"6500","restock_qty":0,"product_code":"BC020202000999","product_code_show":"\u4fe1\u606f\u90e8\u6d4b\u8bd51800\u9999\u6749\u6728","order_item_id":"590882008738308096","order_item_id_show":"SO202406180173","decor_code_show":"\u6d4b\u8bd5\u82b1\u827201","craft_type_code_show":"\u5178\u96c5\u6c99\u8d1d","specs":"\u5178\u96c5\u6c99\u8d1d \u6d4b\u8bd5\u82b1\u827201 11345","material_name":"\u4fe1\u606f\u90e8\u6d4b\u8bd51800\u9999\u6749\u6728"},{"title":"\u94f6\u76fe\u6297\u83cc\u5706\u6807\uff08\u6d4b\u8bd5\u767d\u6807\uff09","num":"500","restock_qty":0,"product_code":"BC020202000999","product_code_show":"\u4fe1\u606f\u90e8\u6d4b\u8bd51800\u9999\u6749\u6728","order_item_id":"590882008738308096","order_item_id_show":"SO202406180173","decor_code_show":"\u6d4b\u8bd5\u82b1\u827201","craft_type_code_show":"\u5178\u96c5\u6c99\u8d1d","specs":"\u5178\u96c5\u6c99\u8d1d \u6d4b\u8bd5\u82b1\u827201 11345","material_name":"\u4fe1\u606f\u90e8\u6d4b\u8bd51800\u9999\u6749\u6728"}],"mac":"28f1e65c8cfd496f"}',true);
|
|
// $param = json_decode('{"token":"Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiI1OTAwNDY0ODg5NDAzODQyNTYiLCJhdXRoIjoiUk9MRV9VU0VfQlJBTkRfU1VQUExJRVIsUk9MRV9PVVRFUl9VU0VSLFJPTEVfQlJBTkRfU1VQUExJRVIsUk9MRV9JTk5FUl9VU0VSLFJPTEVfSU5URVJGQUNFLFJPTEVfU0VORF9CUkFORF9TVVBQTElFUiIsInRva2VuSWQiOiIzIiwiZXhwIjoxNzIxMzU1NDczfQ.BMRYPq_8TXaSE4isig-2hn3I6J25IeFe8_Z9_-LZZt41yGVRE0OQUlSO9zl93a1Lv7fW9D0BB8V9ZoHxvRfWhA","list":[{"title":"E0\u6279\u96f6\u514d\u6f06\uff08\u6d4b\u8bd5\u767d\u6807\uff09","num":"6500","restock_qty":0,"product_code":"BC020202000999","product_code_show":"\u4fe1\u606f\u90e8\u6d4b\u8bd51800\u9999\u6749\u6728","order_item_id":"590882008738308096","order_item_id_show":"SO202406180173","decor_code_show":"\u6d4b\u8bd5\u82b1\u827201","craft_type_code_show":"\u5178\u96c5\u6c99\u8d1d","specs":"\u5178\u96c5\u6c99\u8d1d \u6d4b\u8bd5\u82b1\u827201 11345","material_name":"\u4fe1\u606f\u90e8\u6d4b\u8bd51800\u9999\u6749\u6728"},{"title":"\u94f6\u76fe\u6297\u83cc\u5706\u6807\uff08\u6d4b\u8bd5\u767d\u6807\uff09","num":"500","restock_qty":0,"product_code":"BC020202000999","product_code_show":"\u4fe1\u606f\u90e8\u6d4b\u8bd51800\u9999\u6749\u6728","order_item_id":"590882008738308096","order_item_id_show":"SO202406180173","decor_code_show":"\u6d4b\u8bd5\u82b1\u827201","craft_type_code_show":"\u5178\u96c5\u6c99\u8d1d","specs":"\u5178\u96c5\u6c99\u8d1d \u6d4b\u8bd5\u82b1\u827201 11345","material_name":"\u4fe1\u606f\u90e8\u6d4b\u8bd51800\u9999\u6749\u6728"}],"mac":"28f1e65c8cfd496f"}',true);
|
|
$token = $param['token'];
|
|
$token = $param['token'];
|
|
$list = $param['list'];
|
|
$list = $param['list'];
|
|
@@ -844,12 +861,12 @@ class DwyController extends BaseController
|
|
//end
|
|
//end
|
|
|
|
|
|
foreach ($data as $k => &$v) {
|
|
foreach ($data as $k => &$v) {
|
|
-
|
|
|
|
if (!isset($v['product_list'])) $v['product_list'] = [];
|
|
if (!isset($v['product_list'])) $v['product_list'] = [];
|
|
if (!isset($v['box_code_show']) || $v['box_code_show'] == '设备仓') {
|
|
if (!isset($v['box_code_show']) || $v['box_code_show'] == '设备仓') {
|
|
unset($data[$k]);
|
|
unset($data[$k]);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+ if(isset($v['box_code'])&&in_array($v['box_code'],$un_box)) continue;
|
|
if ($v['qty'] <= 0) {
|
|
if ($v['qty'] <= 0) {
|
|
unset($data[$k]);
|
|
unset($data[$k]);
|
|
continue;
|
|
continue;
|
|
@@ -858,6 +875,7 @@ class DwyController extends BaseController
|
|
if (!isset($v['send_qty'])) $v['send_qty'] = 0;
|
|
if (!isset($v['send_qty'])) $v['send_qty'] = 0;
|
|
foreach ($list as $kk => $vv) {
|
|
foreach ($list as $kk => $vv) {
|
|
if(!isset($vv['restock_qty'])) $vv['restock_qty'] = 0;
|
|
if(!isset($vv['restock_qty'])) $vv['restock_qty'] = 0;
|
|
|
|
+ if($vv['restock_qty'] > 0) return ['status' => '201','data'=>[], 'msg' => '不允许超出可领数量'];
|
|
if ($vv['num'] == 0 && $vv['restock_qty'] == 0) continue;
|
|
if ($vv['num'] == 0 && $vv['restock_qty'] == 0) continue;
|
|
if ($v['material_code_show'] === $vv['title']) {
|
|
if ($v['material_code_show'] === $vv['title']) {
|
|
$v['restore_qty'] = isset($vv['restock_qty']) && $vv['restock_qty'] > 0 ? $vv['restock_qty'] : 0;
|
|
$v['restore_qty'] = isset($vv['restock_qty']) && $vv['restock_qty'] > 0 ? $vv['restock_qty'] : 0;
|
|
@@ -1015,7 +1033,7 @@ class DwyController extends BaseController
|
|
'Content-Type:application/json',
|
|
'Content-Type:application/json',
|
|
'Authorization: ' . $request->header('Authorization'),
|
|
'Authorization: ' . $request->header('Authorization'),
|
|
];
|
|
];
|
|
- $param = '{"direction":"DESC","property":"id","fromClientType":"pc","number":0,"sorts":[],"rules":[{"field":"box_inventory.device_code","option":"LIKE_ANYWHERE","values":["'.$param['device_code'].'"]}],"size":15,"specialConditions":[],"workflowSearchBean":{},"dynamicFormCode":"box_inventory","developmentSystemId":null,"debugFlag":true}';
|
|
|
|
|
|
+ $param = '{"direction":"DESC","property":"id","fromClientType":"pc","number":0,"sorts":[],"rules":[{"field":"box_inventory.device_code","option":"LIKE_ANYWHERE","values":["'.$param['device_code'].'"]}],"size":999,"specialConditions":[],"workflowSearchBean":{},"dynamicFormCode":"box_inventory","developmentSystemId":null,"debugFlag":true}';
|
|
$data = $this->post_helper($url, $param, $header);
|
|
$data = $this->post_helper($url, $param, $header);
|
|
// $data = $this->post_helper($url, json_encode($param), $header);
|
|
// $data = $this->post_helper($url, json_encode($param), $header);
|
|
$data = json_decode($data, true);
|
|
$data = json_decode($data, true);
|
|
@@ -1156,7 +1174,19 @@ class DwyController extends BaseController
|
|
public function andriodLog(Request $request){
|
|
public function andriodLog(Request $request){
|
|
// $data = $request->all();
|
|
// $data = $request->all();
|
|
$data = file_get_contents('php://input');
|
|
$data = file_get_contents('php://input');
|
|
- file_put_contents('dwyAndriod.txt',$data.PHP_EOL,8);
|
|
|
|
|
|
+ $path = date('Ymd');
|
|
|
|
+ $file = 'dwyAndriod.txt';
|
|
|
|
+ if (!is_dir($path)) {
|
|
|
|
+ // 创建目录,第三个参数 true 表示递归创建目录
|
|
|
|
+ mkdir($path, 0755, true);
|
|
|
|
+ }
|
|
|
|
+ $param = json_decode($data,true);
|
|
|
|
+ if(isset($param['type'])&&isset($param['content'])){
|
|
|
|
+ $file = $path.'/'.$param['type'].'_'.$file;
|
|
|
|
+ file_put_contents($file,$param['content'].PHP_EOL,8);
|
|
|
|
+ }else{
|
|
|
|
+ file_put_contents($file,$data.PHP_EOL,8);
|
|
|
|
+ }
|
|
return ['status' => 200, 'data' => []];
|
|
return ['status' => 200, 'data' => []];
|
|
}
|
|
}
|
|
|
|
|