feat(shipping-notice): 添加 MinerU 订单附件表格结构化功能,更新环境配置和数据模型以支持新布局解析和文档模板管理

This commit is contained in:
hugo committed 2026-07-22 18:52:43 +08:00
1 parent c4095b08da
commit c35223d49d
148 files changed
+15709 -1353

No files matched your search

+13 -4
View File
@@ -1319,9 +1319,9 @@ def test_flattened_text_does_not_guess_external_reservation_id():
assert issues[0]["severity"] == "blocking"
def test_adjudication_supports_non_numeric_reservation_templates():
"""不同来源模板可使用字母型 Reservation ID,后端只排除内部 ID,不绑定单一数字模板。"""
raw_text = "Part Number\tReservation Order\tQty\nA001\tAWS-311\t2"
def test_adjudication_supports_five_digit_reservation_templates():
"""不同来源模板可使用 5 位数字 Reservation ID,并保留明确列证据。"""
raw_text = "Part Number\tReservation Order\tQty\nA001\t12345\t2"
lines = [{"part_number": "A001", "reservation_id": "", "qty": 2, "uom": "EA"}]
adjudicated, issues, status = adjudicate_notice_lines(
@@ -1329,7 +1329,7 @@ def test_adjudication_supports_non_numeric_reservation_templates():
)
assert status == "ready"
assert adjudicated[0]["reservation_id"] == "AWS-311"
assert adjudicated[0]["reservation_id"] == "12345"
assert issues[0]["reason"] == "value_corrected"
@@ -1368,6 +1368,15 @@ Part Number\tReservation ID\tQty\tUnit Price\tAmount
assert lines[0]["reservation_id"] == "1000140351"
def test_extract_notice_supports_five_digit_reservation_free_text():
"""自由文本回退路径应识别 5 位 Reservation ID、内部料号和数量。"""
parsed, _confidence, _warnings = _heuristic_extract("12345 10-40594-001 2")
assert parsed["lines"] == [{
"reservation_id": "12345", "part_number": "10-40594-001", "qty": 2.0,
}]
def test_does_not_infer_reservation_id_without_configured_header():
headers = ["Part Number", "Ref", "Qty"]
rows = [["10-40594-001", 1000140351, 2]]