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:
lianjianwei2024
2026-11-03 23:39:46 +08:00
parent 5470286f66
commit 78e58a40c7
40 changed files with 2700 additions and 1373 deletions

View File

@@ -9,6 +9,7 @@
import io
import os
import re
import sqlite3
import sys
import zipfile
import xml.etree.ElementTree as ET
@@ -519,12 +520,36 @@ def test_edited_totals_follow_qty_times_price(server):
def _export_zip(server, sid):
# 决策 264 补记(2026-11-03):原格式导出只走骨架回灌——测试就地从本会话源件提炼一件骨架
# (真实流程=后台上传骨架;这里不依赖本机预置件,保证同口径可跑)。
sc = sqlite3.connect(server["sessdb"])
sc.row_factory = sqlite3.Row
try:
srow = sc.execute("SELECT src_name FROM sessions WHERE id=?", (sid,)).fetchone()
finally:
sc.close()
src_name = srow["src_name"] if srow else ""
sfx = xcos_suffix(src_name)
hc = sqlite3.connect(server["db"])
hc.row_factory = sqlite3.Row
try:
src = os.path.join(str(server["root"]), "CostReview", "data", "source_files", src_name)
if os.path.exists(src):
import classic_skeleton as _cs
_cs.seed_frame(hc, src, "测试骨架-" + (sfx or "x"))
finally:
hc.close()
resp = server["client"].get("/api/session/export", params={"session_id": sid})
if not resp.headers["content-type"].startswith("application/zip"):
raise AssertionError("导出失败: " + resp.text[:300])
return zipfile.ZipFile(io.BytesIO(resp.content))
def xcos_suffix(name):
import classic_skeleton as _cs
return _cs.suffix_of(name)
def test_coef_unit_prefix_no_double_count(server):
"""10m 定额:历史 清单1094.68 / 定额109.468 → 系数 GCL 口径 = 1.0,
清单量改 90000000 后导出定额量 = 9000000(=GCL,单位换算只算一次)。"""