Merge pull request 'fix(admin): 修复创建出库单时商品价格和数量的校验' (#333) from dev into main

Reviewed-on: https://gitea.lihaink.cn/mkm/multi-store/pulls/333
This commit is contained in:
mkm 2024-11-14 18:12:18 +08:00
commit c6d151a9dc

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的商品请先处理');