cqp 1 개월 전
부모
커밋
6b4cabc2b6
3개의 변경된 파일110개의 추가작업 그리고 27개의 파일을 삭제
  1. 13 0
      app/Http/Controllers/Api/FinishedOrderController.php
  2. 96 27
      app/Service/ApplyOrderService.php
  3. 1 0
      routes/api.php

+ 13 - 0
app/Http/Controllers/Api/FinishedOrderController.php

@@ -111,4 +111,17 @@ class FinishedOrderController extends BaseController
             return $this->json_return(201,$data);
         }
     }
+
+    public function finishedOrderList(Request $request)
+    {
+        $service = new FinishedOrderService();
+        $user = $request->get('auth');
+        list($status,$data) = $service->finishedOrderList($request->all());
+
+        if($status){
+            return $this->json_return(200,'',$data);
+        }else{
+            return $this->json_return(201,$data);
+        }
+    }
 }

+ 96 - 27
app/Service/ApplyOrderService.php

@@ -161,6 +161,7 @@ class ApplyOrderService extends Service
         if(! empty($data['storehouse_title'])) $model->where('storehouse_title', 'LIKE', '%'.$data['storehouse_title'].'%');
         if(! empty($data['order_number'])) $model->where('order_number', 'LIKE', '%'.$data['order_number'].'%');
         if(! empty($data['apply_id'])) $model->where('apply_id', $data['apply_id']);
+        if(! empty($data['id'])) $model->where('id', $data['id']);
         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]]);
@@ -1159,6 +1160,7 @@ class ApplyOrderService extends Service
             ->select('id','order_number','apply_time','mark','status','storehouse_title')
             ->orderBy('id','desc');
         if(isset($data['status'])) $model->where('status', $data['status']);
+        if(!empty($data['id'])) $model->where('id', $data['id']);
         if(! empty($data['crt_time'][0]) && ! empty($data['crt_time'][1])){
             $model->where('crt_time',">=",$data['crt_time'][0]);
             $model->where('crt_time',"<=",$data['crt_time'][1]);
@@ -2453,15 +2455,15 @@ class ApplyOrderService extends Service
         } elseif ($type == 8) {
             $result = $this->typeEight($for_type, $id);
         } elseif ($type == 9) {
-
+            $result = $this->typeNine($for_type, $id);
         } elseif ($type == 10) {
-
+            $result = $this->typeTen($for_type, $id);
         } elseif ($type == 11) {
-
+            $result = $this->typeEve($for_type, $id);
         } elseif ($type == 12) {
-
+            $result = $this->typeTwl($for_type, $id);
         } elseif ($type == 13) {
-
+            $result = $this->typeThi($for_type, $id);
         }
 
         return $result;
@@ -2620,7 +2622,7 @@ class ApplyOrderService extends Service
                 ->toArray();
             $result = SaleOrdersProduct::whereIn('id', $sale_orders_product_id)
                 ->where('del_time',0)
-                ->select('id','out_order_no as order')
+                ->select('id','out_order_no as order_no')
                 ->get()->toArray();
         }elseif ($for_type == 3){
             $result = DispatchSub::where('del_time',0)
@@ -2772,7 +2774,7 @@ class ApplyOrderService extends Service
                 ->toArray();
             $result = SaleOrdersProduct::whereIn('id', $sale_orders_product_id)
                 ->where('del_time',0)
-                ->select('id','out_order_no as order')
+                ->select('id','out_order_no as order_no')
                 ->get()->toArray();
         }elseif ($for_type == 2){
             $order_product_id = DispatchSub::where('del_time',0)
@@ -2924,7 +2926,7 @@ class ApplyOrderService extends Service
                 ->toArray();
             $result = SaleOrdersProduct::whereIn('id', $sale_orders_product_id)
                 ->where('del_time',0)
-                ->select('id','out_order_no as order')
+                ->select('id','out_order_no as order_no')
                 ->get()->toArray();
         }elseif ($for_type == 2){
             $dispatch_id = ReportWorkingDetail::where('report_working_id', $id)
@@ -3106,7 +3108,7 @@ class ApplyOrderService extends Service
                 ->toArray();
             $result = SaleOrdersProduct::whereIn('id', $sale_orders_product_id)
                 ->where('del_time',0)
-                ->select('id','out_order_no as order')
+                ->select('id','out_order_no as order_no')
                 ->get()->toArray();
         }elseif ($for_type == 2){
             $order_product_id = DispatchSub::where('del_time',0)
@@ -3246,7 +3248,7 @@ class ApplyOrderService extends Service
 
     private function typeSix($for_type, $id){
         $result = [];
-        $box = Box::where('id', $id)->select('top_order_no')->first();
+        $box = Box::where('id', $id)->first();
         if(empty($box)) return $result;
         $top_order_no = $box->top_order_no;
         $order_no = $box->order_no;
@@ -3259,7 +3261,7 @@ class ApplyOrderService extends Service
                 ->toArray();
             $result = SaleOrdersProduct::whereIn('id', $sale_orders_product_id)
                 ->where('del_time',0)
-                ->select('id','out_order_no as order')
+                ->select('id','out_order_no as order_no')
                 ->get()->toArray();
         }elseif ($for_type == 2){
             $box_detail = new BoxDetail(['channel'=> $top_order_no]);
@@ -3440,7 +3442,7 @@ class ApplyOrderService extends Service
                 ->toArray();
             $result = SaleOrdersProduct::whereIn('id', $sale_orders_product_id)
                 ->where('del_time',0)
-                ->select('id','out_order_no as order')
+                ->select('id','out_order_no as order_no')
                 ->get()->toArray();
         }elseif ($for_type == 2){
             $order_product_id = ScrappCount::where('del_time',0)
@@ -3461,16 +3463,12 @@ class ApplyOrderService extends Service
                 ->select('id', 'dispatch_no as order_no')
                 ->get()->toArray();
         }elseif ($for_type == 4){
-            $dispatch_id = ScrappCount::where('del_time',0)
+            $report_id = ScrappCount::where('del_time',0)
                 ->where('id', $id)
-                ->pluck('dispatch_sub_id')
+                ->pluck('report_id')
                 ->toArray();
-            $detail = ReportWorkingDetail::whereIn('data_id', $dispatch_id)
-                ->where('del_time',0)
-                ->select('report_working_id')
-                ->get()->toArray();
             $result = ReportWorking::where('del_time',0)
-                ->whereIn('id', array_unique(array_column($detail,'report_working_id')))
+                ->whereIn('id', $report_id)
                 ->select('id', 'order_number as order_no')
                 ->get()->toArray();
         }elseif ($for_type == 5){
@@ -3608,7 +3606,7 @@ class ApplyOrderService extends Service
                 ->toArray();
             $result = SaleOrdersProduct::whereIn('id', $sale_orders_product_id)
                 ->where('del_time',0)
-                ->select('id','out_order_no as order')
+                ->select('id','out_order_no as order_no')
                 ->get()->toArray();
         }elseif ($for_type == 2){
             $order_product_id = ScrappCount::where('del_time',0)
@@ -3629,16 +3627,12 @@ class ApplyOrderService extends Service
                 ->select('id', 'dispatch_no as order_no')
                 ->get()->toArray();
         }elseif ($for_type == 4){
-            $dispatch_id = ScrappCount::where('del_time',0)
+            $report_id = ScrappCount::where('del_time',0)
                 ->where('id', $id)
-                ->pluck('dispatch_sub_id')
+                ->pluck('report_id')
                 ->toArray();
-            $detail = ReportWorkingDetail::whereIn('data_id', $dispatch_id)
-                ->where('del_time',0)
-                ->select('report_working_id')
-                ->get()->toArray();
             $result = ReportWorking::where('del_time',0)
-                ->whereIn('id', array_unique(array_column($detail,'report_working_id')))
+                ->whereIn('id', $report_id)
                 ->select('id', 'order_number as order_no')
                 ->get()->toArray();
         }elseif ($for_type == 5){
@@ -3766,6 +3760,81 @@ class ApplyOrderService extends Service
         return $result;
     }
 
+    private function typeNine($for_type, $id){
+        $data_id = ApplyOrderDetail::where('del_time', 0)
+            ->where('apply_order_id', $id)
+            ->where('type', ApplyOrder::type_one)
+            ->pluck('data_id')
+            ->toArray();
+        $result = DispatchSub::where('del_time',0)
+            ->whereIn('id', $data_id)
+            ->select('id', 'dispatch_no as order_no')
+            ->get()->toArray();
+
+        return $result;
+    }
+
+    private function typeTen($for_type, $id){
+        $data_id = ApplyOrderDetail::where('del_time', 0)
+            ->where('apply_order_id', $id)
+            ->where('type', ApplyOrder::type_two)
+            ->pluck('data_id')
+            ->toArray();
+        $detail = ReportWorkingDetail::whereIn('data_id', $data_id)
+            ->where('del_time',0)
+            ->select('report_working_id')
+            ->get()->toArray();
+        $return = ReportWorking::where('del_time',0)
+            ->whereIn('id', array_unique(array_column($detail,'report_working_id')))
+            ->select('id', 'order_number as order_no')
+            ->get()->toArray();
+
+        $result[] = $return[0];
+        return $result;
+    }
+
+    private function typeEve($for_type, $id){
+        $detail = ApplyOrderDetail::where('del_time', 0)
+            ->where('apply_order_id', $id)
+            ->where('type', ApplyOrder::type_four)
+            ->select('data_id as box_id')
+            ->get()->toArray();
+        $result = Box::where('del_time', 0)
+            ->whereIn('id', array_unique(array_column($detail, 'box_id')))
+            ->select("id", 'order_no')
+            ->get()->toArray();
+
+        return $result;
+    }
+
+    private function typeTwl($for_type, $id){
+        $detail = ApplyOrderDetail::where('del_time', 0)
+            ->where('apply_order_id', $id)
+            ->where('type', ApplyOrder::type_three)
+            ->select('data_id as box_id')
+            ->get()->toArray();
+        $result = Box::where('del_time', 0)
+            ->whereIn('id', array_unique(array_column($detail, 'box_id')))
+            ->select("id", 'order_no')
+            ->get()->toArray();
+
+        return $result;
+    }
+
+    private function typeThi($for_type, $id){
+        $detail = ApplyOrderDetail::where('del_time', 0)
+            ->where('apply_order_id', $id)
+            ->where('type', ApplyOrder::type_five)
+            ->select('data_id as zj_id')
+            ->get()->toArray();
+        $result = ScrappCount::where('del_time', 0)
+            ->whereIn('id', array_unique(array_column($detail, 'zj_id')))
+            ->select('id','order_number as order_no')
+            ->get()->toArray();
+
+        return $result;
+    }
+
     public function reportList($data){
         $model = ReportMessage::where('del_time',0)
             ->select('id','order_id','opt_case','quantity','crt_time','user_id','is_use')

+ 1 - 0
routes/api.php

@@ -174,6 +174,7 @@ Route::group(['middleware'=> ['checkLogin']],function ($route){
     $route->any('finishedOrderDetail', 'Api\FinishedOrderController@orderDetail');
     $route->any('finishedOrderEditZj', 'Api\FinishedOrderController@editZj');
     $route->any('finishedOrderGetZj', 'Api\FinishedOrderController@GetZj');
+    $route->any('finishedOrderNewList', 'Api\FinishedOrderController@finishedOrderList');
     //pc端 工序完工------------
 
     //审核统一入口