refactor(admin): 修改仓库商品退货逻辑

- 移除了采购信息的相关代码
- 将 supplier_id 和 price 设置为 0
- 删除了 total_price 的计算逻辑
This commit is contained in:
mkm 2025-01-08 14:42:01 +08:00
parent 3284d43e14
commit 8e07237489

View File

@ -76,15 +76,15 @@ class WarehouseProductReturnLogic extends BaseLogic
throw new BusinessException('该商品库存:'.$params['nums'].'小于仓库库存'.$proudct['nums']);
}
}
$offer = PurchaseProductOffer::where('order_id', $params['bhoid'])->where('product_id', $find['product_id'])->find();
if (!$offer) {
throw new BusinessException('该商品没有采购信息');
}
// $offer = PurchaseProductOffer::where('order_id', $params['bhoid'])->where('product_id', $find['product_id'])->find();
// if (!$offer) {
// throw new BusinessException('该商品没有采购信息');
// }
$datas = [
'source_id' => $params['id'],
'bhoid' => $params['bhoid'] ?? 0,
'warehouse_id' => $find['warehouse_id'],
'supplier_id' => $offer['supplier_id'],
'supplier_id' => 0,
'store_id' => $find['store_id'],
'product_id' => $find['product_id'],
'unit' => $find['unit'],
@ -93,8 +93,10 @@ class WarehouseProductReturnLogic extends BaseLogic
'nums' => $params['nums'],
'return_type' => $params['return_type'],
'mark' => $params['mark'],
'price' => $offer['price'],
'total_price' => bcmul($params['nums'], $offer['price'], 2),
// 'price' => $offer['price'],
// 'total_price' => bcmul($params['nums'], $offer['price'], 2),
'price' => 0,
'total_price' => 0,
];
}