增加了知识图谱导出excel
This commit is contained in:
@@ -280,12 +280,12 @@ def calc_rcj_count(
|
||||
context = BCLDataSourceContext([QuantityItem, moeItem], project_context)
|
||||
|
||||
# 根据节点类型选择不同的计算表达式
|
||||
node_type = node.get("类型", "")
|
||||
if node_type == "人工":
|
||||
node_type = node.get("类型", node.get("type", ""))
|
||||
if node_type == "人工" or node_type == "2":
|
||||
calc_expr = "_材机合并人工数量"
|
||||
elif node_type == "材料":
|
||||
elif node_type == "材料" or node_type == "3":
|
||||
calc_expr = "_材机合并材料数量"
|
||||
elif node_type == "机械":
|
||||
elif node_type == "机械" or node_type == "4":
|
||||
calc_expr = "_材机合并机械数量"
|
||||
else:
|
||||
# 未知类型,使用默认数量
|
||||
@@ -730,7 +730,7 @@ def calculate_rcj_fees(
|
||||
f"定额节点 '{node.get('项目名称', node.get('name', '未命名'))}' 有材机列表,数量: {len(node['材机列表'])}"
|
||||
)
|
||||
for rcj_node in node["材机列表"]:
|
||||
node_type = rcj_node.get("类型")
|
||||
node_type = rcj_node.get("类型", rcj_node.get("type"))
|
||||
# 同时支持数字类型和字符串类型
|
||||
if node_type in ["人工", "2"]:
|
||||
labor_nodes.append((rcj_node, node))
|
||||
@@ -756,7 +756,7 @@ def calculate_rcj_fees(
|
||||
f"定额节点 '{node.get('项目名称', node.get('name', '未命名'))}' 有子节点,数量: {len(node['children'])}"
|
||||
)
|
||||
for child in node["children"]:
|
||||
child_type = child.get("类型")
|
||||
child_type = child.get("类型", child.get("type"))
|
||||
if child_type in ["人工", "2"]:
|
||||
labor_nodes.append((child, node))
|
||||
print(
|
||||
@@ -893,7 +893,7 @@ def calculate_rcj_fees(
|
||||
context = BCLDataSourceContext([moeItem], dxitem_context)
|
||||
|
||||
# 根据节点类型选择不同的计算表达式
|
||||
node_type = node.get("类型", "")
|
||||
node_type = node.get("类型", node.get("type", ""))
|
||||
if node_type in ["人工", "2"]:
|
||||
calc_expr = "_材机合并人工数量"
|
||||
elif node_type in ["材料", "3"]:
|
||||
@@ -1042,7 +1042,13 @@ def calculate_resource_fees(
|
||||
safe_project_guid = f"_{safe_project_guid}"
|
||||
|
||||
# 设置输出目录和文件名
|
||||
output_dir = "计算结果"
|
||||
# 检查calculation_strategy是否有get_output_dir方法
|
||||
if hasattr(calculation_strategy, "get_output_dir"):
|
||||
output_dir = calculation_strategy.get_output_dir()
|
||||
else:
|
||||
# 兼容旧代码,使用默认目录
|
||||
output_dir = "计算结果"
|
||||
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
rcj_output_file = os.path.join(output_dir, f"{safe_project_name}{safe_project_guid}_rcj_fees.json")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user