From a7885a24a152a164d7e26b12098ab92a0e272f24 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 18 十一月 2021 13:13:31 +0800
Subject: [PATCH] Merge branch 'WJC' into wxr6
---
HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs | 33 +++++++++++++++++++++++++++++++--
1 files changed, 31 insertions(+), 2 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..1c7ba43 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs
@@ -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