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:
@@ -35,15 +35,19 @@ def _free_port():
|
||||
|
||||
# ------------------------------------------------------------------ 造数
|
||||
def make_cos4(path, proj_name, bills, lmes=(), build_unit="测试建设单位",
|
||||
proj_lmes=None, uw_lmes=None, zip_ts=None):
|
||||
proj_lmes=None, uw_lmes=None, zip_ts=None, uw_lme_attrs=None,
|
||||
lme_rot=False):
|
||||
"""构造最小可解析的 .cos4(zip 内 Project.xml + 单位工程 xml)。
|
||||
|
||||
bills: [(编码, 名称, 特征, 单位, 工程量, 单价)] —— 分部分项清单(自动配 1 条定额 + 定额消耗)
|
||||
lmes: [(编码, 名称, 规格, 单位, 不含税价, 含税价)] —— 工料机(会进 lmes 与项目级汇总)
|
||||
proj_lmes/uw_lmes: 分别覆盖项目级/单位级汇总的行(默认都用 lmes;
|
||||
决策 108 测试用——造「仅项目工料机有」的场景)
|
||||
uw_lme_attrs: {编码: ' Class="A" Weight="0"...'} 单位级 LME_SUM 追加的文字/标志属性
|
||||
(定额单价专题·决策 259 flags 全采链路测试用;值须自带引号、前导空格)
|
||||
另固定带:1 条措施清单(安全文明施工费)、项目特征 1 条、总造价 1234567.89。
|
||||
"""
|
||||
_uw_attr = (uw_lme_attrs or {}).get
|
||||
lme_proj = "".join(
|
||||
'<LabourMaterialsEquipmentsMachinesSummary Number=%s Name=%s Specification=%s Unit=%s'
|
||||
' Kind="1" Quantity="100" NoTaxPrice=%s TaxPrice=%s/>'
|
||||
@@ -62,7 +66,8 @@ def make_cos4(path, proj_name, bills, lmes=(), build_unit="测试建设单位",
|
||||
def _bill_xml(i, b):
|
||||
num, name, attr, unit, qty, price = b
|
||||
qty, price = float(qty), float(price)
|
||||
lme0 = lmes[0][0] if lmes else "000001"
|
||||
lme0 = ((lmes[i % len(lmes)][0] if lme_rot else lmes[0][0])
|
||||
if lmes else "000001") # lme_rot=多清单轮转引用不同 LME(各配现算量)
|
||||
return (
|
||||
'<WorkElement Number=%s Name=%s Attr=%s Unit=%s Quantity=%s Price=%s Total=%s>'
|
||||
'<Norm Number="N-%d" Name=%s Unit=%s Quantity=%s Price="80" Total=%s>'
|
||||
@@ -84,9 +89,9 @@ def make_cos4(path, proj_name, bills, lmes=(), build_unit="测试建设单位",
|
||||
% ("".join(_bill_xml(i, b) for i, b in enumerate(bills)),
|
||||
"".join(
|
||||
'<LabourMaterialsEquipmentsMachinesSummary Number=%s Name=%s Specification=%s'
|
||||
' Unit=%s Kind="1" Quantity="100" NoTaxPrice=%s TaxPrice=%s/>'
|
||||
' Unit=%s Kind="1" Quantity="100" NoTaxPrice=%s TaxPrice=%s%s/>'
|
||||
% (quoteattr(it[0]), quoteattr(it[1]), quoteattr(it[2]), quoteattr(it[3]),
|
||||
quoteattr(it[4]), quoteattr(it[5]))
|
||||
quoteattr(it[4]), quoteattr(it[5]), _uw_attr(it[0]) or "")
|
||||
for it in (lmes if uw_lmes is None else uw_lmes))))
|
||||
with zipfile.ZipFile(path, "w", zipfile.ZIP_DEFLATED) as z:
|
||||
# zip_ts(决策 243 测试用):同内容不同 zip 时间戳 → 不同 sha256(前后台禁同文件后,
|
||||
|
||||
Reference in New Issue
Block a user