feat(shipping-notice): 实现滚动履约功能,优化发货通知流程与代码清理

清理废弃的ShippingCase相关代码与依赖,统一使用ShippingNotice直接关联客户数据。调整库存网关依赖规则,支持仅对库存满足或已人工放行的订单行生成发货Excel,实现滚动履约逻辑。
This commit is contained in:
hugo committed 2026-08-26 02:47:07 +08:00
1 parent 7cfd5d167e
commit 1e5aedb9ed
235 files changed
+11394 -9613

No files matched your search

+34 -1
View File
@@ -601,6 +601,33 @@ def test_automark_exposes_acroform_widget_as_independent_visual_candidate():
assert 'value_binding' not in widget_candidate['binding']
def test_automark_merges_same_field_same_geometry_sources():
"""关键断言:同字段同页同坐标的 PDF 与 Widget 候选只生成一个画布框。"""
from app.services.shipping_notice import order_document_profile_pdf_automark_service as service
candidates = [
{
'candidate_id': 'pdf-1', 'candidate_kind': 'field_binding',
'binding': {'field_id': 'f-po', 'field_code': 'customer_po_number', 'scope': 'header', 'visual_binding': {
'page_no': 1, 'normalized_bbox': {'x0': .1, 'y0': .2, 'x1': .3, 'y1': .4},
}},
'evidence_sources': ['pdf_coordinate'], 'needs_review': True,
},
{
'candidate_id': 'widget-1', 'candidate_kind': 'field_binding',
'binding': {'field_id': 'f-po', 'field_code': 'customer_po_number', 'scope': 'header', 'visual_binding': {
'page_no': 1, 'normalized_bbox': {'x0': .1, 'y0': .2, 'x1': .3, 'y1': .4},
}},
'evidence_sources': ['acroform_widget'], 'needs_review': True,
},
]
merged = service._merge_duplicate_field_binding_candidates(candidates)
assert len(merged) == 1
assert merged[0]['evidence_sources'] == ['pdf_coordinate', 'acroform_widget']
def test_automark_keeps_unmatched_acroform_widget_as_unbound_visual_candidate(monkeypatch):
"""Widget 技术名未匹配 Schema 时仍可供人工框选,禁止自动猜业务字段。"""
from app.services.shipping_notice import order_document_profile_pdf_automark_service as service
@@ -727,7 +754,11 @@ def test_automark_enriches_widget_table_candidate_with_coordinate_header_text():
coordinate.suggest_order_field_layouts.return_value = {'order_field_candidates': []}
widget_geometry = {
'table_region': {'x0': .1, 'y0': .15, 'x1': .9, 'y1': .8},
'subrow_layouts': [{'row_offset': 0, 'column_boundaries': [0, .25, 1]}],
# 动态 XFA 的表头控件有展示值时,Widget 聚类会把表头带误判为候选行。
'subrow_layouts': [{
'row_offset': 0, 'column_boundaries': [0, .25, 1],
'region': {'x0': .1, 'y0': .15, 'x1': .9, 'y1': .2},
}],
'header_regions': [], 'status': 'needs_review',
}
with patch('app.services.shipping_notice.order_document_profile_pdf_automark_service._profile', return_value=profile), patch(
@@ -751,6 +782,8 @@ def test_automark_enriches_widget_table_candidate_with_coordinate_header_text():
assert field['field_code'] == 'line_no'
assert field['region'] == {'x0': .1, 'y0': .15, 'x1': .3, 'y1': .2}
assert field['evidence_sources'] == ['acroform_widget_geometry', 'pdf_coordinate']
# 已确认的表头带不得同时作为可保存的 Widget 明细行。
assert widget_candidate['payload']['subrow_layouts'] == []
def test_automark_marks_opencv_and_native_structure_conflict_for_review():