From 1527d552d4ab7c72ff77f6658e55736aaa31ffc2 Mon Sep 17 00:00:00 2001 From: yueli Date: Fri, 4 Sep 2026 11:42:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=87=BA=E5=BA=93/=E5=80=9F=E5=BA=93?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E8=AE=B0=E5=BD=95=E5=B9=B6=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E5=BA=93=E4=BD=8D=E5=BF=AB=E7=85=A7=EF=BC=88DB=E5=8A=A0?= =?UTF-8?q?=E5=88=97+=E5=90=8E=E7=AB=AF=E5=86=99=E5=85=A5+=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E9=A1=B5=E5=B1=95=E7=A4=BA=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inventory-backend/app/models/outbound.py | 4 ++++ inventory-backend/app/models/transaction.py | 3 +++ inventory-backend/app/services/outbound_service.py | 6 +++++- inventory-backend/app/services/trans_service.py | 2 ++ inventory-web/src/views/outbound/index.vue | 6 ++++++ inventory-web/src/views/transaction/records.vue | 6 ++++++ 6 files changed, 26 insertions(+), 1 deletion(-) diff --git a/inventory-backend/app/models/outbound.py b/inventory-backend/app/models/outbound.py index 68db370..0b1dfc3 100644 --- a/inventory-backend/app/models/outbound.py +++ b/inventory-backend/app/models/outbound.py @@ -133,6 +133,9 @@ class TransOutbound(db.Model): outbound_time = db.Column(db.DateTime, default=beijing_time) operator_name = db.Column(db.String(100)) # 操作员 + # [新增] 出库时的库位快照(从源库存记录带出,便于历史追溯) + warehouse_location = db.Column(db.String(100)) + remark = db.Column(db.Text) def to_dict(self): @@ -148,5 +151,6 @@ class TransOutbound(db.Model): 'signature_path': self.signature_path, 'outbound_time': self.outbound_time.strftime('%Y-%m-%d %H:%M:%S') if self.outbound_time else None, 'operator_name': self.operator_name, + 'warehouse_location': self.warehouse_location or '', 'remark': self.remark } \ No newline at end of file diff --git a/inventory-backend/app/models/transaction.py b/inventory-backend/app/models/transaction.py index a8403eb..bc4e79f 100644 --- a/inventory-backend/app/models/transaction.py +++ b/inventory-backend/app/models/transaction.py @@ -23,6 +23,8 @@ class TransBorrow(db.Model): return_operator = db.Column(db.String(100)) return_signature = db.Column(db.Text) return_location = db.Column(db.String(100)) + # [新增] 借出时的库位快照(从源库存记录带出,便于历史追溯) + location = db.Column(db.String(100)) status = db.Column(db.String(20), default='borrowed') remark = db.Column(db.Text) @@ -49,6 +51,7 @@ class TransBorrow(db.Model): 'return_operator': self.return_operator, 'return_signature': self.return_signature, 'return_location': self.return_location, + 'location': self.location or '', 'status': self.status, 'remark': self.remark, } diff --git a/inventory-backend/app/services/outbound_service.py b/inventory-backend/app/services/outbound_service.py index 56a06b6..3d35b92 100644 --- a/inventory-backend/app/services/outbound_service.py +++ b/inventory-backend/app/services/outbound_service.py @@ -278,6 +278,8 @@ class OutboundService: quantity=quantity, unit_price=unit_price, outbound_time=current_time, + # [新增] 记录出库时的库位快照 + warehouse_location=getattr(stock_record, 'warehouse_location', None), **common_data ) db.session.add(new_record) @@ -647,7 +649,9 @@ class OutboundService: 'quantity': qty, 'unit_price': price, 'subtotal': subtotal, - 'batch_sn': batch_sn + 'batch_sn': batch_sn, + # [新增] 出库时的库位快照(展示用) + 'warehouse_location': getattr(d, 'warehouse_location', None) or '' }) # 4. 排序输出 diff --git a/inventory-backend/app/services/trans_service.py b/inventory-backend/app/services/trans_service.py index 94725f4..e4c3b32 100644 --- a/inventory-backend/app/services/trans_service.py +++ b/inventory-backend/app/services/trans_service.py @@ -152,6 +152,8 @@ class TransService: borrow_signature=signature, remark=remark, expected_return_time=expected_return_time, + # [新增] 记录借出时的库位快照 + location=getattr(stock, 'warehouse_location', None), status='borrowed', is_returned=False ) diff --git a/inventory-web/src/views/outbound/index.vue b/inventory-web/src/views/outbound/index.vue index 14ee3e6..d1f3993 100644 --- a/inventory-web/src/views/outbound/index.vue +++ b/inventory-web/src/views/outbound/index.vue @@ -56,6 +56,12 @@ + + + diff --git a/inventory-web/src/views/transaction/records.vue b/inventory-web/src/views/transaction/records.vue index ad11712..4b15a3c 100644 --- a/inventory-web/src/views/transaction/records.vue +++ b/inventory-web/src/views/transaction/records.vue @@ -60,6 +60,12 @@ 0 + + +