From 7eb8b78a26accd059cf8e17d756f6d77e6b3f9dd Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期四, 09 六月 2022 21:40:26 +0800
Subject: [PATCH] 2022年06月09日21:39:40
---
HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs | 87 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 87 insertions(+), 0 deletions(-)
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
index d23adfd..ee921ce 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
@@ -748,6 +748,93 @@
return list;
}
/// <summary>
+ /// 鍔ㄦ�佽幏鍙栦紶鎰熷櫒绛夌骇鍒楄〃
+ /// </summary>
+ /// <param name="device">鍔熻兘(sid)</param>
+ /// <returns></returns>
+ public List<string> GetSensorLevelList(Entity.Function device)
+ {
+ List<string> list = new List<string>();
+ var dic = GetSensorLevelDic(device);
+ foreach (var d in dic) {
+ list.Add(d.Key);
+ }
+ return list;
+ }
+ /// <summary>
+ /// 鎸囧畾鑾峰彇绛夌骇鎷兼帴鐨勫瓧绗︿覆
+ /// </summary>
+ /// <param name="device">鍔熻兘(sid)</param>
+ /// <param name="s">鍒濆鍊�</param>
+ /// <param name="isTextBoolean">琛ㄧずtrue(杩斿洖key);false(杩斿洖values)</param>
+ /// <returns></returns>isTextBoolean
+ public string GetSensorLevelText(Entity.Function device, string s, bool isTextBoolean)
+ {
+ if (device == null || device.attrKeyConfigs == null)
+ {
+ return "";
+ }
+ var dic = GetSensorLevelDic(device);
+ if (isTextBoolean)
+ {
+ foreach (var d in dic)
+ {
+ if (d.Value==s)
+ {
+ //濡傛灉values鍊煎瓨鍦紝杩斿洖key鍊�
+ return d.Key.ToString();
+ }
+ }
+
+ }
+ else
+ {
+ foreach (var d in dic)
+ {
+ if (d.Key==s)
+ {
+ //濡傛灉key鍊煎瓨鍦紝杩斿洖values鍊�
+ return d.Value.ToString();
+ }
+ }
+ }
+ return "";
+ }
+ /// <summary>
+ /// 鍔ㄦ�佽幏鍙栦紶鎰熷櫒绛夌骇瀛楀吀
+ /// </summary>
+ /// <param name="device">鍔熻兘(sid)</param>
+ /// <returns></returns>
+ public Dictionary<string,string> GetSensorLevelDic(Entity.Function device)
+ {
+ Dictionary<string, string> dic = new Dictionary<string, string>();
+ if (device == null || device.attrKeyConfigs == null)
+ {
+ return dic;
+ }
+ string strKey = "";
+ string strKeyValues = "";
+ for (int i = 0; i < device.attrKeyConfigs.Count; i++)
+ {
+ var attrKeyConfig = device.attrKeyConfigs[i];
+ foreach (var attrKeyInfo in attrKeyConfig.configs)
+ {
+ //鍔ㄦ�佹嫾鎺ュ瓧绗︿覆
+ strKey = attrKeyInfo.desc + ":" + attrKeyInfo.start + "~" + attrKeyInfo.end + attrKeyConfig.unit;
+ strKeyValues = "(" + attrKeyInfo.start + "," + attrKeyInfo.end + "]";
+ if (!dic.ContainsKey(strKey))
+ {
+ //娌℃湁鍐嶆坊鍔�
+ dic.Add(strKey, strKeyValues);
+ }
+
+ }
+
+ }
+ return dic;
+ }
+
+ /// <summary>
/// 妯″紡/椋庨�熶簰鐩歌浆鎹㈠�肩殑鏂规硶
/// </summary>
/// <param name="text">鏂囨湰</param>
--
Gitblit v1.8.0