From a170a2ecef6d5c87883ed552dbbc81cfb0358d13 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期五, 19 十一月 2021 16:43:53 +0800 Subject: [PATCH] Merge branch 'WJC' into newBranch1 --- HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs | 49 ++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 38 insertions(+), 11 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs index 2ea187d..92d1584 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs @@ -57,17 +57,17 @@ if (text == Language.StringByID(StringId.kongqiyou)) { //浼� - value = "excellent"; + value = "Excellent"; } else if (text == Language.StringByID(StringId.kongqiliang)) { //鑹� - value = "good"; + value = "Good"; } else if (text == Language.StringByID(StringId.kongqicha)) { //宸� - value = "poor"; + value = "Poor"; } AddDic(value); }; @@ -82,31 +82,35 @@ { Input input = new Input(); input.sid = LogicMethod.CurrLogicMethod.NewSid(); - input.condition_type = "9"; + input.condition_type = "6"; Dictionary<string, string> dic = new Dictionary<string, string>(); - LogicMethod.CurrLogicMethod.dictionary(dic, "key", "air_quality"); + LogicMethod.CurrLogicMethod.dictionary(dic, "key", "airquality"); LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "="); LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string"); LogicMethod.CurrLogicMethod.dictionary(dic, "value", value); input.condition.Add(dic); - AddCondition(input); + AddCondition(input, "airquality" ,"="); } /// <summary> /// 娣诲姞鏉′欢 /// </summary> /// <param name="input"></param> - private void AddCondition(Input input) + private void AddCondition(Input input, string keyValue, string comparator) { ///璁板綍绱㈠紩鍊� int index = -1; for (var i = 0; i < Logic.currlogic.input.Count; i++) { var condition_type = Logic.currlogic.input[i].condition_type; - if (condition_type == "9") + if (condition_type == "6") { - ///鎵惧埌鏍囪绱㈠紩锛岄��鍑哄惊鐜綋 - index = i; - break; + var dicList = Logic.currlogic.input[i].condition; + if (ExistKey(dicList, keyValue, comparator)) + { + ///鎵惧埌鏍囪绱㈠紩锛岄��鍑哄惊鐜綋 + index = i; + break; + } } } if (index != -1) @@ -128,5 +132,28 @@ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } + + /// <summary> + /// 鍒ゆ柇鏄惁瀛樺湪Key + /// </summary> + /// <param name="dicList"></param> + /// <param name="keyValue"></param> + /// <param name="comparator">姣旇緝鍏崇郴</param> + /// <returns></returns> + private bool ExistKey(List<Dictionary<string, string>> dicList, string keyValue, string comparator) + { + for (int i = 0; i < dicList.Count; i++) + { + var dic = dicList[i]; + string key = dic["key"]; + string comparatorValue = dic["comparator"]; + if (key == keyValue && comparatorValue == comparator) + { + //鍒ゆ柇鏄惁瀛樺湪 + return true; + } + } + return false; + } } } -- Gitblit v1.8.0