From e06be53dff56744de8db2a2aec136d494cc187bf Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 07 十一月 2023 16:47:02 +0800 Subject: [PATCH] Merge branch 'Dev-Branch' of http://59.41.255.150:6688/r/~wxr/OnPro into Dev-Branch --- HDL-ON_Android/Assets/Language.ini | 19 ++ HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs | 13 + HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs | 49 +++++ HDL_ON/Common/ApiUtlis.cs | 7 HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs | 258 ++++++++++++++++++-------------- HDL-ON_iOS/Resources/Language.ini | 18 ++ HDL_ON/DAL/Server/HttpUtil.cs | 4 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs | 9 HDL-ON_Android/Resources/Resource.designer.cs | 2 HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs | 4 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs | 2 HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs | 61 ++++++- HDL_ON/Common/R.cs | 14 + 13 files changed, 315 insertions(+), 145 deletions(-) diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini index daa1cd7..96e7893 100644 --- a/HDL-ON_Android/Assets/Language.ini +++ b/HDL-ON_Android/Assets/Language.ini @@ -1231,6 +1231,9 @@ 7174=Exceed 7175=Under 7176=HV +7177=Execution mode +7178=Change execution +7179=Execute on receipt 8501=Video door lock 8502=Electric quantity @@ -2633,6 +2636,10 @@ 7174=鐓ф槑搴﹂珮浜� 7175=鐓ф槑搴︿綆浜� 7176=鍏夌収 +7177=鎵ц妯″紡 +7178=鏀瑰彉鎵嶆墽琛� +7179=鏀跺埌灏辨墽琛� + @@ -4023,6 +4030,9 @@ 7174=Exceed 7175=Under 7176=HV +7177=Execution mode +7178=Change execution +7179=Execute on receipt 8501=Video door lock 8502=Electric quantity @@ -5406,6 +5416,9 @@ 7174=Exceed 7175=Under 7176=HV +7177=Execution mode +7178=Change execution +7179=Execute on receipt 8501=Video door lock 8502=Electric quantity @@ -6795,6 +6808,9 @@ 7174=Exceed 7175=Under 7176=HV +7177=Execution mode +7178=Change execution +7179=Execute on receipt 8501=Video door lock 8502=Electric quantity @@ -8120,6 +8136,9 @@ 7174=Exceed 7175=Under 7176=HV +7177=Execution mode +7178=Change execution +7179=Execute on receipt 8501=袙褨写械芯蟹邪屑芯泻 写胁械褉械泄 8502=袣褨谢褜泻褨褋褌褜 械谢械泻褌褉芯械薪械褉谐褨褩 diff --git a/HDL-ON_Android/Resources/Resource.designer.cs b/HDL-ON_Android/Resources/Resource.designer.cs index af7c4b4..485dc4b 100644 --- a/HDL-ON_Android/Resources/Resource.designer.cs +++ b/HDL-ON_Android/Resources/Resource.designer.cs @@ -15,7 +15,7 @@ { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "13.2.1.111")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "13.2.0.99")] public partial class Resource { diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini index daa1cd7..cad4950 100644 --- a/HDL-ON_iOS/Resources/Language.ini +++ b/HDL-ON_iOS/Resources/Language.ini @@ -1231,6 +1231,9 @@ 7174=Exceed 7175=Under 7176=HV +7177=Execution mode +7178=Change execution +7179=Execute on receipt 8501=Video door lock 8502=Electric quantity @@ -2633,6 +2636,9 @@ 7174=鐓ф槑搴﹂珮浜� 7175=鐓ф槑搴︿綆浜� 7176=鍏夌収 +7177=鎵ц妯″紡 +7178=鏀瑰彉鎵嶆墽琛� +7179=鏀跺埌灏辨墽琛� @@ -4023,6 +4029,9 @@ 7174=Exceed 7175=Under 7176=HV +7177=Execution mode +7178=Change execution +7179=Execute on receipt 8501=Video door lock 8502=Electric quantity @@ -5406,6 +5415,9 @@ 7174=Exceed 7175=Under 7176=HV +7177=Execution mode +7178=Change execution +7179=Execute on receipt 8501=Video door lock 8502=Electric quantity @@ -6795,6 +6807,9 @@ 7174=Exceed 7175=Under 7176=HV +7177=Execution mode +7178=Change execution +7179=Execute on receipt 8501=Video door lock 8502=Electric quantity @@ -8120,6 +8135,9 @@ 7174=Exceed 7175=Under 7176=HV +7177=Execution mode +7178=Change execution +7179=Execute on receipt 8501=袙褨写械芯蟹邪屑芯泻 写胁械褉械泄 8502=袣褨谢褜泻褨褋褌褜 械谢械泻褌褉芯械薪械褉谐褨褩 diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs index c04aa5a..96f5c7d 100644 --- a/HDL_ON/Common/ApiUtlis.cs +++ b/HDL_ON/Common/ApiUtlis.cs @@ -535,11 +535,12 @@ //======================瀹夐槻==================== GetSecurityList(); + + //===================璇诲彇閫昏緫鍒楄〃========================== + Logic.LogicList.Clear();//涓婚〉涓嬫媺寮哄埗鍒锋柊鑷姩鍖栧垪琛� + MainView.GetLogicList();//璇诲彇鑷姩鍖栧垪琛� }) { IsBackground = true }.Start(); - - //===================璇诲彇閫昏緫鍒楄〃========================== - Logic.LogicList.Clear();//涓婚〉涓嬫媺寮哄埗鍒锋柊鑷姩鍖栧垪琛� //======================娉ㄥ唽鎺ㄩ��==================== httpRequest.RegisteredPush(); diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index 1af9c9f..77189b4 100644 --- a/HDL_ON/Common/R.cs +++ b/HDL_ON/Common/R.cs @@ -3555,7 +3555,19 @@ /// 鍏夌収 /// </summary> public const int guangzhao = 7176; - + /// <summary> + /// 鎵ц妯″紡 + /// </summary> + public const int zhixingmoshi = 7177; + /// <summary> + /// 鏀瑰彉鎵嶆墽琛� + /// </summary> + public const int gaibiancaizhixing = 7178; + /// <summary> + /// 鏀跺埌灏辨墽琛� + /// </summary> + public const int shoudaojiuzhixing = 7179; + /// <summary> diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs index 0be5794..27ce5ef 100644 --- a/HDL_ON/DAL/Server/HttpUtil.cs +++ b/HDL_ON/DAL/Server/HttpUtil.cs @@ -18,8 +18,8 @@ /// 鍥哄畾鍩熷悕,姝e紡鐜 /// 鍏叡鍩熷悕灏辫繎瑙f瀽 /// </summary> - public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; - //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; + //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; + public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; const string APP_KEY = "HDL-HOME-APP-TEST"; const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"; diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs index d64166b..af8ae15 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using HDL_ON.Entity; using HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock; -using Newtonsoft.Json; namespace HDL_ON.UI.UI2.Intelligence.Automation @@ -42,8 +41,12 @@ /// 浜轰綋浼犳劅鍣ㄦ寔缁椂闂翠笓鐢� /// </summary> private string hold_time=string.Empty; + /// <summary> + /// 妫�娴嬬被鍨� 閰嶅悎condition_type=3鏃朵娇鐢�,娌℃湁璇ュ瓧娈点�佽鍊兼垨0: 鐘舵�佹娴�(姣忔鏀跺埌鐘舵�佸氨鎴愮珛),1:鍔ㄤ綔妫�娴�(闇�瑕佸垏鎹㈢姸鎬佹墠鎴愮珛) + /// </summary> + private string detect_type = "0"; - + private static ConditionDeviceFunList m_Current = null; @@ -199,7 +202,7 @@ //浜轰綋瀛樺湪浼犳劅鍣� case SPK.SensorPirHold: { - + LogicView.FunTypeView view1 = new LogicView.FunTypeView(); view1.btnText.TextID = StringId.rentijiance; @@ -227,6 +230,31 @@ }; + LogicView.FunTypeView view3 = new LogicView.FunTypeView(); + view3.frameLayout.Y = view2.frameLayout.Bottom; + view3.btnText.TextID = StringId.zhixingmoshi; + view3.btnState.TextID = StringId.shoudaojiuzhixing; + fLayout.AddChidren(view3.FLayoutView()); + view3.btnClick.MouseUpEventHandler += (sender, e) => + { + FrameLayout frame = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTrans60lucence }; + this.AddChidren(frame); + LogicView.SwitchView switchView = new LogicView.SwitchView(); + switchView.FLayoutView(frame, StringId.gaibiancaizhixing, StringId.shoudaojiuzhixing, view3.btnState.Text, 2, (intValue) => + { + if (StringId.gaibiancaizhixing == intValue) + { + this.detect_type = "1"; + } + else + { + this.detect_type = "0"; + } + view3.btnState.TextID = intValue; + selectedState = device.spk + "_" + this.detect_type; + }); + }; + if (edit) { @@ -239,9 +267,21 @@ int h = time / (60 * 60); int m = time % (60 * 60) / 60; int s = (time % (60 * 60) % 60); - view2.btnState.Text = LogicMethod.Current.getTimeStr(inputs.hold_time); + view2.btnState.Text = LogicMethod.Current.getTimeStr(inputs.hold_time); view2.btnState.Name = h + ":" + m + ":" + s; this.hold_time = inputs.hold_time; + } + if (!string.IsNullOrEmpty(inputs.detect_type)) + { + this.detect_type = inputs.detect_type; + if (inputs.detect_type == "1") + { + view3.btnState.TextID = StringId.gaibiancaizhixing; + } + else + { + view3.btnState.TextID = StringId.shoudaojiuzhixing; + } } } catch { } @@ -843,6 +883,7 @@ { //浜轰綋瀛樺湪浼犳劅鍣� inputDevice.hold_time = this.hold_time; + inputDevice.detect_type = this.detect_type; } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs index 1425f70..c5fbf03 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs @@ -489,7 +489,7 @@ string value = this.GetKeyValue("people_status", dicList); if (string.IsNullOrEmpty(value)) { - inputView.btnState.Text = LogicMethod.Current.getTimeStr(inputCondition.hold_time).Replace("0s",""); + inputView.btnState.Text = LogicMethod.Current.getTimeStr(inputCondition.hold_time).Replace("0s", ""); break; } @@ -505,6 +505,17 @@ int time = int.Parse(inputCondition.hold_time); inputView.btnState.Text += "鎸佺画" + LogicMethod.Current.getTimeStr(inputCondition.hold_time).Replace("0s", ""); } + if (!string.IsNullOrEmpty(inputCondition.detect_type)) + { + if (inputCondition.detect_type == "1") + { + inputView.btnState.Text += "," + Language.StringByID(StringId.gaibiancaizhixing); + } + else + { + inputView.btnState.Text += "," + Language.StringByID(StringId.shoudaojiuzhixing); + } + } } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs index da5fb58..807103c 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs @@ -107,6 +107,10 @@ /// </summary> public string identifier = ""; /// <summary> + /// 妫�娴嬬被鍨� 閰嶅悎condition_type=3鏃朵娇鐢�,娌℃湁璇ュ瓧娈点�佽鍊兼垨0: 鐘舵�佹娴�(姣忔鏀跺埌鐘舵�佸氨鎴愮珛),1:鍔ㄤ綔妫�娴�(闇�瑕佸垏鎹㈢姸鎬佹墠鎴愮珛); + /// </summary> + public string detect_type = "0"; + /// <summary> /// 浜轰綋绉诲姩浼犳劅鍣紙甯︽寔缁椂闂达級 /// </summary> public string hold_time = ""; diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs index ea4a26d..14b8c93 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs @@ -1080,18 +1080,17 @@ //涓嶆槸涓昏处鍙风洿鎺ヨ繑鍥� return; } - List<LogicData> logicDataList = new List<LogicData>(); + List<LogicIdData> logicDataList = new List<LogicIdData>(); logicDataList.Clear(); System.Threading.Tasks.Task.Run(() => { try { //鑾峰彇閫昏緫ID鍒楄〃锛岀洰鍓嶉拡瀵规墍鏈�<澶囨敞:濡傛灉鍙拡瀵瑰綋鍓嶆墜鏈虹殑璇濓紝鍙互鐩存帴鎷跨紦瀛樻暟鎹嚜鍔ㄥ寲鍒楄〃閬嶅巻> - var idStr = Send.Current.GetLogicIdList(); - if (idStr != null) + var idStrList = Send.Current.GetLogicIdList(); + if (idStrList != null) { - var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data); - logicDataList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date); + logicDataList.AddRange(idStrList); } ///鏈夎嚜鍔ㄥ垪琛ㄦ墠澶勭悊 if (logicDataList.Count > 0) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs index 290a07f..138c39d 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs @@ -197,7 +197,7 @@ }; ///鏄剧ず涔嬪墠鐘舵�� - if (stateVuale != "") + if (!string.IsNullOrEmpty(stateVuale)) { if (stateVuale == btnOn.Text) { diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs index 84ea1a0..d0a06bd 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs @@ -17,119 +17,152 @@ /// </summary> public static void MainShow() { - automationPage.RemoveAll(); - VerticalRefreshLayout vv = new VerticalRefreshLayout(); - vv.Height = Application.GetRealHeight(667 - 64 - 49);//妯℃嫙楂樺害 - automationPage.AddChidren(vv); - vv.BeginHeaderRefreshingAction += () => + + System.Threading.Tasks.Task.Run(() => { - //娓呴櫎涔嬪墠鑷姩鍖栧垪琛�; - Logic.LogicList.Clear(); - //鑾峰彇鑷姩鍒楄〃 - GetLogicList(); - //鍒锋柊鑷姩鍖栫晫闈� - MainShow(); - //鍏抽棴鍒锋柊View锛� - vv.EndHeaderRefreshing(); - }; - //鑾峰彇鑷姩鍖栧垪琛� - GetLogicList(); - for (int i = Logic.LogicList.Count - 1; i >= 0; i--)//闄嶅簭鎺掑垪 - //for (int i = 0; i < Logic.LogicList.Count; i++) - { - var currLogic = Logic.LogicList[i]; - ///涓婁笅闂撮殧12鍍忕礌 - vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) }); - LogicView.SingleLogicView logicView = new LogicView.SingleLogicView(); - vv.AddChidren(logicView.FLayoutView()); - logicView.btnLogicName.Text = currLogic.name; - logicView.btnWeekText.Text = GetCyclicText(currLogic); - logicView.btnclick.MouseUpEventHandler += (sen, e) => + try { - //Logic.currlogic = currLogic; - //var addLogic = new AddLogic(); - //MainPage.BasePageView.AddChidren(addLogic); - //addLogic.Show(); - //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - new MainView { }.SkipAddLogicPage(currLogic); - }; - //寮�鍏冲浘鏍囩殑鐐瑰嚮浜嬩欢 - logicView.btnSwitchIcon.MouseUpEventHandler += (sender1, e1) => + //鑾峰彇鑷姩鍖栧垪琛� + GetLogicList(); + } + catch { } + finally { - logicView.btnSwitchIcon.IsSelected = !logicView.btnSwitchIcon.IsSelected; - if (logicView.btnSwitchIcon.IsSelected) + Application.RunOnMainThread(() => { - logicView.btnSwitchIcon.IsSelected = true; - currLogic.enable = "true"; - } - else - { - logicView.btnSwitchIcon.IsSelected = false; - currLogic.enable = "false"; - } - new System.Threading.Thread(() => - { - try + + automationPage.RemoveAll(); + VerticalRefreshLayout vv = new VerticalRefreshLayout(); + vv.Height = Application.GetRealHeight(667 - 64 - 49);//妯℃嫙楂樺害 + automationPage.AddChidren(vv); + vv.BeginHeaderRefreshingAction += () => { - //閫昏緫浣胯兘鐨勫懡浠� - Send.Current.EnableLogic(currLogic); + System.Threading.Tasks.Task.Run(() => + { + try + { + //寮哄埗鏇存柊鑷姩鍖栧垪琛�; + Logic.LogicList.Clear(); + //鑾峰彇鑷姩鍖栧垪琛� + GetLogicList(); + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + //鍒锋柊鑷姩鍖栫晫闈� + MainShow(); + //鍏抽棴鍒锋柊View锛� + vv.EndHeaderRefreshing(); + }); + } + + }); + + + }; + + for (int i = Logic.LogicList.Count - 1; i >= 0; i--)//闄嶅簭鎺掑垪 + { + var currLogic = Logic.LogicList[i]; + ///涓婁笅闂撮殧12鍍忕礌 + vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) }); + LogicView.SingleLogicView logicView = new LogicView.SingleLogicView(); + vv.AddChidren(logicView.FLayoutView()); + logicView.btnLogicName.Text = currLogic.name; + logicView.btnWeekText.Text = GetCyclicText(currLogic); + logicView.btnclick.MouseUpEventHandler += (sen, e) => + { + //Logic.currlogic = currLogic; + //var addLogic = new AddLogic(); + //MainPage.BasePageView.AddChidren(addLogic); + //addLogic.Show(); + //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + new MainView { }.SkipAddLogicPage(currLogic); + }; + //寮�鍏冲浘鏍囩殑鐐瑰嚮浜嬩欢 + logicView.btnSwitchIcon.MouseUpEventHandler += (sender1, e1) => + { + logicView.btnSwitchIcon.IsSelected = !logicView.btnSwitchIcon.IsSelected; + if (logicView.btnSwitchIcon.IsSelected) + { + logicView.btnSwitchIcon.IsSelected = true; + currLogic.enable = "true"; + } + else + { + logicView.btnSwitchIcon.IsSelected = false; + currLogic.enable = "false"; + } + new System.Threading.Thread(() => + { + try + { + //閫昏緫浣胯兘鐨勫懡浠� + Send.Current.EnableLogic(currLogic); + + } + catch { } + + }) + { IsBackground = true }.Start(); + }; + + + GetSelectIcon(logicView.frameLayout, currLogic); + if (i == 0)//闄嶅簭鎺掑垪 + { + ///鏈�鍚庝竴涓窛绂绘渶搴曢儴12,鐣岄潰鏄剧ず鏁堟灉浣滅敤; + vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(20) }); + } + if (currLogic.enable == "true") + { + logicView.btnSwitchIcon.IsSelected = true; + } + else + { + logicView.btnSwitchIcon.IsSelected = false; + } + ///鏄剧ず鐗规畩鑷姩鍖栨爣蹇� + if (currLogic.tag == true) + { + logicView.btnIsDelTag.Visible = true; + } + else + { + logicView.btnIsDelTag.Visible = false; + } } - catch { } - }) - { IsBackground = true }.Start(); - }; + if (Logic.LogicList.Count == 0) + { + Button btnTipNot = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(120), + Width = Application.GetRealWidth(180), + Height = Application.GetRealWidth(180), + UnSelectedImagePath = "TipNot.png", + }; + automationPage.AddChidren(btnTipNot); + Button btnTipNotText = new Button() + { + Y = btnTipNot.Bottom + Application.GetRealHeight(16), + Height = Application.GetRealHeight(20), + TextID = StringId.logicnull, + TextAlignment = TextAlignment.Center, + TextSize = LogicView.TextSize.text14, + TextColor = CSS.CSS_Color.textConfirmColor, + }; + automationPage.AddChidren(btnTipNotText); + } + }); + } + }); - GetSelectIcon(logicView.frameLayout, currLogic); - if (i == 0)//闄嶅簭鎺掑垪 - //if (Logic.LogicList.Count - 1 == i) - { - ///鏈�鍚庝竴涓窛绂绘渶搴曢儴12,鐣岄潰鏄剧ず鏁堟灉浣滅敤; - vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) }); - } - if (currLogic.enable == "true") - { - logicView.btnSwitchIcon.IsSelected = true; - } - else - { - logicView.btnSwitchIcon.IsSelected = false; - } - ///鏄剧ず鐗规畩鑷姩鍖栨爣蹇� - if (currLogic.tag == true) - { - logicView.btnIsDelTag.Visible = true; - } - else - { - logicView.btnIsDelTag.Visible = false; - } - } - - if (Logic.LogicList.Count == 0) - { - Button btnTipNot = new Button() - { - Gravity = Gravity.CenterHorizontal, - Y = Application.GetRealHeight(120), - Width = Application.GetRealWidth(180), - Height = Application.GetRealWidth(180), - UnSelectedImagePath = "TipNot.png", - }; - automationPage.AddChidren(btnTipNot); - Button btnTipNotText = new Button() - { - Y = btnTipNot.Bottom + Application.GetRealHeight(16), - Height = Application.GetRealHeight(20), - TextID = StringId.logicnull, - TextAlignment = TextAlignment.Center, - TextSize = LogicView.TextSize.text14, - TextColor = CSS.CSS_Color.textConfirmColor, - }; - automationPage.AddChidren(btnTipNotText); - } } /// <summary> /// 鎸�+璺宠浆鍒伴�昏緫鐣岄潰鐨勬柟娉� @@ -265,13 +298,11 @@ //鑷姩鍖栧垪琛ㄤ负0鎵嶅幓鑾峰彇鑷姩鍖栧垪琛紱 return; } - List<string> logicIdList = new List<string>(); + var logicIdList = new List<string>(); //鑾峰彇閫昏緫ID鍒楄〃 - var idStr = Send.Current.GetLogicIdList(); - if (idStr != null) + var dateList = Send.Current.GetLogicIdList(); + if (dateList != null) { - var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data); - var dateList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date); for (int i = 0; i < dateList.Count; i++) { //娣诲姞閫昏緫ID @@ -279,16 +310,15 @@ } } //鑾峰彇鑷姩鍖栧垪琛� - var logicListStr = Send.Current.GetLogic(logicIdList); - if (logicListStr != null) + var logicList = Send.Current.GetLogic(logicIdList); + if (logicList != null) { - var logicList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Logic>>(logicListStr.Data.ToString()); for (int j = 0; j < logicList.Count; j++) { var logic = logicList[j]; if (logic != null) { - //鏌ユ壘鏄惁宸茬粡瀛樺湪璇ラ�昏緫 + //鍘婚噸 var if_logic = Logic.LogicList.Find((c) => c.userLogicId == logic.userLogicId); if (if_logic == null) { @@ -574,8 +604,8 @@ return false; } } - } - class LogicData + } + public class LogicIdData { /// <summary> /// 浜戠鍞竴id diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs index 069e547..a843941 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs @@ -47,7 +47,7 @@ /// 鑾峰彇閫昏緫ID鍒楄〃 /// </summary> /// <returns></returns> - public ResponsePackNew GetLogicIdList(bool isTip = false) + public List<LogicIdData> GetLogicIdList(bool isTip = false) { var jObject = new JObject { { "homeId", LogicMethod.Current.HomeId } }; var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_List, "鑾峰彇閫昏緫ID鍒楄〃"); @@ -61,14 +61,15 @@ { return null; } - return responsePackNew; + var dateList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicIdData>>(responsePackNew.Data.ToString()); + return dateList; } /// <summary> /// 鑾峰彇鑷姩鍖栬鎯� /// </summary> /// <param name="listIdList">鑷姩鍖朓D鍒楄〃</param> /// <returns></returns> - public ResponsePackNew GetLogic(List<string> listIdList, bool isTip = false) + public ResponsePackNew GetLogic1(List<string> listIdList, bool isTip = false) { var jArray = new JArray { }; for (int i = 0; i < listIdList.Count; i++) @@ -89,6 +90,35 @@ } return responsePackNew; } + + /// <summary> + /// 鑾峰彇鑷姩鍖栬鎯� + /// </summary> + /// <param name="listIdList">鑷姩鍖朓D鍒楄〃</param> + /// <returns></returns> + public List<Logic> GetLogic(List<string> listIdList, bool isTip = false) + { + var jArray = new JArray { }; + for (int i = 0; i < listIdList.Count; i++) + { + jArray.Add(listIdList[i]); + } + var jObject = new JObject { { "userLogicIds", jArray } }; + var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Info, "鑾峰彇鑷姩鍖栬鎯�"); + //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken + if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) + { + RefreshToken(); + GetLogic(listIdList, isTip); + } + if (Check(responsePackNew, isTip) == false) + { + return null; + } + var logicList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Logic>>(responsePackNew.Data.ToString()); + return logicList; + } + /// <summary> /// 娣诲姞鑷姩鍖栧懡浠� /// </summary> @@ -117,6 +147,10 @@ if (!string.IsNullOrEmpty(dictionary.hold_time)) { inputTypeJOb.Add("hold_time", dictionary.hold_time); + } + if (!string.IsNullOrEmpty(dictionary.detect_type)) + { + inputTypeJOb.Add("detect_type", dictionary.detect_type); } inputTypeJOb.Add("condition_type", dictionary.condition_type); if (dictionary.condition_type=="9") { @@ -248,6 +282,10 @@ if (!string.IsNullOrEmpty(dictionary.hold_time)) { inputTypeJOb.Add("hold_time", dictionary.hold_time); + } + if (!string.IsNullOrEmpty(dictionary.detect_type)) + { + inputTypeJOb.Add("detect_type", dictionary.detect_type); } inputTypeJOb.Add("condition_type", dictionary.condition_type); if (dictionary.condition_type == "9") @@ -573,21 +611,18 @@ /// <returns></returns> public bool Check(ResponsePackNew r, bool isTip) { + if (r == null) + { + r = new ResponsePackNew { message = "娌″洖澶�,璇风‘璁ょ綉缁滄槸鍚︽甯�.", Code = "-1", }; + } if (r.Code == "0" && r.Data != null && r.Data.ToString() != "") { return true; } - if (r.Code != "0") + //澶辫触鏃舵槸鍚﹁鎻愮ず + if (isTip) { - //澶辫触鏃舵槸鍚﹁鎻愮ず - if (isTip) - { - if (r == null) - { - r = new ResponsePackNew { message = "娌″洖澶�,璇风‘璁ょ綉缁滄槸鍚︽甯�.", Code = "-1", }; - } - new LogicView.TipPopView().FlashingBox(r.message + $"({r.Code})"); - } + new LogicView.TipPopView().FlashingBox(r.message + $"({r.Code})"); } return false; } -- Gitblit v1.8.0