From f534d41c36d5895322bf691784a10435b64609fe Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期五, 25 十二月 2020 13:52:00 +0800 Subject: [PATCH] 修复添加、删除楼层时候,界面刷新异常问题 --- HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs | 61 +++++++++++++++++++----------- 1 files changed, 38 insertions(+), 23 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs index 6154e4a..537504e 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs @@ -104,7 +104,6 @@ } return logicId; } - /// <summary> /// 灏佽Dictionary瀵硅薄 /// </summary> @@ -135,18 +134,23 @@ /// <returns></returns> public static List<HDL_ON.Entity.Room> GetGatewayRoomList(string name) { - List<Entity.Room> roomList = new List<Entity.Room>(); Entity.Room room1 = new Entity.Room(); - room1.roomName = name;//榛樿涓�涓埧闂村悕涓�:鍏ㄩ儴鍖哄煙 - room1.uid = "鍏ㄩ儴鍖哄煙";//榛樿sid鐢ㄨ瘑鍒鎴块棿 + room1.roomName = name;//鑷畾涔夐粯璁や竴涓埧闂村悕涓�:6688 + room1.roomId = "6688";//鑷畾涔夐粯璁d鐢ㄨ瘑鍒鎴块棿 roomList.Add(room1);//榛樿娣诲姞鍒版埧闂村垪琛ㄩ噷 var roomLists = GetGatewayRoomList(); - foreach (var room in roomLists) + for (int i = 0; i < roomLists.Count; i++) { + var room = roomLists[i]; + var devlist = GetRoomDevice(room); + if (devlist.Count == 0) + { + //杩囨护鎺夋病鏈夎澶囩殑鎴块棿; + continue; + } roomList.Add(room); } - return roomList; } /// <summary> @@ -155,7 +159,7 @@ /// <returns></returns> public static List<HDL_ON.Entity.Function> GetGatewayDeviceList() { - return HDL_ON.Entity.DB_ResidenceData.functionList.GetAllFunction(); + return Entity.FunctionList.List.GetDeviceFunctionList(); } /// <summary> /// 鑾峰彇缃戝叧鍦烘櫙鍒楄〃 @@ -163,7 +167,7 @@ /// <returns></returns> public static List<HDL_ON.Entity.Scene> GetSceneList() { - return HDL_ON.Entity.DB_ResidenceData.functionList.scenes; + return HDL_ON.Entity.FunctionList.List.scenes; } /// <summary> /// 鑾峰彇鎴块棿鐨勮澶囧垪琛� @@ -174,18 +178,24 @@ { List<HDL_ON.Entity.Function> deviceLists = new List<Entity.Function>(); List<HDL_ON.Entity.Function> lists = GetGatewayDeviceList(); - foreach (var dev in lists) + if (room.roomId == "6688") { - if (dev.roomIds.Find((id) => id == room.uid) != null) + //榛樿涓�涓埧闂村悕锛�6688 + //鏄剧ず缃戝叧鍏ㄩ儴璁惧 + deviceLists = lists; + } + else + { + for (int i = 0; i < lists.Count; i++) { - deviceLists.Add(dev); - } - if (room.uid == "鍏ㄩ儴鍖哄煙") - { - //鎴块棿鍚嶄负鍏ㄩ儴鍖哄煙鏃讹紝鏄剧ず缃戝叧鍏ㄩ儴璁惧 - deviceLists = lists; - } + var dev = lists[i]; + if (dev.roomIds.Find((id) => id == room.roomId) != null) + { + //娣诲姞灞炰簬杩欎釜鎴块棿鐨勮澶�; + deviceLists.Add(dev); + } + } } return deviceLists; } @@ -198,8 +208,9 @@ { HDL_ON.Entity.Function device = new Entity.Function() { name = "Unknown" }; List<HDL_ON.Entity.Function> deviceLists = GetGatewayDeviceList(); - foreach (var dev in deviceLists) + for (int i = 0; i < deviceLists.Count; i++) { + var dev = deviceLists[i]; if (dev.sid == sid) { device = dev; @@ -218,8 +229,9 @@ { HDL_ON.Entity.Scene scene = new Entity.Scene() { name = "Unknown" }; List<HDL_ON.Entity.Scene> sceneLists = GetSceneList(); - foreach (var sce in sceneLists) + for (int i = 0; i < sceneLists.Count; i++) { + var sce = sceneLists[i]; if (sce.sid == sid) { scene = sce; @@ -237,10 +249,10 @@ { string roomName = ""; List<HDL_ON.Entity.Room> roomLists = GetGatewayRoomList(); - - foreach (var dev in device.roomIds) + for (int i = 0; i < device.roomIds.Count; i++) { - var room = roomLists.Find((c) => c.uid == dev); + var dev = device.roomIds[i]; + var room = roomLists.Find((c) => c.roomId == dev); if (room != null) { roomName += room.floorName + "." + room.roomName + ","; @@ -405,14 +417,17 @@ public static List<Entity.Function> GetShowDeviceList(List<FunctionType> functionType, List<HDL_ON.Entity.Function> deviceList) { List<HDL_ON.Entity.Function> devList = new List<Entity.Function>(); - foreach (var dev in deviceList) + for (int i = 0; i < deviceList.Count; i++) { + var dev = deviceList[i]; if (functionType.Contains(dev.functionType)) { ///杩囨护鎺変笉闇�瑕佹樉绀虹殑璁惧 devList.Add(dev); } + } + return devList; } /// <summary> -- Gitblit v1.8.0