feat(采纳): 采纳工料机改按名称/规格/单位匹配两级汇总(决策108)
按决策108重写 _adopt_summary_rows:①单位工料机命中→按单位编码落地; ②仅项目工料机命中→按项目编码落地并补单位行;③都没有→来源行补两级 (x_adopt_added,取消采纳回收)。匹配键为名称/规格/单位(strip 全等), 编码只随行走,取代决策74/75采纳侧编码口径;同键多条按除税价升序取中位、 2条取低价、偶数多取居中偏低;合并工料机后的保留行现值为准,被合并行不参选; 采纳定额消耗量按映射改码,采纳来源价不再落两级汇总。边界:来源行名称为空 直接走③、同码异物不重复插行。 测试:新增 test_adopt_lme_match.py 6 项;api_harness 造数支持 proj_lmes/ uw_lmes 覆盖两级汇总。另更新决策台账与术语表,清理过时文档与临时 bat 脚本。
This commit is contained in:
@@ -34,11 +34,14 @@ def _free_port():
|
||||
|
||||
|
||||
# ------------------------------------------------------------------ 造数
|
||||
def make_cos4(path, proj_name, bills, lmes=(), build_unit="测试建设单位"):
|
||||
def make_cos4(path, proj_name, bills, lmes=(), build_unit="测试建设单位",
|
||||
proj_lmes=None, uw_lmes=None):
|
||||
"""构造最小可解析的 .cos4(zip 内 Project.xml + 单位工程 xml)。
|
||||
|
||||
bills: [(编码, 名称, 特征, 单位, 工程量, 单价)] —— 分部分项清单(自动配 1 条定额 + 定额消耗)
|
||||
lmes: [(编码, 名称, 规格, 单位, 不含税价, 含税价)] —— 工料机(会进 lmes 与项目级汇总)
|
||||
proj_lmes/uw_lmes: 分别覆盖项目级/单位级汇总的行(默认都用 lmes;
|
||||
决策 108 测试用——造「仅项目工料机有」的场景)
|
||||
另固定带:1 条措施清单(安全文明施工费)、项目特征 1 条、总造价 1234567.89。
|
||||
"""
|
||||
lme_proj = "".join(
|
||||
@@ -46,7 +49,7 @@ def make_cos4(path, proj_name, bills, lmes=(), build_unit="测试建设单位"):
|
||||
' Kind="1" Quantity="100" NoTaxPrice=%s TaxPrice=%s/>'
|
||||
% (quoteattr(it[0]), quoteattr(it[1]), quoteattr(it[2]), quoteattr(it[3]),
|
||||
quoteattr(it[4]), quoteattr(it[5]))
|
||||
for it in lmes)
|
||||
for it in (lmes if proj_lmes is None else proj_lmes))
|
||||
proj = (
|
||||
'<ConstructionProject Name=%s FileKind="1" BulidUnit=%s>'
|
||||
'<SummaryOfCost Total="1234567.89"/>'
|
||||
@@ -84,7 +87,7 @@ def make_cos4(path, proj_name, bills, lmes=(), build_unit="测试建设单位"):
|
||||
' Unit=%s Kind="1" Quantity="100" NoTaxPrice=%s TaxPrice=%s/>'
|
||||
% (quoteattr(it[0]), quoteattr(it[1]), quoteattr(it[2]), quoteattr(it[3]),
|
||||
quoteattr(it[4]), quoteattr(it[5]))
|
||||
for it in lmes)))
|
||||
for it in (lmes if uw_lmes is None else uw_lmes))))
|
||||
with zipfile.ZipFile(path, "w", zipfile.ZIP_DEFLATED) as z:
|
||||
z.writestr("Project.xml", proj.encode("utf-8"))
|
||||
z.writestr("UW1.xml", uw.encode("utf-8"))
|
||||
|
||||
Reference in New Issue
Block a user