From 01c46e7bfe9aa8fb20b29f70c83c03a307af548a Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期二, 22 十二月 2020 16:35:16 +0800
Subject: [PATCH] 2020-12-22 1.更新。

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs |   48 +++++++++++++++++++++++++++---------------------
 1 files changed, 27 insertions(+), 21 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 86ebc92..8a0f17e
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -4,8 +4,8 @@
 
 namespace HDL_ON.UI.UI2.Intelligence.Automation
 {
-    
-    public class LogicMethod
+
+    public  class  LogicMethod
     {
         /// <summary>
         /// 琛ㄧず鏄潯浠�
@@ -77,7 +77,7 @@
                 long m = (long)((dt - startTime).TotalMilliseconds / 10);
                 string sTimeSpan = byteArrayToHexString(int2ByteArray(getTimeStamp()));
 
-               
+
 
                 logicId = sOidBeginsWith + sTimeSpan;
 
@@ -92,10 +92,10 @@
                     string s = Logic.LogicList[i].sid.Substring(20, 4);
                     int iThisSceneId = Convert.ToInt16(s, 16);
                     if (iThisSceneId > maxId)
-                        maxId = iThisSceneId ;
+                        maxId = iThisSceneId;
                 }
 
-                logicId += (maxId+1).ToString("X4");//閫昏緫鍙� 涓や釜byte 
+                logicId += (maxId + 1).ToString("X4");//閫昏緫鍙� 涓や釜byte 
                 logicId += "0000";
             }
             catch
@@ -125,17 +125,16 @@
         /// 鑾峰彇缃戝叧鎴块棿鍒楄〃
         /// </summary>
         /// <returns></returns>
-        public static List<HDL_ON.Entity.Room> GetGatewayRoomList() 
+        public static List<HDL_ON.Entity.Room> GetGatewayRoomList()
         {
-            return HDL_ON.Entity.DB_ResidenceData.residenceData.Rooms;
+            return HDL_ON.Entity.SpatialInfo.CurrentSpatial.RoomList;
         }
         /// <summary>
         /// 鑾峰彇缃戝叧鎴块棿鍒楄〃
         /// </summary>
         /// <returns></returns>
-        public static List<HDL_ON.Entity.Room> GetGatewayRoomList(string name) 
+        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;//榛樿涓�涓埧闂村悕涓�:鍏ㄩ儴鍖哄煙
@@ -144,9 +143,14 @@
             var roomLists = GetGatewayRoomList();
             foreach (var room in roomLists)
             {
+                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>
         /// 鑾峰彇鎴块棿鐨勮澶囧垪琛�
@@ -196,7 +200,7 @@
         /// <returns></returns>
         public static HDL_ON.Entity.Function GetDevice(string sid)
         {
-            HDL_ON.Entity.Function device = new Entity.Function() { name= "Unknown"};
+            HDL_ON.Entity.Function device = new Entity.Function() { name = "Unknown" };
             List<HDL_ON.Entity.Function> deviceLists = GetGatewayDeviceList();
             foreach (var dev in deviceLists)
             {
@@ -216,7 +220,7 @@
         /// <returns></returns>
         public static HDL_ON.Entity.Scene GetSecne(string sid)
         {
-            HDL_ON.Entity.Scene scene = new Entity.Scene() { name = "Unknown"};
+            HDL_ON.Entity.Scene scene = new Entity.Scene() { name = "Unknown" };
             List<HDL_ON.Entity.Scene> sceneLists = GetSceneList();
             foreach (var sce in sceneLists)
             {
@@ -294,17 +298,17 @@
         /// </summary>
         /// <param name="deviceList">璁惧鍒楄〃</param>
         /// <returns></returns>
-        public static List<string> GetDeviceTypeList(List<HDL_ON.Entity.Function> deviceList) 
+        public static List<string> GetDeviceTypeList(List<HDL_ON.Entity.Function> deviceList)
         {
-            List<string> deviceStrTypeList = new List<string>(); 
+            List<string> deviceStrTypeList = new List<string>();
             deviceStrTypeList.Clear();
-            var lightjosn = deviceList.Find((device) => device.functionType == FunctionType.Relay || device.functionType == FunctionType.Dimmer|| device.functionType == FunctionType.ColorTemperature || device.functionType == FunctionType.RGB|| device.functionType == FunctionType.RGBW);
+            var lightjosn = deviceList.Find((device) => device.functionType == FunctionType.Relay || device.functionType == FunctionType.Dimmer || device.functionType == FunctionType.ColorTemperature || device.functionType == FunctionType.RGB || device.functionType == FunctionType.RGBW);
             if (lightjosn != null)
             {
                 deviceStrTypeList.Add(Language.StringByID(StringId.Lights));
             }
 
-            var curtainjosn = deviceList.Find((device) => device.functionType ==FunctionType.Curtain|| device.functionType == FunctionType.MotorCurtain|| device.functionType == FunctionType.RollingShutter);
+            var curtainjosn = deviceList.Find((device) => device.functionType == FunctionType.Curtain || device.functionType == FunctionType.MotorCurtain || device.functionType == FunctionType.RollingShutter);
             if (curtainjosn != null)
             {
                 deviceStrTypeList.Add(Language.StringByID(StringId.Curtain));
@@ -360,11 +364,13 @@
         /// 鏉′欢/鐩爣鏀寔璁惧
         /// </summary>
         /// <returns></returns>
-        public static List<FunctionType> GetSupportEquipment(string if_type)  
+        public static List<FunctionType> GetSupportEquipment(string if_type)
         {
             List<FunctionType> deviceTypeList = new List<FunctionType>();
-            switch (if_type) {
-                case condition_if: {
+            switch (if_type)
+            {
+                case condition_if:
+                    {
                         deviceTypeList.Add(FunctionType.Relay);
                         deviceTypeList.Add(FunctionType.RGB);
                         deviceTypeList.Add(FunctionType.RGBW);

--
Gitblit v1.8.0