From b092639844a87676d9ef0d1b854c0602d4ad56de Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期三, 25 五月 2022 13:13:24 +0800 Subject: [PATCH] 2022年05月25日13:12:28 --- HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs | 4 HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs | 87 +++++++++++++++++++++++++++++ HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs | 27 ++------ HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs | 13 ++- 4 files changed, 104 insertions(+), 27 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs index eadc10b..c0a2ba0 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs @@ -78,13 +78,13 @@ #region 鎵�鏈夌偣鍑讳簨浠� //鏃堕棿 timeView.btnClick.MouseUpEventHandler += (sen, e) => - { + { TimeTpye timeTpye = new TimeTpye(); MainPage.BasePageView.AddChidren(timeTpye); timeTpye.Show(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - }; + }; //鍦烘櫙鐐瑰嚮浜嬩欢 sceneView.btnClick.MouseUpEventHandler += (sen, e) => diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs index 2b606ad..7f0cc74 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs @@ -377,6 +377,7 @@ //tvoc case SPK.SensorTVOC: { + ///tvoc LogicView.FunTypeView tvocView = new LogicView.FunTypeView(); tvocView.btnText.TextID = StringId.tvoc; @@ -709,7 +710,7 @@ /// <param name="stateValue">缂栬緫涔嬪墠鐨勭姸鎬佸��,榛樿涓�""</param> public void PmCo2TvocAction(FrameLayout frame, Entity.Function device, string key, int title, int index, bool edit, string stateValue = "") { - if (edit) + if (edit) { /// this.function = device; @@ -723,12 +724,14 @@ } } PublicInterface view = new PublicInterface(); - var listStr = view.GetViewList(key); - view.SingleSelectionShow(frame, listStr, Language.StringByID(title), view.GetString(key, stateValue) + //var listStr = view.GetViewList(key); + var listStr = view.GetSensorLevelList(device);//2022骞�05鏈�25鏃�10:01:33 浜у搧缁忕悊鍚涚厡瑕佹眰鏀规垚鍔ㄦ�� + view.SingleSelectionShow(frame, listStr, Language.StringByID(title), view.GetSensorLevelText(device, stateValue,true) , (text) => { - var value = view.GetValue(key, text); + //var value = view.GetValue(key, text); + var values = view.GetSensorLevelText(device,text,false); selectedState = device.spk + "_" + key; switch (device.spk) { @@ -746,7 +749,7 @@ } break; } - AddDictionary(key, value, "integer", "in"); + AddDictionary(key, values, "integer", "in"); Save(device, index, edit); }); } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs index ecbb380..eef7829 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs @@ -420,31 +420,18 @@ } break; case SPK.SensorCO2: - { - string str = new InpOrOutLogicMethod { }.GetText(dicList, "co2"); - inputView.btnState.Text = str; - - } - break; case SPK.SensorPm25: - { - string str = new InpOrOutLogicMethod { }.GetText(dicList, "pm25"); - inputView.btnState.Text = str; - - } - break; case SPK.SensorTVOC: - { - string str = new InpOrOutLogicMethod { }.GetText(dicList, "tvoc"); - inputView.btnState.Text = str; - - } - break; case SPK.SensorHcho: { - string str = new InpOrOutLogicMethod { }.GetText(dicList, "hcho"); + string strvalue = ""; + foreach (var dic in dicList) + { + strvalue = dic["value"]; + break; + } + string str = new PublicInterface().GetSensorLevelText(device, strvalue, true); inputView.btnState.Text = str; - } break; case SPK.DoorLock: 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