feat: 落地决策 209/211/213——临删联动与0量隐藏、历史检索硬过滤项单位与0价、附件列及只看未绑筛选

This commit is contained in:
lianjianwei2024
2026-10-26 15:12:09 +08:00
parent 79ab8d1ffd
commit 5de58b49ad
12 changed files with 680 additions and 459 deletions

View File

@@ -278,7 +278,9 @@ def _dyn_rows(sc, sid, uw_id=None):
if c == row[1] and nm:
row[2] = nm
break
return rows
# 决策 209(2026-10-26 主人定):显示端与导出端一致(199)——数量为 0 的行整行不显示,
# 取代 196「骨架保行」的显示端口径;导出端 199 与 qty_map_uw 供数链不经过此处,不动。
return [r for r in rows if r[5] is not None and float(r[5]) != 0]
def dyn_uw_rows(sc, sid, uw_id):

View File

@@ -399,6 +399,9 @@ def match_bill(hist, row, base, kinds, units, classes, limit=20, srcs=None, pfro
w += " AND EXISTS(SELECT 1 FROM bill_attach ba WHERE ba.bill_id=b.id)"
elif att == "no":
w += " AND NOT EXISTS(SELECT 1 FROM bill_attach ba WHERE ba.bill_id=b.id)"
# 决策 211(2026-10-26 主人定):历史比对默认硬过滤——单位「项」的清单与单价 0 的清单
# 无比价意义,不搜出;空价(NULL)不算 0、保守保留(同 199 精神)。各档位共用本串。
w += " AND COALESCE(b.Unit,'')<>'项' AND (b.Price IS NULL OR b.Price<>0)"
out, seen_ids, qn = [], set(), norm_match(row["Name"])
# L0 精确:编码+名称+单位(b.id 带回 → 前端展开定额 / 右栏「定额编码·名称」用)。
# 2026-10-10 决策 27:哈希里的编码只取前 9 位(后 3 位是项目内顺序码,没有对比意义),
@@ -503,6 +506,9 @@ def hist_search(hist, kinds, units, area, pfrom, pto, kw, limit=200, self_name=N
extra.append("EXISTS(SELECT 1 FROM bill_attach ba WHERE ba.bill_id=b.id)")
elif att == "no":
extra.append("NOT EXISTS(SELECT 1 FROM bill_attach ba WHERE ba.bill_id=b.id)")
# 决策 211(2026-10-26 主人定):检索模式同款默认硬过滤——单位「项」与单价 0 的清单不搜出
extra.append("COALESCE(b.Unit,'')<>'项'")
extra.append("(b.Price IS NULL OR b.Price<>0)")
nm = (self_name or "").strip()
src = (self_src or "").strip()
if src or nm:
@@ -588,6 +594,9 @@ def hist_search_lme(hist, orgs=None, area=None, pfrom=None, pto=None, kw="", pmi
oargs += self_ids
_kw_conds(["name", "spec", "unit"], kw, outer, oargs) # 不按排序(决策 27)
_stop_conds(["name", "spec", "unit"], stop, outer, oargs) # 屏蔽词(2026-10-11):命中即整行排除
# 决策 211(2026-10-26 主人定):检索模式工料机 0 价不搜出(别名 price=NoTaxPrice,
# 工程/信息价/市场价三支同滤;NULL 保留)
outer.append("(price IS NULL OR price<>0)")
if pfrom is not None:
outer.append("p2 >= ?"); oargs.append(pfrom)
if pto is not None:
@@ -689,6 +698,8 @@ def match_lme(hist, row, base, orgs=None, limit=20, srcs=None, pfrom=None, pto=N
w, args = _filters(kinds or [], [], [], self_src=self_src, area=area, orgs=orgs, projs=projs)
wpr, apr = _price_range("l.NoTaxPrice", pmin, pmax)
w = w + " AND " + wpr; args = args + apr
# 决策 211(2026-10-26 主人定):除税价 0 的历史工料机不搜出(空价 NULL 保留)
w = w + " AND (l.NoTaxPrice IS NULL OR l.NoTaxPrice<>0)"
res = []
if "project" in srcs:
# 工程分支三档同用「项目工料机」过滤(2026-10-09 主人拍板:配合比行(Kind 6, m3)曾
@@ -792,6 +803,9 @@ def match_lme(hist, row, base, orgs=None, limit=20, srcs=None, pfrom=None, pto=N
wp, argp = _filters([], [], [], prefix="bt", self_src=self_src, area=area, orgs=orgs, projs=projs)
wpp, app = _price_range("p.NoTaxPrice", pmin, pmax)
wp = wp + " AND " + wpp; argp = argp + app
# 决策 211(2026-10-26 主人定):信息价/市场价 0 价条目同样不搜出(0 价无比价意义)——
# 这与 2026-10-09「不能屏蔽价格库任何单位」不冲突:本条滤的是**价格 0**(数据质量),不动单位/类别。
wp = wp + " AND (p.NoTaxPrice IS NULL OR p.NoTaxPrice<>0)"
if pk:
sqlp = """SELECT p.Name, p.Specification, p.Unit, p.NoTaxPrice, p.TaxRate, p.TaxPrice, p.Note note,
bt.Name proj, bt.FileKind,