gogs 1 year ago
parent
commit
05e05b4053
1 changed files with 59 additions and 3 deletions
  1. 59 3
      app/Http/Controllers/Api/DwyController.php

+ 59 - 3
app/Http/Controllers/Api/DwyController.php

@@ -190,12 +190,13 @@ class DwyController extends BaseController
 //        dd(json_encode($param));
         $token = $param['token'];
         $list = $param['list'];
+        $mac = $param['mac'];
         $url = 'https://tm.dwycloud.com/jbl/api/module-data/brand_in_stock/brand_in_stock/diy/box_inventory';
         $header = [
             'Content-Type:application/json',
             'Authorization: ' . $token,
         ];
-        $data = $this->post_helper($url, '{"device_code":"DV00001"}', $header);
+        $data = $this->post_helper($url, '{"device_code":"'.$mac.'"}', $header);
         $data = json_decode($data, true);
         foreach ($data as $k => &$v) {
 
@@ -212,6 +213,11 @@ class DwyController extends BaseController
 //            $key_list = [];
             if (!isset($v['send_qty'])) $v['send_qty'] = 0;
             foreach ($list as $kk => $vv) {
+
+                //写死的代码
+                if($vv['num'] > 0 )  $vv['num'] = 3;
+                //end
+
                 if ($vv['num'] == 0) continue;
                 if ($v['material_code_show'] === $vv['title']) {
                     $v['restore_qty'] = isset($vv['restock_qty']) && $vv['restock_qty'] > 0 ? $vv['restock_qty'] : 0;
@@ -230,15 +236,61 @@ class DwyController extends BaseController
                         'order_item_id' => $vv['order_item_id'] ?? '',
                         'order_item_id_show' => $vv['order_item_id_show'] ?? '',
                         'send_qty' => $vv['num'],
+//                        'send_qty' => 0,
                         'restock_qty' => $vv['restock_qty'] ?? 0,
                     ];
                     $v['product_list'][] = $key_arr;
                 }
+                //测试代码到时候注释掉就好了
+                //8,10
+//                if($v['box_code'] == 'CK00017'){
+//                    $v['box_code'] = 'CK00008';
+//                    $v['box_code_show'] = '商标五号仓';
+//                    $v['send_qty'] = '3';
+//                    $key_arr = [
+//                        'product_code' => $vv['product_code'] ?? '',
+//                        'product_code_show' => $vv['product_code_show'] ?? '',
+//                        'order_item_id' => $vv['order_item_id'] ?? '',
+//                        'order_item_id_show' => $vv['order_item_id_show'] ?? '',
+//                        'send_qty' => 3,
+//                        'restock_qty' => $vv['restock_qty'] ?? 0,
+//                    ];
+//                    $v['product_list'][] = $key_arr;
+//                }elseif($v['box_code'] == 'CK00013'){
+//                    $v['box_code'] = 'CK00010';
+//                    $v['box_code_show'] = '商标七号仓';
+//                    $v['send_qty'] = '3';
+//                    $key_arr = [
+//                        'product_code' => $vv['product_code'] ?? '',
+//                        'product_code_show' => $vv['product_code_show'] ?? '',
+//                        'order_item_id' => $vv['order_item_id'] ?? '',
+//                        'order_item_id_show' => $vv['order_item_id_show'] ?? '',
+//                        'send_qty' => 3,
+//                        'restock_qty' => $vv['restock_qty'] ?? 0,
+//                    ];
+//                    $v['product_list'][] = $key_arr;
+//                } else{
+//                    $v['send_qty'] = 0;
+//                }
 
 
             }
         }
         sort($data);
+        foreach ($data as $kk=>$vv){
+            if($vv['box_code'] === 'CK00013'){
+                $data[$kk]['box_code'] = 'CK00010';
+                $data[$kk]['box_code_show'] = '商标七号仓';
+
+
+                $c = $vv;
+                $c['box_code'] = 'CK00008';
+                $c['box_code_show'] = '商标五号仓';
+                $data[] = $c;
+            }
+
+
+        }
         return ['status' => 200, 'data' => $data];
     }
 
@@ -278,9 +330,12 @@ class DwyController extends BaseController
     public function boxOut(Request $request)
     {
 
+
         $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/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'),
@@ -289,7 +344,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/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,'success'];