feat(shipping-notice): 升级货代发货流程为五阶段,完善业务校验

将货代发货流程从四阶段扩展为五阶段,拆分上传相关逻辑至独立的货代上传阶段;
统一多语言文案修正客户状态语义,将"客户尚未识别"调整为符合业务的"客户尚未确认";
新增严格的上传成功验证谓词,需同时满足任务状态、全部预约单上传成功、存在有效成功上传尝试三个条件方可标记为完成;
新增坐标取值模型配置,支持Legacy冻结绝对坐标和锚点框架受限平移两种模式;
更新全链路相关文档、前端组件、后端服务与测试用例,确保业务逻辑对齐新业务规则。
This commit is contained in:
hugo committed 2026-08-21 09:20:47 +08:00
1 parent 1b6483a4ea
commit 935bf26fa6
86 files changed
+2743 -311

No files matched your search

@@ -504,6 +504,8 @@ def test_compacted_pdf_coordinate_evidence_remains_ready_when_asset_is_recoverab
assert pending.payload_json['layout_candidate'] == snapshot['layout_candidate']
assert 'tables' not in pending.payload_json['coordinate_evidence']
assert 'page_glyphs' not in pending.payload_json['coordinate_evidence']
assert pending.payload_json['matching_features']['version'] == 'v1'
assert pending.payload_json['matching_features']['tables'][0]['bbox'] == [0.01, 0.01, 0.3, 0.2]
assert 'shipping_document_layout_page_glyphs_compacted' in pending.issues_json
assert 'shipping_document_layout_table_glyphs_compacted' in pending.issues_json
assert 'shipping_document_layout_coordinate_evidence_on_demand' in pending.issues_json
@@ -569,6 +571,36 @@ def test_on_demand_evidence_does_not_treat_business_table_list_as_coordinate_map
assert 'tables' not in restored['coordinate_evidence']
def test_on_demand_evidence_returns_coordinates_merged_from_current_layout(app):
"""冻结快照缺坐标而当前 Layout 已有坐标时,必须返回合并后的运行期证据。"""
with app.app_context():
document = _document()
current = record_inline_layout_snapshot(document, {
**_snapshot(),
'coordinate_evidence': {
'pages': {'1': {'width': 100, 'height': 200}},
'page_glyphs': {'1': [{'text': 'H', 'bbox': {'x0': 1, 'y0': 1, 'x1': 2, 'y1': 2}}]},
'tables': {'table-1': [{'text': 'H', 'bbox': {'x0': 1, 'y0': 1, 'x1': 2, 'y1': 2}}]},
'sources': {'pages': {'1': 'pdf_coordinate'}},
},
})
db.session.flush()
document.current_layout_version = current
frozen_layout = {
**_snapshot(),
'tables': [{'table_id': 'table-1', 'page_no': 1, 'bbox': {'x0': 0, 'y0': 0, 'x1': 100, 'y1': 200}}],
'coordinate_evidence': {'pages': {'1': {'width': 100, 'height': 200}}},
}
restored = ensure_on_demand_coordinate_evidence(
document=document, layout=frozen_layout, page_nos={1},
)
# 关键断言:不得因当前版本坐标存在而错误返回旧冻结快照。
assert restored['coordinate_evidence']['page_glyphs']['1'][0]['text'] == 'H'
assert restored['coordinate_evidence']['tables']['table-1'][0]['text'] == 'H'
def test_on_demand_evidence_restores_every_table_on_the_same_page(app, monkeypatch):
"""同一页存在多张物理表时,每个 table_id 都必须获得独立坐标字符证据。"""
with app.app_context():