feat(in-transit-transfer): 调拨类型配置化与库存异动档原子切换
调拨类型从四处硬编码升级为管理页可配置:范围规则(受控字段白名单,规则间且/值间或)、 仓库定义(映射档/固定仓双模式角色解析)、字段转换(批号前缀替换,匹配时快照固化到 scope_json)。 新建 transfer_movement_ledger 库存异动档(参照 ERP inaj_t):自然键幂等增量落档 (插入/换证更新/跳过/缺席不删/执行封存永不触碰),圈档互斥保证一条档记录一生只绑一次明细; 收料证据落地改写档、停写 items。transfer_invoice_items 出生翻转为匹配时从档圈定创建 (一次匹配永久写入 matching_id+ledger_record_id),回查对账/取消释放/执行门禁/待匹配桶全链路适配。 迁移 tt10→tt13 单 head:类型配置表、异动档、items 档外键、transfer_runs.transfer_type 放宽 String(64)。 随行披露:设计文档与实施计划、ADR 0001/0002、in-transit-transfer 术语表、 demand/funclist/technical 文档更新同批入库。
This commit is contained in:
1 parent
28d6085d07
commit
52c71ee46a
78 files changed
+7423
-1702
No files matched your search
@@ -5,6 +5,13 @@
|
||||
逻辑:领取后按 payload.matching_id 加载匹配,运行 run_matching 并回写
|
||||
状态/计数/Hash;匹配不存在时 fail-closed 抛 RuntimeError。业务收尾后
|
||||
handler 自行 finish_job(runner 仅兜底异常路径,正常完成不代收口)。
|
||||
【2026-10-14 出生翻转/快照自足确认】异步重跑的全部口径从 scope_json
|
||||
快照回读——transfer_type 编码 + scope_rules/transform_rules 覆盖传入
|
||||
(不读现行配置规则,在途匹配口径不被中途改配置扰动);类型门禁按
|
||||
require_enabled=False(「停用后存量不受影响」,规格 §4.1),仅要求配置
|
||||
仍存在(类型只有停用没有删除)。run_matching 传 matching_id:重跑圈档
|
||||
仅补建「未被有效 items 占用」的新档记录(D17:自有 items 不重复圈定/
|
||||
不重复评估他匹配行),并刷新本匹配自有 items。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -36,6 +43,8 @@ def run_in_transit_transfer_match(_ctx, payload: dict) -> None:
|
||||
owned_attempt = int(job_row.attempts) if job_row is not None else None
|
||||
|
||||
deps = transfer_deps.get_transfer_dependencies()
|
||||
# [快照自足] 类型/范围/转换规则全部回读 scope_json(无枚举依赖、不查现行
|
||||
# 配置规则);warehouse 路由的 fixed 定义随类型配置现行值(未入快照契约)。
|
||||
scope = matching.scope_json if isinstance(matching.scope_json, dict) else {}
|
||||
source_codes = list(scope.get("source_codes") or [])
|
||||
result = run_matching(
|
||||
@@ -43,8 +52,13 @@ def run_in_transit_transfer_match(_ctx, payload: dict) -> None:
|
||||
business_date=matching.business_date,
|
||||
deps=deps,
|
||||
run_no=matching.run.run_no if matching.run else "RUN-PENDING",
|
||||
# 类型范围随匹配落库回读:异步重跑与创建时口径一致(缺省回落类型1)。
|
||||
transfer_type=str(scope.get("transfer_type")) if scope.get("transfer_type") else None,
|
||||
matching_id=matching.id,
|
||||
scope_rules_override=scope.get("scope_rules") if isinstance(scope.get("scope_rules"), list) else None,
|
||||
transform_rules_override=(
|
||||
scope.get("transform_rules") if isinstance(scope.get("transform_rules"), list) else None
|
||||
),
|
||||
require_enabled=False, # 存量重跑:停用类型不受影响(仅要求配置仍存在)
|
||||
)
|
||||
summary = result.summary
|
||||
matching.status = summary.status
|
||||
|
||||
Reference in new issue
Block a user