cqpCow 2 years ago
parent
commit
7605ef9312
2 changed files with 13 additions and 5 deletions
  1. 3 3
      app/Service/DispatchService.php
  2. 10 2
      app/Service/FinishedOrderService.php

+ 3 - 3
app/Service/DispatchService.php

@@ -260,10 +260,10 @@ class DispatchService extends Service
             $model->where('dispatch_time_start','<=',$data['dispatch_time'][0]);
             $model->where('dispatch_time_end','>=',$data['dispatch_time'][1]);
         }
-        if(! empty($data['emp_name'])) {
+        if(! empty($data['employee_id'])) {
             $team_id = Employee::from('employee as a')
-                ->left('employee_team_permission as b','b.employee_id','a.id')
-                ->where('a.emp_name', 'LIKE', '%'.$data['emp_name'].'%')
+                ->leftJoin('employee_team_permission as b','b.employee_id','a.id')
+                ->where('a.id', $data['employee_id'])
                 ->select('b.team_id')
                 ->get()->toArray();
             $team_id = array_column($team_id,'team_id');

+ 10 - 2
app/Service/FinishedOrderService.php

@@ -85,7 +85,6 @@ class FinishedOrderService extends Service
                     ]);
 
                 unset($result[$key]['order_product_id']);
-                unset($result[$key]['dispatch_no']);
             }
 
             FinishedOrderSub::insert($result);
@@ -147,7 +146,7 @@ class FinishedOrderService extends Service
 
     public function orderList($data){
         $model = FinishedOrderSub::where('del_time',0)
-            ->select('id','order_no','table_header_mark','product_no','product_title','product_size','product_unit','dispatch_quantity','technology_material','technology_name','wood_name','process_mark','table_body_mark','dispatch_quantity','finished_num','status','crt_id','process_id','equipment_id','team_id','dispatch_time_start','dispatch_time_end','dispatch_time','crt_time')
+            ->select('id','order_no','table_header_mark','product_no','product_title','product_size','product_unit','dispatch_quantity','technology_material','technology_name','wood_name','process_mark','table_body_mark','dispatch_quantity','finished_num','status','crt_id','process_id','equipment_id','team_id','dispatch_time_start','dispatch_time_end','dispatch_time','crt_time','dispatch_no')
             ->orderBy('id','desc');
 
         if(! empty($data['order_no'])) $model->where('order_no', 'LIKE', '%'.$data['order_no'].'%');
@@ -160,6 +159,15 @@ class FinishedOrderService extends Service
         if(! empty($data['table_header_mark'])) $model->where('table_header_mark', 'LIKE', '%'.$data['table_header_mark'].'%');
         if(! empty($data['table_body_mark'])) $model->where('table_body_mark', 'LIKE', '%'.$data['table_body_mark'].'%');
         if(! empty($data['dispatch_time'][0]) && ! empty($data['dispatch_time'][1])) $model->whereBetween('dispatch_time',[$data['dispatch_time'][0],$data['dispatch_time'][1]]);
+        if(! empty($data['employee_id'])) {
+            $team_id = Employee::from('employee as a')
+                ->leftJoin('employee_team_permission as b','b.employee_id','a.id')
+                ->where('a.id', $data['employee_id'])
+                ->select('b.team_id')
+                ->get()->toArray();
+            $team_id = array_column($team_id,'team_id');
+            $model->where('team_id',$team_id ?? []);
+        }
         if(isset($data['status'])) $model->where('status',$data['status']);
 
         $list = $this->limit($model,'',$data);