feat(shipping-notice,receipt-report): 新增收料报表功能并优化发货通知流程
清理废弃的shipping xfa ocr automark相关代码和job配置 新增收料报表管理的前端页面、路由和侧边栏入口 新增后端收料报表配置接口、数据库模型和RPA脚本 优化发货通知流程的重试策略,将shipping相关job默认不自动重试 移除废弃的库存源确认相关逻辑,更新流程门禁规则 重构订单模板的值适配器模块,新增坐标OCR值适配器 清理前端shipping菜单和action的废弃选项 更新相关文档和测试用例,调整.gitignore忽略规则
This commit is contained in:
1 parent
260465b72d
commit
1b6483a4ea
466 files changed
+32115
-33796
No files matched your search
@@ -1493,6 +1493,102 @@ def test_normalize_notice_line_aliases():
|
||||
}
|
||||
|
||||
|
||||
def test_normalize_notice_line_uses_frozen_schema_aliases_for_inventory_source_hint():
|
||||
"""邮件列名只有在本次冻结 Schema 配置后才可映射库存源线索,禁止代码内置业务别名。"""
|
||||
schema_definition = {
|
||||
'fields': [
|
||||
{
|
||||
'field_id': 'part', 'field_code': 'part_number', 'scope': 'line',
|
||||
'enabled': True, 'display_name': '内部料号', 'aliases': ['Custom MPN'],
|
||||
},
|
||||
{
|
||||
'field_id': 'qty', 'field_code': 'qty', 'scope': 'line',
|
||||
'enabled': True, 'display_name': '数量', 'aliases': ['Custom Qty'],
|
||||
},
|
||||
{
|
||||
'field_id': 'source', 'field_code': 'inventory_source_hint', 'scope': 'line',
|
||||
'enabled': True, 'display_name': '库存源线索', 'aliases': ['VMI HUB'],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
line = normalize_notice_line(
|
||||
{'Custom MPN': 'A-001', 'Custom Qty': '3', 'VMI HUB': 'CMH01'},
|
||||
schema_definition=schema_definition,
|
||||
)
|
||||
|
||||
assert line == {
|
||||
'part_number': 'A-001',
|
||||
'qty': 3.0,
|
||||
'inventory_source_hint': 'CMH01',
|
||||
}
|
||||
|
||||
|
||||
def test_normalize_notice_line_uses_schema_alias_for_line_remark():
|
||||
"""行备注只能通过冻结 Schema 的正式字段和别名进入订单行。"""
|
||||
schema_definition = {
|
||||
'fields': [
|
||||
{
|
||||
'field_id': 'part', 'field_code': 'part_number', 'scope': 'line',
|
||||
'enabled': True, 'display_name': '内部料号', 'aliases': ['Custom MPN'],
|
||||
},
|
||||
{
|
||||
'field_id': 'qty', 'field_code': 'qty', 'scope': 'line',
|
||||
'enabled': True, 'display_name': '数量', 'aliases': ['Custom Qty'],
|
||||
},
|
||||
{
|
||||
'field_id': 'remark', 'field_code': 'line_remark', 'scope': 'line',
|
||||
'enabled': True, 'display_name': '行备注', 'aliases': ['Customer Note'],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
line = normalize_notice_line(
|
||||
{'Custom MPN': 'A-001', 'Custom Qty': '3', 'Customer Note': 'Ship together'},
|
||||
schema_definition=schema_definition,
|
||||
)
|
||||
|
||||
assert line == {
|
||||
'part_number': 'A-001',
|
||||
'qty': 3.0,
|
||||
'line_remark': 'Ship together',
|
||||
}
|
||||
|
||||
|
||||
def test_parse_notice_table_keeps_configured_line_remark():
|
||||
"""表格中的行备注仅在冻结 Schema 声明其别名后进入解析结果。"""
|
||||
schema_definition = _table_schema_definition()
|
||||
schema_definition['fields'].append({
|
||||
'field_id': 'line-remark', 'field_code': 'line_remark', 'scope': 'line',
|
||||
'value_type': 'string', 'enabled': True, 'display_name': '行备注',
|
||||
'aliases': ['Customer Note'], 'normalizer_key': 'trim', 'validator_keys': [],
|
||||
})
|
||||
|
||||
lines = parse_notice_table_rows(
|
||||
['MPN', 'Allocated QTY', 'Customer Note'],
|
||||
[['D4-A08AR12000002', 10, 'Ship together']],
|
||||
contract=compile_table_header_contract(schema_definition),
|
||||
)
|
||||
|
||||
assert lines == [{
|
||||
'part_number': 'D4-A08AR12000002',
|
||||
'qty': 10.0,
|
||||
'line_remark': 'Ship together',
|
||||
}]
|
||||
|
||||
|
||||
def test_schema_disables_free_text_field_guessing_after_table_parse_miss():
|
||||
"""存在冻结 Schema 时,表格未命中不得用固定 SKU x Qty 正则生成订单行。"""
|
||||
parsed, confidence, warnings = extract_notice_fields(
|
||||
raw_text='D4-A08AR12000002 x 10',
|
||||
schema_definition=_table_schema_definition(),
|
||||
)
|
||||
|
||||
assert parsed['lines'] == []
|
||||
assert confidence == 0.0
|
||||
assert 'schema_table_no_lines' in warnings
|
||||
|
||||
|
||||
def test_normalize_notice_line_splits_frozen_temp_composite():
|
||||
"""TEMP 二段复合文本应拆为客户料号和内部料号,禁止把组合值持久化。"""
|
||||
line = normalize_notice_line({
|
||||
|
||||
Reference in new issue
Block a user