修改预订单商品入库

This commit is contained in:
lewis 2025-01-23 11:12:13 +08:00
parent 75e153031b
commit 0588f765d9
2 changed files with 5 additions and 5 deletions

View File

@ -351,7 +351,7 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
throw new BusinessException('请选择入库仓库');
}
$purchaseProductOffer = PurchaseProductOffer::where('id', $params['id'])->find();
if (empty($purchaseProductOffer) || $params['buyer_nums'] == 0) {
if (empty($purchaseProductOffer) || $params['warehouse_num'] == 0) {
throw new BusinessException('请先设置采购信息再入库');
}
if ($purchaseProductOffer['is_storage'] == 1) {
@ -389,7 +389,7 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
$warehouseOrder->total_price = bcadd($warehouseOrder->total_price, $purchaseProductOffer['total_price'], 2);
$warehouseOrder->save();
}
$purchaseProductOffer['price'] = bcdiv($purchaseProductOffer['total_price'], $params['buyer_nums'], 2);
$purchaseProductOffer['price'] = bcdiv($purchaseProductOffer['total_price'], $params['warehouse_num'], 2);
$data['admin_id'] = $params['admin_id'];
$data['order_type'] = $beforehandOrder['order_type'];
$data['store_id'] = 0;
@ -399,7 +399,7 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
$data['warehouse_id'] = $params['warehouse_id'];
$data['code'] = $warehouseOrder['code'];
$data['product_id'] = $purchaseProductOffer['product_id'];
$data['nums'] = $params['buyer_nums'];
$data['nums'] = $params['warehouse_num'];
$data['purchase'] = $purchaseProductOffer['price'];
$data['total_price'] = $purchaseProductOffer['total_price'];
$data['financial_pm'] = 1;
@ -408,7 +408,7 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
if ($data['nums'] > 0) {
WarehouseProductLogic::add($data, 1, $params['admin_id']);
}
$offerUpdate = ['price' => $purchaseProductOffer['price'], 'status' => 1, 'is_storage' => 1, 'buyer_nums' => $params['buyer_nums']];
$offerUpdate = ['price' => $purchaseProductOffer['price'], 'status' => 1, 'is_storage' => 1, 'warehouse_num' => $params['warehouse_num']];
$offerResult = PurchaseProductOffer::where('id', $purchaseProductOffer['id'])->where('is_storage', 0)->update($offerUpdate);
if (!$offerResult) {
throw new BusinessException('入库失败,采购信息更新出错');

View File

@ -222,7 +222,7 @@ class PurchaseProductOfferLogic extends BaseLogic
Db::startTrans();
try {
$offer->save([
// 'buyer_nums' => $params['buyer_nums'],
'buyer_nums' => $params['buyer_nums'],
'supplier_id' => $params['supplier_id'],
// 'price' => $params['purchase'],
// 'purchase_price' => $params['purchase_price'] ?? 0,