fix(admin): 修复创建出库单时商品价格和数量的校验

- 增加了对商品价格的校验,确保所有商品的价格大于 0
- 优化了对商品数量的校验逻辑
This commit is contained in:
mkm 2024-11-14 18:11:35 +08:00
parent 597554b854
commit 4bdd480e48

View File

@ -352,6 +352,11 @@ class BeforehandOrderLogic extends BaseLogic
throw new BusinessException('该订单已创建出库单');
}
$info = BeforehandOrderCartInfo::where('bhoid', $params['bhoid'])->select();
foreach ($info as $k => $v) {
if($v['pay_price']<=0){
throw new BusinessException('商品价格未空 不能生成出库订单,对应id:'.$v['id']);
}
}
$count = BeforehandOrderCartInfo::where('bhoid', $params['bhoid'])->where('cart_num', 0)->count('id');
if ($count > 0) {
throw new BusinessException('订单中有数量为0的商品请先处理');