refactor(shipping-notice): 重构货代发货通知状态管理,移除废弃的process_status字段

统一货代发货通知的业务阶段为四个标准阶段:接收解析、订单复核、发货准备、上传完成
设置 ui_state 为前端唯一状态数据源,不再依赖 process_status 驱动业务流程
删除 shipping_notices 表的废弃 process_status 列及对应复合索引,新增数据库迁移脚本
替换全栈代码中所有对 process_status 的引用为生命周期、上传状态等领域字段
更新相关文档、测试用例与前端展示逻辑适配新的状态管理规则
This commit is contained in:
hugo committed 2026-08-15 10:19:10 +08:00
1 parent 6684e7181a
commit 5ef8329bd8
178 files changed
+5091 -1734

No files matched your search

@@ -127,7 +127,7 @@ def _seed_candidate_task(*, sender: str = "buyer@wyc.example.com"):
db.session.flush()
task = ShippingNotice(
task_no=f"SN-AUTO-{user.id}", shipping_case_id=case.id, source_candidate_id=candidate.id,
user_id=user.id, source_type="email_attachment", process_status="parsed",
user_id=user.id, source_type="email_attachment",
customer_resolution_status="pending",
)
db.session.add(task)
@@ -418,13 +418,13 @@ def test_numbered_customer_correction_voids_old_number_and_replaces_case(app):
db.session.flush()
first = ShippingNotice(
task_no="SN-CORRECTION-V1", shipping_case_id=case.id, document_version=1,
source_type="manual", process_status="parsed", customer_resolution_status="pending",
source_type="manual", customer_resolution_status="pending",
)
db.session.add(first)
db.session.flush()
latest = ShippingNotice(
task_no="SN-CORRECTION-V2", shipping_case_id=case.id, document_version=2,
supersedes_task_id=first.id, source_type="manual", process_status="waiting_upload",
supersedes_task_id=first.id, source_type="manual", upload_status="pending",
customer_resolution_status="pending", inventory_source_code="DSV",
inventory_source_status="user_confirmed", inventory_lines_json=[{"sku": "A", "quantity": 1}],
match_status="fulfillable", line_results_json=[{"sku": "A"}],
@@ -457,7 +457,7 @@ def test_numbered_customer_correction_voids_old_number_and_replaces_case(app):
assert latest.inventory_source_status is None
assert latest.inventory_lines_json is None
assert latest.export_file_path is None
assert latest.process_status == "parsed"
assert latest.source_type == "manual"
assert get_task_by_ref(old_business_no).id == latest.id
assert get_task_by_ref(replacement.business_no).id == latest.id
assert ShippingTaskEvent.query.filter_by(event_type="customer_correction_applied").count() == 2
@@ -476,7 +476,7 @@ def test_numbered_customer_correction_requires_reason_and_blocks_uploaded_case(a
db.session.flush()
task = ShippingNotice(
task_no="SN-CORRECTION-BLOCK", shipping_case_id=case.id,
source_type="manual", process_status="parsed", customer_resolution_status="pending",
source_type="manual", customer_resolution_status="pending",
)
db.session.add(task)
db.session.commit()
@@ -487,7 +487,7 @@ def test_numbered_customer_correction_requires_reason_and_blocks_uploaded_case(a
assert getattr(exc_info.value, "code", None) == "SHIPPING.CUSTOMER_CORRECTION_REASON_REQUIRED"
db.session.rollback()
task.process_status = "uploaded"
task.upload_status = "uploaded"
db.session.commit()
with pytest.raises(ConflictError) as exc_info:
correct_numbered_task_customer(task, customer_id=correct.id, reason="客户错误", actor_id=None)