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
@@ -310,8 +310,45 @@ def test_user_gate_summary_repairs_stale_rpa_action_for_gate19(app, monkeypatch)
|
||||
assert summary['owner_type'] == 'human'
|
||||
|
||||
|
||||
def test_user_gate_summary_exposes_manual_gate_rpa_retry(app, monkeypatch):
|
||||
"""Gate 20 人工交接也可显式重试 RPA,且不依赖 AUTO_UPLOAD 配置。"""
|
||||
def test_inventory_preparation_keeps_controlled_upload_as_a_secondary_gate_action(app, monkeypatch):
|
||||
"""库存准备以重试为主动作,受控上传仅保留给 Gate 工作台。"""
|
||||
from types import SimpleNamespace
|
||||
from app.services.shipping_notice import process_gate_projection as projection
|
||||
|
||||
execution = SimpleNamespace(
|
||||
id=1, execution_no='EXE-INVENTORY-1', status='blocked',
|
||||
current_gate_code='inventory_preparation',
|
||||
primary_next_action_code='upload_inventory_file',
|
||||
responsible_party='worker', lock_version=1, review_case_id=None, task_id=99,
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
projection,
|
||||
'serialize_process_execution',
|
||||
lambda _execution, include_diagnostics=False: {
|
||||
'execution_no': 'EXE-INVENTORY-1', 'status': 'blocked',
|
||||
'primary_next_action_code': 'upload_inventory_file',
|
||||
'responsible_party': 'worker', 'recovery_targets': [],
|
||||
'active_recovery_plans': [], 'gates': [],
|
||||
'current_gate': {
|
||||
'gate_code': 'inventory_preparation', 'status': 'blocked_manual',
|
||||
'blocking_reason_code': 'inventory_file_empty',
|
||||
'next_action_code': 'upload_inventory_file', 'evaluation_version': 3,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
summary = projection.project_user_gate_summary(execution)
|
||||
|
||||
assert summary['next_action_code'] == 'retry_inventory_preparation'
|
||||
assert summary['primary_action']['code'] == 'retry_inventory_preparation'
|
||||
assert summary['allowed_actions'] == [
|
||||
'retry_inventory_preparation',
|
||||
'upload_inventory_file',
|
||||
]
|
||||
|
||||
|
||||
def test_user_gate_summary_exposes_manual_gate_evidence_confirmation(app, monkeypatch):
|
||||
"""Gate 20 只下发受控凭据登记,不把 RPA 重试伪装为人工上传确认。"""
|
||||
from types import SimpleNamespace
|
||||
from app.services.shipping_notice import process_gate_projection as projection
|
||||
|
||||
@@ -338,10 +375,75 @@ def test_user_gate_summary_exposes_manual_gate_rpa_retry(app, monkeypatch):
|
||||
)
|
||||
|
||||
summary = projection.project_user_gate_summary(execution)
|
||||
assert summary['next_action_code'] == 'retry_freight_upload_rpa'
|
||||
assert summary['next_action_code'] == 'mark_manual_uploaded'
|
||||
assert summary['allowed_actions'] == ['mark_manual_uploaded']
|
||||
assert summary['owner_type'] == 'human'
|
||||
|
||||
|
||||
def test_manual_upload_handoff_projects_evidence_confirmation_as_primary_action(app, monkeypatch):
|
||||
"""Gate 20 必须引导受控凭据登记,不得再重生待办或直接声称上传完成。"""
|
||||
from types import SimpleNamespace
|
||||
from app.services.shipping_notice import process_gate_projection as projection
|
||||
|
||||
execution = SimpleNamespace(
|
||||
id=1, execution_no='EXE-MANUAL-CONFIRM', status='blocked',
|
||||
current_gate_code='manual_upload_handoff',
|
||||
primary_next_action_code='regenerate_manual_upload_todo',
|
||||
responsible_party='owner', lock_version=1, review_case_id=None, task_id=99,
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
projection,
|
||||
'serialize_process_execution',
|
||||
lambda _execution, include_diagnostics=False: {
|
||||
'execution_no': 'EXE-MANUAL-CONFIRM', 'status': 'blocked',
|
||||
'primary_next_action_code': 'regenerate_manual_upload_todo',
|
||||
'responsible_party': 'owner', 'recovery_targets': [],
|
||||
'active_recovery_plans': [], 'gates': [],
|
||||
'current_gate': {
|
||||
'gate_code': 'manual_upload_handoff', 'status': 'blocked_manual',
|
||||
'blocking_reason_code': 'manual_upload_pending',
|
||||
'next_action_code': 'regenerate_manual_upload_todo', 'evaluation_version': 3,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
summary = projection.project_user_gate_summary(execution)
|
||||
|
||||
assert summary['next_action_code'] == 'mark_manual_uploaded'
|
||||
assert summary['allowed_actions'] == ['mark_manual_uploaded']
|
||||
|
||||
|
||||
def test_inventory_source_gate_summary_does_not_expose_line_decision_side_actions(app, monkeypatch):
|
||||
"""规则建议和保留人工决定只属于订单复核明细行,不能泄漏到 Gate 卡。"""
|
||||
from types import SimpleNamespace
|
||||
from app.services.shipping_notice import process_gate_projection as projection
|
||||
|
||||
execution = SimpleNamespace(
|
||||
id=1, execution_no='EXE-ROUTING', status='blocked',
|
||||
current_gate_code='inventory_source_routing', primary_next_action_code='open_inventory_source_review',
|
||||
responsible_party='owner', lock_version=1, review_case_id=None, task_id=99,
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
projection,
|
||||
'serialize_process_execution',
|
||||
lambda _execution, include_diagnostics=False: {
|
||||
'execution_no': 'EXE-ROUTING', 'status': 'blocked',
|
||||
'primary_next_action_code': 'open_inventory_source_review',
|
||||
'responsible_party': 'owner', 'recovery_targets': [],
|
||||
'active_recovery_plans': [], 'gates': [],
|
||||
'current_gate': {
|
||||
'gate_code': 'inventory_source_routing', 'status': 'blocked_manual',
|
||||
'blocking_reason_code': 'no_inventory_source_candidates',
|
||||
'next_action_code': 'open_inventory_source_review', 'evaluation_version': 3,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
summary = projection.project_user_gate_summary(execution)
|
||||
|
||||
assert summary['allowed_actions'] == ['open_inventory_source_review']
|
||||
|
||||
|
||||
def test_process_gate_dependency_integrity_and_excel_only_scope():
|
||||
"""
|
||||
校验依赖图完整性,并锁定「仅重生 Excel」不得失效库存匹配。
|
||||
|
||||
Reference in new issue
Block a user