fix(shipping-notice): 修复订单解析签名与库存 RPA 导出流程

- 修正订单提取运行与模板签名处理
- 优化库存 RPA 归档及报表导出逻辑
- 补充库存参数、归档、运行与签名测试
- 更新 Shipping Notice 技术文档
This commit is contained in:
hugo committed 2026-09-09 16:59:52 +08:00
1 parent dabf140e41
commit 2bb7822247
10 files changed
+300 -43

No files matched your search

@@ -6,6 +6,7 @@ services/shipping_notice/document_layout/order_profile_signature.py
逻辑:由 validation_service 在发布检查前调用;本模块不负责数据库提交或 Profile 引用更新。
另提供 clip_table_bbox_to_business_rows,供签名观测与运行时 matcher 共用。
单逻辑表头行将格内折行副标签按 x 并入所属列,保留文案、不拆成新身份列。
table_patterns 仅纳入 business_lines;line_field_supplement 不进匹配身份。
"""
from __future__ import annotations
@@ -198,8 +199,9 @@ def build_layout_signature(
"""
生成版面签名快照;相同输入必须得到相同 checksum。
核心逻辑:解析模板表区/表头/字段关系 → 从样本区域读取固定文字 → 多样本聚合
中位数与容差 → 过滤动态值与单样本噪声 → 计算稳定 checksum。
核心逻辑:解析模板表区/表头/字段关系 → 仅对 business_lines 建 table_patterns →
从样本区域读取固定文字 → 多样本聚合中位数与容差 → 过滤动态值与单样本噪声 →
计算稳定 checksum。line_field_supplement 只服务按 LN 补料号,不进匹配身份。
Args:
definition: 当前草稿或冻结 Profile 定义 JSON。
@@ -225,11 +227,15 @@ def build_layout_signature(
order_field_layouts=definition.get('order_field_layouts') or [],
)
# [STEP 2] 页面与表区几何模式
# [STEP 2] 页面与主表明细几何模式(排除 line_field_supplement)
page_patterns = _build_page_patterns(sample_layouts=sample_layouts)
matching_tables = [
table for table in profile.table_regions
if str(getattr(table, 'region_role', None) or 'business_lines') == 'business_lines'
]
table_patterns = [
_build_table_pattern(table=table, sample_layouts=sample_layouts)
for table in profile.table_regions
for table in matching_tables
]
field_relation_graph = _build_field_relation_graph(profile, sample_layouts=sample_layouts)
evidence_quality = _build_evidence_quality(