feat(shipping-notice): 完善订单解析、模板管理与库存 RPA 流程
- 优化订单文档解析、补充合并与坐标重建 - 完善订单模板校验、发布及前端管理界面 - 改进库存 RPA 下载回退与工作流处理 - 补充后端、前端及 RPA 自动化测试 - 更新 Shipping Notice 技术文档与四语言文案
This commit is contained in:
1 parent
c4a27324c8
commit
8f2f568f92
46 files changed
+1745
-265
No files matched your search
@@ -710,6 +710,59 @@ def test_coordinate_blind_candidate_excludes_header_layouts_from_rows(app):
|
||||
assert candidate['rows'] == [{'customer_po_line_no': '20', 'part_number': 'PART-A'}]
|
||||
|
||||
|
||||
def test_coordinate_blind_candidate_keeps_rows_when_strategy_needs_review(app, monkeypatch):
|
||||
"""关键断言:策略需复核时盲测预览仍展示最佳努力明细,不能整表吞掉。"""
|
||||
from app.services.shipping_notice.document_layout.runtime_parse_strategy import RuntimeParseStrategy
|
||||
|
||||
with app.app_context():
|
||||
profile, user, documents = _published_profile_with_samples()
|
||||
profile.definition_json = {
|
||||
'document_match': {'required_anchors': []},
|
||||
'table_regions': [{
|
||||
'region_id': 'lines', 'page_scope': 'exact_page', 'page_no': 1,
|
||||
'region': {'x0': 0, 'y0': 0, 'x1': 1, 'y1': 1},
|
||||
'line_layouts': [{
|
||||
'layout_id': 'main', 'row_offset': 0, 'role': 'main',
|
||||
'region': {'x0': 0, 'y0': 0, 'x1': 1, 'y1': 1},
|
||||
'field_regions': [
|
||||
{'field_id': 'line-id', 'field_code': 'customer_po_line_no', 'scope': 'line',
|
||||
'region': {'x0': 0, 'y0': 0, 'x1': .3, 'y1': 1}, 'allowed_sources': ['pdf_coordinate']},
|
||||
{'field_id': 'part-id', 'field_code': 'part_number', 'scope': 'line',
|
||||
'region': {'x0': .3, 'y0': 0, 'x1': 1, 'y1': 1}, 'allowed_sources': ['pdf_coordinate']},
|
||||
],
|
||||
}],
|
||||
}], 'order_field_layouts': [],
|
||||
}
|
||||
glyphs = [
|
||||
{'text': char, 'bbox': {'x0': 20 + index * 4, 'y0': 40, 'x1': 23 + index * 4, 'y1': 50}}
|
||||
for index, char in enumerate('20')
|
||||
] + [
|
||||
{'text': char, 'bbox': {'x0': 80 + index * 4, 'y0': 40, 'x1': 83 + index * 4, 'y1': 50}}
|
||||
for index, char in enumerate('PART-A')
|
||||
]
|
||||
record_inline_layout_snapshot(documents[1], {
|
||||
'snapshot_version': 'shipping_document_table_snapshot.v1', 'status': 'ready',
|
||||
'tables': [{'table_id': 'table-1', 'page_no': 1}],
|
||||
'coordinate_evidence': {
|
||||
'tables': {'table-1': glyphs}, 'pages': {'1': {'width': 200, 'height': 100}},
|
||||
'page_glyphs': {'1': glyphs}, 'sources': {'pages': {'1': 'pdf_coordinate'}},
|
||||
},
|
||||
})
|
||||
db.session.commit()
|
||||
|
||||
def _force_review(**_kwargs):
|
||||
return RuntimeParseStrategy('needs_review', (1,), None, ('PARSE_STRATEGY_ROW_MODE_AMBIGUOUS',))
|
||||
|
||||
monkeypatch.setattr(
|
||||
'app.services.shipping_notice.document_layout.runtime_parse_strategy.resolve_runtime_parse_strategy',
|
||||
_force_review,
|
||||
)
|
||||
candidate = quality._candidate_for_sample(
|
||||
profile=profile, document_id=documents[1].id, table_id='table-1',
|
||||
)
|
||||
assert candidate['rows'] == [{'customer_po_line_no': '20', 'part_number': 'PART-A'}]
|
||||
|
||||
|
||||
def test_profile_checksum_change_invalidates_approved_quality_credential(app):
|
||||
"""关键断言:Profile checksum 变更后,旧盲测凭证绝不能继续放行。"""
|
||||
with app.app_context():
|
||||
|
||||
Reference in new issue
Block a user