JLChen
2021-11-30 0ab9960587ececb5d3e13e7fb062e2f67308f9e7
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -146,12 +146,13 @@
                                case SPK.CurtainRoller:
                                case SPK.CurtainTrietex:
                                //空调
                                case SPK.AcStandard:
                                case SPK.AcStandard:case SPK.HvacAC:
                                //地热
                                case SPK.FloorHeatStandard:
                                case SPK.HvacFloorHeat:case SPK.FloorHeatStandard:
                                //新风
                                case SPK.AirFreshStandard:
                                    {//开关灯
                                case SPK.HvacAirFresh:
                                {//开关灯
                                        foreach (var dic in dicList)
                                        {
@@ -205,6 +206,7 @@
                                    }
                                    break;
                                case SPK.SensorDryContact:
                                case SPK.SensorDryContact2:
                                    {
                                        foreach (var dic in dicList)
                                        {
@@ -269,6 +271,7 @@
                                            switch (dic["key"])
                                            {
                                                case "status":
                                                case "people_status":
                                                    {
                                                        if (value == "true")
                                                        {
@@ -302,6 +305,7 @@
                                    }
                                    break;
                                case SPK.SenesorMegahealth:
                                case SPK.SenesorMegahealth2:
                                    {
                                        foreach (var dic in dicList)
                                        {
@@ -381,41 +385,41 @@
                                case SPK.SensorTemperature:
                                    {
                                       
                                        string str =new InpOrOutLogicMethod { }.GetText(dicList);
                                        string str =new InpOrOutLogicMethod { }.GetText(dicList, "temperature");
                                        inputView.btnState.Text = str;
                                    }
                                    break;
                                case SPK.SensorHumidity:
                                    {
                                        string str = new InpOrOutLogicMethod { }.GetText(dicList);
                                        string str = new InpOrOutLogicMethod { }.GetText(dicList, "humidity");
                                        inputView.btnState.Text = str;
                                    }
                                    break;
                                case SPK.SensorCO2:
                                    {
                                        string str = new InpOrOutLogicMethod { }.GetText(dicList);
                                        string str = new InpOrOutLogicMethod { }.GetText(dicList, "co2");
                                        inputView.btnState.Text = str;
                                    }
                                    break;
                                case SPK.SensorPm25:
                                    {
                                        string str = new InpOrOutLogicMethod { }.GetText(dicList);
                                        string str = new InpOrOutLogicMethod { }.GetText(dicList, "pm25");
                                        inputView.btnState.Text = str;
                                    }
                                    break;
                                case SPK.SensorTVOC:
                                    {
                                        string str = new InpOrOutLogicMethod { }.GetText(dicList);
                                        string str = new InpOrOutLogicMethod { }.GetText(dicList, "tvoc");
                                        inputView.btnState.Text = str;
                                    }
                                    break;
                                case SPK.SensorHcho:
                                    {
                                        string str = new InpOrOutLogicMethod { }.GetText(dicList);
                                        string str = new InpOrOutLogicMethod { }.GetText(dicList, "hcho");
                                        inputView.btnState.Text = str;
                                    }
@@ -658,12 +662,6 @@
                                if (device.spk == SPK.SensorEnvironment
                                || device.spk == SPK.SensorEnvironment2
                                || device.spk == SPK.SensorEnvironment3
                                || device.spk == SPK.SensorTemperature
                                || device.spk == SPK.SensorHumidity
                                || device.spk == SPK.SensorCO2
                                || device.spk == SPK.SensorPm25
                                || device.spk == SPK.SensorTVOC
                                   || device.spk == SPK.SensorHcho
                                )
                                {
                                    //这个设备比较特殊
@@ -725,11 +723,47 @@
                                                break;
                                            case "hcho":
                                                {
                                                    conditionDeviceFunList.PmCo2TvocAction(thisView, device, "hcho", StringId.tvoc, indexVulae, true, stateValue);
                                                    conditionDeviceFunList.PmCo2TvocAction(thisView, device, "hcho", StringId.Formaldehyde, indexVulae, true, stateValue);
                                                }
                                                break;
                                        }
                                    }
                                }
                                else if (device.spk == SPK.SensorTemperature)
                                {
                                   new InpOrOutLogicMethod().SensorView(thisView, device, "temperature", indexVulae);
                                }
                                else if ( device.spk == SPK.SensorHumidity)
                                {
                                    new InpOrOutLogicMethod().SensorView(thisView, device, "humidity", indexVulae);
                                }
                                else if (device.spk == SPK.SensorCO2)
                                {
                                    new InpOrOutLogicMethod().SensorView(thisView, device, "co2", indexVulae);
                                }
                                else if (device.spk == SPK.SensorPm25)
                                {
                                    new InpOrOutLogicMethod().SensorView(thisView, device, "pm25", indexVulae);
                                }
                                else if (device.spk == SPK.SensorTVOC)
                                {
                                    new InpOrOutLogicMethod().SensorView(thisView, device, "tvoc", indexVulae);
                                }
                                else if (device.spk == SPK.SensorHcho)
                                {
                                    new InpOrOutLogicMethod().SensorView(thisView, device, "hcho", indexVulae);
                                }
                                else
@@ -945,6 +979,7 @@
                                    }
                                    break;
                                case SPK.AcStandard:
                                case SPK.HvacAC:
                                    {
                                        string on_off = GetKeyValue("on_off", dicList);
                                        string set_temp = GetKeyValue("set_temp", dicList);
@@ -1043,7 +1078,7 @@
                                    }
                                    break;
                                case SPK.FloorHeatStandard:
                                case SPK.FloorHeatStandard:case SPK.HvacFloorHeat:
                                    {
                                        string on_off = GetKeyValue("on_off", dicList);
                                        string set_temp = GetKeyValue("set_temp", dicList);
@@ -1116,6 +1151,7 @@
                                    }
                                    break;
                                case SPK.AirFreshStandard:
                                case SPK.HvacAirFresh:
                                    {
                                        string on_off = GetKeyValue("on_off", dicList);
                                        string fan = GetKeyValue("fan", dicList);
@@ -1402,6 +1438,7 @@
                    }
                    break;
                case SPK.AcStandard:
                case SPK.HvacAC:
                    {
                        foreach (var dic in dicList)
                        {
@@ -1512,7 +1549,7 @@
                    }
                    break;
                case SPK.FloorHeatStandard:
                case SPK.FloorHeatStandard:case SPK.HvacFloorHeat:
                    {
                        foreach (var dic in dicList)
@@ -1596,6 +1633,7 @@
                    }
                    break;
                case SPK.AirFreshStandard:
                case SPK.HvacAirFresh:
                    {
                        foreach (var dic in dicList)
@@ -1620,8 +1658,8 @@
                                        }
                                    }
                                    break;
                                   case "fan":
                                case "fan":
                                    {
                                        if (button2 == null)
                                        {
@@ -1696,6 +1734,7 @@
                    }
                    break;
                case SPK.SensorDryContact:
                case SPK.SensorDryContact2:
                    {
                        foreach (var dic in dicList)
                        {
@@ -1753,6 +1792,7 @@
                            switch (dic["key"])
                            {
                                case "status":
                                case "people_status":
                                    {
                                        if (value == "true")
                                        {
@@ -1785,6 +1825,7 @@
                    }
                    break;
                case SPK.SenesorMegahealth:
                case SPK.SenesorMegahealth2:
                    {
                        foreach (var dic in dicList)
                        {
@@ -1953,7 +1994,8 @@
                                    }
                                    break;
                                case SPK.AcStandard:
                                case SPK.FloorHeatStandard:
                                case SPK.HvacAC:
                                case SPK.FloorHeatStandard:case SPK.HvacFloorHeat:
                                    {
                                        foreach (var dic in dicList)
                                        {
@@ -2108,12 +2150,11 @@
        /// </summary>
        /// <param name="dicList">状态数据列表</param>
        /// <returns></returns>
        private string GetText(List<Dictionary<string, string>> dicList)
        private string GetText(List<Dictionary<string, string>> dicList,string key)
        {
            string strtext = "";
            foreach (var dic in dicList)
            {
                string key = dic["key"];
                string value = dic["value"];
                string comparator = dic["comparator"];
                switch (key)
@@ -2169,7 +2210,71 @@
            }
            return strtext;
        }
        private void SensorView(FrameLayout thisView, Function device,string key, int indexVulae) {
            //这个设备比较特殊
            ConditionDeviceFunList conditionDeviceFunList = new ConditionDeviceFunList();
            ///当前的索引值数据对象
            Input inputedit = Logic.currlogic.input[indexVulae];
            ///状态值
            string stateValue = "";
            foreach (var dic in inputedit.condition)
            {
                string comparator = dic["comparator"];
                stateValue = dic["value"];
                switch (key)
                {
                    case "temperature":
                        {
                            int titleInt = 0;
                            if (comparator == ">")
                            {
                                titleInt = StringId.wendugaoyu;
                            }
                            else if (comparator == "<")
                            {
                                titleInt = StringId.wendudiyu;
                            }
                            conditionDeviceFunList.InputBoxAction(device, titleInt, indexVulae, true, stateValue);
                        }
                        break;
                    case "humidity":
                        {
                            int titleInt = 0;
                            if (comparator == ">")
                            {
                                titleInt = StringId.shidugaoyu;
                            }
                            else if (comparator == "<")
                            {
                                titleInt = StringId.shidudiyu;
                            }
                            conditionDeviceFunList.InputBoxAction(device, titleInt, indexVulae, true, stateValue);
                        }
                        break;
                    case "co2":
                        {
                            conditionDeviceFunList.PmCo2TvocAction(thisView, device, "co2", StringId.co2, indexVulae, true, stateValue);
                        }
                        break;
                    case "pm25":
                        {
                            conditionDeviceFunList.PmCo2TvocAction(thisView, device, "pm25", StringId.pm25, indexVulae, true, stateValue);
                        }
                        break;
                    case "tvoc":
                        {
                            conditionDeviceFunList.PmCo2TvocAction(thisView, device, "tvoc", StringId.tvoc, indexVulae, true, stateValue);
                        }
                        break;
                    case "hcho":
                        {
                            conditionDeviceFunList.PmCo2TvocAction(thisView, device, "hcho", StringId.Formaldehyde, indexVulae, true, stateValue);
                        }
                        break;
                }
            }
        }
    }
}