cqp 19 saat önce
ebeveyn
işleme
f798615b5e
1 değiştirilmiş dosya ile 15 ekleme ve 7 silme
  1. 15 7
      app/Service/ApplyOrderService.php

+ 15 - 7
app/Service/ApplyOrderService.php

@@ -4273,13 +4273,21 @@ class ApplyOrderService extends Service
         }elseif ($for_type == 3){
             $dispatch_id = ScrappCount::where('del_time',0)
                 ->where('id', $id)
-                ->pluck('dispatch_sub_id')
-                ->toArray();
-            $result = DispatchSub::where('del_time',0)
-                ->whereIn('id', $dispatch_id)
-                ->where('type',1)
-                ->select('id', 'dispatch_no as order_no')
-                ->get()->toArray();
+                ->select('order_product_id','crt_time','process_id','scrapp_num as num')
+                ->first();
+            if(! empty($dispatch_id)){
+                $dispatch_id = $dispatch_id->toArray();
+                $result = DispatchSub::where('del_time',0)
+//                    ->where('order_product_id', $dispatch_id['order_product_id'])
+                    ->where('crt_time', $dispatch_id['crt_time'])
+                    ->where('process_id', $dispatch_id['process_id'])
+                    ->where('dispatch_quantity', $dispatch_id['num'])
+                    ->where('type',1)
+                    ->select('id', 'dispatch_no as order_no')
+                    ->limit(1)
+                    ->get()->toArray();
+            }
+
         }elseif ($for_type == 4){
             $report_id = ScrappCount::where('del_time',0)
                 ->where('id', $id)