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
@@ -38,7 +38,6 @@ def test_auto_progress_stops_at_wait_manual_upload_and_forbids_freight_rpa(app)
|
||||
app.config["SHIPPING_NOTICE_AUTO_PROGRESS_ENABLED"] = True
|
||||
task = ShippingNotice(
|
||||
task_no="SN-STP-WAIT-UPLOAD",
|
||||
process_status="matched",
|
||||
source_type="manual",
|
||||
export_file_path="/tmp/stp-export.xlsx",
|
||||
export_file_name="stp-export.xlsx",
|
||||
@@ -62,7 +61,6 @@ def test_auto_progress_stops_at_must_human_parse_review(app) -> None:
|
||||
app.config["SHIPPING_NOTICE_AUTO_PROGRESS_ENABLED"] = True
|
||||
task = ShippingNotice(
|
||||
task_no="SN-STP-MUST-HUMAN",
|
||||
process_status="pending_review",
|
||||
review_status=RS_PARSE_REVIEW,
|
||||
pending_human_reason=PH_LOW_CONF,
|
||||
source_type="manual",
|
||||
@@ -85,7 +83,6 @@ def test_try_auto_chain_calls_upload_when_auto_upload_enabled(app, monkeypatch)
|
||||
|
||||
task = ShippingNotice(
|
||||
task_no="SN-STP-RPA-ON",
|
||||
process_status="matched",
|
||||
match_status="fulfillable",
|
||||
source_type="manual",
|
||||
line_results_json=[{"line_status": "ok"}],
|
||||
@@ -127,7 +124,6 @@ def test_try_auto_chain_skips_upload_when_auto_upload_disabled(app, monkeypatch)
|
||||
|
||||
task = ShippingNotice(
|
||||
task_no="SN-STP-NO-RPA",
|
||||
process_status="matched",
|
||||
match_status="fulfillable",
|
||||
source_type="manual",
|
||||
line_results_json=[{"line_status": "ok"}],
|
||||
@@ -166,7 +162,6 @@ def test_upload_to_freight_manual_confirm_does_not_hard_reject(app, monkeypatch)
|
||||
|
||||
task = ShippingNotice(
|
||||
task_no="SN-STP-MANUAL-CFM",
|
||||
process_status="waiting_upload",
|
||||
source_type="manual",
|
||||
export_file_path="/tmp/m.xlsx",
|
||||
export_file_name="m.xlsx",
|
||||
@@ -235,7 +230,6 @@ def test_upload_to_freight_manual_confirm_propagates_close_item_failure(app, mon
|
||||
|
||||
task = ShippingNotice(
|
||||
task_no="SN-STP-CLOSE-FAIL",
|
||||
process_status="waiting_upload",
|
||||
source_type="manual",
|
||||
export_file_path="/tmp/m.xlsx",
|
||||
export_file_name="m.xlsx",
|
||||
@@ -301,17 +295,21 @@ def test_export_ready_ui_state_entry_is_task_workbench(app) -> None:
|
||||
with app.app_context():
|
||||
task = ShippingNotice(
|
||||
task_no="SN-STP-ENTRY",
|
||||
process_status="matched",
|
||||
source_type="manual",
|
||||
export_file_path="/tmp/x.xlsx",
|
||||
export_file_name="x.xlsx",
|
||||
)
|
||||
state = build_task_ui_state(task)
|
||||
assert state["checkpoint_kind"] == "wait_manual_upload"
|
||||
assert state["checkpoint"]["kind"] == "wait_manual_upload"
|
||||
assert state["summary"]["entry_surface"] == "task_workbench"
|
||||
button_ids = [b.get("id") for b in (state.get("action_buttons") or [])]
|
||||
button_ids = [
|
||||
item.get("code")
|
||||
for item in [state["actions"].get("primary"), *(state["actions"].get("secondary") or [])]
|
||||
if item
|
||||
]
|
||||
assert "mark_manual_uploaded" in button_ids
|
||||
assert "download_excel" in button_ids
|
||||
assert "action_buttons" not in state
|
||||
|
||||
|
||||
def test_my_todos_owner_can_handle_admin_view_only(app) -> None:
|
||||
@@ -339,7 +337,6 @@ def test_my_todos_owner_can_handle_admin_view_only(app) -> None:
|
||||
mine = ShippingNotice(
|
||||
task_no="SN-STP-OWN",
|
||||
user_id=owner.id,
|
||||
process_status="pending_review",
|
||||
review_status=RS_PARSE_REVIEW,
|
||||
pending_human_reason=PH_LOW_CONF,
|
||||
source_type="manual",
|
||||
@@ -347,7 +344,6 @@ def test_my_todos_owner_can_handle_admin_view_only(app) -> None:
|
||||
waiting_upload = ShippingNotice(
|
||||
task_no="SN-STP-UPLOAD",
|
||||
user_id=owner.id,
|
||||
process_status="matched",
|
||||
source_type="manual",
|
||||
export_file_path="/tmp/own.xlsx",
|
||||
export_file_name="own.xlsx",
|
||||
@@ -355,7 +351,6 @@ def test_my_todos_owner_can_handle_admin_view_only(app) -> None:
|
||||
other = ShippingNotice(
|
||||
task_no="SN-STP-OTHER",
|
||||
user_id=admin.id,
|
||||
process_status="pending_review",
|
||||
review_status=RS_PARSE_REVIEW,
|
||||
pending_human_reason=PH_LOW_CONF,
|
||||
source_type="manual",
|
||||
|
||||
Reference in new issue
Block a user