|
@@ -64,15 +64,14 @@ class ProductionOrderService extends Service
|
|
OrdersProductMain::insert(['production_no' => $production_no,'crt_time' => time(),'crt_id' => $user['id']]);
|
|
OrdersProductMain::insert(['production_no' => $production_no,'crt_time' => time(),'crt_id' => $user['id']]);
|
|
|
|
|
|
//生产数据的源数据
|
|
//生产数据的源数据
|
|
- $result = $msg;
|
|
|
|
|
|
+ $result = $msg[0];
|
|
|
|
+ $quantity_map = $msg[1];
|
|
|
|
|
|
$boom = $process = [];
|
|
$boom = $process = [];
|
|
$time = time();
|
|
$time = time();
|
|
foreach ($result as $key => $value){
|
|
foreach ($result as $key => $value){
|
|
- $quantity_tmp = $data['quantity'][$key];
|
|
|
|
-
|
|
|
|
$result[$key]['production_no'] = $production_no;
|
|
$result[$key]['production_no'] = $production_no;
|
|
- $result[$key]['production_quantity'] = $quantity_tmp;
|
|
|
|
|
|
+ $result[$key]['production_quantity'] = $quantity_map[$value['sale_orders_product_id']];
|
|
$result[$key]['production_time'] = $time;
|
|
$result[$key]['production_time'] = $time;
|
|
$result[$key]['crt_id'] = $user['id'];
|
|
$result[$key]['crt_id'] = $user['id'];
|
|
}
|
|
}
|
|
@@ -86,7 +85,7 @@ class ProductionOrderService extends Service
|
|
|
|
|
|
$time_arr = [];
|
|
$time_arr = [];
|
|
foreach ($result as $key => $value){
|
|
foreach ($result as $key => $value){
|
|
- $quantity_tmp = $data['quantity'][$key];
|
|
|
|
|
|
+ $quantity_tmp = $quantity_map[$value['sale_orders_product_id']];
|
|
|
|
|
|
$time_tmp = date("Ymd", $value['out_order_no_time']);
|
|
$time_tmp = date("Ymd", $value['out_order_no_time']);
|
|
if(! in_array($time_tmp,$time_arr)) $time_arr[] = $time_tmp;
|
|
if(! in_array($time_tmp,$time_arr)) $time_arr[] = $time_tmp;
|
|
@@ -201,11 +200,12 @@ class ProductionOrderService extends Service
|
|
->get()->toArray();
|
|
->get()->toArray();
|
|
|
|
|
|
foreach ($result as $key => $value){
|
|
foreach ($result as $key => $value){
|
|
- if($value['production_quantity'] + $map[$value['sale_orders_product_id']] > $value['order_quantity']) return [false,'生产数量不能大于订单数量'];
|
|
|
|
|
|
+ $quantity_tmp = $map[$value['sale_orders_product_id']] ?? 0;
|
|
|
|
+ if($value['production_quantity'] + $quantity_tmp > $value['order_quantity']) return [false,'生产数量不能大于订单数量'];
|
|
unset($result[$key]['production_quantity']);//删除销售订单的已生产数量
|
|
unset($result[$key]['production_quantity']);//删除销售订单的已生产数量
|
|
}
|
|
}
|
|
|
|
|
|
- return [true, $result];
|
|
|
|
|
|
+ return [true, [$result,$map]];
|
|
}
|
|
}
|
|
|
|
|
|
public function fillData($data){
|
|
public function fillData($data){
|