fix(admin): 修复预订单采购数量为 0 入库问题
- 在预订单入库前增加采购数量检查 - 如果采购数量小于或等于 0,抛出异常阻止入库 - 提升系统稳定性和数据准确性
This commit is contained in:
parent
9fd586722a
commit
fc7bd7dc0f
@ -159,6 +159,11 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
|
||||
throw new BusinessException('请勿重复入库');
|
||||
}
|
||||
$offer_list = PurchaseProductOffer::where(['order_id' => $params['bhoid'], 'is_storage' => 0])->select();
|
||||
foreach ($offer_list as $k => $v) {
|
||||
if($v['buyer_nums']<=0){
|
||||
throw new BusinessException('采购数量不能为0');
|
||||
}
|
||||
}
|
||||
$total_price= PurchaseProductOffer::where(['order_id' => $params['bhoid']])->sum('total_price');
|
||||
$completed_amount= PurchaseProductOffer::where(['order_id' => $params['bhoid'],'pay_type'=>1])->sum('total_price');
|
||||
$outstanding_amount= PurchaseProductOffer::where(['order_id' => $params['bhoid'],'pay_type'=>2])->sum('total_price');
|
||||
|
Loading…
x
Reference in New Issue
Block a user