root 2 سال پیش
والد
کامیت
d43de9966b
4فایلهای تغییر یافته به همراه47 افزوده شده و 5 حذف شده
  1. 1 0
      app/Service/Box/BoxHookService.php
  2. 21 4
      app/Service/Box/BoxService.php
  3. 1 1
      app/Service/FinishedOrderService.php
  4. 24 0
      app/Service/FyyOrderService.php

+ 1 - 0
app/Service/Box/BoxHookService.php

@@ -135,6 +135,7 @@ class BoxHookService extends Service
                 'ext_3' => isset($v['ext_3']) ? $v['ext_3'] : '',
                 'ext_4' => isset($v['ext_4']) ? $v['ext_4'] : '',
                 'ext_5' => isset($v['ext_5']) ? $v['ext_5'] : '',
+                'team_id' => isset($v['team_id']) ? $v['team_id'] : '',
 
             ];
         }

+ 21 - 4
app/Service/Box/BoxService.php

@@ -8,6 +8,7 @@ use App\Model\BoxDetail;
 use App\Model\Header_ext;
 use App\Model\OrdersProduct;
 use App\Model\SaleOrdersProduct;
+use App\Model\Team;
 use App\Service\Service;
 use Illuminate\Support\Facades\DB;
 
@@ -79,6 +80,7 @@ class BoxService extends Service
             $key_list[$v['id']] = [
                 'detail' => $v['params'],
                 'total' => $total,
+                'team_id' => isset($v['team_id']) ? $v['team_id'] : 0,
             ];
         }
         $insert = [];
@@ -98,6 +100,7 @@ class BoxService extends Service
                 $num_list = $key_list[$v['id']];
                 $total = $num_list['total'];
                 $detail = $num_list['detail'];
+                $team_id = $num_list['team_id'];
                 $un_box_num = $v['dispatch_complete_quantity'] - $v['box_num'];
                 if ($total > $un_box_num) return [false, $v['product_title'] . '数量不足'];
 
@@ -118,7 +121,8 @@ class BoxService extends Service
                         'ext_4' => $ext_4,
                         'ext_5' => $ext_5,
                         'num' => $vv,
-                        'box_type' => 0
+                        'box_type' => 0,
+                        'team_id' => $team_id,
 
                     ];
 
@@ -140,6 +144,7 @@ class BoxService extends Service
                 $num_list = $key_list[$v['id']];
                 $total = $num_list['total'];
                 $detail = $num_list['detail'];
+                $team_id = $num_list['team_id'];
                 $box_detail = new BoxDetail(['channel'=>$top_order_no]);
                 $un_box_num = $v['order_quantity'] - $v['box_num'] - $box_detail->where('top_id',$v['id'])->where('box_type',1)->sum('num');
                 if ($total > $un_box_num) return [false, $v['product_title'] . '数量不足'];
@@ -162,6 +167,7 @@ class BoxService extends Service
                         'ext_5' => $ext_5,
                         'num' => $vv,
                         'box_type' => 1,
+                        'team_id' => $team_id,
 
                     ];
 
@@ -230,9 +236,9 @@ class BoxService extends Service
         if(!isset($data['id'])) return [false,'id not found'];
         $sale_order_ids = $data['id'];
         $model = SaleOrdersProduct::where('del_time',0)->wherein('id',$sale_order_ids)
-            ->select('id','out_order_no','customer_no','customer_name','product_no','product_title','product_size','crt_time as production_time','id as sale_orders_product_id','finished_num as dispatch_complete_quantity','box_num','technology_name','wood_name','crt_time','order_quantity')
+            ->select('id','out_order_no','order_no','customer_no','customer_name','product_no','product_title','product_size','crt_time as production_time','id as sale_orders_product_id','finished_num as dispatch_complete_quantity','box_num','technology_name','wood_name','crt_time','order_quantity','technology_material','technology_name','wood_name','process_mark')
             ->orderBy('id','desc')->get()->toArray();
-        $product_list = ordersProduct::wherein('sale_orders_product_id',$sale_order_ids)->select('id','out_order_no','customer_no','customer_name','product_no','sale_orders_product_id','product_title','product_size','dispatch_complete_quantity','box_num','technology_name','wood_name','crt_time','production_quantity')->get()->toArray();
+        $product_list = ordersProduct::wherein('sale_orders_product_id',$sale_order_ids)->select('id','out_order_no','customer_no','customer_name','product_no','sale_orders_product_id','product_title','product_size','dispatch_complete_quantity','box_num','technology_name','wood_name','crt_time','production_quantity','technology_material','technology_name','wood_name','process_mark')->get()->toArray();
         $model_key_list = [];
         foreach ($model as $v){
             $model_key_list[$v['id']] = $v;
@@ -275,6 +281,7 @@ class BoxService extends Service
 //                var_dump($v['order_quantity']);
                 $product_key_list[$v['sale_orders_product_id']] = [
                     'out_order_no' => $v['out_order_no'],
+                    'order_no' => $v['order_no'],
                     'production_time' => '未下生产',
                     'customer_no' => $v['customer_no'],
                     'customer_name' => $v['customer_name'],
@@ -282,6 +289,10 @@ class BoxService extends Service
                     'product_title' => $v['product_title'],
                     'product_size' => $v['product_size'],
                     'id' => -$v['sale_orders_product_id'],
+                    'technology_material' => $v['technology_material'],
+                    'technology_name' => $v['technology_name'],
+                    'wood_name' => $v['wood_name'],
+                    'process_mark' => $v['process_mark'],
                     'type' => '2',
                     'is_box_num' => $v['box_num'] - $box_num,
                     'un_box_num' => $v['order_quantity'] - ($v['box_num'] - $box_num) - $product_num,
@@ -291,6 +302,11 @@ class BoxService extends Service
 
                 $return[] = [
                     'id' => $v['id'],
+                    'technology_material' => $v['technology_material'],
+                    'technology_name' => $v['technology_name'],
+                    'wood_name' => $v['wood_name'],
+                    'order_no' => $v['order_no'],
+                    'process_mark' => -$v['process_mark'],
                     'out_order_no' => $v['out_order_no'],
                     'production_time' => date('Y-m-d',$v['crt_time']),
                     'customer_no' => $v['customer_no'],
@@ -395,13 +411,14 @@ class BoxService extends Service
         foreach ($sale_orders_product as $v){
             $sale_orders_key_product[$v['id']] = $v;
         }
+        $team_key_list = Team::pluck('title','id')->toArray();
         foreach ($list as &$v){
             $detail = $sale_orders_key_product[$v['top_id']];
 //            var_dump($detail);die;
             $v['customer_name'] = $detail['customer_name'];
             $v['technology_material'] = $detail['technology_material'];
             $v['wood_name'] = $detail['wood_name'];
-            $v['team_name'] = '';
+            $v['team_name'] = isset($team_key_list[$v['team_id']]) ? $team_key_list[$v['team_id']] : '' ;
         }
 
         return [true,$list];

+ 1 - 1
app/Service/FinishedOrderService.php

@@ -238,7 +238,7 @@ class FinishedOrderService extends Service
         if($this->isEmpty($data,'finish_id') && $this->isEmpty($data,'team_id')) return [false,'人员和班组不能都为空!'];
 
         $bool = DispatchSub::whereIn('id',$data['id'])->where('job_status',1)->exists();
-        if($bool) return [false,'正在队列中,请不要重复操作!'];
+//        if($bool) return [false,'正在队列中,请不要重复操作!'];
 
         $result = DispatchSub::whereIn('id',$data['id'])
             ->select('id','finished_num','dispatch_quantity','out_order_no_time','process_id','dispatch_no','order_product_id','sale_orders_product_id','order_no','product_no','product_title','price','customer_name','technology_material','technology_name','wood_name')

+ 24 - 0
app/Service/FyyOrderService.php

@@ -286,6 +286,18 @@ class FyyOrderService extends Service
                 ->groupBy('order_no')
                 ->orderBy('id','desc')
                 ->get()->toArray();
+            $key_list = [];
+            foreach ($list as $v){
+                $customer_name = $v['customer_name'];
+                if(!isset($key_list[$customer_name])) $key_list[$customer_name] = [
+                    'customer_name' => $customer_name,
+                    'list' => [],
+                ];
+//                unset($v['customer_name']);
+                $key_list[$customer_name]['list'][] = $v;
+                sort($key_list);
+                $list = $key_list;
+            }
         }elseif($data['type'] == 2){
             $list = SaleOrdersProduct::where('del_time',0)
                 ->select('order_no','out_order_no','customer_name')
@@ -293,6 +305,18 @@ class FyyOrderService extends Service
                 ->groupBy('order_no')
                 ->orderBy('id','desc')
                 ->get()->toArray();
+            $key_list = [];
+            foreach ($list as $v){
+                $customer_name = $v['customer_name'];
+                if(!isset($key_list[$customer_name])) $key_list[$customer_name] = [
+                    'customer_name' => $customer_name,
+                    'list' => [],
+                ];
+//                unset($v['customer_name']);
+                $key_list[$customer_name]['list'][] = $v;
+                sort($key_list);
+                $list = $key_list;
+            }
         }
 
         return [true, $list];