空运未填报价日期时不默认当天,查出舱位后由销售点选再写回日期。
包装类型里的托盘不再被抄进增值服务。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -46,7 +46,7 @@ _LABEL_KEYS = (
|
||||
r"包装方式|包装类型|货量|货物数量|整柜或拼柜|箱型箱量|"
|
||||
+ _QUOTE_DATE_LABEL_RE
|
||||
+ r"|运输分类|车型/数量|车型数量|"
|
||||
r"贸易条款|货好时间|货源地|提货地址|收货地址|送货地址|商品海关编码|海关编码|HS编码|HS|是否含油|是否含电|是否含磁|"
|
||||
r"贸易条款|货好时间|货源地|提货地址|收货地址|送货地址|增值服务(非必填)|增值服务|商品海关编码|海关编码|HS编码|HS|是否含油|是否含电|是否含磁|"
|
||||
r"客户名称|货值|是否为危险品|通关口岸(非必填)|通关口岸"
|
||||
)
|
||||
_LABEL_LINE = re.compile(rf"^({_LABEL_KEYS})\s*[::]\s*(.+)$")
|
||||
@@ -68,6 +68,8 @@ _OPTIONAL_INQUIRY_LABELS = (
|
||||
"收货地址",
|
||||
"送货地址",
|
||||
"贸易条款",
|
||||
"增值服务(非必填)",
|
||||
"增值服务",
|
||||
"起运港",
|
||||
)
|
||||
# 图上常见「4. 希望送到…」:编号项不是询价字段,值收到这里为止。
|
||||
@@ -112,6 +114,7 @@ _CLARIFY_NAMES = frozenset(
|
||||
"送货地址",
|
||||
"通关口岸",
|
||||
"始发站",
|
||||
"增值服务",
|
||||
}
|
||||
)
|
||||
# 报价单表头和格子在同一行:只洗这些询价键,不碰提货/收货地址。
|
||||
@@ -477,6 +480,7 @@ def extract_inquiry_snapshot(
|
||||
if str(facts.get(key) or "").strip():
|
||||
facts[key] = clip_inquiry_value(str(facts[key]))
|
||||
facts = _drop_fee_place_values(_clip_sheet_inquiry_facts(facts))
|
||||
facts = _apply_air_added_services(text, facts, mode)
|
||||
subtype = str(facts.get("运输类型") or "").strip()
|
||||
return {
|
||||
"business_line": mode,
|
||||
@@ -524,6 +528,7 @@ def extract_inquiry_snapshot(
|
||||
if str(facts.get(key) or "").strip():
|
||||
facts[key] = clip_inquiry_value(str(facts[key]))
|
||||
facts = _drop_fee_place_values(_clip_sheet_inquiry_facts(facts))
|
||||
facts = _apply_air_added_services(text, facts, mode)
|
||||
land_subtype = str((b_payload or {}).get("land_subtype") or facts.get("运输类型") or "").strip()
|
||||
if land_subtype and not str(facts.get("运输类型") or "").strip():
|
||||
facts["运输类型"] = land_subtype
|
||||
@@ -703,6 +708,15 @@ def _clip_sheet_inquiry_facts(facts: dict[str, str]) -> dict[str, str]:
|
||||
return {key: val for key, val in out.items() if str(val or "").strip()}
|
||||
|
||||
|
||||
def _apply_air_added_services(text: str, facts: dict[str, str], mode: str) -> dict[str, str]:
|
||||
"""空运才收增值服务。其他业务线原样返回,避免海运口播里的托盘被记进来。"""
|
||||
if (mode or "").strip().upper() != "AIR":
|
||||
return facts
|
||||
from agent.schema.added_services import apply_air_value_added
|
||||
|
||||
return apply_air_value_added(text, facts)
|
||||
|
||||
|
||||
def _merge_optional_inquiry_labels(text: str, facts: dict[str, str]) -> dict[str, str]:
|
||||
"""把原话里的通关口岸、货好时间、提货/收货地址写进询价事实。有值才覆盖。"""
|
||||
from agent.schema.field_validate import normalize_facts
|
||||
@@ -754,6 +768,9 @@ def _harvest_labels(text: str, labels: tuple[str, ...]) -> dict[str, str]:
|
||||
begin = pos + len(label)
|
||||
end = kept[i + 1][0] if i + 1 < len(kept) else len(raw)
|
||||
chunk = raw[begin:end]
|
||||
# 增值服务只认冒号后同一行。空行不能把下一行「报价日期(非必填):」收成服务。
|
||||
if label.startswith("增值服务"):
|
||||
chunk = chunk.split("\n", 1)[0]
|
||||
chunk = re.sub(r"^[\s::,,、]+", "", chunk)
|
||||
chunk = re.sub(r"[\s,,、]+$", "", chunk)
|
||||
if chunk:
|
||||
|
||||
Reference in New Issue
Block a user