feat(shipping-notice): 实现滚动履约功能,优化发货通知流程与代码清理
清理废弃的ShippingCase相关代码与依赖,统一使用ShippingNotice直接关联客户数据。调整库存网关依赖规则,支持仅对库存满足或已人工放行的订单行生成发货Excel,实现滚动履约逻辑。
This commit is contained in:
1 parent
7cfd5d167e
commit
1e5aedb9ed
235 files changed
+11394
-9613
No files matched your search
@@ -82,6 +82,16 @@ def test_gate_action_contract_rejects_inventory_reroute_for_excel_gate():
|
||||
) is True
|
||||
|
||||
|
||||
def test_inventory_preparation_allows_reload_existing_result_without_rpa():
|
||||
"""RPA 超时后可重读已有库存结果;该动作仅属于库存准备 Gate。"""
|
||||
assert action_belongs_to_gate(
|
||||
gate_code='inventory_preparation', action_code='reload_inventory_result',
|
||||
) is True
|
||||
assert action_belongs_to_gate(
|
||||
gate_code='inventory_matching', action_code='reload_inventory_result',
|
||||
) is False
|
||||
|
||||
|
||||
def test_inventory_sufficiency_actions_keep_business_specific_labels():
|
||||
"""库存缺口恢复必须保留精确业务动作,禁止客户端降级为统一“重试”。"""
|
||||
assert action_presentation('open_shortage_review') == {
|
||||
@@ -140,7 +150,7 @@ def test_gate_action_presentation_declares_ui_dispatch_without_frontend_action_c
|
||||
'label_key': 'workspace.shippingNotice.processGate.actionCodes.mark_manual_uploaded',
|
||||
'kind': 'current_gate',
|
||||
'dispatch': 'dialog',
|
||||
'ui_handler': 'manual_upload_evidence',
|
||||
'ui_handler': 'manual_upload_confirmation',
|
||||
}
|
||||
assert action_presentation('confirm_customer') == {
|
||||
'code': 'confirm_customer',
|
||||
@@ -433,6 +443,43 @@ def test_inventory_preparation_exposes_only_rpa_retry(app, monkeypatch):
|
||||
assert summary['allowed_actions'] == ['retry_inventory_preparation']
|
||||
|
||||
|
||||
def test_inventory_rpa_timeout_prefers_reload_existing_result(app, monkeypatch):
|
||||
"""RPA 超时先重读已落盘结果,不能把主按钮直接指向新的 RPA 请求。"""
|
||||
from types import SimpleNamespace
|
||||
from app.services.shipping_notice import process_gate_projection as projection
|
||||
|
||||
execution = SimpleNamespace(
|
||||
id=1, execution_no='EXE-INVENTORY-TIMEOUT', status='blocked',
|
||||
current_gate_code='inventory_preparation',
|
||||
primary_next_action_code='retry_inventory_preparation',
|
||||
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-TIMEOUT', 'status': 'blocked',
|
||||
'primary_next_action_code': 'retry_inventory_preparation',
|
||||
'responsible_party': 'worker', 'recovery_targets': [],
|
||||
'active_recovery_plans': [], 'gates': [],
|
||||
'current_gate': {
|
||||
'gate_code': 'inventory_preparation', 'status': 'blocked_retryable',
|
||||
'blocking_reason_code': 'inventory_rpa_timeout',
|
||||
'next_action_code': 'retry_inventory_preparation', 'evaluation_version': 3,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
summary = projection.project_user_gate_summary(execution)
|
||||
|
||||
assert summary['next_action_code'] == 'reload_inventory_result'
|
||||
assert summary['primary_action']['code'] == 'reload_inventory_result'
|
||||
assert summary['allowed_actions'] == [
|
||||
'reload_inventory_result',
|
||||
'retry_inventory_preparation',
|
||||
]
|
||||
|
||||
|
||||
def test_user_gate_summary_exposes_manual_gate_evidence_and_rpa_retry(app, monkeypatch):
|
||||
"""Gate 20 保持凭据登记主动作,并显式下发可选 RPA 重试。"""
|
||||
from types import SimpleNamespace
|
||||
@@ -507,8 +554,8 @@ def test_manual_upload_handoff_projects_evidence_confirmation_as_primary_action(
|
||||
assert summary['primary_action']['target_anchor'] == 'manual_upload'
|
||||
|
||||
|
||||
def test_manual_upload_handoff_projects_excel_recovery_at_artifact_anchor(app, monkeypatch):
|
||||
"""跨 Gate Excel 恢复必须采用 RecoveryPlan 的位置,不能继承 Gate 20 的上传位置。"""
|
||||
def test_manual_upload_handoff_hides_excel_regeneration_for_single_notice(app, monkeypatch):
|
||||
"""同一 Notice 只能有一个 Excel,上传阶段不得投影重生入口。"""
|
||||
from types import SimpleNamespace
|
||||
from app.services.shipping_notice import process_gate_projection as projection
|
||||
|
||||
@@ -533,16 +580,10 @@ def test_manual_upload_handoff_projects_excel_recovery_at_artifact_anchor(app, m
|
||||
},
|
||||
},
|
||||
)
|
||||
monkeypatch.setattr(projection, '_excel_regeneration_allowed', lambda **_: True)
|
||||
|
||||
summary = projection.project_user_gate_summary(execution)
|
||||
|
||||
regeneration = next(
|
||||
item for item in summary['action_presentation']
|
||||
if item['code'] == 'regenerate_excel_artifact'
|
||||
)
|
||||
assert regeneration['target_surface'] == 'fulfillment_prep'
|
||||
assert regeneration['target_anchor'] == 'excel_artifact'
|
||||
assert 'regenerate_excel_artifact' not in summary['allowed_actions']
|
||||
assert all(item['code'] != 'regenerate_excel_artifact' for item in summary['action_presentation'])
|
||||
|
||||
|
||||
def test_inventory_source_gate_summary_exposes_no_manual_selection_action(app, monkeypatch):
|
||||
|
||||
Reference in new issue
Block a user