cqp 9 сар өмнө
parent
commit
927de005f5

+ 38 - 0
app/Service/ApplyOrderService.php

@@ -155,6 +155,32 @@ class ApplyOrderService extends Service
         if(! empty($data['crt_id'])) $model->where('crt_id', $data['crt_id']);
         if(! empty($data['apply_time'][0]) && ! empty($data['apply_time'][1])) $model->whereBetween('apply_time',[$data['apply_time'][0],$data['apply_time'][1]]);
         if(! empty($data['crt_time'][0]) && ! empty($data['crt_time'][1])) $model->whereBetween('crt_time',[$data['crt_time'][0],$data['crt_time'][1]]);
+        if(! empty($data['dispatch_no'])){
+            $dispatch_id = DispatchSub::where('del_time',0)
+                ->where('dispatch_no', 'LIKE', '%'.$data['dispatch_no'].'%')
+                ->select('id')
+                ->get()->toArray();
+            $dispatch_id = array_column($dispatch_id,'id');
+            $detail = ApplyOrderDetail::where('del_time',0)
+                ->where('type', $data['type'])
+                ->whereIn('data_id', $dispatch_id)
+                ->select('apply_order_id')
+                ->get()->toArray();
+            $model->whereIn('id', array_unique(array_column($detail,'apply_order_id')));
+        }
+        if(! empty($data['box_no'])){
+            $box_id = Box::where('del_time',0)
+                ->where('order_no', 'LIKE', '%'.$data['box_no'].'%')
+                ->select('id')
+                ->get()->toArray();
+            $box_id = array_column($box_id,'id');
+            $detail = ApplyOrderDetail::where('del_time',0)
+                ->where('type', $data['type'])
+                ->whereIn('data_id', $box_id)
+                ->select('apply_order_id')
+                ->get()->toArray();
+            $model->whereIn('id', array_unique(array_column($detail,'apply_order_id')));
+        }
 
         $list = $this->limit($model,'',$data);
         $list = $this->fillData($list);
@@ -620,6 +646,18 @@ class ApplyOrderService extends Service
         if(! empty($data['crt_id'])) $model->where('crt_id', $data['crt_id']);
         if(! empty($data['report_time'][0]) && ! empty($data['report_time'][1])) $model->whereBetween('report_time',[$data['report_time'][0],$data['report_time'][1]]);
         if(! empty($data['crt_time'][0]) && ! empty($data['crt_time'][1])) $model->whereBetween('crt_time',[$data['crt_time'][0],$data['crt_time'][1]]);
+        if(! empty($data['dispatch_no'])) {
+            $dispatch_id = DispatchSub::where('del_time',0)
+                ->where('dispatch_no', 'LIKE', '%'.$data['dispatch_no'].'%')
+                ->select('id')
+                ->get()->toArray();
+            $dispatch_id = array_column($dispatch_id,'id');
+            $detail = ReportWorkingDetail::where('del_time',0)
+                ->whereIn('data_id', $dispatch_id)
+                ->select('report_working_id')
+                ->get()->toArray();
+            $model->whereIn('id', array_unique(array_column($detail,'report_working_id')));
+        }
 
         $list = $this->limit($model,'',$data);
         $list = $this->reportWorkingfillData($list);

+ 24 - 0
app/Service/ScrappService.php

@@ -99,6 +99,18 @@ class ScrappService extends Service
             $order_number = str_replace("ZJ","",$data['order_number']);
             if(! empty($order_number)) $model->where('order_number', 'LIKE', '%'.$data['order_number'].'%');
         }
+        if(! empty($data['dispatch_no'])) {
+            $dispatch_id = DispatchSub::where('del_time',0)
+                ->where('dispatch_no', 'LIKE', '%'.$data['dispatch_no'].'%')
+                ->select('id')
+                ->get()->toArray();
+            $dispatch_id = array_column($dispatch_id,'id');
+            $model->whereIn('dispatch_sub_id', $dispatch_id);
+        }
+        if(! empty($data['team_id'])) $model->where('team_id', $data['team_id']);
+        if(! empty($data['finished_id'])) $model->where('finished_id', $data['finished_id']);
+        if(! empty($data['equipment_id'])) $model->where('equipment_id', $data['equipment_id']);
+        if(! empty($data['process_id'])) $model->where('process_id', $data['process_id']);
 
         $list = $this->limit($model,'',$data);
         $list = $this->fillZjList($list);
@@ -183,6 +195,18 @@ class ScrappService extends Service
             $order_number = str_replace("BLP","",$data['order_number']);
             if(! empty($order_number)) $model->where('order_number', 'LIKE', '%'.$data['order_number'].'%');
         }
+        if(! empty($data['dispatch_no'])) {
+            $dispatch_id = DispatchSub::where('del_time',0)
+                ->where('dispatch_no', 'LIKE', '%'.$data['dispatch_no'].'%')
+                ->select('id')
+                ->get()->toArray();
+            $dispatch_id = array_column($dispatch_id,'id');
+            $model->whereIn('dispatch_sub_id', $dispatch_id);
+        }
+        if(! empty($data['team_id'])) $model->where('team_id', $data['team_id']);
+        if(! empty($data['finished_id'])) $model->where('finished_id', $data['finished_id']);
+        if(! empty($data['equipment_id'])) $model->where('equipment_id', $data['equipment_id']);
+        if(! empty($data['process_id'])) $model->where('process_id', $data['process_id']);
 
         $list = $this->limit($model,'',$data);
         $list = $this->fillBLPList($list);