From e9775d3013567b4f06ed5af72f02396f742af3bf Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 06 九月 2023 11:59:52 +0800 Subject: [PATCH] 编辑群控增加线程 --- HDL_ON/Entity/Function/Function.cs | 116 +++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 95 insertions(+), 21 deletions(-) diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 4f6404c..711418f 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -445,20 +445,52 @@ /// </summary> public bool collect = false; - private bool _online = false; - /// <summary> - /// 鏄惁鍦ㄧ嚎 - /// </summary> - public bool online - { + private bool _online; + public bool online { get { + if (spk == SPK.AirSwitchP3) + { + return _online; + } return true; } set { _online = value; } + } + ///// <summary> + ///// 鏄惁鍦ㄧ嚎 + ///// </summary> + //public bool online + //{ + // get + // { + // if(spk == SPK.AirSwitchP3) + // { + // return _online; + // } + // return true; + // } + // set + // { + // _online = value; + // } + //} + + public bool isOnline() + { + if (spk == SPK.AirSwitchP3) + { + return online; + } + return true; + } + + public void setOnine(bool isOnline) + { + online = isOnline; } /// <summary> @@ -730,9 +762,9 @@ /// <summary> /// 淇濆瓨鎴块棿缁戝畾淇℃伅 /// </summary> - public void UpdataRoomIds() + public async void UpdataRoomIds() { - new System.Threading.Thread(() => + new System.Threading.Thread( () => { var pack = ApiUtlis.Ins.HttpRequest.UpdataDevcieBindRoomInfo(this); //鐩存帴淇濆瓨鏈湴锛� @@ -813,10 +845,10 @@ { foreach (var temp in gc.sids) { - var light = FunctionList.List.GetLightList().Find((obj) => obj.sid == temp.sid); - if (light != null) + var tempDevice = FunctionList.List.GetLightList().Find((obj) => obj.sid == temp.sid); + if (tempDevice != null) { - foreach (var attr in light.attributes) + foreach (var attr in tempDevice.attributes) { if (list.Find((obj) => obj.key == attr.key) == null) { @@ -835,6 +867,10 @@ foreach (var attr in list) { + if(attr.key == FunctionAttributeKey.ColorfulBegin || attr.key == FunctionAttributeKey.ColorfulEnd || attr.key == FunctionAttributeKey.ColorfulTime) + { + continue; + } //绐楀笜鍚屾椂鍙戦�佸紑鍏宠窡鐧惧垎姣斾細鏈夐棶棰橈紝 if(spk == SPK.CurtainRoller || spk == SPK.CurtainTrietex || spk == SPK.CurtainDream) { @@ -850,27 +886,54 @@ sFunc.type = "5"; } - string us = ""; switch (attr.key) { case FunctionAttributeKey.SetTemp: + var tt = GetAttribute(FunctionAttributeKey.TempType); + if (tt == null) + { + attr.unit = "掳C"; + } + else + { + if (tt.unit == string.Empty) + { + attr.unit = "掳C"; + } + else + { + if (tt.unit == "C") + { + attr.unit = "掳C"; + } + else if (tt.unit == "F") + { + attr.unit = "掳F"; + } + else + { + attr.unit = tt.unit; + } + } + } + break; case FunctionAttributeKey.RoomTemp: - us = "掳C"; + attr.unit = "掳C"; var tempType = attributes.Find((obj) => obj.key == FunctionAttributeKey.TempType); if (tempType != null) { - us = tempType.curValue.ToString(); + attr.unit = tempType.curValue.ToString(); } break; case FunctionAttributeKey.Percent: case FunctionAttributeKey.Brightness: - us = "%"; + attr.unit = "%"; break; case FunctionAttributeKey.CCT: - us = "K"; + attr.unit = "K"; break; case FunctionAttributeKey.Angle: - us = "掳"; + attr.unit = "掳"; break; } @@ -934,13 +997,13 @@ vv = 26; } sFunc.status.Add(new SceneFunctionStatus() { - UintString = us, + UintString = attr.unit, key = attr.key, value = Convert.ToInt32(vv).ToString(), max = attr.max, min = attr.min }) ; } else { sFunc.status.Add(new SceneFunctionStatus() { - UintString = us, + UintString = attr.unit, key = attr.key, value = attr.curValue.ToString(), max = attr.max, min = attr.min }); } break; @@ -954,6 +1017,11 @@ /// 鏇存柊鏃堕棿 /// </summary> public DateTime refreshTime = DateTime.MinValue; + /// <summary> + /// 鏈�鍚庢洿鏂扮姸鎬佺殑鏃堕棿 + /// </summary> + [Newtonsoft.Json.JsonIgnore] + public DateTime updateTime = DateTime.MinValue; /// <summary> /// 鑾峰彇鏈湴鎺у埗鏁版嵁 @@ -1088,6 +1156,10 @@ /// 浜戠璐熻矗鐢熸垚 /// </summary> public string deviceId = "0"; + /// <summary> + /// 鍦ㄧ嚎鐘舵�� + /// </summary> + public bool online = true; public List<AttributesStatus> status = new List<AttributesStatus>(); } /// <summary> @@ -1846,6 +1918,8 @@ { var spkList = new List<string>(); spkList.Add(ElectricEnergy); + spkList.Add(AirSwitch); + spkList.Add(AirSwitchP3); return spkList; } #endregion @@ -2190,8 +2264,8 @@ spkList.Add(ElectricTuyaWeepRobot2); spkList.Add(ElectricTuyaWaterValve); spkList.Add(ElectricTuyaWaterValve2); - spkList.Add(AirSwitch); - spkList.Add(AirSwitchP3); + //spkList.Add(AirSwitch); + //spkList.Add(AirSwitchP3); return spkList; } -- Gitblit v1.8.0