From 3db5c3218f405795dc9a2d0f6afdde8ab8ac9e73 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期二, 23 十一月 2021 09:11:30 +0800
Subject: [PATCH] Merge branch 'WJC' of http://172.16.1.23:6688/r/~wxr/HDL_APP_Project into WJC
---
HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs | 61 ++++++++++++++++++++++--------
1 files changed, 44 insertions(+), 17 deletions(-)
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs
index 09e746e..92d1584 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs
@@ -57,22 +57,22 @@
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);
};
}
-
+
}
/// <summary>
/// 灏佽鏁版嵁
@@ -81,32 +81,36 @@
private void AddDic(string value)
{
Input input = new Input();
- input.sid = LogicMethod.NewSid();
- input.condition_type = "9";
+ input.sid = LogicMethod.CurrLogicMethod.NewSid();
+ input.condition_type = "6";
Dictionary<string, string> dic = new Dictionary<string, string>();
- LogicMethod.dictionary(dic, "key", "air_quality");
- LogicMethod.dictionary(dic, "comparator", "=");
- LogicMethod.dictionary(dic, "data_type", "string");
- LogicMethod.dictionary(dic, "value", value);
+ 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)
@@ -121,12 +125,35 @@
Logic.currlogic.input.Add(input);
}
- LogicMethod.RemoveAllView();
+ LogicMethod.CurrLogicMethod.RemoveAllView();
AddLogic addLogic = new AddLogic();
MainPage.BasePageView.AddChidren(addLogic);
addLogic.Show();
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