feat(shipping-notice): 添加货代履约策略管理功能,支持策略创建、发布及版本控制,增强订单冻结和预约管理逻辑
This commit is contained in:
1 parent
abd8fc1e16
commit
d62f5107b2
82 files changed
+4914
-514
No files matched your search
@@ -39,10 +39,19 @@ def _freeze_export_snapshot(
|
||||
*, header: dict[int, object] | None = None, lines: list[tuple[int, int, str, int, str]] | None = None,
|
||||
) -> None:
|
||||
"""为导出测试建立冻结订单和可用库存核验,避免测试绕过正式履约门禁。"""
|
||||
field_codes = {
|
||||
str(item.get('field_id')): str(item.get('field_code') or '')
|
||||
for item in (version.definition_json or {}).get('fields') or []
|
||||
}
|
||||
po_number = next(
|
||||
(str(value) for field_id, value in (header or {}).items() if field_codes.get(str(field_id)) == 'po_number'),
|
||||
'TEST-PO-001',
|
||||
)
|
||||
snapshot = ShippingOrderSnapshot(
|
||||
task_id=task.id, extraction_id=extraction.id, schema_version_id=version.id,
|
||||
order_data_version=1, rule_versions_json={},
|
||||
header_values_json={str(key): value for key, value in (header or {}).items()},
|
||||
customer_po_number=po_number,
|
||||
)
|
||||
db.session.add(snapshot)
|
||||
db.session.flush()
|
||||
@@ -225,7 +234,7 @@ def test_published_template_generates_dynamic_artifact(app, tmp_path):
|
||||
_freeze_export_snapshot(
|
||||
task, extraction, version,
|
||||
header={customer.id: 'acme', po_number.id: '16754796'},
|
||||
lines=[(1, part.id, 'PN-1', 1, 'RES-EXPORT-1')],
|
||||
lines=[(1, part.id, 'PN-1', 1, '1000000001')],
|
||||
)
|
||||
|
||||
path, filename, artifact = generate_shipment_excel(task)
|
||||
@@ -409,8 +418,8 @@ def test_export_matches_inventory_by_profile_keys_not_row_position(app, tmp_path
|
||||
_freeze_export_snapshot(
|
||||
task, extraction, version,
|
||||
lines=[
|
||||
(1, part.id, 'PN-A', 1, 'RES-KEYED-A'),
|
||||
(2, part.id, 'PN-B', 1, 'RES-KEYED-B'),
|
||||
(1, part.id, 'PN-A', 1, '1000000002'),
|
||||
(2, part.id, 'PN-B', 1, '1000000003'),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -579,7 +588,7 @@ def test_export_rejects_ambiguous_inventory_values_and_cleans_partial_file(app,
|
||||
db.session.add(task); db.session.flush()
|
||||
_freeze_export_snapshot(
|
||||
task, extraction, version,
|
||||
lines=[(1, part.id, 'PN-A', 1, 'RES-AMBIGUOUS-A')],
|
||||
lines=[(1, part.id, 'PN-A', 1, '1000000004')],
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match='值不一致'):
|
||||
|
||||
Reference in new issue
Block a user