From e74f8bfbe6c52f220deef5fc99a53c3a7872808d Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期二, 11 四月 2023 17:08:34 +0800
Subject: [PATCH] Merge branch 'Dev-Wxr' into wjc
---
HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs | 150 +++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 130 insertions(+), 20 deletions(-)
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs
index 28dea93..1c25db0 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs
@@ -1,22 +1,79 @@
锘縰sing System;
using System.Collections.Generic;
+using HDL_ON.Common;
+using HDL_ON.DAL.Server;
using Shared;
namespace HDL_ON.Entity
{
- public class GroupControl
+ public class GroupControl : Function
{
public GroupControl()
{
+ spk = "GroupControl";
}
+ /// <summary>
+ /// 缇ゆ帶ID
+ /// </summary>
+ public string userDeviceGroupControlId = string.Empty;
/// <summary>
/// 缇ゆ帶sid
/// </summary>
- public string sid = string.Empty;
+ //public string sid = string.Empty;
+ /// <summary>
+ /// 鐢熸垚缇ゆ帶sid
+ /// </summary>
+ public string NewGroupControlSid()
+ {
+ string sceneId = "";
+ try
+ {
+ string sOidBeginsWith = "000101";//鍘傚晢 + 閫氳鏂瑰紡
+ DateTime dt = DateTime.Now;
+ DateTime startTime = TimeZoneInfo.ConvertTimeToUtc(new DateTime(2020, 1, 1));
+ long m = (long)((dt - startTime).TotalMilliseconds / 10);
+ string sTimeSpan = "00000000";
+
+ byte[] arry = new byte[4];
+ arry[0] = (byte)(m & 0xFF);
+ arry[1] = (byte)((m & 0xFF00) >> 8);
+ arry[2] = (byte)((m & 0xFF0000) >> 16);
+ arry[3] = (byte)((m >> 24) & 0xFF);
+ sTimeSpan = arry[0].ToString("X2") + arry[1].ToString("X2") + arry[2].ToString("X2") + arry[3].ToString("X2");
+
+
+ if (sTimeSpan.Length >= 8)
+ {
+ sTimeSpan = sTimeSpan.Substring(0, 8);
+ }
+ else
+ {
+ sTimeSpan = Guid.NewGuid().ToString().Substring(0, 8);
+ //sTimeSpan = "00000000";
+ }
+
+ sceneId = sOidBeginsWith + sTimeSpan;
+
+ sceneId += "AA";
+ sceneId += "AA01";
+ int maxId = 1;
+
+ Random random = new Random(Guid.NewGuid().GetHashCode());
+ maxId = random.Next(10);
+
+ sceneId += (maxId + 1).ToString("X4");
+ sceneId += "0000";
+ }
+ catch
+ {
+ return sceneId;
+ }
+ return sceneId;
+ }
/// <summary>
/// 缇ゆ帶鍚嶇О
/// </summary>
- public string name = string.Empty;
+ //public string name = string.Empty;
/// <summary>
/// 缇ゆ帶绫诲瀷
/// </summary>
@@ -25,39 +82,69 @@
/// 鎴块棿uid
/// </summary>
public List<String> uids = new List<string>();
- public List<String> roomIds = 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 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>
- /// <returns></returns>
- public string GetRoomListName()
+ /// <param name="pairs"></param>
+ public void Control(Dictionary<string,object> pairs)
{
- string roomNameList = "";
- foreach (var roomId in roomIds)
+ try
{
- var findRoom = SpatialInfo.CurrentSpatial.RoomList.Find(obj => obj.roomId == roomId);
- if (findRoom == null)
+ var controlValues = new Dictionary<string, object>();
+ foreach(var p in pairs)
{
- continue;
+ controlValues.Add("key", p.Key);
+ controlValues.Add("value", p.Value);
}
- if (roomNameList != "")
+ var pack = ApiUtlis.Ins.HttpRequest.ControlGroupControl(userDeviceGroupControlId, controlValues);
+ if (pack != null)
{
- roomNameList += ",";
+ if (pack.Code == StateCode.SUCCESS)
+ {
+ //DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl.
+ }
+ else
+ {
+ MainPage.Log($"缇ゆ帶鎺у埗澶辫触,Code: {pack.Code}");
+ }
}
- roomNameList += findRoom.floorName + "-" + findRoom.roomName;
}
- if (roomNameList == "")
- {
- roomNameList = Language.StringByID(StringId.WholeZone);
+ catch (Exception ex){
+ MainPage.Log($"缇ゆ帶鎺у埗澶辫触: {ex.Message}");
}
- return roomNameList;
}
}
@@ -71,6 +158,29 @@
/// 鍔熻兘spk
/// </summary>
public string spk = string.Empty;
+
+
+ }
+
+
+ public class GroupControlType
+ {
+ /// <summary>
+ /// 绫诲瀷
+ /// </summary>
+ public string type = string.Empty;
+ /// <summary>
+ /// 绫诲瀷鍚嶇О
+ /// </summary>
+ public string typeName = string.Empty;
+ /// <summary>
+ /// 缇ゆ帶鏀寔鐨剆pk
+ /// </summary>
+ public List<string> spks = new List<string>();
+ /// <summary>
+ /// 缇ゆ帶鏀寔鐨剆pk灞炴��
+ /// </summary>
+ public List<string> spkAttrs = new List<string>();
}
}
--
Gitblit v1.8.0