wjc
2022-05-25 b092639844a87676d9ef0d1b854c0602d4ad56de
2022年05月25日13:12:28

输入条件传感器动态获取等级列表
4个文件已修改
131 ■■■■ 已修改文件
HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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) =>
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);
               });
        }
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:
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>