From e1a8f2f7e4d850beedeb1469610b878c1427e976 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 15 十二月 2021 09:01:53 +0800
Subject: [PATCH] 更新

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs |  359 +++++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 263 insertions(+), 96 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index 1158bc6..e6fc71d 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -135,7 +135,8 @@
                             //鍖哄埆涓嶅悓璁惧锛屾樉绀轰笉鍚岃澶囩姸鎬�
                             switch (device.spk)
                             {
-                                //寮�鍏崇伅鍏� light.Switch
+                                //寮�鍏崇伅鍏�
+                                case SPK.AirSwitch:
                                 case SPK.LightDimming:
                                 case SPK.LightRGB:
                                 case SPK.LightRGBW:
@@ -147,10 +148,16 @@
                                 case SPK.CurtainTrietex:
                                 //绌鸿皟
                                 case SPK.AcStandard:
+                                case SPK.HvacAC:
                                 //鍦扮儹
+                                case SPK.HvacFloorHeat:
                                 case SPK.FloorHeatStandard:
                                 //鏂伴
                                 case SPK.AirFreshStandard:
+                                case SPK.HvacAirFresh:
+                                //鎻掑骇
+                                case SPK.PanelSocket:
+                                case SPK.ElectricSocket:
                                     {//寮�鍏崇伅
                                         foreach (var dic in dicList)
                                         {
@@ -205,6 +212,7 @@
                                     }
                                     break;
                                 case SPK.SensorDryContact:
+                                case SPK.SensorDryContact2:
                                     {
                                         foreach (var dic in dicList)
                                         {
@@ -269,6 +277,7 @@
                                             switch (dic["key"])
                                             {
                                                 case "status":
+                                                case "people_status":
                                                     {
                                                         if (value == "true")
                                                         {
@@ -302,6 +311,7 @@
                                     }
                                     break;
                                 case SPK.SenesorMegahealth:
+                                case SPK.SenesorMegahealth2:
                                     {
                                         foreach (var dic in dicList)
                                         {
@@ -380,35 +390,42 @@
                                     break;
                                 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, "hcho");
                                         inputView.btnState.Text = str;
 
                                     }
@@ -416,8 +433,9 @@
                             }
                         }
                         break;
-                    case "4":
+                    case "6":
                         {
+                            //inputView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png";
                             inputView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png";
                             string strtext = "";
                             string strvalue = "";
@@ -429,8 +447,9 @@
 
                                 switch (key)
                                 {
-                                    case "outdoor_temp":
+                                    case "temperature":
                                         {
+                                            //浜戠澶╂皵鏉′欢 鍩庡競娓╁害瑙﹀彂
                                             strvalue = value + "鈩�";
                                             if (comparator == ">")
                                             {
@@ -443,8 +462,9 @@
 
                                         }
                                         break;
-                                    case "outdoor_humity":
+                                    case "humidity":
                                         {
+                                            //浜戠澶╂皵鏉′欢 鍩庡競婀垮害瑙﹀彂
                                             strvalue = value + "%";
                                             if (comparator == ">")
                                             {
@@ -457,13 +477,68 @@
 
                                         }
                                         break;
-                                    case "pm2.5":
+                                    case "pm25":
                                         {
+                                            //浜戠澶╂皵鏉′欢 鍩庡競pm2.5瑙﹀彂
                                             strtext = Language.StringByID(StringId.PM25);
                                             strvalue = new PublicInterface { }.GetString("pm25", value);
                                         }
                                         break;
+                                    case "weather":
+                                        {
+                                            //浜戠澶╂皵鏉′欢 鍩庡競澶╂皵瑙﹀彂
+                                            strtext = Language.StringByID(StringId.tianqibianhua);
+                                            switch (value)
+                                            {
+                                                case "Sunny":
+                                                    {
+                                                        strtext = Language.StringByID(StringId.clearday);
 
+                                                    }
+                                                    break;
+                                                case "Cloudy":
+                                                    {
+
+                                                        strtext = Language.StringByID(StringId.cloudy);
+
+                                                    }
+                                                    break;
+                                                case "Rain":
+                                                    {
+                                                        strtext = Language.StringByID(StringId.rain);
+                                                    }
+                                                    break;
+
+                                            }
+                                        }
+                                        break;
+                                    case "airquality":
+                                        {
+                                            //浜戠澶╂皵鏉′欢 鍩庡競绌烘皵璐ㄩ噺
+                                            strtext = Language.StringByID(StringId.kongqizhiliang);
+                                            switch (value)
+                                            {
+                                                case "Excellent":
+                                                    {
+                                                        strtext = Language.StringByID(StringId.kongqiyou);
+
+                                                    }
+                                                    break;
+                                                case "Good":
+                                                    {
+
+                                                        strtext = Language.StringByID(StringId.kongqiliang);
+
+                                                    }
+                                                    break;
+                                                case "Poor":
+                                                    {
+                                                        strtext = Language.StringByID(StringId.kongqicha);
+                                                    }
+                                                    break;
+                                            }
+                                        }
+                                        break;
                                 }
 
 
@@ -472,70 +547,27 @@
                             inputView.btnState.Text = strvalue;
                         }
                         break;
-                    case "6":
+                    case "8":
                         {
-                            inputView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png";
+                            inputView.btnIcon.UnSelectedImagePath = "LogicIcon/location.png";
                             foreach (var dic in dicList)
                             {
                                 string strtext = "";
                                 string value = dic["value"];
                                 switch (value)
                                 {
-                                    case "sunny":
+                                    case "arrive":
                                         {
-                                            strtext = Language.StringByID(StringId.clearday);
-
+                                            strtext = Language.StringByID(StringId.daoda);
                                         }
                                         break;
-                                    case "cloudy":
+                                    case "leave":
                                         {
-
-                                            strtext = Language.StringByID(StringId.cloudy);
-
+                                            strtext = Language.StringByID(StringId.likai);
                                         }
                                         break;
-                                    case "rainy":
-                                        {
-                                            strtext = Language.StringByID(StringId.rain);
-                                        }
-                                        break;
-
                                 }
-                                inputView.btnText.TextID = StringId.tianqibianhua;
-                                inputView.btnState.Text = strtext;
-                            }
-                        }
-                        break;
-                    case "9":
-                        {
-                            inputView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png";
-                            foreach (var dic in dicList)
-                            {
-                                string strtext = "";
-                                string value = dic["value"];
-                                switch (value)
-                                {
-                                    case "excellent":
-                                        {
-                                            strtext = Language.StringByID(StringId.kongqiyou);
-
-                                        }
-                                        break;
-                                    case "good":
-                                        {
-
-                                            strtext = Language.StringByID(StringId.kongqiliang);
-
-                                        }
-                                        break;
-                                    case "poor":
-                                        {
-                                            strtext = Language.StringByID(StringId.kongqicha);
-                                        }
-                                        break;
-
-                                }
-                                inputView.btnText.TextID = StringId.kongqizhiliang;
+                                inputView.btnText.TextID = StringId.likiadaoda;
                                 inputView.btnState.Text = strtext;
                             }
                         }
@@ -651,11 +683,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
                                 )
                                 {
                                     //杩欎釜璁惧姣旇緝鐗规畩
@@ -708,7 +735,6 @@
                                             case "pm25":
                                                 {
                                                     conditionDeviceFunList.PmCo2TvocAction(thisView, device, "pm25", StringId.pm25, indexVulae, true, stateValue);
-
                                                 }
                                                 break;
                                             case "tvoc":
@@ -716,8 +742,49 @@
                                                     conditionDeviceFunList.PmCo2TvocAction(thisView, device, "tvoc", StringId.tvoc, indexVulae, true, stateValue);
                                                 }
                                                 break;
+                                            case "hcho":
+                                                {
+                                                    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
@@ -729,7 +796,7 @@
                                 }
                             }
                             break;
-                        case "4":
+                        case "6":
                             {
                                 ///褰撳墠鐨勭储寮曞�兼暟鎹璞�
                                 Input inputedit = Logic.currlogic.input[indexVulae];
@@ -744,7 +811,7 @@
                                     stateValue = dic["value"];
                                     switch (key)
                                     {
-                                        case "outdoor_temp":
+                                        case "temperature":
                                             {
                                                 if (comparator == ">")
                                                 {
@@ -758,7 +825,7 @@
 
                                             }
                                             break;
-                                        case "outdoor_humity":
+                                        case "humidity":
                                             {
 
                                                 if (comparator == ">")
@@ -772,42 +839,57 @@
 
                                             }
                                             break;
-                                        case "pm2.5":
+                                        case "pm25":
                                             {
                                                 intValue = StringId.PM25;
+                                            }
+                                            break;
+                                        case "weather":
+                                            {
+                                                intValue = StringId.tianqibianhua;
+                                            }
+                                            break;
+                                        case "airquality":
+                                            {
+                                                intValue = StringId.kongqizhiliang;
                                             }
                                             break;
 
                                     }
                                 }
                                 OutdoorEnvironment outdoorEnvironment = new OutdoorEnvironment();
-                                if (intValue == StringId.PM25)
+                                if (intValue == StringId.tianqibianhua)
                                 {
+                                    //鍩庡競澶╂皵锛堟櫞澶╋紝涓嬮洦锛�
+                                    WeatherCondition weatherCondition = new WeatherCondition();
+                                    MainPage.BasePageView.AddChidren(weatherCondition);
+                                    weatherCondition.Show();
+                                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                                }
+                                else if (intValue == StringId.PM25)
+                                {
+                                    //鍩庡競澶╂皵锛坧m2.5锛�
                                     outdoorEnvironment.PmAction(thisView, stateValue);
+                                }
+                                else if (intValue == StringId.kongqizhiliang)
+                                {
+                                    //鍩庡競澶╂皵锛堢┖姘旇川閲忥級
+                                    AirQuality airQuality = new AirQuality();
+                                    MainPage.BasePageView.AddChidren(airQuality);
+                                    airQuality.Show();
+                                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                                 }
                                 else
                                 {
+                                    //鍩庡競澶╂皵锛堟俯婀垮害锛�
                                     outdoorEnvironment.InputBoxAction(intValue, stateValue);
                                 }
-
                             }
                             break;
-                        case "6":
+                        case "8":
                             {
-
-                                WeatherCondition weatherCondition = new WeatherCondition();
-                                MainPage.BasePageView.AddChidren(weatherCondition);
-                                weatherCondition.Show();
-                                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-                            }
-                            break;
-                        case "9":
-                            {
-
-                                AirQuality airQuality = new AirQuality();
-                                MainPage.BasePageView.AddChidren(airQuality);
-                                airQuality.Show();
-                                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                                AddInputType addInputType = new AddInputType();
+                                addInputType.LocationView(thisView, true);
                             }
                             break;
 
@@ -860,8 +942,12 @@
                             //鍖哄埆涓嶅悓璁惧锛屾樉绀轰笉鍚岃澶囩姸鎬�
                             switch (device.spk)
                             {
+                                case SPK.AirSwitch:
                                 case SPK.LightSwitch:
-                                    {//寮�鍏崇伅
+                                //鎻掑骇
+                                case SPK.PanelSocket:
+                                case SPK.ElectricSocket:
+                                    {//寮�鍏�
 
                                         foreach (var dic in dicList)
                                         {
@@ -933,6 +1019,7 @@
                                     }
                                     break;
                                 case SPK.AcStandard:
+                                case SPK.HvacAC:
                                     {
                                         string on_off = GetKeyValue("on_off", dicList);
                                         string set_temp = GetKeyValue("set_temp", dicList);
@@ -1031,7 +1118,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);
@@ -1104,6 +1191,7 @@
                                     }
                                     break;
                                 case SPK.AirFreshStandard:
+                                case SPK.HvacAirFresh:
                                     {
                                         string on_off = GetKeyValue("on_off", dicList);
                                         string fan = GetKeyValue("fan", dicList);
@@ -1307,7 +1395,11 @@
         {
             switch (device.spk)
             {
+                //鎻掑骇
+                case SPK.PanelSocket:
+                case SPK.ElectricSocket:
                 //寮�鍏崇伅鍏�
+                case SPK.AirSwitch:
                 case SPK.LightSwitch:
                     {
                         foreach (var dic in dicList)
@@ -1390,6 +1482,7 @@
                     }
                     break;
                 case SPK.AcStandard:
+                case SPK.HvacAC:
                     {
                         foreach (var dic in dicList)
                         {
@@ -1500,7 +1593,7 @@
 
                     }
                     break;
-                case SPK.FloorHeatStandard:
+                case SPK.FloorHeatStandard:case SPK.HvacFloorHeat:
                     {
 
                         foreach (var dic in dicList)
@@ -1584,6 +1677,7 @@
                     }
                     break;
                 case SPK.AirFreshStandard:
+                case SPK.HvacAirFresh:
                     {
 
                         foreach (var dic in dicList)
@@ -1608,8 +1702,8 @@
                                         }
                                     }
                                     break;
-                             
-                                   case "fan":
+
+                                case "fan":
                                     {
                                         if (button2 == null)
                                         {
@@ -1684,6 +1778,7 @@
                     }
                     break;
                 case SPK.SensorDryContact:
+                case SPK.SensorDryContact2:
                     {
                         foreach (var dic in dicList)
                         {
@@ -1741,6 +1836,7 @@
                             switch (dic["key"])
                             {
                                 case "status":
+                                case "people_status":
                                     {
                                         if (value == "true")
                                         {
@@ -1773,6 +1869,7 @@
                     }
                     break;
                 case SPK.SenesorMegahealth:
+                case SPK.SenesorMegahealth2:
                     {
                         foreach (var dic in dicList)
                         {
@@ -1869,6 +1966,7 @@
                             //鍖哄埆涓嶅悓璁惧锛屾樉绀轰笉鍚岃澶囩姸鎬�
                             switch (device.spk)
                             {
+                                case SPK.AirSwitch:
                                 case SPK.LightSwitch:
                                     {//寮�鍏崇伅
 
@@ -1941,7 +2039,8 @@
                                     }
                                     break;
                                 case SPK.AcStandard:
-                                case SPK.FloorHeatStandard:
+                                case SPK.HvacAC:
+                                case SPK.FloorHeatStandard:case SPK.HvacFloorHeat:
                                     {
                                         foreach (var dic in dicList)
                                         {
@@ -2096,12 +2195,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)
@@ -2148,11 +2246,80 @@
                             strtext = Language.StringByID(StringId.tvoc) + new PublicInterface { }.GetString("tvoc", value);
                         }
                         break;
+                    case "hcho":
+                        {
+                            strtext = Language.StringByID(StringId.Formaldehyde) + new PublicInterface { }.GetString("hcho", value);
+                        }
+                        break;
                 }
             }
             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;
+                }
+            }
+        }
     }
 }
 

--
Gitblit v1.8.0