Bladeren bron

接口对接

cqpCow 8 maanden geleden
bovenliggende
commit
754c5b4759
4 gewijzigde bestanden met toevoegingen van 183 en 2 verwijderingen
  1. 33 0
      app/Http/Controllers/Api/JRFIDController.php
  2. 138 2
      app/Service/JRFIDServerService.php
  3. 6 0
      config/j_rfid.php
  4. 6 0
      routes/api.php

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

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

+ 138 - 2
app/Service/JRFIDServerService.php

@@ -1103,14 +1103,14 @@ class JRFIDServerService extends Service
             $rules = [];
             if(! empty($data['drawing_no'])) {
                 $rules[] = [
-                    'field' => 'exe_sep_order_a.contact_no',
+                    'field' => 'exe_sep_order_a.drawing_no',
                     'option' => 'IN',
                     'values' => $data['drawing_no']
                 ];
             }
             if(! empty($data['contract_no'])) {
                 $rules[] = [
-                    'field' => 'exe_sep_order_a.drawing_no',
+                    'field' => 'exe_sep_order_a.contract_no',
                     'option' => 'IN',
                     'values' => $data['contract_no']
                 ];
@@ -1164,6 +1164,142 @@ class JRFIDServerService extends Service
         return [true, $result];
     }
 
+    public function furnSeparateOrderDtCompList($data,$param){
+        if(empty($data['site'])) return [false, '站点不能为空'];
+        $header = array_merge($param['header'], ['site:'. $data['site']]);
+        $url = config("j_rfid.furnSeparateOrderDtCompList");
+
+        if(! empty($data['drawing_no']) || ! empty($data['contract_no']) || ! empty($data['region']) || ! empty($data['room']) || ! empty($data['assembly_name']) || ! empty($data['component'])) {
+            $rules = [];
+            if(! empty($data['drawing_no'])) {
+                $rules[] = [
+                    'field' => 'furn_sep_order_dt_prod.drawing_no',
+                    'option' => 'IN',
+                    'values' => $data['drawing_no']
+                ];
+            }
+            if(! empty($data['contract_no'])) {
+                $rules[] = [
+                    'field' => 'furn_sep_order_dt_prod.contact_no',
+                    'option' => 'IN',
+                    'values' => $data['contract_no']
+                ];
+            }
+            if(! empty($data['region'])) {
+                $rules[] = [
+                    'field' => 'furn_sep_order_dt_prod.region',
+                    'option' => 'IN',
+                    'values' => $data['region']
+                ];
+            }
+            if(! empty($data['room'])) {
+                $rules[] = [
+                    'field' => 'furn_sep_order_dt_assem.room',
+                    'option' => 'IN',
+                    'values' => $data['room']
+                ];
+            }
+            if(! empty($data['assembly_name'])) {
+                $rules[] = [
+                    'field' => 'furn_sep_order_dt_assem.assembly_name',
+                    'option' => 'IN',
+                    'values' => $data['assembly_name']
+                ];
+            }
+            if(! empty($data['component'])) {
+                $rules[] = [
+                    'field' => 'component',
+                    'option' => 'IN',
+                    'values' => $data['component']
+                ];
+            }
+
+            $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 getWorkshopData($data,$param){
+        if(empty($data['site'])) return [false, '站点不能为空'];
+        if(empty($data['type'])) return [false, 'TYPE不能为空'];
+        $header = array_merge($param['header'], ['site:'. $data['site']]);
+
+        $url = config("j_rfid.getWorkshopData");
+
+        if(! empty($data['drawing_no'])) $post['drawing_no'] = $data['drawing_no'];
+        if(! empty($data['contract_no'])) $post['contract_no'] = $data['contract_no'];
+        if(! empty($data['region'])) $post['region'] = $data['region'];
+        if(! empty($data['room'])) $post['room'] = $data['room'];
+        if(! empty($data['assembly_name'])) $post['assembly_name'] = $data['assembly_name'];
+        if(! empty($data['component'])) $post['component'] = $data['component'];
+
+        $post['type'] = $data['type'];
+        $post['site'] = $data['site'];
+        $post['size'] = $data['size'] ?? 10;
+        $post['number'] = $data['number'] ?? 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['message']];
+        if(! empty($result['type']) && $result['type'] == 'errorVm') return [false, $result['message']];
+
+        if(! isset($result['success'])) {
+            $error = $result[0]['message'] ?? "操作失败,请刷新页面";
+            return [false, $error];
+        }
+
+        return [true, $result['data']];
+    }
+
+    public function screenGetSendData($data,$param){
+        if(empty($data['site'])) return [false, '站点不能为空'];
+        if(empty($data['type'])) return [false, 'TYPE不能为空'];
+        $header = array_merge($param['header'], ['site:'. $data['site']]);
+
+        $url = config("j_rfid.screenGetSendData");
+
+        if(! empty($data['drawing_no'])) $post['drawing_no'] = $data['drawing_no'];
+        if(! empty($data['contract_no'])) $post['contract_no'] = $data['contract_no'];
+        if(! empty($data['region'])) $post['region'] = $data['region'];
+        if(! empty($data['room'])) $post['room'] = $data['room'];
+        if(! empty($data['assembly_name'])) $post['assembly_name'] = $data['assembly_name'];
+        if(! empty($data['component'])) $post['component'] = $data['component'];
+
+        $post['type'] = $data['type'];
+        $post['site'] = $data['site'];
+        $post['size'] = $data['size'] ?? 10;
+        $post['number'] = $data['number'] ?? 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['message']];
+        if(! empty($result['type']) && $result['type'] == 'errorVm') return [false, $result['message']];
+
+        if(! isset($result['success'])) {
+            $error = $result[0]['message'] ?? "操作失败,请刷新页面";
+            return [false, $error];
+        }
+
+        return [true, $result['data']];
+    }
+
     public function post_helper($url, $data, $header = [], $timeout = 20){
         Log::channel('apiLog')->info('工装云POST', ["api" => $url , "param" => $data ,"header" => $header]);
 

+ 6 - 0
config/j_rfid.php

@@ -75,4 +75,10 @@ return [
     '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',
+    //拆单详情产品、组件、部件查询列表
+    'furnSeparateOrderDtCompList' => 'https://gzy.qingyaokeji.com/api/module-data/furn_separate_order_dt_comp_list/page',
+    //查询车间数据(合同号、区域、房号、图号、组件、部件)
+    'getWorkshopData' => 'https://gzy.qingyaokeji.com/api/module-data/separate_order/separate_order/diy/get_workshop_data',
+    //查询发货数据(合同号、发货单号、房号、图号、组件、部件)
+    'screenGetSendData' => 'https://gzy.qingyaokeji.com/api/module-data/send_and_receipt/send_and_receipt/diy/screen_get_send_data',
 ];

+ 6 - 0
routes/api.php

@@ -90,4 +90,10 @@ Route::group(['middleware'=> ['CheckJRFIDLogin']],function ($route){
     $route->any('screenGetSepData', 'Api\JRFIDController@screenGetSepData');
     //拆单产品、组件、部件查询列表
     $route->any('furnSeparateOrderCompList', 'Api\JRFIDController@furnSeparateOrderCompList');
+    //拆单详情产品、组件、部件查询列表
+    $route->any('furnSeparateOrderDtCompList', 'Api\JRFIDController@furnSeparateOrderDtCompList');
+    //查询车间数据(合同号、区域、房号、图号、组件、部件)
+    $route->any('getWorkshopData', 'Api\JRFIDController@getWorkshopData');
+    //查询发货数据(合同号、发货单号、房号、图号、组件、部件)
+    $route->any('screenGetSendData', 'Api\JRFIDController@screenGetSendData');
 });