wei
2020-12-23 d814c978efc068425c500a553cf7ec6b4f628219
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
old mode 100644 new mode 100755
@@ -127,7 +127,7 @@
        /// <returns></returns>
        public static List<HDL_ON.Entity.Room> GetGatewayRoomList()
        {
            return HDL_ON.Entity.DB_ResidenceData.residenceData.Rooms;
            return HDL_ON.Entity.SpatialInfo.CurrentSpatial.RoomList;
        }
        /// <summary>
        /// 获取网关房间列表
@@ -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>