修正一键出库功能的逻辑错误

- 修改BeforehandOrderLogic中的注释,将"一键入库"更改为"一键出库"
- 更新BeforehandOrderCartInfoLogic中的入库逻辑,增加订单类型字段
- 优化重复入库的判断条件,提高代码可读性和性能
This commit is contained in:
mkm 2024-10-15 15:40:34 +08:00
parent edec1712dc
commit 08615d130c
2 changed files with 4 additions and 3 deletions

View File

@ -277,7 +277,7 @@ class BeforehandOrderLogic extends BaseLogic
}
/**
* @notes 一键
* @notes 一键
* @param array $params
* @return bool
* @author admin

View File

@ -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'];