Browse Source

完成设备所在业务空间

jxing 5 years ago
parent
commit
9970abe662
1 changed files with 5 additions and 3 deletions
  1. 5 3
      datacenter/docs/relation_calc/Eq2Sp.md

+ 5 - 3
datacenter/docs/relation_calc/Eq2Sp.md

@@ -54,6 +54,8 @@ try:
     # 将下面对数据库的操作作为一个事务, 出异常则自动rollback
     input_table_list = tables.split(',')
     output_table_list = out_tables.split(',')
+    #if len(input_table_list) > 0
+        #plpy.info(input_table_list[0])
     with plpy.subtransaction():
         for i in range(0, len(input_table_list)):
             in_table_name = input_table_list[i]
@@ -74,7 +76,7 @@ try:
                     continue
                 # 获取楼层下的业务空间
                 space_plan = plpy.prepare("select id, outline from {0} as sp where project_id = $1 and outline is not null and floor_id = $2".format(in_table_name), ["text", "text"])
-                spaces = plan.execute([project_id, floor_id])
+                spaces = space_plan.execute([project_id, floor_id])
                 if len(spaces) == 0:
                     continue
                 # 判断设备的bim_location是否在业务空间的outline内
@@ -96,7 +98,7 @@ else:
 $$
 LANGUAGE 'plpython3u' VOLATILE;
 
-select public.rel_eq2sp('Pj1101010015', '', 2, 2);
+select public.rel_eq2sp('zone_general,zone_lighting', 'r_eq_in_sp_zone_general,r_eq_in_sp_zone_lighting', 'Pj1101010015', 2, 2);
 ```
 ## 输入
     1. 参与计算的业务空间表的全名称, 带schema名, 以英文逗号隔开
@@ -106,4 +108,4 @@ select public.rel_eq2sp('Pj1101010015', '', 2, 2);
     5. 第二个要被删除的sign, 只能是int型, 值为1或2 (1表示手动维护的关系, 2表示自动计算的关系)
 ## 返回结果
     true    成功
-    false   失败
+    false   失败