|
@@ -34,7 +34,6 @@ class BoxService extends Service
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 包装
|
|
|
* @param $data
|
|
@@ -42,27 +41,6 @@ class BoxService extends Service
|
|
|
*/
|
|
|
public function boxIn($data)
|
|
|
{
|
|
|
-// if(!isset($data['params'])) return [false,'not found params'];
|
|
|
-// $param = $data['params'];
|
|
|
-// $param = [
|
|
|
-// [
|
|
|
-// 'id' => 716,
|
|
|
-// 'order_no' => 716,
|
|
|
-// 'params' => [
|
|
|
-// '1',
|
|
|
-// '1',
|
|
|
-//
|
|
|
-// ],
|
|
|
-
|
|
|
-// ], [
|
|
|
-// 'id' => 723,
|
|
|
-// 'order_no' => 716,
|
|
|
-// 'params' => [
|
|
|
-// '40'
|
|
|
-// ],
|
|
|
-// ],
|
|
|
-// ];
|
|
|
-
|
|
|
$ids = [];
|
|
|
$sale_ids = [];
|
|
|
$top_order_no = $data['order_no'];
|
|
@@ -120,12 +98,13 @@ class BoxService extends Service
|
|
|
'ext_4' => $ext_4,
|
|
|
'ext_5' => $ext_5,
|
|
|
'num' => $vv,
|
|
|
+ 'price' => $v['price'],
|
|
|
'box_type' => 1,
|
|
|
'team_id' => $team_id,
|
|
|
'shipment_order_no' => $transport_no,
|
|
|
];
|
|
|
-
|
|
|
}
|
|
|
+
|
|
|
SaleOrdersProduct::where('id',$v['sale_orders_product_id'])->update([
|
|
|
'box_num' => DB::raw('box_num + '.$total),
|
|
|
]);
|
|
@@ -164,6 +143,7 @@ class BoxService extends Service
|
|
|
'ext_4' => $ext_4,
|
|
|
'ext_5' => $ext_5,
|
|
|
'num' => $vv,
|
|
|
+ 'price' => $v['price'],
|
|
|
'box_type' => $box_type,
|
|
|
'team_id' => $team_id,
|
|
|
'shipment_order_no' => $transport_no,
|
|
@@ -175,6 +155,11 @@ class BoxService extends Service
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
+ //客户名称
|
|
|
+ $ext_1 = "";
|
|
|
+ if(empty($ext_1) && isset($sale_product_list[0]['customer_name'])) $ext_1 = $sale_product_list[0]['customer_name'];
|
|
|
+ if(empty($ext_1) && isset($product_list[0]['customer_name'])) $ext_1 = $product_list[0]['customer_name'];
|
|
|
+
|
|
|
$insert['detail'] = $box_insert;
|
|
|
$insert['top_order_no'] = $top_order_no;
|
|
|
$insert['order_no'] = $box_no;
|
|
@@ -188,7 +173,7 @@ class BoxService extends Service
|
|
|
$this->delLock($key);
|
|
|
|
|
|
DB::commit();
|
|
|
- return [true,''];
|
|
|
+ return [true, ['package_data' => $msg->toArray()]];
|
|
|
}catch (\Exception $e){
|
|
|
DB::rollBack();
|
|
|
return [false,$e->getLine().':'.$e->getMessage()];
|
|
@@ -326,7 +311,7 @@ class BoxService extends Service
|
|
|
$model = SaleOrdersProduct::where('del_time',0)->wherein('id',$sale_order_ids)
|
|
|
->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::where('del_time',0)->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',DB::raw('(production_quantity - scrapp_num) as production_quantity '),DB::raw('finished_num as dispatch_complete_quantity '),'technology_material','technology_name','wood_name','process_mark')->get()->toArray();
|
|
|
+ $product_list = ordersProduct::where('del_time',0)->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',DB::raw('(production_quantity - scrapp_num) as production_quantity'),DB::raw('finished_num as dispatch_complete_quantity'),'technology_material','technology_name','wood_name','process_mark')->get()->toArray();
|
|
|
$model_key_list = [];
|
|
|
foreach ($model as $v){
|
|
|
$model_key_list[$v['id']] = $v;
|
|
@@ -361,12 +346,7 @@ class BoxService extends Service
|
|
|
$box_num += $vv['box_num'];
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-// $product_num = isset($product_key_num_list[$v['id']]) ? $product_key_num_list[$v['id']]['product_num'] : 0;
|
|
|
-// $box_num = isset($product_key_num_list[$v['id']]) ? $product_key_num_list[$v['id']]['box_num'] : 0;
|
|
|
if(($v['order_quantity'] - $product_num) === 0) continue;
|
|
|
-// var_dump($v['order_quantity']);
|
|
|
-// 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'],
|
|
@@ -413,23 +393,6 @@ class BoxService extends Service
|
|
|
$return[] = $v;
|
|
|
}
|
|
|
|
|
|
-// $data = [
|
|
|
-// [
|
|
|
-// 'id' => 1,
|
|
|
-// 'out_order_no' => '销售订单号',
|
|
|
-// 'production_time' => '下生产时间',
|
|
|
-// 'customer_no' => '客户编码',
|
|
|
-// 'customer_name' => '客户名称',
|
|
|
-// 'product_no' => '产品编码',
|
|
|
-// 'product_title' => '产品名称',
|
|
|
-// 'product_size' => '产品规格',
|
|
|
-// 'type' => '1生产包装2备用包装',
|
|
|
-// 'is_box_num' => '已包装数量',
|
|
|
-// 'un_box_num' => '未包装',
|
|
|
-// 'sale_num' => '销售数量',
|
|
|
-// ]
|
|
|
-// ];
|
|
|
-
|
|
|
return [true,$return];
|
|
|
}
|
|
|
|
|
@@ -563,6 +526,7 @@ class BoxService extends Service
|
|
|
// $ext_3 = $v['technology_name'];//工艺名称
|
|
|
// $ext_4 = $v['wood_name'];//木皮
|
|
|
// $ext_5 = $v['process_mark'];//工艺备注
|
|
|
+ // toDO 有问题
|
|
|
OrdersProduct::where('product_no',$vv['ext_1'])->where('technology_material',$vv['ext_2'])->where('technology_name',$vv['ext_3'])->where('wood_name',$vv['ext_4'])->where('process_mark',$vv['ext_5'])->where('sale_orders_product_id',$vv['top_id'])
|
|
|
->update([
|
|
|
'box_num' => DB::raw('box_num - '.$vv['num'])
|