feat(in-transit-transfer): inbound/outbound 幂等重命名与解析用途分层
- receipt→inbound 三件套改名(回调桥/文件门禁/触发服务),回调链幂等去重,迁移 tt14 同步台账键与测试基建 - 库存解析用途分层 onhand/inbound/outbound(迁移 tt15):解析档案、文件存储与下载名按用途隔离,管理端表单同步 - 「成熟」概念退役(迁移 tt16):数据无成熟属性,日期边界由调用方入参严格判定 - backlog 新增重解析服务,在途重识别投影 processing,EML 父项不再停留处理中 - 收料 RPA 回调/归档/排程链路同步改名挂点,运维脚本复位假完成状态 - 文档随批:ADR 0003 模块边界决策、10-15/10-16 计划与设计、调拨文档族与 demand/tec/funclist - 同步 chat/errors 文案四语言、调拨前端卡片与 e2e、测试全家
This commit is contained in:
1 parent
43dceaf027
commit
8102a1fe44
151 files changed
+8057
-2382
No files matched your search
@@ -1,6 +1,6 @@
|
||||
"""在途调拨严格数量门禁。
|
||||
|
||||
用途:实现"收料数量 == 外部系统 账面库存 才可执行"的精确匹配规则,
|
||||
用途:实现"异动数量 == 外部系统 账面库存 才可执行"的精确匹配规则,
|
||||
禁止部分调拨、数量容差与隐式截断。
|
||||
依赖:标准库 decimal。
|
||||
逻辑:所有比较基于 Decimal 精确语义;非法数量(0/负数/非数字)在解析层拒绝。
|
||||
@@ -18,11 +18,11 @@ MATCH_INVENTORY_NOT_FOUND = "blocked_inventory_not_found"
|
||||
|
||||
|
||||
class QuantityValidationError(ValueError):
|
||||
"""收料数量非法(0、负数、非数字)。"""
|
||||
"""入站数量非法(0、负数、非数字)。"""
|
||||
|
||||
|
||||
def validate_receipt_quantity(value: Any) -> Decimal:
|
||||
"""校验并归一化收料数量。
|
||||
def validate_inbound_quantity(value: Any) -> Decimal:
|
||||
"""校验并归一化入站数量。
|
||||
|
||||
Args:
|
||||
value: 数字或数字字符串。
|
||||
@@ -34,9 +34,9 @@ def validate_receipt_quantity(value: Any) -> Decimal:
|
||||
try:
|
||||
quantity = Decimal(str(value))
|
||||
except (InvalidOperation, ValueError) as exc:
|
||||
raise QuantityValidationError(f"invalid receipt quantity: {value!r}") from exc
|
||||
raise QuantityValidationError(f"invalid inbound quantity: {value!r}") from exc
|
||||
if quantity <= 0:
|
||||
raise QuantityValidationError(f"receipt quantity must be positive: {value!r}")
|
||||
raise QuantityValidationError(f"inbound quantity must be positive: {value!r}")
|
||||
return quantity
|
||||
|
||||
|
||||
@@ -45,17 +45,17 @@ def strict_quantities_equal(left: Any, right: Any) -> bool:
|
||||
return Decimal(str(left)) == Decimal(str(right))
|
||||
|
||||
|
||||
def classify_quantity_match(receipt_quantity: Any, external_quantity: Any | None) -> str:
|
||||
def classify_quantity_match(inbound_quantity: Any, external_quantity: Any | None) -> str:
|
||||
"""按严格相等规则分类数量匹配结果。
|
||||
|
||||
Args:
|
||||
receipt_quantity: 收料数量。
|
||||
inbound_quantity: 入站异动数量。
|
||||
external_quantity: 外部系统 账面库存;None 表示无库存。
|
||||
Returns:
|
||||
'executable' | 'blocked_quantity_mismatch' | 'blocked_inventory_not_found'。
|
||||
"""
|
||||
if external_quantity is None:
|
||||
return MATCH_INVENTORY_NOT_FOUND
|
||||
if strict_quantities_equal(receipt_quantity, external_quantity):
|
||||
if strict_quantities_equal(inbound_quantity, external_quantity):
|
||||
return MATCH_EXECUTABLE
|
||||
return MATCH_QUANTITY_MISMATCH
|
||||
Reference in new issue
Block a user