From d538cbe6f5e307122c37cde69b999dc9df30731a Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期五, 22 七月 2022 17:24:32 +0800 Subject: [PATCH] 2022年07月22日17:24:23 --- HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs | 1 HDL_ON/DAL/Server/HttpUtil.cs | 1 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs | 95 ++++++++++++++++++++----------- HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs | 32 +++++----- HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs | 2 5 files changed, 80 insertions(+), 51 deletions(-) diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs index ce16936..015e50c 100644 --- a/HDL_ON/DAL/Server/HttpUtil.cs +++ b/HDL_ON/DAL/Server/HttpUtil.cs @@ -17,6 +17,7 @@ /// 鍥哄畾鍩熷悕,姝e紡鐜 /// 鍏叡鍩熷悕灏辫繎瑙f瀽 /// </summary> + //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm /// <summary> diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs index 02bd437..63fd88a 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs @@ -63,7 +63,7 @@ case SPK.LightRGB: case SPK.LightRGBW: case SPK.LightCCT: - //case SPK.LightSwitch: + case SPK.LightSwitch: //绐楀笜 case SPK.CurtainSwitch: case SPK.CurtainRoller: diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs index 6a3bd4e..d75a820 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs @@ -258,6 +258,7 @@ /// <param name="deviceList"></param> private void LoadingDeviceListView(VerticalScrolViewLayout verticalScrolView, List<HDL_ON.Entity.Function> deviceList) { + loading.Start(); System.Threading.Tasks.Task.Run(() => { diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs index eb1cc55..a6402bb 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs @@ -2036,11 +2036,11 @@ { if (value == "true") { - button1.Text = Language.StringByID(StringId.zaixian); + button2.Text = Language.StringByID(StringId.zaixian); } else { - button1.Text = Language.StringByID(StringId.buzaixian); + button2.Text = Language.StringByID(StringId.buzaixian); } } break; @@ -2057,26 +2057,28 @@ string value = dic["value"]; switch (dic["key"]) { - case "people_status": - { - if (value == "true") - { - button1.Text = Language.StringByID(StringId.youren); - } - else { - button1.Text = Language.StringByID(StringId.wuren); - } - - } - break; + case "target_status": { if (value == "4") { - button2.Text = Language.StringByID(StringId.shi); + button1.Text = Language.StringByID(StringId.shi); } } break; + case "people_status": + { + if (value == "true") + { + button2.Text = Language.StringByID(StringId.youren); + } + else + { + button2.Text = Language.StringByID(StringId.wuren); + } + + } + break; } } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs index 9044957..c0f23e1 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs @@ -147,7 +147,9 @@ /// <returns></returns> public List<HDL_ON.Entity.Room> GetGatewayRoomList() { - return HDL_ON.Entity.SpatialInfo.CurrentSpatial.RoomList; + return HDL_ON.Entity.SpatialInfo.CurrentSpatial.RoomList; + + } /// <summary> /// 鑾峰彇缃戝叧鎴块棿鍒楄〃 @@ -180,7 +182,9 @@ /// <returns></returns> public List<HDL_ON.Entity.Function> GetGatewayDeviceList() { - return Entity.FunctionList.List.GetDeviceFunctionList(); + var list = Entity.FunctionList.List.GetDeviceFunctionList(); + return GetTestDevice(list, true); + //return list; } /// <summary> /// 鑾峰彇鍦烘櫙鍒楄〃 @@ -586,7 +590,7 @@ ///闂ㄩ攣绫� else if (deviceType == Language.StringByID(StringId.DoorLock)) { - functionTypeList.Add(SPK.DoorLock); + functionTypeList.Add(SPK.DoorLock); } else { @@ -943,57 +947,57 @@ { try { - //鑾峰彇閫昏緫ID鍒楄〃锛岀洰鍓嶉拡瀵规墍鏈�<澶囨敞:濡傛灉鍙拡瀵瑰綋鍓嶆墜鏈虹殑璇濓紝鍙互鐩存帴鎷跨紦瀛樻暟鎹嚜鍔ㄥ寲鍒楄〃閬嶅巻> - var idStr = Send.GetLogicIdList(); + //鑾峰彇閫昏緫ID鍒楄〃锛岀洰鍓嶉拡瀵规墍鏈�<澶囨敞:濡傛灉鍙拡瀵瑰綋鍓嶆墜鏈虹殑璇濓紝鍙互鐩存帴鎷跨紦瀛樻暟鎹嚜鍔ㄥ寲鍒楄〃閬嶅巻> + var idStr = Send.GetLogicIdList(); if (idStr.Code == "0" && idStr.Data != null && idStr.Data.ToString() != "") { var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data); logicDataList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date); } - ///鏈夎嚜鍔ㄥ垪琛ㄦ墠澶勭悊 - if (logicDataList.Count > 0) + ///鏈夎嚜鍔ㄥ垪琛ㄦ墠澶勭悊 + if (logicDataList.Count > 0) { - ///閬嶅巻鎵�鏈夊垪琛� - for (int i = 0; i < logicDataList.Count; i++) + ///閬嶅巻鎵�鏈夊垪琛� + for (int i = 0; i < logicDataList.Count; i++) { var logicDate = logicDataList[i]; - ///鑷姩鍖栨病鏈夐厤缃湴鐞嗗洿鏍忎笉澶勭悊 - if (string.IsNullOrEmpty(logicDate.geo_fence.latitude) || string.IsNullOrEmpty(logicDate.geo_fence.longitude)) + ///鑷姩鍖栨病鏈夐厤缃湴鐞嗗洿鏍忎笉澶勭悊 + if (string.IsNullOrEmpty(logicDate.geo_fence.latitude) || string.IsNullOrEmpty(logicDate.geo_fence.longitude)) { - //缁忕含搴︿负绌�,璁や负鑷姩鍖栨病鏈夐厤缃湴鐞嗗洿鏍忥紝涓嶅鐞�; - continue; + //缁忕含搴︿负绌�,璁や负鑷姩鍖栨病鏈夐厤缃湴鐞嗗洿鏍忥紝涓嶅鐞�; + continue; } - //鑷姩鍖栭厤缃緭鍏ユ潯浠剁含搴� - double lat = Convert.ToDouble(logicDate.geo_fence.latitude.Replace(",", ".")); - //鑷姩鍖栭厤缃緭鍏ユ潯浠剁粡搴� - double lon = Convert.ToDouble(logicDate.geo_fence.longitude.Replace(",", ".")); - //鑷姩鍖栭厤缃緭鍏ユ潯浠�<鍦扮悊鍥存爮鍗婂緞><鍗曚綅锛屽叕閲屻�佸崈绫�.绫�> - int radius = int.Parse(logicDate.geo_fence.radius); - //璁$畻2涓粡绾害涔嬮棿鐨勮窛绂� - int r = Infrastructure.Service.Helper.CalculatedDistance.Distance(out_lat, out_lng, lat, lon); - //瀹氫箟涓�涓眬閮ㄥ彉閲� - string direction = string.Empty; - //涓ょ偣璺濈灏忎簬閰嶇疆璺濈<鏃㈣嚜鍔ㄥ寲閰嶇疆杈撳叆鏉′欢鍦扮悊鍥存爮鍗婂緞>,璇存槑杩涘叆鍖哄煙 - if (r < radius) + //鑷姩鍖栭厤缃緭鍏ユ潯浠剁含搴� + double lat = Convert.ToDouble(logicDate.geo_fence.latitude.Replace(",", ".")); + //鑷姩鍖栭厤缃緭鍏ユ潯浠剁粡搴� + double lon = Convert.ToDouble(logicDate.geo_fence.longitude.Replace(",", ".")); + //鑷姩鍖栭厤缃緭鍏ユ潯浠�<鍦扮悊鍥存爮鍗婂緞><鍗曚綅锛屽叕閲屻�佸崈绫�.绫�> + int radius = int.Parse(logicDate.geo_fence.radius); + //璁$畻2涓粡绾害涔嬮棿鐨勮窛绂� + int r = Infrastructure.Service.Helper.CalculatedDistance.Distance(out_lat, out_lng, lat, lon); + //瀹氫箟涓�涓眬閮ㄥ彉閲� + string direction = string.Empty; + //涓ょ偣璺濈灏忎簬閰嶇疆璺濈<鏃㈣嚜鍔ㄥ寲閰嶇疆杈撳叆鏉′欢鍦扮悊鍥存爮鍗婂緞>,璇存槑杩涘叆鍖哄煙 + if (r < radius) { - //鍒拌揪鏌愬湴 - direction = "arrive"; + //鍒拌揪鏌愬湴 + direction = "arrive"; } else { - //绂诲紑 - direction = "leave"; + //绂诲紑 + direction = "leave"; } - ///閬嶅巻缂撳瓨鍒楄〃<涓嶄负绌鸿鏄庢暟鎹凡缁忔帹閫佽繃锛屼笉鍐嶆帹閫�> - var isPush = pushList.Find((o) => o.homeId == HomeId && o.userId == UserInfo.Current.ID && o.userLogicId == logicDate.userLogicId && o.arriveOnLeave == direction); + ///閬嶅巻缂撳瓨鍒楄〃<涓嶄负绌鸿鏄庢暟鎹凡缁忔帹閫佽繃锛屼笉鍐嶆帹閫�> + var isPush = pushList.Find((o) => o.homeId == HomeId && o.userId == UserInfo.Current.ID && o.userLogicId == logicDate.userLogicId && o.arriveOnLeave == direction); if (isPush == null) { - //鎺ㄩ�佺粰浜戠鏄惁鎴愬姛 - bool push = Send.GeoFenceStateReport(logicDate.userLogicId, logicDate.sid, direction); + //鎺ㄩ�佺粰浜戠鏄惁鎴愬姛 + bool push = Send.GeoFenceStateReport(logicDate.userLogicId, logicDate.sid, direction); if (push) { - ///娣诲姞鍒版帹閫佸垪琛� - pushList.Add(new Push + ///娣诲姞鍒版帹閫佸垪琛� + pushList.Add(new Push { homeId = HomeId, userId = UserInfo.Current.ID, @@ -1014,6 +1018,27 @@ /// 鎺ㄩ�佸垪琛�<杩欓噷鏁版嵁宸茬粡鎺ㄩ�佽繃> /// </summary> private static List<Push> pushList = new List<Push>(); + /// <summary> + /// 鑾峰彇妯℃嫙鐨勮澶囧垪琛� + /// </summary> + /// <param name="isBool">鏄惁寮�鍚�</param> + /// <returns></returns> + private List<Entity.Function> GetTestDevice(List<HDL_ON.Entity.Function> list, bool isBool) + { + if (isBool) + { + Entity.Function function = new Entity.Function { sid = "0123456789", name = "瓒呭0娉紶鎰熷櫒", spk = Entity.SPK.SensorUtrasonic }; + var device = list.Find((o) => { return o.sid == function.sid; }); + if (device == null) + { + list.Add(function); + } + + } + return list; + + + } } public class Push -- Gitblit v1.8.0