|
@@ -16,7 +16,7 @@ def get_dicdata(sql,dic):
|
|
|
data=test.get_data(sql)
|
|
|
dic_data=[dict(zip(dic,item)) for item in data]
|
|
|
return list(dic_data)
|
|
|
-def get_project_models(project_id,build_id):
|
|
|
+def get_project_models(project_id,building_id):
|
|
|
'''
|
|
|
Get all the models in the project.
|
|
|
project-->folder-->model.
|
|
@@ -28,9 +28,9 @@ def get_project_models(project_id,build_id):
|
|
|
"id,name,local_id,local_name,sequence_id,model_id,building_id,project_id " \
|
|
|
"from floor " \
|
|
|
"where project_id='%s' " \
|
|
|
- "and (building_id is null or building_id='%s') " \
|
|
|
+ "and ('%s' is null or building_id='%s') " \
|
|
|
"order by sequence_id desc"\
|
|
|
- %(project_id,build_id)
|
|
|
+ %(project_id,building_id,building_id)
|
|
|
COMPONENT_KEYS = [
|
|
|
'id',
|
|
|
'name',
|
|
@@ -222,7 +222,7 @@ def save_edge_data(edge,block_id,build_id):
|
|
|
data = test.save_data(sql)
|
|
|
except Exception as e:
|
|
|
print(e)
|
|
|
-def del_project_data(project_id,system_name,domain,build_id):
|
|
|
+def del_project_data(project_id,system_name,domain,building_id):
|
|
|
"""
|
|
|
Before save.delete old data.
|
|
|
:param project_id:
|
|
@@ -232,10 +232,10 @@ def del_project_data(project_id,system_name,domain,build_id):
|
|
|
"where project_id='%s'"\
|
|
|
"and mep_system_type='%s'" \
|
|
|
"and domain='%s'" \
|
|
|
- "and (building_id is null or building_id='%s')" \
|
|
|
- % (project_id,system_name,domain,build_id)
|
|
|
+ "and ('%s' is null or building_id='%s')" \
|
|
|
+ % (project_id,system_name,domain,building_id,building_id)
|
|
|
test.save_data(sql)
|
|
|
-def get_connected_block_data(project_id,block_id,system_name,domain):
|
|
|
+def get_connected_block_data(project_id,block_id,system_name,domain,building_id):
|
|
|
'''
|
|
|
Get all the connected_block .
|
|
|
:param project_id:
|
|
@@ -248,8 +248,9 @@ def get_connected_block_data(project_id,block_id,system_name,domain):
|
|
|
"and block_id='%s'" \
|
|
|
"and mep_system_type='%s'" \
|
|
|
"and domain='%s'" \
|
|
|
+ "and ('%s' is null or building_id='%s')" \
|
|
|
"order by cast(depth as int) asc"\
|
|
|
- % (project_id,block_id,system_name,domain)
|
|
|
+ % (project_id,block_id,system_name,domain,building_id,building_id)
|
|
|
KEYS = [
|
|
|
'id',
|
|
|
'id1',
|
|
@@ -262,11 +263,14 @@ def get_connected_block_data(project_id,block_id,system_name,domain):
|
|
|
'block_id',
|
|
|
'project_id',
|
|
|
'depth',
|
|
|
+ 'mep_system_type',
|
|
|
+ 'domain',
|
|
|
+ 'building_id',
|
|
|
]
|
|
|
element_data.extend(get_dicdata(sql, KEYS))
|
|
|
element_data = list(map(systemutils.dic2obj, element_data))
|
|
|
return element_data
|
|
|
-def get_connected_block_source_data(project_id,block_id,system_name,domain):
|
|
|
+def get_connected_block_source_data(project_id,block_id,system_name,domain,building_id):
|
|
|
'''
|
|
|
Get all the connected_block source .
|
|
|
:param project_id:
|
|
@@ -279,12 +283,17 @@ def get_connected_block_source_data(project_id,block_id,system_name,domain):
|
|
|
"and block_id='%s'" \
|
|
|
"and mep_system_type='%s'" \
|
|
|
"and domain='%s'" \
|
|
|
- % (project_id,block_id,system_name,domain)
|
|
|
+ "and ('%s' is null or building_id='%s')" \
|
|
|
+ % (project_id,block_id,system_name,domain,building_id,building_id)
|
|
|
KEYS = [
|
|
|
'id',
|
|
|
'project_id',
|
|
|
'block_id',
|
|
|
'source_id',
|
|
|
+ 'source_type',
|
|
|
+ 'mep_system_type',
|
|
|
+ 'domain',
|
|
|
+ 'building_id',
|
|
|
]
|
|
|
element_data.extend(get_dicdata(sql, KEYS))
|
|
|
element_data = list(map(systemutils.dic2obj, element_data))
|
|
@@ -296,7 +305,7 @@ def update_connected_block_data(block_datas):
|
|
|
:return:
|
|
|
'''
|
|
|
for block_data in block_datas:
|
|
|
- sql="update revit_calc.connected_block set direction='%s',depth='%s' where id='%s'"\
|
|
|
+ sql="update revit_calc.connected_block set direction='%s',depth='%s' where id='%s'" \
|
|
|
%(block_data.direction,block_data.depth,block_data.id)
|
|
|
data = test.save_data(sql)
|
|
|
|