feat(shipping-notice): 升级货代发货流程为五阶段,完善业务校验

将货代发货流程从四阶段扩展为五阶段,拆分上传相关逻辑至独立的货代上传阶段;
统一多语言文案修正客户状态语义,将"客户尚未识别"调整为符合业务的"客户尚未确认";
新增严格的上传成功验证谓词,需同时满足任务状态、全部预约单上传成功、存在有效成功上传尝试三个条件方可标记为完成;
新增坐标取值模型配置,支持Legacy冻结绝对坐标和锚点框架受限平移两种模式;
更新全链路相关文档、前端组件、后端服务与测试用例,确保业务逻辑对齐新业务规则。
This commit is contained in:
hugo committed 2026-08-21 09:20:47 +08:00
1 parent 1b6483a4ea
commit 935bf26fa6
86 files changed
+2743 -311

No files matched your search

+14 -13
View File
@@ -77,18 +77,18 @@ def test_unified_actions_preserve_backend_surface_without_action_code_fallback()
"primary_action": {
"code": "mark_manual_uploaded",
"label": "登记人工上传",
"target_surface": "upload_complete",
"target_surface": "freight_upload",
},
"action_presentation": [{
"code": "download_excel",
"label": "下载发货 Excel",
"target_surface": "upload_complete",
"target_surface": "freight_upload",
"target_anchor": "excel_artifact",
}],
},
)
assert state["primary"]["target_surface"] == "upload_complete"
assert state["secondary"][0]["target_surface"] == "upload_complete"
assert state["primary"]["target_surface"] == "freight_upload"
assert state["secondary"][0]["target_surface"] == "freight_upload"
assert state["secondary"][0]["target_anchor"] == "excel_artifact"
@@ -121,7 +121,7 @@ def test_task_ui_state_stage_context_is_opt_in(app) -> None:
assert "stage_context" in detailed_state
def test_build_task_ui_state_exposes_four_business_stages_and_unified_actions(app) -> None:
def test_build_task_ui_state_exposes_five_business_stages_and_unified_actions(app) -> None:
"""没有 Gate 的旧 checkpoint 仅表达状态,不能再直接产生可写 UI 动作。"""
with app.app_context():
task = ShippingNotice(
@@ -133,13 +133,13 @@ def test_build_task_ui_state_exposes_four_business_stages_and_unified_actions(ap
state = build_task_ui_state(task)
assert state["stage"]["code"] == "order_review"
assert state["stage"]["index"] == 2
assert state["stage"]["total"] == 4
assert state["stage"]["total"] == 5
assert state["actions"]["primary"] is None
assert state["actions"]["secondary"] == []
def test_build_task_ui_state_exposes_backend_owned_lifecycle_entries(app) -> None:
"""正式工作台的四个入口必须由后端下发,页面不能按阶段顺序自行生成。"""
"""正式工作台的五个入口必须由后端下发,页面不能按阶段顺序自行生成。"""
with app.app_context():
task = ShippingNotice(
task_no="SN-UI-LIFECYCLE-ENTRIES",
@@ -153,6 +153,7 @@ def test_build_task_ui_state_exposes_backend_owned_lifecycle_entries(app) -> Non
{"code": "intake_parse", "state": "available", "target_surface": "order_lifecycle_workbench"},
{"code": "order_review", "state": "current", "target_surface": "order_lifecycle_workbench"},
{"code": "fulfillment_prep", "state": "unavailable", "target_surface": "order_lifecycle_workbench"},
{"code": "freight_upload", "state": "unavailable", "target_surface": "order_lifecycle_workbench"},
{"code": "upload_complete", "state": "unavailable", "target_surface": "order_lifecycle_workbench"},
]
@@ -213,7 +214,7 @@ def test_task_ui_state_formal_gate_overrides_stale_task_fields(app) -> None:
def test_task_ui_state_manual_upload_gate_overrides_stale_task_fields(app) -> None:
"""正式人工上传 Gate 必须裁决为通知完成,不受旧复核字段影响。"""
"""正式人工上传 Gate 必须停留货代上传,不受旧复核字段影响。"""
with app.app_context():
from app.services.shipping_notice.process_gate_service import ensure_execution_for_workflow_version
@@ -235,16 +236,16 @@ def test_task_ui_state_manual_upload_gate_overrides_stale_task_fields(app) -> No
state = build_task_ui_state(task)
assert state['lifecycle_stage'] == 'upload_complete'
assert state['lifecycle_stage'] == 'freight_upload'
assert state['lifecycle_authority'] == 'process_gate'
assert state['stage']['code'] == 'upload_complete'
assert state['stage']['code'] == 'freight_upload'
assert [entry['state'] for entry in state['lifecycle_entries']] == [
'available', 'available', 'available', 'current',
'available', 'available', 'available', 'current', 'unavailable',
]
def test_build_task_ui_state_maps_domain_facts_to_fulfillment_and_upload_stages(app) -> None:
"""库存匹配/上传结果只映射四个业务阶段。"""
"""库存匹配与无证据历史上传分别映射通知准备和货代上传。"""
with app.app_context():
fulfillment = ShippingNotice(
task_no="SN-UI-FULFILLMENT",
@@ -259,7 +260,7 @@ def test_build_task_ui_state_maps_domain_facts_to_fulfillment_and_upload_stages(
)
assert build_task_ui_state(fulfillment)["stage"]["code"] == "fulfillment_prep"
upload_state = build_task_ui_state(upload, include_stage_context=True)
assert upload_state["stage"]["code"] == "upload_complete"
assert upload_state["stage"]["code"] == "freight_upload"
# 旧 Task 字段只能决定工作面;没有可追溯 UploadAttempt 时不得显示上传成功。
assert upload_state["stage_context"]["upload"]["outcome"] == "awaiting_manual"