From d993e6796e7d6493408a36aab1f151c2b07adbb5 Mon Sep 17 00:00:00 2001 From: dxc Date: Mon, 2 Mar 2026 12:09:24 +0800 Subject: [PATCH] refactor: remove total_price from product inbound service --- inventory-backend/app/services/inbound/product_service.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/inventory-backend/app/services/inbound/product_service.py b/inventory-backend/app/services/inbound/product_service.py index d145938..bdaf8f9 100644 --- a/inventory-backend/app/services/inbound/product_service.py +++ b/inventory-backend/app/services/inbound/product_service.py @@ -171,7 +171,6 @@ class ProductInboundService: production_time_range=time_range, raw_material_cost=raw_cost, manual_cost=unit_total_cost, - total_price=total_price, quality_status=data.get('quality_status', '合格'), product_photo=json.dumps(photo_list), quality_report_link=json.dumps(quality_list), @@ -222,7 +221,7 @@ class ProductInboundService: if 'sale_price' in data: stock.sale_price = float(data['sale_price']) if 'raw_material_cost' in data: stock.raw_material_cost = float(data['raw_material_cost']) - if 'unit_total_cost' in data: stock.manual_cost = float(data['unit_total_cost']) + if 'unit_total_cost' in data: stock.manual_cost = float(data['unit_total_cost']) # 映射到 manual_cost 物理字段 if 'in_quantity' in data: new_qty = float(data['in_quantity']) @@ -231,10 +230,6 @@ class ProductInboundService: stock.stock_quantity = float(stock.stock_quantity) + diff stock.available_quantity = float(stock.available_quantity) + diff - if 'unit_total_cost' in data or 'in_quantity' in data: - qty = float(data.get('in_quantity', stock.in_quantity or 1)) - stock.total_price = float(stock.manual_cost or 0) * qty - if 'production_start_time' in data or 'production_end_time' in data: old_range = stock.production_time_range or " ~ " parts = old_range.split(' ~ ')