更新代码

This commit is contained in:
chentianrui
2025-10-14 16:13:18 +08:00
parent f5f26c5cf8
commit 0a4dedda1c
230 changed files with 7029 additions and 855114 deletions
+19 -10
View File
@@ -231,16 +231,17 @@ def create_ration_from_node(node: dict[str, any]) -> Ration:
ration.所属定额库 = node.get("所属定额库")
ration.专业属性 = node.get("专业属性")
ration.地形费计算方式 = node.get("地形费计算方式")
ration.专业类型 = node.get("调差类型")
# 遍历节点的所有属性,确保所有可能的字段都被设置
for key, value in node.items():
if hasattr(ration, key) and not key.startswith("_"):
# 不再限制为类上已有的属性,允许把节点上的所有属性同步到对象上
if not key.startswith("_"):
if value is not None:
setattr(ration, key, str(value) if value != "" else "")
ration.乙供材料费不含税 = node.get("材料费")
ration.children = node.get("children")
ration.children = node.get("children") or node.get("材机列表")
ration.专业类型 = node.get("调差类型")
ration.乙供材料费不含税 = node.get("乙供材料费") or node.get("乙供材料费不含税")
return ration
@@ -290,7 +291,6 @@ def create_material_from_node(node: dict[str, any]) -> Material:
material.单重 = node.get("单重")
material.增值税率 = node.get("增值税率")
material.数量 = node.get("数量")
material.损耗率 = node.get("损耗率")
material.规格型号 = node.get("规格型号")
material.线重 = node.get("线重")
material.截面积 = node.get("截面积")
@@ -303,8 +303,8 @@ def create_material_from_node(node: dict[str, any]) -> Material:
material.投标单价 = node.get("投标单价")
material.特征段 = node.get("特征段")
material.颜色标记 = node.get("颜色标记")
material.价不含税 = node.get("单价不含税")
material.价含税 = node.get("单价含税")
material.预算价不含税 = node.get("单价不含税")
material.预算价含税 = node.get("单价含税")
material.结算市场价不含税 = node.get("结算市场价不含税")
material.结算市场价含税 = node.get("结算市场价含税")
material.基准价不含税 = node.get("基准价不含税")
@@ -323,12 +323,13 @@ def create_material_from_node(node: dict[str, any]) -> Material:
# 遍历节点的所有属性,确保所有可能的字段都被设置
for key, value in node.items():
if hasattr(material, key) and not key.startswith("_"):
# 不再限制为类上已有的属性,允许把节点上的所有属性同步到对象上
if not key.startswith("_"):
if value is not None:
setattr(material, key, str(value) if value != "" else "")
material.预算价不含税 = material.单价不含税
material.children = node.get("children")
material.损耗 = node.get("损耗率")
return material
@@ -387,7 +388,8 @@ def create_equipment_from_node(node: dict[str, any]) -> Equipment:
# 遍历节点的所有属性,确保所有可能的字段都被设置
for key, value in node.items():
if hasattr(equipment, key) and not key.startswith("_"):
# 不再限制为类上已有的属性,允许把节点上的所有属性同步到对象上
if not key.startswith("_"):
if value is not None:
setattr(equipment, key, str(value) if value != "" else "")
equipment.children = node.get("children")
@@ -474,6 +476,13 @@ def init_bcl_calculator(*args, **kwargs):
else:
config_path = default_path
# 加载脚本前,重置全局 calculator,避免跨工程复用上一次加载的状态
try:
calculator.reset()
logging.info("[init_bcl_calculator] 已重置 BCLCalculator 状态")
except Exception as _e:
logging.warning(f"[init_bcl_calculator] 重置 BCLCalculator 失败: {_e}")
# 加载脚本
result = True
use_filtered_files = False