feat(in-transit-transfer): 自动调拨联动收料就绪并分层来源错误
- 调度整合:退役 in_transit_receipt_file_job,收料归档收敛 shipping_receipt_rpa_archive,排程注册表统一 - 自动调拨 Job:调拨前确保各来源当日收料文件就绪(缺失自动触发收料 RPA),严格等量匹配后生成 ERP 调拨单 - worker 手动唤醒:排程工作台支持手动唤醒与 runs 透视,heartbeat 协议同步 - 收料缺失幸存 T2:parse_failed 状态落库(迁移 q4c5) - 来源错误分层与 stale 时钟换源:改挂 inventory_checked_at 库存查得时刻,展示阈值与执行门禁解耦(迁移 t5a6) - 新增 wecom_sender 企微通知:每非空 Run 汇总一条,通知失败不影响 ERP 结果 - 同步排程工作台/调拨卡片前端、chat/admin 文案四语言、RPA 脚本与测试全家
This commit is contained in:
1 parent
993e581135
commit
abf3d48927
144 files changed
+10161
-2132
No files matched your search
@@ -226,7 +226,7 @@ def test_disabled_source_can_be_saved_before_profile_and_template_binding(app):
|
||||
|
||||
|
||||
def test_activation_is_a_separate_gate_and_reports_unfinished_steps(app):
|
||||
"""普通保存只能保留停用站点;独立启用动作必须返回尚未完成的测试步骤。"""
|
||||
"""普通保存只能保留停用站点;独立启用动作必须返回尚未完成的硬门槛。"""
|
||||
app.config['FREIGHT_RPA_CREDENTIAL_KEY'] = Fernet.generate_key().decode('ascii')
|
||||
with app.app_context():
|
||||
login = shipping_inventory_service.save_profile(_profile_data(code='ACTIVATION_LOGIN'), actor_id=None)
|
||||
@@ -234,7 +234,7 @@ def test_activation_is_a_separate_gate_and_reports_unfinished_steps(app):
|
||||
payload.update({'enabled': False, 'parsing_profile_id': None, 'excel_template_id': None})
|
||||
draft = shipping_inventory_service.save_source(payload, actor_id=None, allow_enable_transition=False)
|
||||
assert draft['activation']['ready'] is False
|
||||
assert draft['activation']['missing_requirements'] == ['parsing_profile', 'excel_template', 'configuration_test']
|
||||
assert draft['activation']['missing_requirements'] == ['parsing_profile', 'excel_template']
|
||||
|
||||
payload['enabled'] = True
|
||||
saved = shipping_inventory_service.save_source(
|
||||
@@ -245,11 +245,11 @@ def test_activation_is_a_separate_gate_and_reports_unfinished_steps(app):
|
||||
with pytest.raises(ConflictError) as exc_info:
|
||||
shipping_inventory_service.activate_source(draft['id'], actor_id=None)
|
||||
assert exc_info.value.code == 'SHIPPING.INVENTORY_SOURCE_ACTIVATION_BLOCKED'
|
||||
assert exc_info.value.details['missing_requirements'] == ['parsing_profile', 'excel_template', 'configuration_test']
|
||||
assert exc_info.value.details['missing_requirements'] == ['parsing_profile', 'excel_template']
|
||||
|
||||
|
||||
def test_activation_status_exposes_structured_checks_without_duplicate_test_blocks(app):
|
||||
"""未测试站点应显示后续验证步骤,但只由测试门禁阻断,避免管理员面对重复待办。"""
|
||||
def test_activation_status_exposes_only_hard_gate_checks(app):
|
||||
"""启用门禁仅暴露连接/解析/发货模板硬门槛,不再包含测试导出或后续准备项。"""
|
||||
app.config['FREIGHT_RPA_CREDENTIAL_KEY'] = Fernet.generate_key().decode('ascii')
|
||||
with app.app_context():
|
||||
login = shipping_inventory_service.save_profile(_profile_data(code='CHECKS_LOGIN'), actor_id=None)
|
||||
@@ -267,14 +267,13 @@ def test_activation_status_exposes_structured_checks_without_duplicate_test_bloc
|
||||
|
||||
checks = {item['code']: item for item in draft['activation']['checks']}
|
||||
|
||||
# 关键断言:未进行测试时,解析/仓库验证被展示为待测试而非额外阻断门禁。
|
||||
assert checks['configuration_test']['blocking'] is True
|
||||
assert checks['configuration_test']['evidence'] == {'state': 'not_started'}
|
||||
assert checks['parsing_validation']['status'] == 'pending'
|
||||
assert checks['parsing_validation']['blocking'] is False
|
||||
assert checks['warehouse_mapping']['status'] == 'pending'
|
||||
assert checks['warehouse_mapping']['blocking'] is False
|
||||
assert draft['activation']['missing_requirements'] == ['parsing_profile', 'excel_template', 'configuration_test']
|
||||
# 关键断言:测试导出与可选准备项已退出启用门禁;仅硬门槛阻断。
|
||||
assert set(checks) == {'rpa_profile', 'parsing_profile', 'excel_template', 'template_validation'}
|
||||
assert 'configuration_test' not in checks
|
||||
assert checks['rpa_profile']['blocking'] is False
|
||||
assert checks['parsing_profile']['blocking'] is True
|
||||
assert checks['excel_template']['blocking'] is True
|
||||
assert draft['activation']['missing_requirements'] == ['parsing_profile', 'excel_template']
|
||||
|
||||
|
||||
def test_enabled_source_rejects_disabled_rpa_profile(app):
|
||||
@@ -355,8 +354,8 @@ def test_direct_parsing_profile_binding_keeps_source_disabled_and_writes_audit(a
|
||||
assert history[0]['source_config_version_after'] == bound[0]['config_version']
|
||||
|
||||
|
||||
def test_bulk_parsing_profile_binding_is_atomic_when_one_site_is_enabled(app):
|
||||
"""批量绑定必须先全量预检;已启用站点阻断时其余站点不能部分写入。"""
|
||||
def test_bulk_parsing_profile_binding_allows_enabled_sites(app):
|
||||
"""批量绑定允许包含已启用站点;全部预检通过后原子写入。"""
|
||||
app.config['FREIGHT_RPA_CREDENTIAL_KEY'] = Fernet.generate_key().decode('ascii')
|
||||
with app.app_context():
|
||||
login = shipping_inventory_service.save_profile(_profile_data(code='BULK_BIND_LOGIN'), actor_id=None)
|
||||
@@ -366,16 +365,16 @@ def test_bulk_parsing_profile_binding_is_atomic_when_one_site_is_enabled(app):
|
||||
enabled = shipping_inventory_service.save_source(_source_data(login['id'], code='BULK_BIND_ENABLED'), actor_id=None)
|
||||
profile = _parsing_profile()
|
||||
|
||||
with pytest.raises(ConflictError) as exc_info:
|
||||
shipping_inventory_service.bind_source_parsing_profile(
|
||||
[disabled['id'], enabled['id']], profile['id'], actor_id=None,
|
||||
reason='批量迁移同类报表', operation='bulk',
|
||||
)
|
||||
bound = shipping_inventory_service.bind_source_parsing_profile(
|
||||
[disabled['id'], enabled['id']], profile['id'], actor_id=None,
|
||||
reason='批量迁移同类报表', operation='bulk',
|
||||
)
|
||||
|
||||
# 关键断言:任一站点不可变更时,停用站点也不得留下部分绑定或审计。
|
||||
assert exc_info.value.code == 'SHIPPING.INVENTORY_SOURCE_BINDING_BLOCKED'
|
||||
assert db.session.get(ShippingInventorySource, disabled['id']).parsing_profile_id is None
|
||||
assert ShippingInventorySourceParsingBindingAudit.query.count() == 0
|
||||
# 关键断言:已启用站点可直接换绑;两站同步写入且留下审计。
|
||||
assert {row['id'] for row in bound} == {disabled['id'], enabled['id']}
|
||||
assert all(row['parsing_profile_id'] == profile['id'] for row in bound)
|
||||
assert db.session.get(ShippingInventorySource, enabled['id']).enabled is True
|
||||
assert ShippingInventorySourceParsingBindingAudit.query.count() == 2
|
||||
|
||||
|
||||
def test_direct_parsing_binding_rejects_template_fields_missing_from_profile(app):
|
||||
|
||||
Reference in new issue
Block a user