cqp 3 mesi fa
parent
commit
cf5165e5e8
1 ha cambiato i file con 15 aggiunte e 0 eliminazioni
  1. 15 0
      app/Service/ApplyOrderService.php

+ 15 - 0
app/Service/ApplyOrderService.php

@@ -751,6 +751,21 @@ class ApplyOrderService extends Service
                 ->get()->toArray();
             $model->whereIn('id', array_unique(array_column($detail,'report_working_id')));
         }
+        if(! empty($data['sale_order_number'])){
+            $id = SaleOrdersProduct::where('del_time',0)
+                ->where('out_order_no', 'LIKE', '%'.$data['sale_order_number'].'%')
+                ->select('id')
+                ->get()->toArray();
+            $dispatch_id = DispatchSub::where('del_time',0)
+                ->whereIn('sale_orders_product_id',array_column($id,'id'))
+                ->select('id')
+                ->get()->toArray();
+            $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);