增加了知识图谱导出excel
This commit is contained in:
@@ -356,7 +356,8 @@ def get_quantity_nodes(json_file_path, project_name, engineering_type, project_g
|
||||
)
|
||||
|
||||
node_name = node.get("清单名称", node.get("项目名称", "未命名"))
|
||||
node_id = node.get("id", node.get("GUID", "未知ID"))
|
||||
# 强制使用GUID而不是ID
|
||||
node_id = node.get("GUID") or node.get("guid") or node.get("id", "未知ID")
|
||||
current_path = f"{parent_path}/{node_name}" if parent_path else node_name
|
||||
|
||||
if is_bill_node:
|
||||
@@ -386,7 +387,8 @@ def get_quantity_nodes(json_file_path, project_name, engineering_type, project_g
|
||||
|
||||
# 处理每个清单节点
|
||||
for bill_node in bill_nodes:
|
||||
bill_id = bill_node.get("id") or bill_node.get("GUID")
|
||||
# 强制使用GUID而不是ID
|
||||
bill_id = bill_node.get("GUID") or bill_node.get("guid") or bill_node.get("id")
|
||||
bill_name = bill_node.get("清单名称", bill_node.get("项目名称", "未命名清单"))
|
||||
bill_children = bill_node.get("children", [])
|
||||
|
||||
@@ -400,7 +402,9 @@ def get_quantity_nodes(json_file_path, project_name, engineering_type, project_g
|
||||
# 为每个工程量节点设置清单节点信息
|
||||
for node in bill_quantity_nodes:
|
||||
# 存储关键信息而不是整个对象
|
||||
node["bill_id"] = bill_id
|
||||
# 强制使用GUID而不是ID
|
||||
node["bill_guid"] = bill_id # 新增GUID字段
|
||||
node["bill_id"] = bill_id # 保持兼容性
|
||||
node["bill_name"] = bill_name
|
||||
node["取费表名称"] = bill_node.get("取费表名称", bill_node.get("取费表", ""))
|
||||
# 设置parent_id以保持兼容性
|
||||
@@ -448,7 +452,9 @@ def get_quantity_nodes(json_file_path, project_name, engineering_type, project_g
|
||||
# 在项目中查找父节点
|
||||
def find_node_by_id(node_list, node_id):
|
||||
for n in node_list:
|
||||
if n.get("id") == node_id or n.get("GUID") == node_id:
|
||||
# 强制使用GUID而不是ID进行匹配
|
||||
node_guid = n.get("GUID") or n.get("guid") or n.get("id")
|
||||
if node_guid == node_id:
|
||||
return n
|
||||
if "children" in n and n["children"]:
|
||||
found = find_node_by_id(n["children"], node_id)
|
||||
@@ -471,10 +477,13 @@ def get_quantity_nodes(json_file_path, project_name, engineering_type, project_g
|
||||
)
|
||||
|
||||
if is_bill_node:
|
||||
bill_id = parent_node.get("id") or parent_node.get("GUID")
|
||||
# 强制使用GUID而不是ID
|
||||
bill_id = parent_node.get("GUID") or parent_node.get("guid") or parent_node.get("id")
|
||||
bill_name = parent_node.get("清单名称", parent_node.get("项目名称", "未命名清单"))
|
||||
|
||||
node["bill_id"] = bill_id
|
||||
# 强制使用GUID而不是ID
|
||||
node["bill_guid"] = bill_id # 新增GUID字段
|
||||
node["bill_id"] = bill_id # 保持兼容性
|
||||
node["bill_name"] = bill_name
|
||||
node["取费表名称"] = parent_node.get("取费表名称", parent_node.get("取费表", ""))
|
||||
# 设置parent_id以保持兼容性
|
||||
|
||||
Reference in New Issue
Block a user