From 0ab9960587ececb5d3e13e7fb062e2f67308f9e7 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期二, 30 十一月 2021 13:33:03 +0800
Subject: [PATCH] 2021-11-30 1.修复乐橙Android,没调用拒接接口问题。

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs |  434 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 407 insertions(+), 27 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index 398c19a..223b059 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -146,10 +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)
                                         {
 
@@ -203,6 +206,7 @@
                                     }
                                     break;
                                 case SPK.SensorDryContact:
+                                case SPK.SensorDryContact2:
                                     {
                                         foreach (var dic in dicList)
                                         {
@@ -267,6 +271,7 @@
                                             switch (dic["key"])
                                             {
                                                 case "status":
+                                                case "people_status":
                                                     {
                                                         if (value == "true")
                                                         {
@@ -300,6 +305,7 @@
                                     }
                                     break;
                                 case SPK.SenesorMegahealth:
+                                case SPK.SenesorMegahealth2:
                                     {
                                         foreach (var dic in dicList)
                                         {
@@ -376,7 +382,48 @@
 
                                     }
                                     break;
+                                case SPK.SensorTemperature:
+                                    {
+                                       
+                                        string str =new InpOrOutLogicMethod { }.GetText(dicList, "temperature");
+                                        inputView.btnState.Text = str;
+                                    }
+                                    break;
+                                case SPK.SensorHumidity:
+                                    {
+                                        string str = new InpOrOutLogicMethod { }.GetText(dicList, "humidity");
+                                        inputView.btnState.Text = str;
 
+                                    }
+                                    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");
+                                        inputView.btnState.Text = str;
+
+                                    }
+                                    break;
                             }
                         }
                         break;
@@ -504,6 +551,17 @@
                             }
                         }
                         break;
+                    case "10":
+                        {
+                            //鐢╯id鎵惧埌鍦烘櫙锛�
+                            var scene = LogicMethod.CurrLogicMethod.GetSecne(inputCondition.sid);
+                            inputView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png";
+                            inputView.btnNextIcon.Visible = false;
+                            inputView.btnClick.Visible = false;
+                            //鏄剧ず鍦烘櫙鍚嶇О
+                            inputView.btnText.Text = scene.name;
+                        }
+                        break;
 
                 }
                 //鍐嶆缂栬緫鏉′欢鐘舵�佺偣鍑讳簨浠�
@@ -601,7 +659,10 @@
                             {
                                 //鐢╯id鎵惧埌璁惧锛�
                                 var device = LogicMethod.CurrLogicMethod.GetDevice(inputCondition.sid);
-                                if (device.spk == SPK.SensorEnvironment|| device.spk == SPK.SensorEnvironment2 || device.spk == SPK.SensorEnvironment3)
+                                if (device.spk == SPK.SensorEnvironment
+                                || device.spk == SPK.SensorEnvironment2
+                                || device.spk == SPK.SensorEnvironment3
+                                )
                                 {
                                     //杩欎釜璁惧姣旇緝鐗规畩
                                     ConditionDeviceFunList conditionDeviceFunList = new ConditionDeviceFunList();
@@ -653,7 +714,6 @@
                                             case "pm25":
                                                 {
                                                     conditionDeviceFunList.PmCo2TvocAction(thisView, device, "pm25", StringId.pm25, indexVulae, true, stateValue);
-
                                                 }
                                                 break;
                                             case "tvoc":
@@ -661,8 +721,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
@@ -755,6 +856,7 @@
                                 MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                             }
                             break;
+
                     }
                 };
                 ///鍒犻櫎鎺т欢
@@ -801,7 +903,6 @@
                             targetView.btnText.Text = device.name;
                             //鏀瑰彉璁惧鍚嶇О鏄剧ず鎺т欢瀹藉害
                             targetView.btnText.Width = Application.GetRealWidth(80);
-
                             //鍖哄埆涓嶅悓璁惧锛屾樉绀轰笉鍚岃澶囩姸鎬�
                             switch (device.spk)
                             {
@@ -878,6 +979,7 @@
                                     }
                                     break;
                                 case SPK.AcStandard:
+                                case SPK.HvacAC:
                                     {
                                         string on_off = GetKeyValue("on_off", dicList);
                                         string set_temp = GetKeyValue("set_temp", dicList);
@@ -976,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);
@@ -1036,27 +1138,62 @@
                                                     break;
                                             }
 
+                                        }
+                                        if (on_off != "" && on_off == "off")
+                                        {
+                                            stateStr = Language.StringByID(StringId.offLogic);
+                                        }
+                                        else
+                                        {
+                                            stateStr = stateStr.TrimEnd(',');
 
-                                            switch (mode)
+                                        }
+                                    }
+                                    break;
+                                case SPK.AirFreshStandard:
+                                case SPK.HvacAirFresh:
+                                    {
+                                        string on_off = GetKeyValue("on_off", dicList);
+                                        string fan = GetKeyValue("fan", dicList);
+                                        if (on_off != "")
+                                        {
+                                            switch (on_off)
                                             {
-                                                case "cool":
+                                                case "on":
                                                     {
-                                                        stateStr += Language.StringByID(StringId.coolLogic) + ",";
+                                                        stateStr = Language.StringByID(StringId.onLogic) + ",";
                                                     }
                                                     break;
-                                                case "heat":
+                                                case "off":
                                                     {
-                                                        stateStr += Language.StringByID(StringId.heatingLogic) + ",";
+                                                        stateStr = Language.StringByID(StringId.offLogic) + ",";
+                                                    }
+                                                    break;
+                                            }
+                                        }
+                                        if (fan != "")
+                                        {
+
+                                            switch (fan)
+                                            {
+                                                case "high":
+                                                    {
+                                                        stateStr += Language.StringByID(StringId.HighWindSpeed) + ",";
+                                                    }
+                                                    break;
+                                                case "medium":
+                                                    {
+                                                        stateStr += Language.StringByID(StringId.MiddleWindSpeed) + ",";
+                                                    }
+                                                    break;
+                                                case "low":
+                                                    {
+                                                        stateStr += Language.StringByID(StringId.LowWindSpeed) + ",";
                                                     }
                                                     break;
                                                 case "auto":
                                                     {
-                                                        stateStr += Language.StringByID(StringId.autoLogic) + ",";
-                                                    }
-                                                    break;
-                                                case "dry":
-                                                    {
-                                                        stateStr += Language.StringByID(StringId.dehumidifyLogic) + ",";
+                                                        stateStr += Language.StringByID(StringId.Auto) + ",";
                                                     }
                                                     break;
                                             }
@@ -1088,6 +1225,27 @@
                         break;
                     case "3":
                         {
+                            //鐢╯id鎵惧埌瀹夐槻锛�
+                            var security = LogicMethod.CurrLogicMethod.GetSecurity(outputTarget.sid);
+                            targetView.btnIcon.UnSelectedImagePath = "LogicIcon/security.png";
+                            targetView.btnDelay.Visible = false;
+                            //鏄剧ず瀹夐槻鍚嶇О 
+                            targetView.btnText.Text = security.name;
+                            string value = GetKeyValue("security", dicList);
+                            if (value == "enable")
+                            {
+                                stateStr = Language.StringByID(StringId.bufang);
+
+                            }
+                            else
+                            {
+                                stateStr = Language.StringByID(StringId.chefang);
+                            }
+
+                        }
+                        break;
+                    case "4":
+                        {
                             targetView.btnIcon.UnSelectedImagePath = "LogicIcon/time.png";
                             foreach (var dic in dicList)
                             {
@@ -1098,9 +1256,9 @@
                         break;
                 }
 
-                if (outputTarget.target_type == "1")
+                if (outputTarget.target_type == "1" || outputTarget.target_type == "3")
                 {
-                    targetView.btnState.Text =new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr;
+                    targetView.btnState.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr;
                 }
                 else
                 {
@@ -1139,7 +1297,12 @@
                             break;
                         case "3":
                             {
-
+                                Security security = new Security();
+                                security.SecurityMethod(thisView, "", edit, indexVulae);
+                            }
+                            break;
+                        case "4":
+                            {
                                 FrameLayout fLayout = new FrameLayout
                                 {
                                     BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
@@ -1275,6 +1438,7 @@
                     }
                     break;
                 case SPK.AcStandard:
+                case SPK.HvacAC:
                     {
                         foreach (var dic in dicList)
                         {
@@ -1385,7 +1549,7 @@
 
                     }
                     break;
-                case SPK.FloorHeatStandard:
+                case SPK.FloorHeatStandard:case SPK.HvacFloorHeat:
                     {
 
                         foreach (var dic in dicList)
@@ -1468,6 +1632,74 @@
 
                     }
                     break;
+                case SPK.AirFreshStandard:
+                case SPK.HvacAirFresh:
+                    {
+
+                        foreach (var dic in dicList)
+                        {
+                            string value = dic["value"];
+                            switch (dic["key"])
+                            {
+                                case "on_off":
+                                    {
+                                        switch (value)
+                                        {
+                                            case "on":
+                                                {
+                                                    button1.Text = Language.StringByID(StringId.onLogic);
+                                                }
+                                                break;
+                                            case "off":
+                                                {
+                                                    button1.Text = Language.StringByID(StringId.offLogic);
+                                                }
+                                                break;
+                                        }
+                                    }
+                                    break;
+
+                                case "fan":
+                                    {
+                                        if (button2 == null)
+                                        {
+                                            //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+                                            break;
+                                        }
+                                        switch (value)
+                                        {
+                                            case "high":
+                                                {
+                                                    button2.Text = Language.StringByID(StringId.HighWindSpeed);
+                                                }
+                                                break;
+                                            case "medium":
+                                                {
+                                                    button2.Text = Language.StringByID(StringId.MiddleWindSpeed);
+                                                }
+                                                break;
+                                            case "low":
+                                                {
+                                                    button2.Text = Language.StringByID(StringId.LowWindSpeed);
+                                                }
+                                                break;
+                                            case "auto":
+                                                {
+                                                    button2.Text = Language.StringByID(StringId.Auto);
+                                                }
+                                                break;
+                                        }
+
+
+                                    }
+                                    break;
+
+                            }
+
+                        }
+
+                    }
+                    break;
                 case SPK.SensorGas:
                 case SPK.SensorSmoke:
                     {
@@ -1502,6 +1734,7 @@
                     }
                     break;
                 case SPK.SensorDryContact:
+                case SPK.SensorDryContact2:
                     {
                         foreach (var dic in dicList)
                         {
@@ -1559,6 +1792,7 @@
                             switch (dic["key"])
                             {
                                 case "status":
+                                case "people_status":
                                     {
                                         if (value == "true")
                                         {
@@ -1591,6 +1825,7 @@
                     }
                     break;
                 case SPK.SenesorMegahealth:
+                case SPK.SenesorMegahealth2:
                     {
                         foreach (var dic in dicList)
                         {
@@ -1660,6 +1895,13 @@
                             //鐢╯id鎵惧埌璁惧锛�
                             var device = LogicMethod.CurrLogicMethod.GetDevice(inputCondition.sid);
                             name = device.name + "-";
+                        }
+                        break;
+                    case "10":
+                        {
+                            //鐢╯id鎵惧埌鍦烘櫙锛�
+                            var scene = LogicMethod.CurrLogicMethod.GetSecne(inputCondition.sid);
+                            name = scene.name + "-";
                         }
                         break;
 
@@ -1752,7 +1994,8 @@
                                     }
                                     break;
                                 case SPK.AcStandard:
-                                case SPK.FloorHeatStandard:
+                                case SPK.HvacAC:
+                                case SPK.FloorHeatStandard:case SPK.HvacFloorHeat:
                                     {
                                         foreach (var dic in dicList)
                                         {
@@ -1783,18 +2026,24 @@
 
                         }
                         break;
+                    case "3":
+                        {
+                            //鐢╯id鎵惧埌瀹夐槻锛�
+                            var security = LogicMethod.CurrLogicMethod.GetSecurity(outputTarget.sid);
+                            name += security.name;
+
+                        }
+                        break;
                 }
 
                 if (!MainView.IsGatewayType)
                 {
-                    name +=Language.StringByID(StringId.push);
+                    name += Language.StringByID(StringId.push);
                 }
             }
             catch { }
             return name;
         }
-
-
         /// <summary>
         /// 寤舵椂鏃堕棿鏂规硶
         /// </summary>
@@ -1890,11 +2139,142 @@
                     state = seconds.ToString() + Language.StringByID(StringId.s);
                 }
             }
-            if (!string.IsNullOrEmpty(state)) {
+            if (!string.IsNullOrEmpty(state))
+            {
                 state = Language.StringByID(StringId.delayLogic) + state;
             }
             return state;
         }
+        /// <summary>
+        /// 鑾峰彇鏄剧ず闈㈢啛鏂囨湰
+        /// </summary>
+        /// <param name="dicList">鐘舵�佹暟鎹垪琛�</param>
+        /// <returns></returns>
+        private string GetText(List<Dictionary<string, string>> dicList,string key)
+        {
+            string strtext = "";
+            foreach (var dic in dicList)
+            {
+                string value = dic["value"];
+                string comparator = dic["comparator"];
+                switch (key)
+                {
 
+                    case "temperature":
+                        {
+                            if (comparator == ">")
+                            {
+                                strtext = ">" + value + "鈩�";
+                            }
+                            else if (comparator == "<")
+                            {
+                                strtext = "<" + value + "鈩�";
+                            }
+
+                        }
+                        break;
+                    case "humidity":
+                        {
+                            if (comparator == ">")
+                            {
+                                strtext = ">" + value + "%";
+                            }
+                            else if (comparator == "<")
+                            {
+                                strtext = "<" + value + "%";
+                            }
+
+                        }
+                        break;
+                    case "co2":
+                        {
+                            strtext = Language.StringByID(StringId.co2) + new PublicInterface { }.GetString("co2", value);
+                        }
+                        break;
+                    case "pm25":
+                        {
+                            strtext = Language.StringByID(StringId.pm25) + new PublicInterface { }.GetString("pm25", value);
+                        }
+                        break;
+                    case "tvoc":
+                        {
+                            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