From d94b52bf7355de1db9f969f32c5c4f162c0473f3 Mon Sep 17 00:00:00 2001 From: DXC Date: Thu, 4 Jun 2026 17:19:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E5=BA=93=E6=A8=A1=E5=9D=97=EF=BC=9A?= =?UTF-8?q?=E7=89=A9=E6=96=99=E7=B1=BB=E5=88=AB=E9=9A=94=E7=A6=BB=E7=A1=AC?= =?UTF-8?q?=E6=80=A7=E6=A0=A1=E9=AA=8C=EF=BC=88=E5=86=99=E6=8B=A6=E6=88=AA?= =?UTF-8?q?=EF=BC=8C=E8=AF=BB=E6=94=BE=E5=AE=BD=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inventory-backend/app/services/inbound/buy_service.py | 6 ++++++ inventory-backend/app/services/inbound/product_service.py | 6 ++++++ inventory-backend/app/services/inbound/semi_service.py | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/inventory-backend/app/services/inbound/buy_service.py b/inventory-backend/app/services/inbound/buy_service.py index b4b3654..11fbe5e 100644 --- a/inventory-backend/app/services/inbound/buy_service.py +++ b/inventory-backend/app/services/inbound/buy_service.py @@ -100,6 +100,12 @@ class BuyInboundService: if not material: raise ValueError("所选物料不存在") if not material.is_enabled: raise ValueError(f"物料【{material.name}】已停用") + # ============================================================ + # 物料类别隔离校验:采购入库禁止"半成品"/"成品" + # ============================================================ + if material.category and ("半成品" in material.category or "成品" in material.category): + raise ValueError(f"物料【{material.name}】类别为【{material.category}】,禁止作为采购件入库!") + # ============================================================ # 强制质检校验:如果物料标记为强制质检,则必须提供到检状态和检测报告 # ============================================================ diff --git a/inventory-backend/app/services/inbound/product_service.py b/inventory-backend/app/services/inbound/product_service.py index ac47faf..a073448 100644 --- a/inventory-backend/app/services/inbound/product_service.py +++ b/inventory-backend/app/services/inbound/product_service.py @@ -115,6 +115,12 @@ class ProductInboundService: if not material.is_enabled: raise ValueError(f"物料【{material.name}】已停用,无法办理新入库。") + # ============================================================ + # 物料类别隔离校验:成品入库必须为"成品"类目 + # ============================================================ + if not material.category or "成品" not in material.category: + raise ValueError(f"物料【{material.name}】类别为【{material.category or '空'}】,非成品,无法办理成品入库!") + ProductInboundService._check_unique( serial_number=data.get('serial_number') ) diff --git a/inventory-backend/app/services/inbound/semi_service.py b/inventory-backend/app/services/inbound/semi_service.py index 1a6dc6b..c4e1b79 100644 --- a/inventory-backend/app/services/inbound/semi_service.py +++ b/inventory-backend/app/services/inbound/semi_service.py @@ -122,6 +122,12 @@ class SemiInboundService: if not material.is_enabled: raise ValueError(f"物料【{material.name}】已停用,无法办理新入库。") + # ============================================================ + # 物料类别隔离校验:半成品入库必须为"半成品"类目 + # ============================================================ + if not material.category or "半成品" not in material.category: + raise ValueError(f"物料【{material.name}】类别为【{material.category or '空'}】,非半成品,无法办理半成品入库!") + SemiInboundService._check_unique( base_id=base_id, serial_number=data.get('serial_number'),