机器人回复补调用编码;集拼报价条带字段写到下一行,业务员落中文名。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
linmianxun
2026-10-06 13:41:12 +08:00
co-authored by Cursor
parent 58df358577
commit 177dd0b25f
22 changed files with 1934 additions and 210 deletions
+30 -1
View File
@@ -232,6 +232,19 @@ def overlay_labeled_facts(
return {"filepath": str(tmp), "file_b64": out_b64}
def _band_value_goes_below(ws, label_cell) -> bool:
"""同一行凑齐业务员、客户名称、始发地,就是集拼询价条带。"""
text = str(label_cell.value or "").replace(" ", "")
if not any(key in text for key in ("客户名称", "业务员", "始发地", "货物类型")):
return False
hits = 0
for cell in ws[label_cell.row]:
compact = str(cell.value or "").replace(" ", "").replace(":", "").replace(":", "")
if compact in {"业务员", "客户名称", "始发地", "货物类型", "条款", "发货日期"}:
hits += 1
return hits >= 3
def _match_collab_label(text: str) -> tuple[str, ...] | None:
raw = (text or "").replace(":", ":").strip()
for marker, keys in _COLLAB_LABEL_MARKERS:
@@ -241,7 +254,23 @@ def _match_collab_label(text: str) -> tuple[str, ...] | None:
def _label_value_cell(ws, label_cell):
"""标签右侧格子;合并标签则从合并区右边开始。"""
"""标签右侧格子;合并标签则从合并区右边开始。
跨境集拼蓝条是「业务员 | 客户名称 | 始发地」,值在下一行。
写到右侧会把客户名称填进「始发地」表头。
"""
if _band_value_goes_below(ws, label_cell):
col = label_cell.column
merged = getattr(ws, "merged_cells", None)
if merged is not None:
for rng in merged.ranges:
if (
rng.min_row <= label_cell.row <= rng.max_row
and rng.min_col <= label_cell.column <= rng.max_col
):
col = rng.min_col
break
return ws.cell(row=label_cell.row + 1, column=col)
row_idx = label_cell.row
start_col = label_cell.column + 1
merged = getattr(ws, "merged_cells", None)