Merge pull request 'dev' (#278) from dev into main

Reviewed-on: #278
This commit is contained in:
mkm 2024-10-16 10:25:23 +08:00
commit 32cd07e889
2 changed files with 12 additions and 3 deletions

View File

@ -127,10 +127,13 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
if($params['bhoid']<=0){
throw new BusinessException('参数错误');
}
$count = PurchaseProductOffer::where(['order_id' => $params['bhoid'], 'is_storage' => 0, 'buyer_nums' => 0])->count('id');
$count = PurchaseProductOffer::where(['order_id' => $params['bhoid'], 'buyer_confirm' => 0])->count('id');
$beforehandOrder = BeforehandOrder::where('id', $params['bhoid'])->field('order_type,warehousing_id')->find();
if ($count > 0 || $beforehandOrder['warehousing_id'] > 0) {
if ($count > 0) {
throw new BusinessException('还有商品正在采购中,请先设置采购信息在入库');
}
if ($beforehandOrder['warehousing_id'] > 0) {
throw new BusinessException('请勿重复入库');
}
$offer_list = PurchaseProductOffer::where(['order_id' => $params['bhoid'], 'is_storage' => 0])->select();

View File

@ -130,7 +130,13 @@ class WarehouseProductLogic extends BaseLogic
$total_price = bcmul($after_nums, $params['purchase'], 2);
WarehouseProductStorege::update(['nums' => bcsub($storege['nums'], $params['nums']), 'total_price' => $total_price], ['id' => $storege['id']]);
} else {
throw new BusinessException('仓库商品不存在' . '|' . $params['product_id']);
$data = [
'warehouse_id' => $params['warehouse_id'],
'product_id' => $params['product_id'],
'nums' => -$params['nums'],
'total_price' => 0
];
$storege = WarehouseProductStorege::create($data);
}
} else {
$storege['nums'] = 0;