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
@@ -185,8 +185,8 @@ def test_layout_job_exhaustion_fails_version_without_leaking_provider_error(app)
|
||||
assert 'shipping_document_layout_job_exhausted' in version.issues_json
|
||||
|
||||
|
||||
def test_layout_job_xfa_hybrid_skips_mineru_path(app):
|
||||
"""XFA hybrid 文档不得进入 MinerU/PDFium 表格路径。"""
|
||||
def test_layout_job_xfa_hybrid_keeps_xfa_identity_and_builds_visual_layout(app):
|
||||
"""XFA hybrid 必须保留 datasets 身份,同时进入统一视觉表格/Layout 管线。"""
|
||||
from tests.test_shipping_xfa_helpers import build_synthetic_xfa_hybrid_pdf, load_datasets_fixture
|
||||
|
||||
with app.app_context():
|
||||
@@ -197,7 +197,20 @@ def test_layout_job_xfa_hybrid_skips_mineru_path(app):
|
||||
return_value=pdf_bytes,
|
||||
), patch(
|
||||
'app.jobs.handlers.shipping_document_layout.build_mineru_table_snapshot',
|
||||
) as mineru_mock:
|
||||
) as visual_layout_mock:
|
||||
visual_layout_mock.return_value = {
|
||||
'snapshot_version': 'shipping_document_table_snapshot.v1',
|
||||
'provider': 'mineru',
|
||||
'status': 'ready',
|
||||
'tables': [{'table_id': 'visual-main', 'page_no': 1}],
|
||||
'capability': {},
|
||||
'layout_candidate': {'schema_version': 'shipping_document_layout.v1'},
|
||||
'coordinate_evidence': {
|
||||
'pages': {'1': {'width': 100, 'height': 100}},
|
||||
'page_glyphs': {'1': []},
|
||||
},
|
||||
'issues': [],
|
||||
}
|
||||
run_shipping_document_layout(
|
||||
JobContext(config=dict(app.config), logger=None, extras={}),
|
||||
{'job_id': job.id},
|
||||
@@ -206,10 +219,10 @@ def test_layout_job_xfa_hybrid_skips_mineru_path(app):
|
||||
db.session.refresh(version)
|
||||
db.session.refresh(document)
|
||||
db.session.refresh(job)
|
||||
mineru_mock.assert_not_called()
|
||||
visual_layout_mock.assert_called_once()
|
||||
assert version.status == 'ready'
|
||||
assert version.payload_json.get('provider') == 'xfa'
|
||||
assert version.payload_json.get('tables') == []
|
||||
assert version.payload_json.get('provider') == 'mineru'
|
||||
assert version.payload_json.get('tables') == [{'table_id': 'visual-main', 'page_no': 1}]
|
||||
assert version.payload_json['xfa_capability']['structure_analysis_ready'] is True
|
||||
assert document.current_layout_version_id == version.id
|
||||
assert job.status == 'success'
|
||||
@@ -221,16 +234,22 @@ def test_layout_job_xfa_hybrid_skips_mineru_path(app):
|
||||
assert 'counts' not in version.payload_json
|
||||
|
||||
|
||||
def test_runtime_xfa_probe_skips_mineru_for_hybrid(app):
|
||||
"""runtime 在 XFA hybrid 探测成功后不得调用 MinerU。"""
|
||||
def test_runtime_xfa_visual_layout_does_not_create_unfrozen_value_source_capability(app):
|
||||
"""runtime 只提供共享视觉 Layout;正式 Job 才能冻结并附加 datasets capability。"""
|
||||
from tests.test_shipping_xfa_helpers import build_synthetic_xfa_hybrid_pdf, load_datasets_fixture
|
||||
|
||||
from tests.test_shipping_document_layout_runtime import _candidate
|
||||
|
||||
with app.app_context():
|
||||
app.config['SHIPPING_NOTICE_LAYOUT_MINERU_ENABLED'] = True
|
||||
app.config['SHIPPING_NOTICE_LAYOUT_MINERU_BASE_URL'] = 'http://mineru.test'
|
||||
pdf_bytes = build_synthetic_xfa_hybrid_pdf(load_datasets_fixture())
|
||||
with patch(
|
||||
'app.services.shipping_notice.document_layout.runtime.MinerUClient',
|
||||
) as mineru_client:
|
||||
) as mineru_client, patch(
|
||||
'app.services.shipping_notice.document_layout.runtime.parse_mineru_candidate',
|
||||
return_value=_candidate(),
|
||||
):
|
||||
from app.services.shipping_notice.document_layout.runtime import build_mineru_table_snapshot
|
||||
|
||||
snapshot = build_mineru_table_snapshot(
|
||||
@@ -239,7 +258,7 @@ def test_runtime_xfa_probe_skips_mineru_for_hybrid(app):
|
||||
document_id=1,
|
||||
content_hash='a' * 64,
|
||||
)
|
||||
mineru_client.assert_not_called()
|
||||
mineru_client.return_value.parse_file_async.assert_called_once()
|
||||
assert snapshot is not None
|
||||
assert snapshot['provider'] == 'xfa'
|
||||
assert snapshot['tables'] == []
|
||||
assert 'xfa_capability' not in snapshot
|
||||
assert snapshot['provider'] != 'xfa'
|
||||
Reference in new issue
Block a user