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