销售侧汇总统一叫费用合计,并认准空运费的金额。

企微跳转改为账号密码登录,报价卡上的费用按原金额改回;航线按单价数量金额报价时不再记成海运费。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-24 11:15:33 +08:00
co-authored by Cursor
parent 84207bb4e5
commit 4dfd756bcf
24 changed files with 778 additions and 150 deletions
+12 -4
View File
@@ -80,17 +80,25 @@ def split_segments(text: str) -> SplitOutcome:
"""
按运输方式出现的先后切段。
「段1:海运」和同一句里的「陆运+海运」都认。同一方式出现两次则 same_mode,不建单。
已经标了两段以上时,只按「段N:」切,表里重复的「海运/陆运」不当新段。
「段1:海运」和同一句里的「陆运+海运」都认。
写了「段N:」就只按段标切:一份海运报价单文件名会先标「段1:海运」,
表里再写「运输方式:海运」仍是单段,不能报同一方式两段。
没写段标时,报价单反复出现「海运」也当单段;只有「陆运+海运」才切多段。
真的两段都是海运(段1:海运 + 段2:海运)才 same_mode,不建单。
每段正文只收「字段名:值」,不猜没写标签的港口。
"""
raw = text or ""
explicit = list(_EXPLICIT_SEG.finditer(raw))
hits = explicit if len(explicit) >= 2 else list(_MODE_RE.finditer(raw))
# explicit_only_segment_split:有段标就只认段标。一份附件常被标「段1:海运」,表里还会再写一次海运。
hits = explicit if explicit else list(_MODE_RE.finditer(raw))
if len(hits) < 2:
return SplitOutcome()
modes = [_MODE_BY_WORD[hit.group(2)] for hit in hits]
if len(modes) != len(set(modes)):
unique = set(modes)
if len(modes) != len(unique):
# 没标出两段时,同一种方式写两次仍是单段(海运报价单标题+运输方式)。
if len(explicit) < 2 and len(unique) == 1:
return SplitOutcome()
return SplitOutcome(same_mode=True)
segments: list[Segment] = []
for i, hit in enumerate(hits):