From 478b90fe5006d97e85ef5fd3586eea7f42c8798e Mon Sep 17 00:00:00 2001 From: yueli Date: Mon, 7 Sep 2026 14:01:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=87=BA=E5=BA=93=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E8=B4=AF=E7=A9=BF=E7=94=B3=E8=AF=B7=E2=86=92=E6=89=AB=E7=A0=81?= =?UTF-8?q?=E5=87=BA=E5=BA=93=E2=80=94=E2=80=94=E7=94=B3=E8=AF=B7=E5=8D=95?= =?UTF-8?q?=E5=8A=A0=20outbound=5Ftype=EF=BC=8C=E7=94=B3=E8=AF=B7=E6=97=B6?= =?UTF-8?q?=E9=80=89=E7=B1=BB=E5=9E=8B=E3=80=81=E6=89=AB=E7=A0=81=E5=87=BA?= =?UTF-8?q?=E5=BA=93=E8=87=AA=E5=8A=A8=E5=B8=A6=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inventory-backend/app/api/v1/outbound.py | 3 ++- inventory-backend/app/models/outbound.py | 3 +++ inventory-backend/app/services/outbound_service.py | 3 ++- inventory-web/src/views/outbound/Selection.vue | 11 +++++++++++ inventory-web/src/views/outbound/create.vue | 4 ++++ 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/inventory-backend/app/api/v1/outbound.py b/inventory-backend/app/api/v1/outbound.py index 6f9ccb0..ee8690e 100644 --- a/inventory-backend/app/api/v1/outbound.py +++ b/inventory-backend/app/api/v1/outbound.py @@ -412,7 +412,8 @@ def create_outbound_request(): items=items, allowed_approvers=allowed_approvers, remark=data.get('remark'), - approver_id=approver_id + approver_id=approver_id, + outbound_type=data.get('outbound_type') # 出库类型(申请时确定) ) return jsonify({ diff --git a/inventory-backend/app/models/outbound.py b/inventory-backend/app/models/outbound.py index 0b1dfc3..94b9d2d 100644 --- a/inventory-backend/app/models/outbound.py +++ b/inventory-backend/app/models/outbound.py @@ -18,6 +18,8 @@ class OutboundApproval(db.Model): applicant_id = db.Column(db.Integer, nullable=False, index=True) # 申请说明 remark = db.Column(db.Text) + # 出库类型:SALES/USE/PRODUCTION/LOSS/REPAIR(申请时确定,扫码出库自动带出) + outbound_type = db.Column(db.String(50)) # 状态: 0-待审批, 1-已通过, 2-已驳回, 3-已完成(已出库) status = db.Column(db.Integer, default=0, nullable=False) # 允许审批的人员列表 (JSON格式: [{"type": "role", "value": "admin"}, {"type": "user", "value": "123"}]) @@ -81,6 +83,7 @@ class OutboundApproval(db.Model): 'applicant_id': self.applicant_id, 'applicant_name': self._get_user_name(self.applicant_id), 'remark': self.remark, + 'outbound_type': self.outbound_type or '', 'status': self.status, 'status_text': ['待审批', '已通过', '已驳回', '已完成', '已完结'][self.status] if self.status in [0, 1, 2, 3, 4] else '未知', 'allowed_approvers': self.get_allowed_approvers(), diff --git a/inventory-backend/app/services/outbound_service.py b/inventory-backend/app/services/outbound_service.py index 3d35b92..3aa3520 100644 --- a/inventory-backend/app/services/outbound_service.py +++ b/inventory-backend/app/services/outbound_service.py @@ -701,7 +701,7 @@ class OutboundApprovalService: return f"APR-OUT-{date_str}-{time_str}-{sequence:04d}" @staticmethod - def create_request(applicant_id, items, allowed_approvers, remark=None, approver_id=None): + def create_request(applicant_id, items, allowed_approvers, remark=None, approver_id=None, outbound_type=None): """ 创建出库审批单(申请阶段,直接存储前端传来的物料信息快照,不关联具体库存记录) @@ -759,6 +759,7 @@ class OutboundApprovalService: request_no=request_no, applicant_id=applicant_id, remark=remark, + outbound_type=outbound_type, # 申请时确定的出库类型,扫码出库时带出 status=0, # 待审批 ) diff --git a/inventory-web/src/views/outbound/Selection.vue b/inventory-web/src/views/outbound/Selection.vue index 8e20b68..3886539 100644 --- a/inventory-web/src/views/outbound/Selection.vue +++ b/inventory-web/src/views/outbound/Selection.vue @@ -395,6 +395,15 @@ + + + + + + + + + (null) const approvers = ref([]) const requestSubmitting = ref(false) @@ -1088,6 +1098,7 @@ const confirmSubmitRequest = async () => { quantity: item.export_quantity || 0 })), remark: buildRemarkWithShortage(trimmed), + outbound_type: requestOutboundType.value, approver_id: requestApproverId.value } diff --git a/inventory-web/src/views/outbound/create.vue b/inventory-web/src/views/outbound/create.vue index 66bd33f..b863c35 100644 --- a/inventory-web/src/views/outbound/create.vue +++ b/inventory-web/src/views/outbound/create.vue @@ -462,6 +462,10 @@ const handleRequestChange = (val: number | null) => { if (selectedRequest.value?.remark) { form.remark = selectedRequest.value.remark } + // ★ 自动带出申请时确定的出库类型(库管无需再选);旧单无类型则留待手动选择 + if (selectedRequest.value?.outbound_type) { + form.outbound_type = selectedRequest.value.outbound_type + } } // 切换申请单时清空购物车,防止已扫物品与新单据混淆 cartItems.value = []