cqp 1 月之前
父節點
當前提交
30372a3c34
共有 1 個文件被更改,包括 52 次插入26 次删除
  1. 52 26
      app/Service/ApplyOrderService.php

+ 52 - 26
app/Service/ApplyOrderService.php

@@ -3306,7 +3306,8 @@ class ApplyOrderService extends Service
                     ->get()->toArray();
                     ->get()->toArray();
                 $return = array_merge($return, $tmp);
                 $return = array_merge($return, $tmp);
             }
             }
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }elseif ($for_type == 7){
         }elseif ($for_type == 7){
             $process = Process::where('del_time',0)
             $process = Process::where('del_time',0)
                 ->where('is_need_remain',1)
                 ->where('is_need_remain',1)
@@ -3369,7 +3370,8 @@ class ApplyOrderService extends Service
                 ->whereIn('id', $apply_order_id)
                 ->whereIn('id', $apply_order_id)
                 ->select('id','order_number as order_no')
                 ->select('id','order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }elseif ($for_type == 11){
         }elseif ($for_type == 11){
             $dispatch_id = ReportWorkingDetail::where('report_working_id', $id)
             $dispatch_id = ReportWorkingDetail::where('report_working_id', $id)
                 ->where('del_time',0)
                 ->where('del_time',0)
@@ -3398,7 +3400,8 @@ class ApplyOrderService extends Service
                 ->select('id','order_number as order_no')
                 ->select('id','order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
 
 
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }elseif ($for_type == 12){
         }elseif ($for_type == 12){
             $dispatch_id = ReportWorkingDetail::where('report_working_id', $id)
             $dispatch_id = ReportWorkingDetail::where('report_working_id', $id)
                 ->where('del_time',0)
                 ->where('del_time',0)
@@ -3426,7 +3429,8 @@ class ApplyOrderService extends Service
                 ->select('id','order_number as order_no')
                 ->select('id','order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
 
 
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }elseif ($for_type == 13){
         }elseif ($for_type == 13){
             $s_id = ScrappCount::where('del_time', 0)
             $s_id = ScrappCount::where('del_time', 0)
                 ->where('report_id', $id)
                 ->where('report_id', $id)
@@ -3469,7 +3473,8 @@ class ApplyOrderService extends Service
                 ->select('id','order_number as order_no')
                 ->select('id','order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
 
 
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }
         }
 
 
         return $result;
         return $result;
@@ -3575,7 +3580,8 @@ class ApplyOrderService extends Service
                 ->whereIn('id', $apply_order_id)
                 ->whereIn('id', $apply_order_id)
                 ->select('id','order_number as order_no')
                 ->select('id','order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }elseif ($for_type == 11){
         }elseif ($for_type == 11){
             $sale = DispatchSub::where('id', $id)->select('order_no','sale_orders_product_id as id')->get()->toArray();
             $sale = DispatchSub::where('id', $id)->select('order_no','sale_orders_product_id as id')->get()->toArray();
             $box_id = [];
             $box_id = [];
@@ -3599,7 +3605,8 @@ class ApplyOrderService extends Service
                 ->select('id','order_number as order_no')
                 ->select('id','order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
 
 
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }elseif ($for_type == 12){
         }elseif ($for_type == 12){
             $sale = DispatchSub::where('id', $id)->select('order_no','sale_orders_product_id as id')->get()->toArray();
             $sale = DispatchSub::where('id', $id)->select('order_no','sale_orders_product_id as id')->get()->toArray();
             $box_id = [];
             $box_id = [];
@@ -3622,7 +3629,8 @@ class ApplyOrderService extends Service
                 ->select('id','order_number as order_no')
                 ->select('id','order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
 
 
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }elseif ($for_type == 13){
         }elseif ($for_type == 13){
             $s_id = ScrappCount::where('del_time', 0)
             $s_id = ScrappCount::where('del_time', 0)
                 ->where('dispatch_sub_id', $id)
                 ->where('dispatch_sub_id', $id)
@@ -3660,7 +3668,8 @@ class ApplyOrderService extends Service
                 ->select('id','order_number as order_no')
                 ->select('id','order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
 
 
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }
         }
 
 
         return $result;
         return $result;
@@ -3715,7 +3724,8 @@ class ApplyOrderService extends Service
                 ->whereIn('id', array_unique(array_column($detail,'report_working_id')))
                 ->whereIn('id', array_unique(array_column($detail,'report_working_id')))
                 ->select('id', 'order_number as order_no')
                 ->select('id', 'order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }elseif ($for_type == 5){
         }elseif ($for_type == 5){
             $dispatch_id = BoxWithDispatch::where('del_time',0)
             $dispatch_id = BoxWithDispatch::where('del_time',0)
                 ->where('box_id', $id)
                 ->where('box_id', $id)
@@ -3743,7 +3753,8 @@ class ApplyOrderService extends Service
                 ->whereIn('process_id', $process)
                 ->whereIn('process_id', $process)
                 ->select('id', 'order_number as order_no')
                 ->select('id', 'order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }elseif ($for_type == 8){
         }elseif ($for_type == 8){
             $dispatch_id = BoxWithDispatch::where('del_time',0)
             $dispatch_id = BoxWithDispatch::where('del_time',0)
                 ->where('box_id', $id)
                 ->where('box_id', $id)
@@ -3758,7 +3769,8 @@ class ApplyOrderService extends Service
                 ->where('scrapp_num','>', 0)
                 ->where('scrapp_num','>', 0)
                 ->select('id', 'order_number as order_no')
                 ->select('id', 'order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }elseif ($for_type == 9){
         }elseif ($for_type == 9){
             $dispatch_id = BoxWithDispatch::where('del_time',0)
             $dispatch_id = BoxWithDispatch::where('del_time',0)
                 ->where('box_id', $id)
                 ->where('box_id', $id)
@@ -3803,7 +3815,8 @@ class ApplyOrderService extends Service
                 ->whereIn('id', $apply_order_id)
                 ->whereIn('id', $apply_order_id)
                 ->select('id','order_number as order_no')
                 ->select('id','order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }elseif ($for_type == 11){
         }elseif ($for_type == 11){
             $dispatch_id = BoxWithDispatch::where('del_time',0)
             $dispatch_id = BoxWithDispatch::where('del_time',0)
                 ->where('box_id', $id)
                 ->where('box_id', $id)
@@ -3830,7 +3843,8 @@ class ApplyOrderService extends Service
                 ->whereIn('id', $apply_order_id)
                 ->whereIn('id', $apply_order_id)
                 ->select('id','order_number as order_no')
                 ->select('id','order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }elseif ($for_type == 12){
         }elseif ($for_type == 12){
             $dispatch_id = BoxWithDispatch::where('del_time',0)
             $dispatch_id = BoxWithDispatch::where('del_time',0)
                 ->where('box_id', $id)
                 ->where('box_id', $id)
@@ -3857,7 +3871,8 @@ class ApplyOrderService extends Service
                 ->select('id','order_number as order_no')
                 ->select('id','order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
 
 
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }elseif ($for_type == 13){
         }elseif ($for_type == 13){
             $dispatch_id = BoxWithDispatch::where('del_time',0)
             $dispatch_id = BoxWithDispatch::where('del_time',0)
                 ->where('box_id', $id)
                 ->where('box_id', $id)
@@ -3910,7 +3925,8 @@ class ApplyOrderService extends Service
                 ->whereIn('id', $apply_order_id)
                 ->whereIn('id', $apply_order_id)
                 ->select('id','order_number as order_no')
                 ->select('id','order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }
         }
 
 
         return $result;
         return $result;
@@ -3982,7 +3998,8 @@ class ApplyOrderService extends Service
                 $return = array_merge($return, $tmp);
                 $return = array_merge($return, $tmp);
             }
             }
 
 
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }elseif ($for_type == 8){
         }elseif ($for_type == 8){
             $result = ScrappCount::where('del_time',0)
             $result = ScrappCount::where('del_time',0)
                 ->where('id', $id)
                 ->where('id', $id)
@@ -4036,7 +4053,8 @@ class ApplyOrderService extends Service
                 ->whereIn('id', $apply_order_id)
                 ->whereIn('id', $apply_order_id)
                 ->select('id','order_number as order_no')
                 ->select('id','order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }elseif ($for_type == 11){
         }elseif ($for_type == 11){
             $dispatch_id = ScrappCount::where('del_time',0)
             $dispatch_id = ScrappCount::where('del_time',0)
                 ->where('id', $id)
                 ->where('id', $id)
@@ -4064,7 +4082,8 @@ class ApplyOrderService extends Service
                 ->select('id','order_number as order_no')
                 ->select('id','order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
 
 
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }elseif ($for_type == 12){
         }elseif ($for_type == 12){
             $dispatch_id = ScrappCount::where('del_time',0)
             $dispatch_id = ScrappCount::where('del_time',0)
                 ->where('id', $id)
                 ->where('id', $id)
@@ -4091,7 +4110,8 @@ class ApplyOrderService extends Service
                 ->select('id','order_number as order_no')
                 ->select('id','order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
 
 
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }elseif ($for_type == 13){
         }elseif ($for_type == 13){
             $apply_order_id = ApplyOrderDetail::where('del_time', 0)
             $apply_order_id = ApplyOrderDetail::where('del_time', 0)
                 ->where('data_id', $id)
                 ->where('data_id', $id)
@@ -4129,7 +4149,8 @@ class ApplyOrderService extends Service
                 ->select('id','order_number as order_no')
                 ->select('id','order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
 
 
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }
         }
 
 
         return $result;
         return $result;
@@ -4201,7 +4222,8 @@ class ApplyOrderService extends Service
                 $return = array_merge($return, $tmp);
                 $return = array_merge($return, $tmp);
             }
             }
 
 
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }elseif ($for_type == 7){
         }elseif ($for_type == 7){
             $process = Process::where('del_time',0)
             $process = Process::where('del_time',0)
                 ->where('is_need_remain',1)
                 ->where('is_need_remain',1)
@@ -4259,7 +4281,8 @@ class ApplyOrderService extends Service
                 ->whereIn('id', $apply_order_id)
                 ->whereIn('id', $apply_order_id)
                 ->select('id','order_number as order_no')
                 ->select('id','order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }elseif ($for_type == 11){
         }elseif ($for_type == 11){
             $dispatch_id = ScrappCount::where('del_time',0)
             $dispatch_id = ScrappCount::where('del_time',0)
                 ->where('id', $id)
                 ->where('id', $id)
@@ -4287,7 +4310,8 @@ class ApplyOrderService extends Service
                 ->select('id','order_number as order_no')
                 ->select('id','order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
 
 
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }elseif ($for_type == 12){
         }elseif ($for_type == 12){
             $dispatch_id = ScrappCount::where('del_time',0)
             $dispatch_id = ScrappCount::where('del_time',0)
                 ->where('id', $id)
                 ->where('id', $id)
@@ -4314,7 +4338,8 @@ class ApplyOrderService extends Service
                 ->select('id','order_number as order_no')
                 ->select('id','order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
 
 
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }elseif ($for_type == 13){
         }elseif ($for_type == 13){
             $apply_order_id = ApplyOrderDetail::where('del_time', 0)
             $apply_order_id = ApplyOrderDetail::where('del_time', 0)
                 ->where('data_id', $id)
                 ->where('data_id', $id)
@@ -4352,7 +4377,8 @@ class ApplyOrderService extends Service
                 ->select('id','order_number as order_no')
                 ->select('id','order_number as order_no')
                 ->get()->toArray();
                 ->get()->toArray();
 
 
-            $result[] = $return[0] ?? [];
+            $t = $return[0] ?? [];
+            if(! empty($t)) $result[] = $t;
         }
         }
 
 
         return $result;
         return $result;