|
@@ -790,7 +790,7 @@ class DwyController extends BaseController
|
|
|
public function setLb(Request $request)
|
|
|
{
|
|
|
$param = $request->all();
|
|
|
- file_put_contents('dwy.txt', json_encode($param) . PHP_EOL, 8);
|
|
|
+ file_put_contents('dwy_setlb.txt', json_encode($param) . PHP_EOL, 8);
|
|
|
|
|
|
//单独的处理哪些口子不能用的逻辑
|
|
|
$url = 'https://tm.dwycloud.com/jbl/api/module-data/device/device/diy/device_code';
|
|
@@ -813,6 +813,12 @@ class DwyController extends BaseController
|
|
|
// $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'];
|
|
|
$list = $param['list'];
|
|
|
+ foreach ($list as &$a){
|
|
|
+ if($a['num'] < 0) {
|
|
|
+ $a['num'] = $a['num'] + $a['restock_qty'];
|
|
|
+ $a['restock_qty'] = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
$mac = $param['mac'];
|
|
|
// if($mac === '28f1e65c8cfd496f'){
|
|
|
////
|
|
@@ -825,6 +831,14 @@ class DwyController extends BaseController
|
|
|
];
|
|
|
$data = $this->post_helper($url, '{"device_code":"'.$mac.'"}', $header);
|
|
|
$data = json_decode($data, true);
|
|
|
+
|
|
|
+ if($mac == '6766748e144e3b7b'){
|
|
|
+ foreach ($data as $k=>$v){
|
|
|
+ if($v['material_code_show'] == '尊贵免漆背板E0小标' && $v['box_code_show'] == '商标二号仓'){
|
|
|
+ unset($data[$k]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
// if($mac == 'a6a672c3e458bed2'||$mac == 'DV00001'){
|
|
|
// usort($data, function ($a,$b){
|
|
|
// return str_replace('CK','',$a['box_code']) - str_replace('CK','',$b['box_code']);
|
|
@@ -948,7 +962,71 @@ class DwyController extends BaseController
|
|
|
public function setLb1(Request $request)
|
|
|
{
|
|
|
$param = $request->all();
|
|
|
- file_put_contents('dwy.txt', json_encode($param) . PHP_EOL, 8);
|
|
|
+ file_put_contents('dwy_setlb1.txt', json_encode($param) . PHP_EOL, 8);
|
|
|
+// var_dump($param);
|
|
|
+ //start 增加一层逻辑,数量超了不允许领用
|
|
|
+// $url = 'https://tm.dwycloud.com/jbl/api/module-data/sale_order_dtl_brand/page';
|
|
|
+// $token = $param['token'];
|
|
|
+// $json = json_decode('{"direction":"DESC","property":"id","fromClientType":"pc","number":0,"sorts":[],"rules":[{"field":"exe_sale_order_b.no","option":"LIKE_ANYWHERE","values":["SO202405300207"]}],"size":100,"specialConditions":[],"workflowSearchBean":{},"dynamicFormCode":"sale_order","dynamicFormTable":null,"ignoreField":true,"developmentSystemId":null}',true);
|
|
|
+// $json['rules'][0]['values'] = [$param['list'][0]['order_item_id_show']];
|
|
|
+// $json['workflowSearchBean'] = [""=>""];
|
|
|
+//// var_dump(json_encode($json));die;
|
|
|
+// $header = [
|
|
|
+// 'Content-Type:application/json',
|
|
|
+// 'Authorization: ' . $token,
|
|
|
+// ];
|
|
|
+// $box_data = $this->post_helper($url, json_encode($json), $header);
|
|
|
+// $box_data = json_decode($box_data,true);
|
|
|
+//// var_dump($box_data);die;
|
|
|
+// $limit_data = [];
|
|
|
+// if(isset($box_data['content'])){
|
|
|
+// $box_data = $box_data['content'];
|
|
|
+// foreach ($box_data as $b){
|
|
|
+//// $key = $b['material_code_show'].'_'.$b['specs'].'_'.$b['decor_code_show'].'_'.$b['decor_two_code_show'].'_'.$b['craft_type_code_show'].'_'.$b['craft_type_two_code_show'].'_'.$b['mat_material_a']['mat_category_code'].'_'.$b['mat_material_a']['grade_show'].'_'.$b['mat_material_a']['cpdj_show'];
|
|
|
+// $key = $b['material_code'].'_'.$b['prod_trademark_compare_view']['brand_code_show'];
|
|
|
+// $qty = $b['qty'];
|
|
|
+// $out_qty = $b['out_stock_qty_total'];
|
|
|
+// if(isset($limit_data[$key])){
|
|
|
+// $limit_data[$key]['qty'] += $qty;
|
|
|
+// }else{
|
|
|
+// $limit_data[$key] = [
|
|
|
+// 'qty' => $qty,
|
|
|
+// 'out_qty' => $out_qty,
|
|
|
+// 'key' => $key,
|
|
|
+// ];
|
|
|
+// }
|
|
|
+// }
|
|
|
+// foreach ($param['list'] as $v){
|
|
|
+// $key = $v['product_code'].'_'.$v['title'];
|
|
|
+// var_dump($key);
|
|
|
+// var_dump($limit_data);die;
|
|
|
+// }
|
|
|
+//
|
|
|
+
|
|
|
+ foreach ($param['list'] as &$a){
|
|
|
+ if($a['num'] < 0) {
|
|
|
+ $a['num'] = $a['num'] + $a['restock_qty'];
|
|
|
+ $a['restock_qty'] = 0;
|
|
|
+ }
|
|
|
+ if($a['num'] == 0) {
|
|
|
+ $a['num'] = $a['restock_qty'];
|
|
|
+ $a['restock_qty'] = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $nlist = [];
|
|
|
+ foreach ($param['list'] as $ll){
|
|
|
+ $ll['restock_qty'] = 0;
|
|
|
+ if($ll['num'] <= 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $nlist[] = $ll;
|
|
|
+ }
|
|
|
+ $param['list'] = $nlist;
|
|
|
+ //end
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
//单独的处理哪些口子不能用的逻辑
|
|
|
$url = 'https://tm.dwycloud.com/jbl/api/module-data/device/device/diy/device_code';
|
|
@@ -983,9 +1061,7 @@ class DwyController extends BaseController
|
|
|
'Authorization: ' . $token,
|
|
|
];
|
|
|
$data = $this->post_helper($url, '{"device_code":"'.$mac.'"}', $header);
|
|
|
-// var_dump($data);
|
|
|
$data = json_decode($data, true);
|
|
|
-// var_dump($data);die;
|
|
|
// if($mac == 'a6a672c3e458bed2'||$mac == 'DV00001'){
|
|
|
// usort($data, function ($a,$b){
|
|
|
// return str_replace('CK','',$a['box_code']) - str_replace('CK','',$b['box_code']);
|
|
@@ -993,24 +1069,34 @@ class DwyController extends BaseController
|
|
|
// }else{
|
|
|
//
|
|
|
// }
|
|
|
+// var_dump($data);die;
|
|
|
+ if($mac == '6766748e144e3b7b'){
|
|
|
+ foreach ($data as $k=>$v){
|
|
|
+ if($v['material_code_show'] == '尊贵免漆背板E0小标' && $v['box_code_show'] == '商标二号仓'){
|
|
|
+ unset($data[$k]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+// var_dump($data);die;
|
|
|
usort($data, function($a, $b) {
|
|
|
return $b['qty'] < $a['qty'];
|
|
|
});
|
|
|
-
|
|
|
+ foreach ($data as $kk=> $vv){
|
|
|
+ $data[$kk]['material_code_show'] = trim($vv['material_code_show']);
|
|
|
+ }
|
|
|
//做一个单独的校验,如果数量不够则返回失败
|
|
|
$out_key_list = [];
|
|
|
foreach ($list as $l){
|
|
|
if(!isset($out_key_list[$l['title']])) $out_key_list[$l['title']] = 0;
|
|
|
$out_key_list[$l['title']] += $l['num'];
|
|
|
}
|
|
|
-
|
|
|
$box_key_list = [];
|
|
|
foreach ($data as $d){
|
|
|
if (!isset($d['box_code_show']) || $d['box_code_show'] == '设备仓') {
|
|
|
continue;
|
|
|
}
|
|
|
- if(!isset($box_key_list[$d['material_code_show']])) $box_key_list[$d['material_code_show']] = 0;
|
|
|
- $box_key_list[$d['material_code_show']] += $d['qty'];
|
|
|
+ if(!isset($box_key_list[$d['material_code_show']])) $box_key_list[trim($d['material_code_show'])] = 0;
|
|
|
+ $box_key_list[trim($d['material_code_show'])] += $d['qty'];
|
|
|
}
|
|
|
foreach ($out_key_list as $k=>$v){
|
|
|
if(!isset($box_key_list[$k])){
|
|
@@ -1039,7 +1125,7 @@ class DwyController extends BaseController
|
|
|
if(!isset($vv['restock_qty'])) $vv['restock_qty'] = 0;
|
|
|
if($vv['restock_qty'] > 0 && $vv['num'] > 0 ) return ['status' => '201','data'=>[], 'msg' => '不允许超出可领数量'];
|
|
|
if ($vv['num'] == 0 && $vv['restock_qty'] == 0) continue;
|
|
|
- if($vv['num'] < 0) {
|
|
|
+ if($vv['num'] <= 0) {
|
|
|
$vv['num'] = $vv['restock_qty']+$vv['num'];
|
|
|
$vv['restock_qty'] = 0;
|
|
|
}
|
|
@@ -1285,8 +1371,8 @@ class DwyController extends BaseController
|
|
|
$param = $request->all();
|
|
|
file_put_contents('dwy.txt', json_encode($param) . PHP_EOL, 8);
|
|
|
//商标绑定
|
|
|
- $url = 'https://tm.dwycloud.com/jbl/api/module-data/brand_in_stock/brand_in_stock/diy/1';
|
|
|
-// $url = 'https://tm.dwycloud.com/jbl/api/module-data/brand_in_stock/brand_in_stock/diy/lead_bind';
|
|
|
+// $url = 'https://tm.dwycloud.com/jbl/api/module-data/brand_in_stock/brand_in_stock/diy/1';
|
|
|
+ $url = 'https://tm.dwycloud.com/jbl/api/module-data/brand_in_stock/brand_in_stock/diy/lead_bind';
|
|
|
$header = [
|
|
|
'Content-Type:application/json',
|
|
|
'Authorization: ' . $request->header('Authorization'),
|
|
@@ -1295,8 +1381,8 @@ class DwyController extends BaseController
|
|
|
$this->post_helper($url, json_encode($lead_bind), $header);
|
|
|
|
|
|
//商标出库
|
|
|
-// $url = 'https://tm.dwycloud.com/jbl/api/module-data/brand_in_stock/brand_in_stock/diy/lead_bind_out_stock';
|
|
|
- $url = 'https://tm.dwycloud.com/jbl/api/module-data/brand_in_stock/brand_in_stock/diy/11';
|
|
|
+ $url = 'https://tm.dwycloud.com/jbl/api/module-data/brand_in_stock/brand_in_stock/diy/lead_bind_out_stock';
|
|
|
+// $url = 'https://tm.dwycloud.com/jbl/api/module-data/brand_in_stock/brand_in_stock/diy/11';
|
|
|
$lead_bind = $param['lead_out'];
|
|
|
$this->post_helper($url, json_encode($lead_bind), $header);
|
|
|
return ['status'=>200,'msg'=>'success'];
|
|
@@ -1423,6 +1509,9 @@ class DwyController extends BaseController
|
|
|
$data = file_get_contents('andriodList.txt');
|
|
|
$data = json_decode($data,true);
|
|
|
$param = $request->all();
|
|
|
+ if(!isset($param['package'])){
|
|
|
+ $param['package'] = 'cbj';
|
|
|
+ }
|
|
|
if(isset($param['type'])){
|
|
|
$type = $param['type'];
|
|
|
$return = [];
|
|
@@ -1431,6 +1520,14 @@ class DwyController extends BaseController
|
|
|
}
|
|
|
$data = $return;
|
|
|
}
|
|
|
+ if(isset($param['package'])){
|
|
|
+ $type = $param['package'];
|
|
|
+ $return = [];
|
|
|
+ foreach ($data as $v){
|
|
|
+ if($v['package'] == $type) $return[] = $v;
|
|
|
+ }
|
|
|
+ $data = $return;
|
|
|
+ }
|
|
|
return ['status'=>200,'data'=> $data];
|
|
|
}
|
|
|
|