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/WeatherCondition.cs |   39 ++++++++++++++++++++++++++++++++++-----
 1 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs
index 7bbf196..1c683eb 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs
@@ -56,15 +56,15 @@
                     string text = view.btnClick.Tag.ToString();
                     if (text == Language.StringByID(StringId.clearday))
                     {
-                        value = "sunny";
+                        value = "Sunny";
                     }
                     else if (text == Language.StringByID(StringId.cloudy))
                     {
-                        value = "cloudy";
+                        value = "Cloudy";
                     }
                     else if (text == Language.StringByID(StringId.rain))
                     {
-                        value = "rainy";
+                        value = "Rain";
                     }
                     AddDic(value);
                 };
@@ -86,13 +86,13 @@
             LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
             LogicMethod.CurrLogicMethod.dictionary(dic, "value", value);
             input.condition.Add(dic);
-            AddCondition(input);
+            AddCondition(input, "weather",  "=");
         }
         /// <summary>
         /// 娣诲姞鏉′欢
         /// </summary>
         /// <param name="input"></param>
-        private void AddCondition(Input input)
+        private void AddCondition(Input input, string keyValue, string comparator)
         {
             ///璁板綍绱㈠紩鍊�
             int index = -1;
@@ -101,6 +101,13 @@
                 var condition_type = Logic.currlogic.input[i].condition_type;
                 if (condition_type == "6")
                 {
+                    var dicList = Logic.currlogic.input[i].condition;
+                    if (ExistKey(dicList, keyValue, comparator))
+                    {
+                        ///鎵惧埌鏍囪绱㈠紩锛岄��鍑哄惊鐜綋
+                        index = i;
+                        break;
+                    }
                     ///鎵惧埌鏍囪绱㈠紩锛岄��鍑哄惊鐜綋
                     index = i;
                     break;
@@ -125,5 +132,27 @@
             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