From f14dcfd967404e197e7ec995ca8d6f2b090d3b7d Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期五, 11 九月 2020 09:16:59 +0800
Subject: [PATCH] 优化多功能面板:绑定温湿度传感器目标,和设备列表回路显示。优化数据矫正功能温湿度度不设置的情况。优化门锁时间设置最后一天和最后最后一个月的时间显示等 细节

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlExperienceAccountLogic.cs |   87 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 78 insertions(+), 9 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlExperienceAccountLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlExperienceAccountLogic.cs
index d181a06..9c4f1dc 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlExperienceAccountLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlExperienceAccountLogic.cs
@@ -58,6 +58,8 @@
             this.InitDeviceData();
             //鍒濆鍖栧満鏅�
             this.InitSceneData();
+            //鍒锋柊宸﹁竟鍒锋柊鎴块棿瑙嗗浘鍒楄〃
+            HdlRoomLogic.Current.RefreshRoomListView();
         }
 
         #endregion
@@ -104,7 +106,10 @@
             house.IsVirtually = true;
             house.Save(false);
             Config.Instance.HomeId = house.Id;
-            Config.Instance.Home = House.GetHouseByHouseId(house.Id);
+            Config.Instance.Home = HdlResidenceLogic.Current.GetHouseByHouseId(house.Id);
+
+            //棰勫垱寤轰釜浜轰腑蹇冨叏閮ㄧ殑鏂囦欢澶�
+            HdlFileLogic.Current.CreatAllUserCenterDirectory();
         }
 
         #endregion
@@ -163,8 +168,6 @@
             var listFloorKey = this.GetAllFloorKeys();
             var dicRoomName = this.GetRoomSampleList();
 
-            //璁剧疆鍒濆妤煎眰
-            Config.Instance.Home.CurrentFloorId = listFloorKey[0];
             foreach (string floorKey in listFloorKey)
             {
                 foreach (string roomId in dicRoomName.Keys)
@@ -219,6 +222,7 @@
                 list.Add(new AddDevicePra { DeviceType = VirtualDeviceEnum.A3鎸夐敭闈㈡澘, RoomId = floorKey + "_KeTing", DeviceCount = 1 });
                 list.Add(new AddDevicePra { DeviceType = VirtualDeviceEnum.A4鎸夐敭闈㈡澘, RoomId = floorKey + "_KeTing", DeviceCount = 2 });
                 list.Add(new AddDevicePra { DeviceType = VirtualDeviceEnum.A绌鸿皟缃戝叧, RoomId = floorKey + "_KeTing", DeviceCount = 1 });
+                //list.Add(new AddDevicePra { DeviceType = VirtualDeviceEnum.A鍥芥爣3璺�10A缁х數鍣ㄥ皬妯″潡, RoomId = floorKey + "_KeTing", DeviceCount = 1 });
 
                 //闃冲彴
                 list.Add(new AddDevicePra { DeviceType = VirtualDeviceEnum.A220pir浼犳劅鍣�, RoomId = floorKey + "_YangTai", DeviceCount = 1 });
@@ -234,13 +238,13 @@
                 list.Add(new AddDevicePra { DeviceType = VirtualDeviceEnum.A绌烘皵寮�鍏�, RoomId = floorKey + "_XuanGuan", DeviceCount = 1 });
                 list.Add(new AddDevicePra { DeviceType = VirtualDeviceEnum.A1璺皟鍏夊櫒, RoomId = floorKey + "_XuanGuan", DeviceCount = 1 });
                 list.Add(new AddDevicePra { DeviceType = VirtualDeviceEnum.A闂ㄧ獥纾佷紶鎰熷櫒, RoomId = floorKey + "_XuanGuan", DeviceCount = 1 });
-                list.Add(new AddDevicePra { DeviceType = VirtualDeviceEnum.A鏅鸿兘闂ㄩ攣, RoomId = floorKey + "_XuanGuan", DeviceCount = 1 });
 
                 //鍘ㄦ埧
                 list.Add(new AddDevicePra { DeviceType = VirtualDeviceEnum.A4鎸夐敭闈㈡澘, RoomId = floorKey + "_ChuFang", DeviceCount = 1 });
                 list.Add(new AddDevicePra { DeviceType = VirtualDeviceEnum.A姘存蹈浼犳劅鍣�, RoomId = floorKey + "_ChuFang", DeviceCount = 1 });
                 list.Add(new AddDevicePra { DeviceType = VirtualDeviceEnum.A鐑熼浘浼犳劅鍣�, RoomId = floorKey + "_ChuFang", DeviceCount = 1 });
                 list.Add(new AddDevicePra { DeviceType = VirtualDeviceEnum.A鐕冩皵浼犳劅鍣�, RoomId = floorKey + "_ChuFang", DeviceCount = 1 });
+                list.Add(new AddDevicePra { DeviceType = VirtualDeviceEnum.A鍚搁《鐕冩皵浼犳劅鍣�, RoomId = floorKey + "_ChuFang", DeviceCount = 1 });
 
                 //璧板粖
                 list.Add(new AddDevicePra { DeviceType = VirtualDeviceEnum.A4鎸夐敭闈㈡澘, RoomId = floorKey + "_ZouLang", DeviceCount = 1 });
@@ -255,6 +259,9 @@
         {
             //鍏堝埛鏂板鍣�
             LocalDevice.Current.ReFreshByLocal();
+            //椤轰究涔熸暣涓�涓嬬綉鍏�(鏈夊彲鑳藉畠鏄粠瀹炰綋璐﹀彿杞负铏氭嫙鏃�,娌℃湁娓呯┖)
+            HdlGatewayLogic.Current.ReFreshByLocal();
+            HdlGatewayLogic.Current.RefreshAppOldSelectGatewayId();
 
             Type thisType = m_Current.GetType();
             //鑾峰彇闇�瑕佸垱寤虹殑铏氭嫙璁惧鍒楄〃
@@ -558,6 +565,7 @@
                 //1涓紶鎰熷櫒
                 var device = new IASZone() { DeviceAddr = "DeviceAddr" + this.DeviceNumber, DeviceEpoint = 1 };
                 device.IasDeviceType = 13;
+                device.DeviceID = 1026;
                 //璁剧疆璁惧鐨勫熀鏈俊鎭�
                 this.SetBaseDataToDevice(device, 1200, 1200, "MSPIR01-ZB.10", i_RoomId);
 
@@ -578,8 +586,23 @@
             {
                 var device = new IASZone() { DeviceAddr = "DeviceAddr" + this.DeviceNumber, DeviceEpoint = 1 };
                 device.IasDeviceType = 43;
+                device.DeviceID = 1026;
                 //璁剧疆璁惧鐨勫熀鏈俊鎭�
                 this.SetBaseDataToDevice(device, 1300, 1300, "MSG01/M-ZB.10", i_RoomId);
+
+                this.DeviceNumber++;
+            }
+        }
+
+        public void Zigbee鍚搁《鐕冩皵浼犳劅鍣�(int i_DeviceCount, string i_RoomId)
+        {
+            for (int i = 0; i < i_DeviceCount; i++)
+            {
+                var device = new IASZone() { DeviceAddr = "DeviceAddr" + this.DeviceNumber, DeviceEpoint = 1 };
+                device.IasDeviceType = 43;
+                device.DeviceID = 1026;
+                //璁剧疆璁惧鐨勫熀鏈俊鎭�
+                this.SetBaseDataToDevice(device, 1300, 1300, "MGCD01/ZB.10", i_RoomId);
 
                 this.DeviceNumber++;
             }
@@ -591,6 +614,7 @@
             {
                 var device = new IASZone() { DeviceAddr = "DeviceAddr" + this.DeviceNumber, DeviceEpoint = 1 };
                 device.IasDeviceType = 21;
+                device.DeviceID = 1026;
                 //璁剧疆璁惧鐨勫熀鏈俊鎭�
                 this.SetBaseDataToDevice(device, 1301, 1301, "MSDC01/M-ZB.10", i_RoomId);
 
@@ -604,6 +628,7 @@
             {
                 var device = new IASZone() { DeviceAddr = "DeviceAddr" + this.DeviceNumber, DeviceEpoint = 1 };
                 device.IasDeviceType = 40;
+                device.DeviceID = 1026;
                 //璁剧疆璁惧鐨勫熀鏈俊鎭�
                 this.SetBaseDataToDevice(device, 1301, 1301, "MSS01/M-ZB.10", i_RoomId);
 
@@ -617,6 +642,7 @@
             {
                 var device = new IASZone() { DeviceAddr = "DeviceAddr" + this.DeviceNumber, DeviceEpoint = 1 };
                 device.IasDeviceType = 13;
+                device.DeviceID = 1026;
                 //璁剧疆璁惧鐨勫熀鏈俊鎭�
                 this.SetBaseDataToDevice(device, 1303, 1303, "MSPIR01/M-ZB.10", i_RoomId);
 
@@ -630,6 +656,7 @@
             {
                 var device = new IASZone() { DeviceAddr = "DeviceAddr" + this.DeviceNumber, DeviceEpoint = 1 };
                 device.IasDeviceType = 42;
+                device.DeviceID = 1026;
                 //璁剧疆璁惧鐨勫熀鏈俊鎭�
                 this.SetBaseDataToDevice(device, 1304, 1304, "MSW01/M-ZB.10", i_RoomId);
 
@@ -643,6 +670,7 @@
             {
                 var device = new IASZone() { DeviceAddr = "DeviceAddr" + this.DeviceNumber, DeviceEpoint = 1 };
                 device.IasDeviceType = 44;
+                device.DeviceID = 1026;
                 //璁剧疆璁惧鐨勫熀鏈俊鎭�
                 this.SetBaseDataToDevice(device, 1305, 1305, "MBU01/M-ZB.10", i_RoomId);
 
@@ -687,8 +715,8 @@
                     this.SetBaseDataToDevice(device, 2300, 2300, "MPD0101-ZB.10", i_RoomId);
                 }
 
-                //1涓户鐢靛櫒
-                var device2 = new ToggleLight() { DeviceAddr = "DeviceAddr" + this.DeviceNumber, DeviceEpoint = 8 };
+                //1涓皟鍏夊櫒
+                var device2 = new DimmableLight() { DeviceAddr = "DeviceAddr" + this.DeviceNumber, DeviceEpoint = 8 };
                 device2.DfunctionType = DeviceFunctionType.A鐏厜;
                 //璁剧疆璁惧鐨勫熀鏈俊鎭�
                 this.SetBaseDataToDevice(device2, 2300, 2300, "MPD0101-ZB.10", i_RoomId);
@@ -867,6 +895,31 @@
             }
         }
 
+        public void Zigbee鍥芥爣3璺�10A缁х數鍣ㄥ皬妯″潡(int i_DeviceCount, string i_RoomId)
+        {
+            for (int i = 0; i < i_DeviceCount; i++)
+            {
+                //4涓共鎺ョ偣
+                for (int j = 1; j <= 4; j++)
+                {
+                    var device = new Panel() { DeviceAddr = "DeviceAddr" + this.DeviceNumber, DeviceEpoint = j };
+                    //璁剧疆璁惧鐨勫熀鏈俊鎭�
+                    this.SetBaseDataToDevice(device, 2000, 2000, "MLR0310-ZB.20", i_RoomId);
+                }
+                //3涓户鐢靛櫒
+                for (int j = 5; j <= 7; j++)
+                {
+                    var device = new ToggleLight() { DeviceAddr = "DeviceAddr" + this.DeviceNumber, DeviceEpoint = j };
+                    device.DfunctionType = DeviceFunctionType.A鐏厜;
+                    //璁剧疆璁惧鐨勫熀鏈俊鎭�
+                    this.SetBaseDataToDevice(device, 2000, 2000, "MLR0310-ZB.20", i_RoomId);
+                    device.DeviceEpointName = Language.StringByID(R.MyInternationalizationString.uLight) + (j - 4);
+                }
+
+                this.DeviceNumber++;
+            }
+        }
+
         /// <summary>
         /// 璁剧疆璁惧鐨勫熀鏈俊鎭�
         /// </summary>
@@ -885,10 +938,24 @@
             device.ModelIdentifier = ModelIdentifier;
             device.CurrentGateWayId = string.Empty;
 
-            //榛樿姣忎釜璁惧閮藉彲浠ュ畾浣�
+            //榛樿姣忎釜璁惧閮藉彲浠ュ畾浣�,鎷ユ湁寮�鍏冲姛鑳�
             device.InClusterList.Add(new CommonDevice.InClusterObj { InCluster = 3 });
             device.OutClusterList.Add(new CommonDevice.OutClusterObj { OutCluster = 3 });
-
+            if (device.Type == DeviceType.AirSwitch || device.Type == DeviceType.OnOffOutput
+                || device.Type == DeviceType.DimmableLight || device.Type == DeviceType.ColorDimmableLight)
+            {
+                device.InClusterList.Add(new CommonDevice.InClusterObj { InCluster = 6 });
+                device.OutClusterList.Add(new CommonDevice.OutClusterObj { OutCluster = 6 });
+            }
+            if (device.Type == DeviceType.OnOffOutput || device.Type == DeviceType.DimmableLight
+                || device.Type == DeviceType.ColorDimmableLight)
+            {
+                device.InClusterList.Add(new CommonDevice.InClusterObj { InCluster = 8 });
+            }
+            if (device.Type == DeviceType.WindowCoveringDevice)
+            {
+                device.InClusterList.Add(new CommonDevice.InClusterObj { InCluster = 258 });
+            }
             //娣诲姞铏氭嫙璁惧
             LocalDevice.Current.AddVirtualDeviceToMemory(device);
 
@@ -933,7 +1000,9 @@
             A鏂规偊鍙屽紑鍥涙帶闈㈡澘 = 23,
             A鏂规偊鍥涘紑鍏帶闈㈡澘 = 24,
             A鏂规偊鏂伴闈㈡澘 = 25,
-            A鏂规偊鏂伴灏忔ā鍧� = 26
+            A鏂规偊鏂伴灏忔ā鍧� = 26,
+            A鍚搁《鐕冩皵浼犳劅鍣� = 27,
+            A鍥芥爣3璺�10A缁х數鍣ㄥ皬妯″潡 = 28,
         }
 
         #endregion

--
Gitblit v1.8.0