commit
32cd07e889
@ -127,10 +127,13 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
|
|||||||
if($params['bhoid']<=0){
|
if($params['bhoid']<=0){
|
||||||
throw new BusinessException('参数错误');
|
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();
|
$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('请勿重复入库');
|
throw new BusinessException('请勿重复入库');
|
||||||
}
|
}
|
||||||
$offer_list = PurchaseProductOffer::where(['order_id' => $params['bhoid'], 'is_storage' => 0])->select();
|
$offer_list = PurchaseProductOffer::where(['order_id' => $params['bhoid'], 'is_storage' => 0])->select();
|
||||||
|
@ -130,7 +130,13 @@ class WarehouseProductLogic extends BaseLogic
|
|||||||
$total_price = bcmul($after_nums, $params['purchase'], 2);
|
$total_price = bcmul($after_nums, $params['purchase'], 2);
|
||||||
WarehouseProductStorege::update(['nums' => bcsub($storege['nums'], $params['nums']), 'total_price' => $total_price], ['id' => $storege['id']]);
|
WarehouseProductStorege::update(['nums' => bcsub($storege['nums'], $params['nums']), 'total_price' => $total_price], ['id' => $storege['id']]);
|
||||||
} else {
|
} 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 {
|
} else {
|
||||||
$storege['nums'] = 0;
|
$storege['nums'] = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user