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

@@ -27,7 +27,7 @@ def _task(**kwargs):
defaults = {
'task_no': 'OT-1',
'id': 1,
'process_status': 'parsed',
'upload_status': None,
'pending_human_reason': None,
'inventory_lines_json': None,
'inventory_snapshot_id': None,
@@ -57,14 +57,14 @@ def test_project_line_retryable_hides_shortage_and_running():
def test_decide_completed_is_noop():
task = _task(process_status='completed')
task = _task(upload_status='uploaded')
decided = decide_retry_action_only(task, scope='task')
assert decided['action'] == ACTION_NOOP
assert decided['reason_code'] == 'already_completed'
def test_decide_missing_snapshot_fetch(monkeypatch):
task = _task(process_status='parsed', inventory_snapshot_id=None, inventory_lines_json=None)
task = _task(inventory_snapshot_id=None, inventory_lines_json=None)
monkeypatch.setattr(
'app.services.shipping_notice.inventory_source_gate.is_inventory_source_stable',
lambda _t: True,
@@ -74,7 +74,7 @@ def test_decide_missing_snapshot_fetch(monkeypatch):
def test_decide_rpa_pending_already_running():
task = _task(pending_human_reason='rpa_pending', process_status='waiting_inventory')
task = _task(pending_human_reason='rpa_pending')
decided = decide_retry_action_only(task, scope='task')
assert decided['action'] == ACTION_NOOP
assert decided['reason_code'] == 'already_running'
@@ -83,7 +83,6 @@ def test_decide_rpa_pending_already_running():
def test_fulfillable_task_without_excel_continues_auto_progress(monkeypatch):
"""库存已完全匹配但 Excel 尚未生成时,任务级重试必须推进后续 Gate。"""
task = _task(
process_status='matched',
inventory_snapshot_id=7,
inventory_lines_json=[{'part_number': 'PN-1'}],
)