diff --git a/inventory-backend/app/api/v1/inbound/buy.py b/inventory-backend/app/api/v1/inbound/buy.py
index 7b14a88..56e711c 100644
--- a/inventory-backend/app/api/v1/inbound/buy.py
+++ b/inventory-backend/app/api/v1/inbound/buy.py
@@ -119,12 +119,13 @@ def get_list():
# 新增筛选参数
category = request.args.get('category', '')
material_type = request.args.get('material_type', '')
+ company = request.args.get('company', '')
# 状态参数处理
statuses_str = request.args.get('statuses', '')
statuses = statuses_str.split(',') if statuses_str else []
- result = BuyInboundService.get_list(page, limit, keyword, statuses, category, material_type)
+ result = BuyInboundService.get_list(page, limit, keyword, statuses, category, material_type, company)
# 字段级脱敏
user_permissions = get_current_user_permissions()
if result.get('items'):
diff --git a/inventory-backend/app/models/inbound/buy.py b/inventory-backend/app/models/inbound/buy.py
index 59a9534..1de1ee6 100644
--- a/inventory-backend/app/models/inbound/buy.py
+++ b/inventory-backend/app/models/inbound/buy.py
@@ -33,7 +33,7 @@ class StockBuy(db.Model):
available_quantity = db.Column(db.Numeric(19, 4), default=0)
# 财务与商务
- unit_price = db.Column(db.Numeric(19, 4), default=0) # 现意为:不含税单价
+ pre_tax_unit_price = db.Column(db.Numeric(19, 4), default=0) # 现意为:不含税单价
post_tax_unit_price = db.Column(db.Numeric(19, 4), default=0) # 税后单价
total_price = db.Column(db.Numeric(19, 4), default=0) # 总价
# [新增] 税率
@@ -98,7 +98,7 @@ class StockBuy(db.Model):
'available_quantity': float(self.available_quantity or 0),
'qty_available': float(self.available_quantity or 0),
- 'unit_price': float(self.unit_price or 0),
+ 'unit_price': float(self.pre_tax_unit_price or 0),
'post_tax_unit_price': float(self.post_tax_unit_price or 0),
'total_price': float(self.total_price or 0),
# [新增] 税率
diff --git a/inventory-backend/app/services/inbound/buy_service.py b/inventory-backend/app/services/inbound/buy_service.py
index 219d691..5fa056d 100644
--- a/inventory-backend/app/services/inbound/buy_service.py
+++ b/inventory-backend/app/services/inbound/buy_service.py
@@ -137,7 +137,7 @@ class BuyInboundService:
warehouse_location=data.get('warehouse_location'),
# 价格信息
- unit_price=u_price,
+ pre_tax_unit_price=u_price,
post_tax_unit_price=float(data.get('post_tax_unit_price') or 0),
tax_rate=tax_rate, # [新增]
total_price=in_qty * u_price,
@@ -195,9 +195,9 @@ class BuyInboundService:
stock.stock_quantity = float(stock.stock_quantity) + diff
stock.available_quantity = float(stock.available_quantity) + diff
- if 'unit_price' in data: stock.unit_price = float(data['unit_price'])
+ if 'unit_price' in data: stock.pre_tax_unit_price = float(data['unit_price'])
- stock.total_price = float(stock.in_quantity) * float(stock.unit_price)
+ stock.total_price = float(stock.in_quantity) * float(stock.pre_tax_unit_price)
db.session.commit()
return stock
except Exception as e:
diff --git a/inventory-web/src/views/stock/inbound/buy.vue b/inventory-web/src/views/stock/inbound/buy.vue
index d0af1d9..48a0648 100644
--- a/inventory-web/src/views/stock/inbound/buy.vue
+++ b/inventory-web/src/views/stock/inbound/buy.vue
@@ -55,7 +55,7 @@