refactor(shipping-notice): 重构货代发货通知状态管理,移除废弃的process_status字段
统一货代发货通知的业务阶段为四个标准阶段:接收解析、订单复核、发货准备、上传完成 设置 ui_state 为前端唯一状态数据源,不再依赖 process_status 驱动业务流程 删除 shipping_notices 表的废弃 process_status 列及对应复合索引,新增数据库迁移脚本 替换全栈代码中所有对 process_status 的引用为生命周期、上传状态等领域字段 更新相关文档、测试用例与前端展示逻辑适配新的状态管理规则
This commit is contained in:
1 parent
6684e7181a
commit
5ef8329bd8
178 files changed
+5091
-1734
No files matched your search
@@ -81,7 +81,7 @@ class ReconcileProgressResult:
|
||||
outcome: Literal[
|
||||
'reused_existing', # L1 命中,已绑定到既有 Task
|
||||
'duplicate_decision_required', # L2/L3 命中,等待人工裁决
|
||||
'ownership_anomaly_rejected', # 归属异常(Q13),process_status=rejected
|
||||
'ownership_anomaly_rejected', # 归属异常(Q13),进入人工隔离
|
||||
'stp_enqueued', # 无冲突或用户裁决后,已入队 STP
|
||||
'resume_result', # 仅 resume 结果(未到入队)
|
||||
'idempotent_replay', # 同 operation_id 幂等回返
|
||||
@@ -453,7 +453,7 @@ def reconcile_and_progress(
|
||||
• replay_mode(bool):允许 legacy_job_id.reference_key != case_no。
|
||||
默认 false(防跨 Case 错挂)。
|
||||
• BRANCH F 硬隔离:先 db.session.rollback() 回滚 BRANCH B/C 半写 → 写 sensitive 审计
|
||||
→ ReviewCase 无 process_status 列则抛 422 SHIPPING.RECONCILE_OWNERSHIP_ANOMALY,
|
||||
→ 归属异常统一抛 422 SHIPPING.RECONCILE_OWNERSHIP_ANOMALY,
|
||||
否则返回 outcome=ownership_anomaly_rejected。
|
||||
|
||||
Args:
|
||||
@@ -732,7 +732,7 @@ def reconcile_and_progress(
|
||||
pending_reason = 'ownership_anomaly'
|
||||
# [Phase 4 Q13 硬隔离] — 先回滚 BRANCH B/C 半写(_write_back_case_task_binding)
|
||||
# 避免把 Case 的 candidate_id / confirmed_task_id / fulfilled_task_id 留痕;
|
||||
# 再单独写 sensitive 审计;再根据 ReviewCase 是否有 process_status 列返回
|
||||
# 再单独写 sensitive 审计;ReviewCase 不承担履约阶段字段
|
||||
# outcome=ownership_anomaly_rejected 或抛 422 SHIPPING.RECONCILE_OWNERSHIP_ANOMALY。
|
||||
try:
|
||||
db.session.rollback()
|
||||
@@ -777,34 +777,13 @@ def reconcile_and_progress(
|
||||
pass
|
||||
msg = (f'ambiguous ownership: match_level={match_result.get("match_level")} '
|
||||
f'user_action={user_action}; marked ownership_anomaly pending human review')
|
||||
case_attr_writable = hasattr(case_after, 'process_status')
|
||||
if not case_attr_writable:
|
||||
# ReviewCase 没有 process_status(process_status 属于 CaseEvent/Wave 层)
|
||||
# → 降级:抛 422 给前端显式提示 hard_isolation=True(让前端走裁决面板)
|
||||
raise ValidationError(
|
||||
msg,
|
||||
code='SHIPPING.RECONCILE_OWNERSHIP_ANOMALY',
|
||||
details={
|
||||
'hard_isolation': True,
|
||||
'match': {
|
||||
k: match_result.get(k)
|
||||
for k in ('match_level', 'confidence', 'task_no')
|
||||
},
|
||||
'user_action': user_action,
|
||||
'next_suggested_actions': [
|
||||
'reuse_existing', 'create_revision', 'force_create',
|
||||
],
|
||||
'legacy_job_id': (int(legacy_job_id) if legacy_job_id is not None else None),
|
||||
'replay_mode': bool(replay_mode),
|
||||
},
|
||||
)
|
||||
final_result = ReconcileProgressResult(
|
||||
outcome='ownership_anomaly_rejected',
|
||||
case_no=str(case_after.case_no), match=match_result,
|
||||
task_no=None, job_id=None, idempotency_key=idem_key,
|
||||
operation_id=op_id, resume_outcome=None, audit_written=False, message=msg,
|
||||
)
|
||||
# 用 case_after 替换引用,防止后续审计写已失效对象
|
||||
# 用 case_after 替换引用,防止后续审计写入已失效对象。
|
||||
case = case_after
|
||||
user = db.session.get(User, int(user_id))
|
||||
|
||||
|
||||
Reference in new issue
Block a user