From 592974441a4df95fffd9167c90192da1a390b1c2 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 06 六月 2023 11:51:12 +0800
Subject: [PATCH] Merge branch 'Dev-Branch'

---
 HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs |  105 ++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 77 insertions(+), 28 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs
index e58062f..30fbc37 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs
@@ -1,5 +1,8 @@
 锘縰sing System;
 using System.Collections.Generic;
+using HDL_ON.Common;
+using HDL_ON.DAL.Server;
+using HDL_ON.DriverLayer;
 using Shared;
 
 namespace HDL_ON.Entity
@@ -79,41 +82,85 @@
         /// <summary>
         /// 鎴块棿uid
         /// </summary>
-        public List<String> uids = new List<string>();
+        [Newtonsoft.Json.JsonIgnore]
+        public List<string> uids = new List<string>();
         //public List<String> roomIds = new List<string>();
         /// <summary>
         /// 缇ゆ帶鍔熻兘sid閰嶇疆
         /// </summary>
         public List<GroupControlFunction> sids = new List<GroupControlFunction>();
 
+        /// <summary>
+        /// 鑾峰彇璁惧娣诲姞鍒版埧闂寸殑鎴块棿鍚嶇О
+        /// </summary>
+        /// <returns></returns>
+        public string GetUidListName()
+        {
+            string roomNameList = "";
+            foreach (var roomId in uids)
+            {
+                var findRoom = SpatialInfo.CurrentSpatial.RoomList.Find(obj => obj.roomId == roomId);
+                if (findRoom == null)
+                {
+                    continue;
+                }
+                if (roomNameList != "")
+                {
+                    roomNameList += ",";
+                }
+                roomNameList += findRoom.floorName + "-" + findRoom.roomName;
+            }
+            if (roomNameList == "")
+            {
+                roomNameList = Language.StringByID(StringId.WholeZone);
+            }
+            return roomNameList;
+        }
 
-
-        ///// <summary>
-        ///// 鑾峰彇璁惧娣诲姞鍒版埧闂寸殑鎴块棿鍚嶇О
-        ///// </summary>
-        ///// <returns></returns>
-        //public string GetRoomListName()
-        //{
-        //    string roomNameList = "";
-        //    foreach (var roomId in roomIds)
-        //    {
-        //        var findRoom = SpatialInfo.CurrentSpatial.RoomList.Find(obj => obj.roomId == roomId);
-        //        if (findRoom == null)
-        //        {
-        //            continue;
-        //        }
-        //        if (roomNameList != "")
-        //        {
-        //            roomNameList += ",";
-        //        }
-        //        roomNameList += findRoom.floorName + "-" + findRoom.roomName;
-        //    }
-        //    if (roomNameList == "")
-        //    {
-        //        roomNameList = Language.StringByID(StringId.WholeZone);
-        //    }
-        //    return roomNameList;
-        //}
+        /// <summary>
+        /// 缇ゆ帶鎺у埗
+        /// </summary>
+        /// <param name="pairs"></param>
+        public void Control(Dictionary<string,string> pairs)
+        {
+            try
+            {
+               
+                if (DriverLayer.Control.Ins.GatewayOnline_Local)
+                {
+                    var functionControlDataObj = GetGatewayAlinkControlData(pairs);
+                    var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(functionControlDataObj);
+                    var sendBytes = DriverLayer.Control.Ins.ConvertSendBodyData(CommunicationTopic.ct.ControlGroupControlTopic, functionControlDataJson);
+                    new Control_Udp().SendLocalHdlLinkData(sendBytes, functionControlDataObj.id, 3);
+                    MainPage.Log($"鏈湴閫氳 鍙戦�丠DL-Link鏁版嵁:{functionControlDataJson}");
+                }
+                else
+                {
+                    
+                    var controlValues = new Dictionary<string, object>();
+                    foreach (var p in pairs)
+                    {
+                        controlValues.Add("key", p.Key);
+                        controlValues.Add("value", p.Value);
+                    }
+                    var pack = ApiUtlis.Ins.HttpRequest.ControlGroupControl(userDeviceGroupControlId, controlValues);
+                    if (pack != null)
+                    {
+                        if (pack.Code == StateCode.SUCCESS)
+                        {
+                            //DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl.
+                        }
+                        else
+                        {
+                            MainPage.Log($"缇ゆ帶鎺у埗澶辫触,Code: {pack.Code}");
+                        }
+                    }
+                }
+            }
+            catch (Exception ex){
+                MainPage.Log($"缇ゆ帶鎺у埗澶辫触: {ex.Message}");
+            }
+        }
     }
 
     public class GroupControlFunction
@@ -126,6 +173,8 @@
         /// 鍔熻兘spk
         /// </summary>
         public string spk = string.Empty;
+
+
     }
 
 

--
Gitblit v1.8.0