From 35c4bc03ee8da50317cd3f33e9f52f0a4259affd Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期三, 23 十二月 2020 15:53:08 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/WJC' into NewFilePath

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
old mode 100644
new mode 100755
index 6154e4a..3e7d9f5
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -135,18 +135,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鐢ㄨ瘑鍒鎴块棿
             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 +160,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 +168,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>
         /// 鑾峰彇鎴块棿鐨勮澶囧垪琛�
@@ -198,8 +203,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 +224,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;
@@ -238,8 +245,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 dev = device.roomIds[i];
                 var room = roomLists.Find((c) => c.uid == dev);
                 if (room != null)
                 {
@@ -405,14 +414,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