From e1871e6f7ce50a9b3f6ee9237f66d641dc98e883 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期六, 28 八月 2021 19:23:22 +0800 Subject: [PATCH] 2021-8-28-4 --- HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs | 6 +- HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs | 121 +++++++++++++++++++++++++++++++++++---- HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs | 15 +++++ HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs | 2 4 files changed, 127 insertions(+), 17 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs index 0bc97bc..a6dc46d 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs @@ -641,8 +641,23 @@ view.SingleSelectionShow(frame, listStr, Language.StringByID(title), view.GetString(key, stateValue) , (text) => { + var value = view.GetValue(key, text); selectedState = device.spk + "_" + key; + switch (device.spk) + { + case SPK.SensorTemperature: + case SPK.SensorHumidity: + case SPK.SensorCO2: + case SPK.SensorPm25: + case SPK.SensorTVOC: + case SPK.SensorHcho: + { + ///鍏徃浼犳劅鍣╧ey鐨勫仴鍊兼槸鈥渧alue鈥濓紱 + key = "value"; + } + break; + } AddDictionary(key, value, "integer", "in"); Save(device, index, edit); }); diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs index 999ffc2..4b137f1 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs @@ -381,41 +381,41 @@ case SPK.SensorTemperature: { - string str =new InpOrOutLogicMethod { }.GetText(dicList); + string str =new InpOrOutLogicMethod { }.GetText(dicList, "temperature"); inputView.btnState.Text = str; } break; case SPK.SensorHumidity: { - string str = new InpOrOutLogicMethod { }.GetText(dicList); + string str = new InpOrOutLogicMethod { }.GetText(dicList, "humidity"); inputView.btnState.Text = str; } break; case SPK.SensorCO2: { - string str = new InpOrOutLogicMethod { }.GetText(dicList); + string str = new InpOrOutLogicMethod { }.GetText(dicList, "co2"); inputView.btnState.Text = str; } break; case SPK.SensorPm25: { - string str = new InpOrOutLogicMethod { }.GetText(dicList); + string str = new InpOrOutLogicMethod { }.GetText(dicList, "pm25"); inputView.btnState.Text = str; } break; case SPK.SensorTVOC: { - string str = new InpOrOutLogicMethod { }.GetText(dicList); + string str = new InpOrOutLogicMethod { }.GetText(dicList, "tvoc"); inputView.btnState.Text = str; } break; case SPK.SensorHcho: { - string str = new InpOrOutLogicMethod { }.GetText(dicList); + string str = new InpOrOutLogicMethod { }.GetText(dicList, "hcho"); inputView.btnState.Text = str; } @@ -658,12 +658,6 @@ if (device.spk == SPK.SensorEnvironment || device.spk == SPK.SensorEnvironment2 || device.spk == SPK.SensorEnvironment3 - || device.spk == SPK.SensorTemperature - || device.spk == SPK.SensorHumidity - || device.spk == SPK.SensorCO2 - || device.spk == SPK.SensorPm25 - || device.spk == SPK.SensorTVOC - || device.spk == SPK.SensorHcho ) { //杩欎釜璁惧姣旇緝鐗规畩 @@ -730,6 +724,42 @@ break; } } + + } + else if (device.spk == SPK.SensorTemperature) + { + + new InpOrOutLogicMethod().SensorView(thisView, device, "temperature", indexVulae); + + } + else if ( device.spk == SPK.SensorHumidity) + { + + new InpOrOutLogicMethod().SensorView(thisView, device, "humidity", indexVulae); + + } + else if (device.spk == SPK.SensorCO2) + { + + new InpOrOutLogicMethod().SensorView(thisView, device, "co2", indexVulae); + + } + else if (device.spk == SPK.SensorPm25) + { + + new InpOrOutLogicMethod().SensorView(thisView, device, "pm25", indexVulae); + + } + else if (device.spk == SPK.SensorTVOC) + { + + new InpOrOutLogicMethod().SensorView(thisView, device, "tvoc", indexVulae); + + } + else if (device.spk == SPK.SensorHcho) + { + + new InpOrOutLogicMethod().SensorView(thisView, device, "hcho", indexVulae); } else @@ -2108,12 +2138,11 @@ /// </summary> /// <param name="dicList">鐘舵�佹暟鎹垪琛�</param> /// <returns></returns> - private string GetText(List<Dictionary<string, string>> dicList) + private string GetText(List<Dictionary<string, string>> dicList,string key) { string strtext = ""; foreach (var dic in dicList) { - string key = dic["key"]; string value = dic["value"]; string comparator = dic["comparator"]; switch (key) @@ -2169,7 +2198,71 @@ } return strtext; } + private void SensorView(FrameLayout thisView, Function device,string key, int indexVulae) { + //杩欎釜璁惧姣旇緝鐗规畩 + ConditionDeviceFunList conditionDeviceFunList = new ConditionDeviceFunList(); + ///褰撳墠鐨勭储寮曞�兼暟鎹璞� + Input inputedit = Logic.currlogic.input[indexVulae]; + ///鐘舵�佸�� + string stateValue = ""; + foreach (var dic in inputedit.condition) + { + string comparator = dic["comparator"]; + stateValue = dic["value"]; + switch (key) + { + case "temperature": + { + int titleInt = 0; + if (comparator == ">") + { + titleInt = StringId.wendugaoyu; + } + else if (comparator == "<") + { + titleInt = StringId.wendudiyu; + } + conditionDeviceFunList.InputBoxAction(device, titleInt, indexVulae, true, stateValue); + } + break; + case "humidity": + { + int titleInt = 0; + if (comparator == ">") + { + titleInt = StringId.shidugaoyu; + } + else if (comparator == "<") + { + titleInt = StringId.shidudiyu; + } + conditionDeviceFunList.InputBoxAction(device, titleInt, indexVulae, true, stateValue); + } + break; + case "co2": + { + conditionDeviceFunList.PmCo2TvocAction(thisView, device, "co2", StringId.co2, indexVulae, true, stateValue); + } + break; + case "pm25": + { + conditionDeviceFunList.PmCo2TvocAction(thisView, device, "pm25", StringId.pm25, indexVulae, true, stateValue); + } + break; + case "tvoc": + { + conditionDeviceFunList.PmCo2TvocAction(thisView, device, "tvoc", StringId.tvoc, indexVulae, true, stateValue); + } + break; + case "hcho": + { + conditionDeviceFunList.PmCo2TvocAction(thisView, device, "hcho", StringId.tvoc, indexVulae, true, stateValue); + } + break; + } + } + } } } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs index 3db3fcd..edb2001 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs @@ -991,17 +991,17 @@ { switch (strValue) { - case "(0,1000]": + case "(0,399]": { text = Language.StringByID(StringId.zhengchang) + ":0~399PPB"; } break; - case "(1001,2000]": + case "(400,699]": { text = Language.StringByID(StringId.chaobiao) + ":400~699PPB"; } break; - case "(2000,200000]": + case "(700,70000]": { text = Language.StringByID(StringId.yanzhong) + ":>700PPB"; } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs index 193f4c7..a4aeaed 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs @@ -280,6 +280,8 @@ logicjArray.Add(logicIfon); var jObject = new JObject { { "homeId", LogicMethod.CurrLogicMethod.HomeId }, { "logics", logicjArray } }; + + string str = jObject.ToString(); responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Update,5); //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) -- Gitblit v1.8.0