feat(shipping-notice): 收敛复核阶段同源投影与 OT 后履约推进

统一 Case/Progress 阶段 label_key、修复 Job 成功未推进 OT 的可重试失败投影与写路径,并落地 OT 后行级匹配/波次履约与版面诊断开关。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
hugoandCursor committed 2026-08-07 13:11:14 +08:00
1 parent 74270adc22
commit fd6a23f870
100 files changed
+12138 -1017

No files matched your search

@@ -649,6 +649,7 @@ def apply_task_transition(task: ShippingNotice, transition: TaskTransition) -> N
将命名状态迁移写入 ShippingNotice 的 process_status / review_status / pending_human_reason。
核心逻辑:查 TASK_TRANSITIONS 表驱动字段更新;所有 Tool 写库须经本函数,禁止散落赋值。
库存相关迁移后同步挂接 OT 的 stage(waiting_inventory → inventory_fetching 等)。
Args:
task: 待更新的 ShippingNotice 实例(尚未 commit)。
@@ -663,3 +664,12 @@ def apply_task_transition(task: ShippingNotice, transition: TaskTransition) -> N
task.pending_human_reason = spec.pending_human_reason
if spec.clear_error_message:
task.error_message = None
# [STEP] 履约态变更后回写 OT stage,避免进度条卡在 order_creating。
try:
from app.services.shipping_notice.order_task_stage_machine import (
sync_order_task_stage_for_notice,
)
sync_order_task_stage_for_notice(task)
except Exception: # noqa: BLE001 — 无 OT / 无 Flask 上下文时跳过,不阻断主迁移
pass