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
@@ -200,17 +200,17 @@ def test_map_notice_to_processing_status_stage_domain_mapping():
|
||||
)
|
||||
|
||||
uploaded = SimpleNamespace(
|
||||
process_status='uploaded', current_step='', upload_status='', export_file_path=None,
|
||||
current_step='', upload_status='uploaded', export_file_path=None,
|
||||
)
|
||||
assert map_notice_to_processing_status_stage(uploaded) == ('completed', 'completed')
|
||||
|
||||
waiting = SimpleNamespace(
|
||||
process_status='waiting_upload', current_step='', upload_status='', export_file_path='/x.xlsx',
|
||||
current_step='', upload_status='pending', export_file_path='/x.xlsx',
|
||||
)
|
||||
assert map_notice_to_processing_status_stage(waiting) == ('automating', 'freight_uploading')
|
||||
|
||||
matching = SimpleNamespace(
|
||||
process_status='matching', current_step='step5_match', upload_status='', export_file_path=None,
|
||||
current_step='step5_match', upload_status='', match_status='matching', export_file_path=None,
|
||||
)
|
||||
assert map_notice_to_processing_status_stage(matching) == ('automating', 'inventory_matching')
|
||||
|
||||
@@ -224,7 +224,6 @@ def test_map_notice_unknown_status_fail_closed():
|
||||
)
|
||||
|
||||
unknown = SimpleNamespace(
|
||||
process_status='totally_unknown_xyz',
|
||||
current_step='',
|
||||
upload_status='',
|
||||
export_file_path=None,
|
||||
@@ -288,7 +287,37 @@ def test_inventory_snapshot_missing_projects_retryable_inventory_action():
|
||||
|
||||
assert payload['user_status'] == 'retryable'
|
||||
assert payload['retryable'] is True
|
||||
assert payload['primary_action']['code'] == 'retry'
|
||||
# 主动作必须保留 Gate 原始码,前端才能提交到正确的库存准备执行器。
|
||||
assert payload['primary_action'] == {
|
||||
'code': 'retry_inventory_preparation',
|
||||
'i18n_key': 'workspace.shippingNotice.processGate.actionCodes.retry_inventory_preparation',
|
||||
'parameters': {},
|
||||
}
|
||||
|
||||
|
||||
def test_inventory_file_empty_keeps_gate_retry_as_the_only_primary_action():
|
||||
"""库存文件缺失必须保留 Gate 重试,不得降级为线外上传或空按钮。"""
|
||||
payload = apply_user_projection_fields({
|
||||
'status': 'processing',
|
||||
'stage': 'inventory_fetching',
|
||||
'source_type': 'order_task',
|
||||
'shipping_notice_no': 'SN-1',
|
||||
'current_gate': {
|
||||
'gate_code': 'inventory_preparation',
|
||||
'status': 'blocked_manual',
|
||||
'next_action_code': 'retry_inventory_preparation',
|
||||
'blocking_reason_code': 'inventory_file_empty',
|
||||
},
|
||||
'available_actions': ['retry_inventory_preparation'],
|
||||
})
|
||||
|
||||
assert payload['user_status'] == 'waiting_human'
|
||||
assert payload['primary_action'] == {
|
||||
'code': 'retry_inventory_preparation',
|
||||
'i18n_key': 'workspace.shippingNotice.processGate.actionCodes.retry_inventory_preparation',
|
||||
'parameters': {},
|
||||
}
|
||||
assert payload['available_actions'] == ['retry_inventory_preparation']
|
||||
|
||||
|
||||
def test_waiting_human_reconcile_action_uses_projected_available_actions():
|
||||
|
||||
Reference in new issue
Block a user