往期补单采购不增加库存
This commit is contained in:
parent
585f64b2f5
commit
68fab40a25
@ -212,6 +212,16 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
|
|||||||
];
|
];
|
||||||
$res = WarehouseOrder::create($arr);
|
$res = WarehouseOrder::create($arr);
|
||||||
foreach ($offer_list as $k => $v) {
|
foreach ($offer_list as $k => $v) {
|
||||||
|
if (!empty($v['source_order_info'])) {
|
||||||
|
// 采购单来源于往期补单,需要减少对应订单的入库数量
|
||||||
|
$sourceOrderInfo = reset_index($v['source_order_info'], 'source_order_id');
|
||||||
|
$orders = BeforehandOrder::field('id,order_type')->whereIn('id', array_keys($sourceOrderInfo))->select()->toArray();
|
||||||
|
foreach ($orders as $order) {
|
||||||
|
if ($order['order_type'] == 6) {
|
||||||
|
$v['buyer_nums'] = $v['buyer_nums'] - $sourceOrderInfo[$order['id']]['need_num'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$data['admin_id'] = $params['admin_id'];
|
$data['admin_id'] = $params['admin_id'];
|
||||||
$data['order_type'] = $beforehandOrder['order_type'];
|
$data['order_type'] = $beforehandOrder['order_type'];
|
||||||
$data['store_id'] = 0;
|
$data['store_id'] = 0;
|
||||||
@ -241,7 +251,9 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
|
|||||||
if($product_arr!=[]){
|
if($product_arr!=[]){
|
||||||
StoreProduct::where('id',$v['product_id'])->save($product_arr);
|
StoreProduct::where('id',$v['product_id'])->save($product_arr);
|
||||||
}
|
}
|
||||||
WarehouseProductLogic::add($data);
|
if ($data['nums'] > 0) {
|
||||||
|
WarehouseProductLogic::add($data);
|
||||||
|
}
|
||||||
PurchaseProductOffer::where('id', $v['id'])->update(['status' => 1, 'is_storage' => 1]);
|
PurchaseProductOffer::where('id', $v['id'])->update(['status' => 1, 'is_storage' => 1]);
|
||||||
}
|
}
|
||||||
$attrs = ['warehousing_id' => $res['id'],'is_warehousing'=>1];
|
$attrs = ['warehousing_id' => $res['id'],'is_warehousing'=>1];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user