cqpCow 8 miesięcy temu
rodzic
commit
d9662322d5

+ 11 - 0
app/Http/Controllers/Api/JRFIDController.php

@@ -335,4 +335,15 @@ class JRFIDController extends BaseController
             return $this->json_return(201,$data);
         }
     }
+
+    public function packageList(Request $request){
+        list($bool, $data) = (new JRFIDServerService())->packageList($request->all(),$request->common_param);
+
+        if($bool){
+            return $this->json_return(200,'',$data);
+        }else{
+            if($bool === 0) return $this->json_return(401,$data);
+            return $this->json_return(201,$data);
+        }
+    }
 }

+ 49 - 1
app/Service/JRFIDServerService.php

@@ -915,7 +915,7 @@ class JRFIDServerService extends Service
         $header = array_merge($param['header'], ['site:'. $data['site']]);
         $url = config("j_rfid.sendAndReceiptList");
 
-        if(! empty($data['contract_no']) || ! empty($data['no'])) {
+        if(! empty($data['contract_no']) || ! empty($data['no']) || ! empty($data['drawing_no'])) {
             $rules = [];
             if(! empty($data['contract_no'])) {
                 $rules[] = [
@@ -931,6 +931,13 @@ class JRFIDServerService extends Service
                     'values' => $data['no']
                 ];
             }
+            if(! empty($data['drawing_no'])) {
+                $rules[] = [
+                    'field' => 'drawing_no',
+                    'option' => 'IN',
+                    'values' => $data['drawing_no']
+                ];
+            }
             $post['rules'] = $rules;
         }
 
@@ -999,6 +1006,47 @@ class JRFIDServerService extends Service
         return [true, $result];
     }
 
+    public function packageList($data,$param){
+        if(empty($data['site'])) return [false, '站点不能为空'];
+        $header = array_merge($param['header'], ['site:'. $data['site']]);
+        $url = config("j_rfid.packageList");
+
+        if(! empty($data['drawing_no']) || ! empty($data['contract_no'])) {
+            $rules = [];
+            if(! empty($data['drawing_no'])) {
+                $rules[] = [
+                    'field' => 'drawing_no',
+                    'option' => 'IN',
+                    'values' => $data['drawing_no']
+                ];
+            }
+            if(! empty($data['contract_no'])) {
+                $rules[] = [
+                    'field' => 'contract_no',
+                    'option' => 'IN',
+                    'values' => $data['contract_no']
+                ];
+            }
+            $post['rules'] = $rules;
+        }
+
+        $post['size'] = $data['size'] ?? 10;
+        $post['number'] = ($data['number'] ?? 1) - 1;
+
+        list($status,$result) = $this->post_helper($url,$post,$header);
+        if(! $status) return [$status, $result];
+
+        if(! empty($result['status']) && $result['status'] == 'error') return [false, $result['msg']];
+        if(! empty($result['type']) && $result['type'] == 'errorVm') return [false, $result['message']];
+
+        if(! isset($result['content'])) {
+            $error = $result[0]['message'] ?? "操作失败,请刷新页面";
+            return [false, $error];
+        }
+
+        return [true, $result];
+    }
+
     public function post_helper($url, $data, $header = [], $timeout = 20){
         Log::channel('apiLog')->info('工装云POST', ["api" => $url , "param" => $data ,"header" => $header]);
 

+ 2 - 0
config/j_rfid.php

@@ -67,4 +67,6 @@ return [
     'sendAndReceiptList' => 'https://gzy.qingyaokeji.com/api/module-data/send_and_receipt_list/page',
     //发货单详情组件列表
     'sendOrderDtAssemList' => 'https://gzy.qingyaokeji.com/api/module-data/send_order_dt_assem_list/page',
+    //包装单列表
+    'packageList' => 'https://gzy.qingyaokeji.com/api/module-data/package_list/page',
 ];

+ 2 - 0
routes/api.php

@@ -82,4 +82,6 @@ Route::group(['middleware'=> ['CheckJRFIDLogin']],function ($route){
     $route->any('sendAndReceiptList', 'Api\JRFIDController@sendAndReceiptList');
     //发货单详情组件列表
     $route->any('sendOrderDtAssemList', 'Api\JRFIDController@sendOrderDtAssemList');
+    //包装单列表
+    $route->any('packageList', 'Api\JRFIDController@packageList');
 });