浏览代码

接口对接

cqpCow 1 年之前
父节点
当前提交
d27c4a0374
共有 4 个文件被更改,包括 56 次插入0 次删除
  1. 11 0
      app/Http/Controllers/Api/JRFIDController.php
  2. 41 0
      app/Service/JRFIDServerService.php
  3. 2 0
      config/j_rfid.php
  4. 2 0
      routes/api.php

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

@@ -368,4 +368,15 @@ class JRFIDController extends BaseController
             return $this->json_return(201,$data);
         }
     }
+
+    public function furnSeparateOrderCompList(Request $request){
+        list($bool, $data) = (new JRFIDServerService())->furnSeparateOrderCompList($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);
+        }
+    }
 }

+ 41 - 0
app/Service/JRFIDServerService.php

@@ -1094,6 +1094,47 @@ class JRFIDServerService extends Service
         return [true, $result['furn_sep_order_dt_assem_list']];
     }
 
+    public function furnSeparateOrderCompList($data,$param){
+        if(empty($data['site'])) return [false, '站点不能为空'];
+        $header = array_merge($param['header'], ['site:'. $data['site']]);
+        $url = config("j_rfid.furnSeparateOrderCompList");
+
+        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

@@ -73,4 +73,6 @@ return [
     'screenAutoCreateDispatch' => 'https://gzy.qingyaokeji.com/api/module-data/furn_dispatch_order_dt/furn_dispatch_order_dt/diy/screen_auto_create_dispatch',
     //根据芯片id查找拆单相关数据
     'screenGetSepData' => 'https://gzy.qingyaokeji.com/api/module-data/furn_separate_order_dt/furn_separate_order_dt/diy/screen_get_sep_data',
+    //拆单产品、组件、部件查询列表
+    'furnSeparateOrderCompList' => 'https://gzy.qingyaokeji.com/api/module-data/furn_separate_order_comp_list/page',
 ];

+ 2 - 0
routes/api.php

@@ -88,4 +88,6 @@ Route::group(['middleware'=> ['CheckJRFIDLogin']],function ($route){
     $route->any('screenAutoCreateDispatch', 'Api\JRFIDController@screenAutoCreateDispatch');
     //根据芯片id查找拆单相关数据
     $route->any('screenGetSepData', 'Api\JRFIDController@screenGetSepData');
+    //拆单产品、组件、部件查询列表
+    $route->any('furnSeparateOrderCompList', 'Api\JRFIDController@furnSeparateOrderCompList');
 });