refactor(export): 整体采纳改块通道,退役骨架引擎与手工导出

This commit is contained in:
lianjianwei2024
2026-11-07 13:42:54 +08:00
parent f142910bbd
commit 6ad0d1a442
222 changed files with 869 additions and 78980 deletions

View File

@@ -384,7 +384,7 @@ def _region3(p, c, d3):
return "/".join(x for x in (p, c, d3) if x) or None
def match_bill(hist, row, base, kinds, units, classes, limit=20, srcs=None, pfrom=None, pto=None, self_name=None, self_src=None, area=None, projs=None, pmin=None, pmax=None, att="all", unit_free=False):
def match_bill(hist, row, base, kinds, units, classes, limit=20, srcs=None, pfrom=None, pto=None, self_name=None, self_src=None, area=None, projs=None, pmin=None, pmax=None, att="all", unit_free=False, only_batch_ids=None):
bf, bt = span(base) # 基准期次:单月 int 或 (起, 止) 区间
"""row: sqlite Row of s_bills
unit_free(2026-11-02 主人定,Excel 批量匹配专用):Excel 只有一列清单名称没有单位/编码 ——
@@ -404,6 +404,14 @@ def match_bill(hist, row, base, kinds, units, classes, limit=20, srcs=None, pfro
# 决策 211(2026-10-26 主人定):历史比对默认硬过滤——单位「项」的清单与单价 0 的清单
# 无比价意义,不搜出;空价(NULL)不算 0、保守保留(同 199 精神)。各档位共用本串。
w += " AND COALESCE(b.Unit,'')<>'项' AND (b.Price IS NULL OR b.Price<>0)"
# 决策 277(2026-11-07 主人定):清单比对同后缀硬过滤——调用方传入允许的批次 id 集
# (同后缀+判不出后缀的;None=不过滤,工料机路径恒传 None)。四档共用本串。
if only_batch_ids is not None:
if only_batch_ids:
w += " AND bt.id IN (%s)" % ",".join("?" * len(only_batch_ids))
args = args + list(only_batch_ids)
else:
w += " AND 1=0"
out, seen_ids, qn = [], set(), norm_match(row["Name"])
# L0 精确:编码+名称+单位(b.id 带回 → 前端展开定额 / 右栏「定额编码·名称」用)。
# 2026-10-10 决策 27:哈希里的编码只取前 9 位(后 3 位是项目内顺序码,没有对比意义),
@@ -486,7 +494,7 @@ def match_bill(hist, row, base, kinds, units, classes, limit=20, srcs=None, pfro
return res[:limit]
def hist_search(hist, kinds, units, area, pfrom, pto, kw, limit=200, self_name=None, self_src=None, page=1, stop=None, projs=None, pmin=None, pmax=None, att="all"):
def hist_search(hist, kinds, units, area, pfrom, pto, kw, limit=200, self_name=None, self_src=None, page=1, stop=None, projs=None, pmin=None, pmax=None, att="all", only_batch_ids=None):
"""独立检索(2026-10-08 主人定第 4 轮 B 方案):跨**全部入库项目**(kind='project')按
条件+关键词 直查清单库,与工作台选中的行无关(主人:"搜索条件高于点选清单")。
行结构与 match_bill() 完全一致 —— 前端 renderHist / 右栏 / ± 展开零改动复用,差异只有:
@@ -512,6 +520,14 @@ def hist_search(hist, kinds, units, area, pfrom, pto, kw, limit=200, self_name=N
# 决策 211(2026-10-26 主人定):检索模式同款默认硬过滤——单位「项」与单价 0 的清单不搜出
extra.append("COALESCE(b.Unit,'')<>'项'")
extra.append("(b.Price IS NULL OR b.Price<>0)")
# 决策 277(2026-11-07 主人定):清单检索同后缀硬过滤——调用方传入允许的批次 id 集
# (同后缀+判不出后缀的;None=不过滤,工料机路径恒传 None)。
if only_batch_ids is not None:
if only_batch_ids:
extra.append("bt.id IN (%s)" % ",".join("?" * len(only_batch_ids)))
args = args + list(only_batch_ids)
else:
extra.append("1=0")
nm = (self_name or "").strip()
src = (self_src or "").strip()
if src or nm: