feat(file-check): 更新文件检核工具 API Key 配置及相关文档
This commit is contained in:
1 parent
634dee4b81
commit
55cf7ff734
74 files changed
+1525
-1182
No files matched your search
@@ -19,15 +19,24 @@ _PO_NUMBER_PATTERNS = (
|
||||
|
||||
|
||||
def normalize_po_number(value: Any) -> str:
|
||||
"""
|
||||
标准化采购单号;Wistron 等客户原文常带 ZNB 前缀(如 ZNB16754796 / ZNB-16754796),输出为纯数字段。
|
||||
"""
|
||||
text = str(value or "").strip()
|
||||
if not text:
|
||||
return ""
|
||||
if text.lower() in {"number", "no", "n/a", "na", "none"}:
|
||||
return ""
|
||||
upper = text.upper()
|
||||
if upper.startswith("ZNB") and len(text) > 3:
|
||||
tail = text[3:].strip().lstrip("-_/ ")
|
||||
if tail.isdigit():
|
||||
return tail
|
||||
return text
|
||||
|
||||
|
||||
def find_po_number_in_document(text: str) -> str:
|
||||
"""从发货通知全文中按正则模式提取 PO Number。"""
|
||||
raw = str(text or "")
|
||||
if not raw.strip():
|
||||
return ""
|
||||
@@ -39,6 +48,7 @@ def find_po_number_in_document(text: str) -> str:
|
||||
|
||||
|
||||
def enrich_notice_with_po_number(parsed: dict[str, Any], *, raw_text: str = "") -> dict[str, Any]:
|
||||
"""将结构化/文档级 PO Number 回填到 parsed 结果(含 ZNB 前缀标准化)。"""
|
||||
po_number = normalize_po_number(
|
||||
parsed.get("po_number") or parsed.get("PO Number") or parsed.get("purchase_order_number")
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user