Merge pull request 'fix(purchase): 修复采购产品报价中产品不存在的问题' (#491) from dev into main

Reviewed-on: #491
This commit is contained in:
mkm 2025-01-25 10:52:35 +08:00
commit bd672b439a

View File

@ -60,7 +60,7 @@ class PurchaseProductOfferLogic extends BaseLogic
if ($mark == '') { if ($mark == '') {
$mark = BeforehandOrderCartInfo::where('bhoid', $params['order_id'])->where('product_id', $params['product_id'])->value('mark'); $mark = BeforehandOrderCartInfo::where('bhoid', $params['order_id'])->where('product_id', $params['product_id'])->value('mark');
} }
$find = StoreProduct::where('id', $params['product_id'])->find(); $find = StoreProduct::where('id', $params['product_id'])->withTrashed()->find();
$purchaseProductOffer = PurchaseProductOffer::where(['order_id' => $procurementOrder['id'], 'product_id' => $params['product_id']])->find(); $purchaseProductOffer = PurchaseProductOffer::where(['order_id' => $procurementOrder['id'], 'product_id' => $params['product_id']])->find();
if ($purchaseProductOffer) { if ($purchaseProductOffer) {
$purchaseProductOffer->need_num = $purchaseProductOffer['need_num'] + $params['need_num']; $purchaseProductOffer->need_num = $purchaseProductOffer['need_num'] + $params['need_num'];
@ -104,6 +104,7 @@ class PurchaseProductOfferLogic extends BaseLogic
return true; return true;
} catch (\Exception $e) { } catch (\Exception $e) {
Db::rollback(); Db::rollback();
d($e);
throw new BusinessException($e->getMessage()); throw new BusinessException($e->getMessage());
} }
} }