feat(export): 决策263-266 单一骨架导出通路/数据全量入库/空骨架规则标注/导入按内容判族
- 决策 263:定额单价专题(三同合并全字段统一、原价三级链、LME Summary 26 属性收口、x_flags 采集、e2e 回归) - 决策 264 补记五:原格式导出只保留骨架回灌一条通路;删除 export_cos.export_zip 旧引擎;新增 skeleton_engine(内容判族/唯一结构位/结构旁注/路径指纹);单位级/项目级非数据层 x_attr/x_side 采集与回灌;导出件成员名改 GBK 原始字节(_GbkZipInfo);后台「导出设置」导出空骨架(标注) - 决策 265:导入按内容判族(zip 内含 ConstructProject→SWT 族,否则 COS 族;裸 XML 同),扩展名不参与拦截;api_scan 取消 EXT_OK 过滤 - 决策 266:结构位统一「自增区域/自增块/自增行」,取消「固定」;min_count(区域1/块行0),导出条数=max;区域数据0条保底1空壳;LME 汇总两形态(带组成闭合块/普通自闭合行)按行硬分派 - 前序未提交:HTML 导出整体移除(export_html.py 删除)、Excel 导出加序号列并移除说明页、.yhy 导入(import_yhy.py) - 测试:367 passed / 3 skipped;新增 test_topic_price/test_yhy_import/test_import_suffix 等
This commit is contained in:
@@ -77,16 +77,14 @@ def test_norm_ntdel_export_omits(server):
|
||||
r = post(server, "/api/session/norm/op", {"session_id": sid, "op": "unntdel", "norm_id": norm_id})
|
||||
assert r["ok"] is True
|
||||
assert _n_norm_in_export(server, sid, b'Number="N-1"') == base # 恢复后又在场
|
||||
# 采纳定额工程量回填(2026-10-15):导出应带批次原工程量 10.0;规格 2026-10-16 起定额
|
||||
# 工程量按源文件规律 6 位小数导出(清单仍 3 位)→ 采纳定额处为 Quantity="10.000000"
|
||||
# 2026-11-03 决策 264 补记五:工程量统一按数据本体 6 位导出(清单/定额同口径)——
|
||||
# 清单 10 → 10.000000;采纳定额 10 → 10.000000
|
||||
import io as _io
|
||||
import zipfile as _zipfile
|
||||
resp = server["client"].get("/api/session/export", params={"session_id": sid})
|
||||
zf = _zipfile.ZipFile(_io.BytesIO(resp.content))
|
||||
cnt = sum(zf.read(n).count(b'Quantity="10.0"') for n in zf.namelist())
|
||||
assert cnt == 1, cnt # 清单工程量 1 处(原文件原样,源清单未改不重写);原定额已按 9.3 转临删省略
|
||||
cnt6 = sum(zf.read(n).count(b'Quantity="10.000000"') for n in zf.namelist())
|
||||
assert cnt6 == 1, cnt6 # 采纳定额(带批次原工程量,6 位小数格式)
|
||||
cnt = sum(zf.read(n).count(b'Quantity="10.000000"') for n in zf.namelist())
|
||||
assert cnt == 2, cnt # 清单 1 处 + 采纳定额 1 处(原定额已按 9.3 转临删省略)
|
||||
|
||||
|
||||
def test_adopt_gcl_default_and_price_overwrite(server):
|
||||
@@ -109,7 +107,7 @@ def test_adopt_gcl_default_and_price_overwrite(server):
|
||||
assert resp.headers["content-type"].startswith("application/zip"), resp.text[:300]
|
||||
zf = _zipfile.ZipFile(_io.BytesIO(resp.content))
|
||||
cnt = sum(zf.read(n).count(b'Quantity="10.000000"') for n in zf.namelist())
|
||||
assert cnt == 1, cnt
|
||||
assert cnt == 2, cnt # 清单 10 + 采纳定额 10(统一 6 位)
|
||||
# 公式跟清单量走:清单量改 20 → 不改定额、直接导出 → 定额量 20.0
|
||||
con = sqlite3.connect(server["sessdb"])
|
||||
con.execute("UPDATE s_bills SET Quantity=20 WHERE id=?", (bill_id,))
|
||||
@@ -119,17 +117,16 @@ def test_adopt_gcl_default_and_price_overwrite(server):
|
||||
resp = server["client"].get("/api/session/export", params={"session_id": sid})
|
||||
zf = _zipfile.ZipFile(_io.BytesIO(resp.content))
|
||||
cnt = sum(zf.read(n).count(b'Quantity="20.000000"') for n in zf.namelist())
|
||||
assert cnt == 1, cnt
|
||||
# 决策 244 补六:清单行三值 = 数量 3 位、单价/合价 2 位(XML 精确断言;
|
||||
# 子串计数会误配 NoTaxPrice / WorkContent 的既有 2 位值)
|
||||
assert cnt == 2, cnt # 清单 20 + 公式定额跟清单量走 20(统一 6 位)
|
||||
# 决策 233/264:合价=工程量×单价(导出按现算写穿,不照搬库里不一致的旧 Total)
|
||||
import xml.etree.ElementTree as _ET
|
||||
_unit_txt = "".join(zf.read(n).decode("utf-8", "replace") for n in zf.namelist()
|
||||
if n.lower() != "project.xml")
|
||||
_root = _ET.fromstring(_unit_txt)
|
||||
_we = _root.find(".//WorkElement")
|
||||
assert _we is not None
|
||||
assert _we.attrib["Quantity"] == "20.000" and _we.attrib["Price"] == "600.00" \
|
||||
and _we.attrib["Total"] == "6000.00", dict(_we.attrib)
|
||||
assert _we.attrib["Quantity"] == "20.000000" and _we.attrib["Price"] == "600.00" \
|
||||
and _we.attrib["Total"] == "12000.00", dict(_we.attrib)
|
||||
|
||||
|
||||
def test_norm_unadopt_hard_delete(server):
|
||||
@@ -237,9 +234,9 @@ def test_qty_export_follows_source_pattern(server):
|
||||
assert resp.headers["content-type"].startswith("application/zip"), resp.text[:200]
|
||||
zf = _zipfile.ZipFile(_io.BytesIO(resp.content))
|
||||
allx = b"".join(zf.read(n) for n in zf.namelist())
|
||||
assert allx.count(b'Quantity="1.425000"') == 1, allx.count(b'Quantity="1.425000"') # 采纳定额 6 位
|
||||
assert allx.count(b'Quantity="7.125"') == 1, allx.count(b'Quantity="7.125"') # 改过的清单 3 位
|
||||
assert allx.count(b'Quantity="10.0"') == 1, allx.count(b'Quantity="10.0"') # 未改的原定额,原格式保留
|
||||
assert allx.count(b'Quantity="1.425000"') == 1, allx.count(b'Quantity="1.425000"') # 采纳定额 6 位
|
||||
assert allx.count(b'Quantity="7.125000"') == 1, allx.count(b'Quantity="7.125000"') # 改过的清单(6 位口径)
|
||||
assert allx.count(b'Quantity="10.000000"') == 1, allx.count(b'Quantity="10.000000"') # 未改的原定额(6 位口径)
|
||||
|
||||
|
||||
def test_schema_self_describe(server):
|
||||
|
||||
Reference in New Issue
Block a user