修正一键出库功能的逻辑错误
- 修改BeforehandOrderLogic中的注释,将"一键入库"更改为"一键出库" - 更新BeforehandOrderCartInfoLogic中的入库逻辑,增加订单类型字段 - 优化重复入库的判断条件,提高代码可读性和性能
This commit is contained in:
parent
edec1712dc
commit
08615d130c
@ -277,7 +277,7 @@ class BeforehandOrderLogic extends BaseLogic
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 一键入库
|
||||
* @notes 一键出库
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author admin
|
||||
|
@ -125,9 +125,9 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
|
||||
throw new BusinessException('参数错误');
|
||||
}
|
||||
$count = PurchaseProductOffer::where(['order_id' => $params['bhoid'], 'is_storage' => 0, 'buyer_nums' => 0])->count('id');
|
||||
$warehousing_id = BeforehandOrder::where('id', $params['bhoid'])->value('warehousing_id');
|
||||
$beforehandOrder = BeforehandOrder::where('id', $params['bhoid'])->field('order_type,warehousing_id')->find();
|
||||
|
||||
if ($count > 0 || $warehousing_id > 0) {
|
||||
if ($count > 0 || $beforehandOrder['warehousing_id'] > 0) {
|
||||
throw new BusinessException('请勿重复入库');
|
||||
}
|
||||
$offer_list = PurchaseProductOffer::where(['order_id' => $params['bhoid'], 'is_storage' => 0])->select();
|
||||
@ -152,6 +152,7 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
|
||||
$res = WarehouseOrder::create($arr);
|
||||
foreach ($offer_list as $k => $v) {
|
||||
$data['admin_id'] = $params['admin_id'];
|
||||
$data['order_type'] = $beforehandOrder['order_type'];
|
||||
$data['store_id'] = 0;
|
||||
$data['oid'] = $res['id'];
|
||||
$data['supplier_id'] = $v['supplier_id'];
|
||||
|
Loading…
x
Reference in New Issue
Block a user