From a9d1161b1df96e7ddad566335989a1444e433ef5 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期二, 28 三月 2023 11:54:45 +0800
Subject: [PATCH] 2023年03月28日11:52:02

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs |  539 +++++++++++++++++++++++++++++------------------------------
 1 files changed, 262 insertions(+), 277 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index d9f0de4..22e489a 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -48,6 +48,7 @@
                 {
                     case "1":
                         {
+                           
                             inputView.btnIcon.UnSelectedImagePath = "LogicIcon/time.png";
                             foreach (var dic in dicList)
                             {
@@ -129,12 +130,8 @@
                     case "2":
                         {
                             inputView.btnIcon.UnSelectedImagePath = "LogicIcon/time.png";
-                            foreach (var dic in dicList)
-                            {
-                                string value = dic["value"];
-                                inputView.btnText.Text = Language.StringByID(StringId.timeHorizon) + ": " + value;
-                            }
-
+                            string value= this.GetKeyValue("timesection", dicList);
+                            inputView.btnText.Text = Language.StringByID(StringId.timeHorizon) + ": " + value;
                         }
                         break;
                     case "3":
@@ -143,7 +140,7 @@
                             //鐢╯id鎵惧埌璁惧锛�
                             var device = LogicMethod.Current.GetDevice(inputCondition.sid);
                             //鐢ㄨ澶囩殑functionType绫诲瀷鎵惧埌瀵瑰簲鍥炬爣锛�
-                            inputView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetIconPath(device.spk);
+                            inputView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetDeviceIconPath(device);
                             //鏄剧ず璁惧鍚嶇О
                             inputView.btnText.Text = device.name;
                             //鏀瑰彉璁惧鍚嶇О鏄剧ず鎺т欢瀹藉害
@@ -175,91 +172,56 @@
                                 case SPK.PanelSocket:
                                 case SPK.ElectricSocket:
                                     {//寮�鍏崇伅
-                                        foreach (var dic in dicList)
+                                        string value = this.GetKeyValue("on_off", dicList);
+                                        inputView.btnState.Text = Language.StringByID(StringId.offLogic);
+                                        if (value == "on")
                                         {
-
-                                            string value = dic["value"];
-                                            if (value == "on")
-                                            {
-                                                inputView.btnState.Text = Language.StringByID(StringId.onLogic);
-
-                                            }
-                                            else
-                                            {
-                                                inputView.btnState.Text = Language.StringByID(StringId.offLogic);
-                                            }
+                                            inputView.btnState.Text = Language.StringByID(StringId.onLogic);
                                         }
                                     }
                                     break;
                                 //浼犳劅鍣�
                                 case SPK.SensorHelp:
                                     {
-                                        foreach (var dic in dicList)
+                                        string value = this.GetKeyValue("alarm_status", dicList);
+                                        inputView.btnState.Text = Language.StringByID(StringId.zhengchang);
+                                        if (value == "alarm")
                                         {
-                                            string value = dic["value"];
-                                            if (value == "alarm")
-                                            {
-                                                inputView.btnState.Text = Language.StringByID(StringId.qiujiu);
-
-                                            }
-                                            else
-                                            {
-                                                inputView.btnState.Text = Language.StringByID(StringId.zhengchang);
-                                            }
+                                            inputView.btnState.Text = Language.StringByID(StringId.qiujiu);
                                         }
                                     }
                                     break;
                                 case SPK.SensorSmoke:
                                 case SPK.SensorGas:
                                     {
-                                        foreach (var dic in dicList)
+                                        string value = this.GetKeyValue("alarm_status", dicList);
+                                        inputView.btnState.Text = Language.StringByID(StringId.wuxieluo);
+                                        if (value == "alarm")
                                         {
-                                            string value = dic["value"];
-                                            if (value == "alarm")
-                                            {
-                                                inputView.btnState.Text = Language.StringByID(StringId.xieluo);
+                                            inputView.btnState.Text = Language.StringByID(StringId.xieluo);
 
-                                            }
-                                            else
-                                            {
-                                                inputView.btnState.Text = Language.StringByID(StringId.wuxieluo);
-                                            }
                                         }
                                     }
                                     break;
                                 case SPK.SensorWater:
                                     {
-                                        foreach (var dic in dicList)
+                                        string value = this.GetKeyValue("alarm_status", dicList);
+                                        inputView.btnState.Text = Language.StringByID(StringId.wuluoshui);
+                                        if (value == "alarm")
                                         {
-                                            string value = dic["value"];
-                                            if (value == "alarm")
-                                            {
-                                                inputView.btnState.Text = Language.StringByID(StringId.luoshui);
-
-                                            }
-                                            else
-                                            {
-                                                inputView.btnState.Text = Language.StringByID(StringId.wuluoshui);
-                                            }
+                                            inputView.btnState.Text = Language.StringByID(StringId.luoshui);
                                         }
                                     }
                                     break;
                                 case SPK.SensorDryContact:
                                 case SPK.SensorDryContact2:
                                     {
-                                        foreach (var dic in dicList)
+
+                                        string value = this.GetKeyValue("on_off", dicList);
+                                        inputView.btnState.Text = Language.StringByID(StringId.offLogic);
+                                        if (value == "on")
                                         {
-
-                                            string value = dic["value"];
-                                            if (value == "on")
-                                            {
-                                                inputView.btnState.Text = Language.StringByID(StringId.onLogic);
-
-                                            }
-                                            else
-                                            {
-                                                inputView.btnState.Text = Language.StringByID(StringId.offLogic);
-                                            }
+                                            inputView.btnState.Text = Language.StringByID(StringId.onLogic);
                                         }
                                     }
                                     break;
@@ -267,132 +229,89 @@
                                 case SPK.SensorDuiShe:
                                 case SPK.SensorPir:
                                     {
-                                        foreach (var dic in dicList)
+                                        string value = this.GetKeyValue("people_status", dicList);
+                                        inputView.btnState.Text = Language.StringByID(StringId.wuren);
+                                        if (value == "true")
                                         {
+                                            inputView.btnState.Text = Language.StringByID(StringId.youren);
 
-                                            string value = dic["value"];
-                                            if (value == "true")
-                                            {
-                                                inputView.btnState.Text = Language.StringByID(StringId.youren);
-
-                                            }
-                                            else
-                                            {
-                                                inputView.btnState.Text = Language.StringByID(StringId.wuren);
-                                            }
                                         }
                                     }
                                     break;
                                 case SPK.SensorDoorWindow:
                                     {
-                                        foreach (var dic in dicList)
+                                        string value = this.GetKeyValue("contact_status", dicList);
+                                        inputView.btnState.Text = Language.StringByID(StringId.bihe);
+                                        if (value == "open")
                                         {
-
-                                            string value = dic["value"];
-                                            if (value == "open")
-                                            {
-                                                inputView.btnState.Text = Language.StringByID(StringId.kaiqi);
-
-                                            }
-                                            else
-                                            {
-                                                inputView.btnState.Text = Language.StringByID(StringId.bihe);
-                                            }
+                                            inputView.btnState.Text = Language.StringByID(StringId.kaiqi);
                                         }
+                                       
                                     }
                                     break;
                                 case SPK.SensorUtrasonic:
                                     {
+                                        string key = this.GetKey(dicList);
+                                        string value = this.GetValue(dicList);
                                         string str = "";
-                                        foreach (var dic in dicList)
+                                        switch (key)
                                         {
-                                            string value = dic["value"];
-                                            switch (dic["key"])
-                                            {
-                                                case "status":
-                                                case "people_status":
+                                            case "status":
+                                            case "people_status":
+                                                {
+                                                    str = Language.StringByID(StringId.wuren);
+                                                    if (value == "true")
                                                     {
-                                                        if (value == "true")
-                                                        {
-                                                            str = Language.StringByID(StringId.youren);
-                                                        }
-                                                        else
-                                                        {
-                                                            str = Language.StringByID(StringId.wuren);
-                                                        }
-
-
+                                                        str = Language.StringByID(StringId.youren);
                                                     }
-                                                    break;
-                                                case "dismantle":
+                                                }
+                                                break;
+                                            case "dismantle":
+                                                {
+                                                    str = Language.StringByID(StringId.buzaixian);
+                                                    if (value == "true")
                                                     {
-                                                        if (value == "true")
-                                                        {
-                                                            str = Language.StringByID(StringId.zaixian);
-                                                        }
-                                                        else
-                                                        {
-                                                            str = Language.StringByID(StringId.buzaixian);
-                                                        }
+                                                        str = Language.StringByID(StringId.zaixian);
                                                     }
-                                                    break;
-
-                                            }
+                                                }
+                                                break;
 
                                         }
                                         inputView.btnState.Text = str;
                                     }
                                     break;
                                 case SPK.SenesorMegahealth:
+                                case SPK.SensorMmvPose:
                                     {
-                                        foreach (var dic in dicList)
+                                        string key = this.GetKey(dicList);
+                                        string value = this.GetValue(dicList);
+                                        if (key == "people_status")
                                         {
-                                            string value = dic["value"];
-                                            switch (dic["key"])
+                                            inputView.btnState.Text = Language.StringByID(StringId.wuren);
+                                            if (value == "true")
                                             {
-                                                case "people_status":
-                                                    {
-                                                        if (value == "true")
-                                                        {
-                                                            inputView.btnState.Text = Language.StringByID(StringId.youren);
-                                                        }
-                                                        else
-                                                        {
-                                                            inputView.btnState.Text = Language.StringByID(StringId.wuren);
-                                                        }
-
-                                                    }
-                                                    break;
-                                                case "target_status":
-                                                    {
-                                                        if (value == "4")
-                                                        {
-                                                            inputView.btnState.Text = Language.StringByID(StringId.shi);
-                                                        }
-                                                    }
-                                                    break;
+                                                inputView.btnState.Text = Language.StringByID(StringId.youren);
                                             }
-
+                                        }
+                                        else if (key == "target_status")
+                                        {
+                                            if (value == "4")
+                                            {
+                                                inputView.btnState.Text = Language.StringByID(StringId.shi);
+                                            }
                                         }
                                     }
                                     break;
                                 case SPK.SenesorMegahealth2:
                                     {
-                                        foreach (var dic in dicList)
-                                        {
-                                            string value = dic["value"];
-                                            if (value == "fall")
-                                            {
-                                                inputView.btnState.Text = Language.StringByID(StringId.diedao);
-                                            }
-                                            else
-                                            {
-                                                inputView.btnState.Text = Language.StringByID(StringId.wuren);
-                                            }
+                                        string value = this.GetValue(dicList);
+                                        inputView.btnState.Text = Language.StringByID(StringId.wuren);
+                                        if (value == "fall") {
+                                            inputView.btnState.Text = Language.StringByID(StringId.diedao);
                                         }
                                     }
                                     break;
-                                case SPK.SensorEnvironment:
+                                case SPK.SensorEnvironment:case SPK.SensorEnvironmentHailin:
                                 case SPK.SensorEnvironment2:
                                 case SPK.SensorEnvironment3:
                                     {
@@ -456,7 +375,7 @@
                                 case SPK.SensorTemperature:
                                     {
 
-                                        string str = new InpOrOutLogicMethod { }.GetText(dicList, "temperature");
+                                        string str =this.GetText(dicList, "temperature");
                                         inputView.btnState.Text = str;
                                     }
                                     break;
@@ -467,31 +386,23 @@
 
                                     }
                                     break;
+                                case SPK.SensorPm10:
                                 case SPK.SensorCO2:
                                 case SPK.SensorPm25:
                                 case SPK.SensorTVOC:
                                 case SPK.SensorHcho:
                                     {
-                                        string strvalue = "";
-                                        foreach (var dic in dicList)
-                                        {
-                                            strvalue = dic["value"];
-                                            break;
-                                        }
-                                        string str = new PublicInterface().GetSensorLevelText(device, strvalue, true);
+                                        string value = this.GetValue(dicList);
+                                        string str = new PublicInterface().GetSensorLevelText(device, value, true);
                                         inputView.btnState.Text = str;
                                     }
                                     break;
                                 case SPK.DoorLock:
                                     {
-                                        foreach (var dic in dicList)
+                                        string value = this.GetValue(dicList);
+                                        if (value == "open")
                                         {
-                                            string value = dic["value"];
-                                            if (value == "open")
-                                            {
-                                                inputView.btnState.Text = Language.StringByID(StringId.kaiqi);
-                                            }
-
+                                            inputView.btnState.Text = Language.StringByID(StringId.kaiqi);
                                         }
                                     }
                                     break;
@@ -503,20 +414,19 @@
                                         }
                                         else
                                         {
-
-                                            foreach (var dic in dicList)
-                                            {
-                                                string key = dic["key"];
-                                                if (key == "user_id")
-                                                {
-                                                    string userId = dic["value"];
-                                                    var FaceItem = this.FaceItem(userId, device.deviceId);
-                                                    inputView.btnState.Text = FaceItem.userName;
-                                                    // Language.StringByID(StringId.kaiqi);
-                                                }
-
-                                            }
+                                            string userId = this.GetKeyValue("user_id",dicList);
+                                            var FaceItem = this.GetFaceItem(userId, device.deviceId);
+                                            inputView.btnState.Text = FaceItem.userName;
                                         }
+                                    }
+                                    break;
+                                case SPK.IpCam_Imou:
+                                    {
+                                        if (inputCondition.identifier == "door_caipcam_region_alram_eventll_cloud_event")
+                                        {
+                                            inputView.btnState.Text = Language.StringByID(StringId.quyuruqingaojing);
+                                        }
+                                        
                                     }
                                     break;
                             }
@@ -639,26 +549,18 @@
                     case "8":
                         {
                             inputView.btnIcon.UnSelectedImagePath = "LogicIcon/location.png";
-                            foreach (var dic in dicList)
+                            string value = this.GetValue(dicList);
+                            if (value == "arrive")
                             {
-                                string strtext = "";
-                                string value = dic["value"];
-                                switch (value)
-                                {
-                                    case "arrive":
-                                        {
-                                            strtext = Language.StringByID(StringId.daoda);
-                                        }
-                                        break;
-                                    case "leave":
-                                        {
-                                            strtext = Language.StringByID(StringId.likai);
-                                        }
-                                        break;
-                                }
-                                inputView.btnText.TextID = StringId.likiadaoda;
-                                inputView.btnState.Text = strtext;
+                                value = Language.StringByID(StringId.daoda);
                             }
+                            else if (value == "leave")
+                            {
+                                value = Language.StringByID(StringId.likai);
+                            }
+
+                            inputView.btnText.TextID = StringId.likiadaoda;
+                            inputView.btnState.Text = value;
                         }
                         break;
                     case "10":
@@ -770,13 +672,11 @@
                             {
                                 //鐢╯id鎵惧埌璁惧锛�
                                 var device = LogicMethod.Current.GetDevice(inputCondition.sid);
-                                if (device.spk == SPK.SensorEnvironment
+                                if (device.spk == SPK.SensorEnvironment || device.spk == SPK.SensorEnvironmentHailin
                                 || device.spk == SPK.SensorEnvironment2
                                 || device.spk == SPK.SensorEnvironment3
                                 )
                                 {
-                                    //杩欎釜璁惧姣旇緝鐗规畩
-                                    ConditionDeviceFunList conditionDeviceFunList = new ConditionDeviceFunList();
                                     ///褰撳墠鐨勭储寮曞�兼暟鎹璞�
                                     Input inputedit = Logic.currlogic.input[indexVulae];
                                     ///鐘舵�佸��
@@ -800,7 +700,7 @@
                                                     {
                                                         titleInt = StringId.wendudiyu;
                                                     }
-                                                    conditionDeviceFunList.InputBoxAction(device, titleInt, indexVulae, true, stateValue);
+                                                    ConditionDeviceFunList.Current.InputBoxAction(device, titleInt, indexVulae, true, stateValue);
                                                 }
                                                 break;
                                             case "humidity":
@@ -814,27 +714,27 @@
                                                     {
                                                         titleInt = StringId.shidudiyu;
                                                     }
-                                                    conditionDeviceFunList.InputBoxAction(device, titleInt, indexVulae, true, stateValue);
+                                                    ConditionDeviceFunList.Current.InputBoxAction(device, titleInt, indexVulae, true, stateValue);
                                                 }
                                                 break;
                                             case "co2":
                                                 {
-                                                    conditionDeviceFunList.PmCo2TvocAction(thisView, device, "co2", StringId.co2, indexVulae, true, stateValue);
+                                                    ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "co2", StringId.co2, indexVulae, true, stateValue);
                                                 }
                                                 break;
                                             case "pm25":
                                                 {
-                                                    conditionDeviceFunList.PmCo2TvocAction(thisView, device, "pm25", StringId.pm25, indexVulae, true, stateValue);
+                                                    ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "pm25", StringId.pm25, indexVulae, true, stateValue);
                                                 }
                                                 break;
                                             case "tvoc":
                                                 {
-                                                    conditionDeviceFunList.PmCo2TvocAction(thisView, device, "tvoc", StringId.tvoc, indexVulae, true, stateValue);
+                                                    ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "tvoc", StringId.tvoc, indexVulae, true, stateValue);
                                                 }
                                                 break;
                                             case "hcho":
                                                 {
-                                                    conditionDeviceFunList.PmCo2TvocAction(thisView, device, "hcho", StringId.Formaldehyde, indexVulae, true, stateValue);
+                                                    ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "hcho", StringId.Formaldehyde, indexVulae, true, stateValue);
                                                 }
                                                 break;
                                         }
@@ -844,37 +744,43 @@
                                 else if (device.spk == SPK.SensorTemperature)
                                 {
 
-                                    new InpOrOutLogicMethod().SensorView(thisView, device, "temperature", indexVulae);
+                                   this.SensorView(thisView, device, "temperature", indexVulae);
 
                                 }
                                 else if (device.spk == SPK.SensorHumidity)
                                 {
 
-                                    new InpOrOutLogicMethod().SensorView(thisView, device, "humidity", indexVulae);
+                                    this.SensorView(thisView, device, "humidity", indexVulae);
 
                                 }
                                 else if (device.spk == SPK.SensorCO2)
                                 {
 
-                                    new InpOrOutLogicMethod().SensorView(thisView, device, "co2", indexVulae);
+                                    this.SensorView(thisView, device, "co2", indexVulae);
+
+                                }
+                                else if (device.spk == SPK.SensorPm10)
+                                {
+
+                                    this.SensorView(thisView, device, "pm10", indexVulae);
 
                                 }
                                 else if (device.spk == SPK.SensorPm25)
                                 {
 
-                                    new InpOrOutLogicMethod().SensorView(thisView, device, "pm25", indexVulae);
+                                    this.SensorView(thisView, device, "pm25", indexVulae);
 
                                 }
                                 else if (device.spk == SPK.SensorTVOC)
                                 {
 
-                                    new InpOrOutLogicMethod().SensorView(thisView, device, "tvoc", indexVulae);
+                                    this.SensorView(thisView, device, "tvoc", indexVulae);
 
                                 }
                                 else if (device.spk == SPK.SensorHcho)
                                 {
 
-                                    new InpOrOutLogicMethod().SensorView(thisView, device, "hcho", indexVulae);
+                                    this.SensorView(thisView, device, "hcho", indexVulae);
 
                                 }
                                 else
@@ -1024,7 +930,7 @@
                             //鐢╯id鎵惧埌璁惧锛�
                             var device = LogicMethod.Current.GetDevice(outputTarget.sid);
                             //鐢ㄨ澶囩殑functionType绫诲瀷鎵惧埌瀵瑰簲鍥炬爣锛�
-                            targetView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetIconPath(device.spk);
+                            targetView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetDeviceIconPath(device);
                             //鏄剧ず璁惧鍚嶇О
                             targetView.btnText.Text = device.name;
                             //鏀瑰彉璁惧鍚嶇О鏄剧ず鎺т欢瀹藉害
@@ -1033,11 +939,27 @@
                             //鍖哄埆涓嶅悓璁惧锛屾樉绀轰笉鍚岃澶囩姸鎬�
                             switch (device.spk)
                             {
+
+                                //鎻掑骇(鏈塙SB)
+                                case SPK.PanelSocket:
+                                    {
+                                        string on_off = GetKeyValue("on_off_master", dicList);
+                                        if (on_off == "on")
+                                        {
+                                            stateStr = Language.StringByID(StringId.onLogic);
+                                        }
+                                        else
+                                        {
+                                            stateStr = stateStr = Language.StringByID(StringId.offLogic);
+                                        }
+                                    }
+                                    break;
                                 case SPK.AirSwitch:
                                 case SPK.LightSwitch:
                                 //鎻掑骇
-                                case SPK.PanelSocket:
                                 case SPK.ElectricSocket:
+                                //鏈烘鎵�
+                                case SPK.MechanicalArm:
                                     {//寮�鍏�
 
                                         foreach (var dic in dicList)
@@ -1077,6 +999,14 @@
                                         else if (brightness != "")
                                         {
                                             stateStr = brightness + "%";
+                                        }
+                                        if (device.spk == SPK.LightCCT)
+                                        {
+                                            //鑹叉俯杩欎釜灞炴�ф墠鏈夋晥
+                                            if (stateStr != Language.StringByID(StringId.offLogic) && GetKeyValue("cct", dicList) != "")
+                                            {
+                                                stateStr += "," +GetKeyValue("cct", dicList) + "k";
+                                            }
                                         }
 
                                     }
@@ -1385,12 +1315,15 @@
                                 case SPK.MusicStandard:
                                 case SPK.AvMusic:
                                     {
-                                        foreach (var dic in dicList)
+                                        string song_name = GetKeyValue("song_name", dicList);
+                                        string volume = GetKeyValue("volume", dicList);
+                                        stateStr = song_name + ";" +Language.StringByID(StringId.volumeMusic)+volume;
+                                        if (stateStr.StartsWith(";"))
                                         {
-                                            if (dic["key"] == "song_name")
-                                            {
-                                                stateStr = dic["value"]?.ToString();
-                                            }
+                                            stateStr = stateStr.Substring(1, stateStr.Length - 1);
+                                        }else if (stateStr.EndsWith(Language.StringByID(StringId.volumeMusic)))
+                                        {
+                                            stateStr = stateStr.Substring(0, stateStr.Length - 3);
                                         }
                                     }
                                     break;
@@ -1442,11 +1375,11 @@
 
                 if (outputTarget.target_type == "1" || outputTarget.target_type == "3")
                 {
-                    targetView.btnState.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr;
+                    targetView.btnState.Text = this.GetTimeText(outputTarget.delay) + stateStr;
                 }
                 else
                 {
-                    targetView.btnText.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr;
+                    targetView.btnText.Text = this.GetTimeText(outputTarget.delay) + stateStr;
                 }
                 //鍐嶆缂栬緫鏉′欢鐘舵�佺偣鍑讳簨浠�
                 targetView.btnClick.MouseUpEventHandler += (sen, e) =>
@@ -1503,20 +1436,18 @@
                 //寤舵椂鐐瑰嚮浜嬩欢
                 targetView.btnDelay.MouseUpEventHandler += (sen, e) =>
                 {
-
-                    InpOrOutLogicMethod inpOrOutLogicMethod = new InpOrOutLogicMethod();
-                    inpOrOutLogicMethod.Delayed(thisView, outputTarget.delay, (value) =>
-                    {
-                        outputTarget.delay = value.ToString();
-                        if (outputTarget.target_type == "1")
-                        {
-                            targetView.btnState.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr;
-                        }
-                        else
-                        {
-                            targetView.btnText.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr;
-                        }
-                    });
+                    this.Delayed(thisView, outputTarget.delay, (value) =>
+                     {
+                         outputTarget.delay = value.ToString();
+                         if (outputTarget.target_type == "1")
+                         {
+                             targetView.btnState.Text = this.GetTimeText(outputTarget.delay) + stateStr;
+                         }
+                         else
+                         {
+                             targetView.btnText.Text = this.GetTimeText(outputTarget.delay) + stateStr;
+                         }
+                     });
 
                 };
                 ///鍒犻櫎鎺т欢
@@ -1539,12 +1470,29 @@
         {
             switch (device.spk)
             {
-                //鎻掑骇
+                //鎻掑骇(鏈塙SB)
                 case SPK.PanelSocket:
+                    {
+                        foreach (var dic in dicList)
+                        {
+                            string value = dic["value"];
+                            if (value == "on")
+                            {
+                                button1.Text = Language.StringByID(StringId.onLogic);
+                            }
+                            else
+                            {
+                                button1.Text = Language.StringByID(StringId.offLogic);
+                            }
+                        }
+                    }
+                    break;
                 case SPK.ElectricSocket:
                 //寮�鍏崇伅鍏�
                 case SPK.AirSwitch:
                 case SPK.LightSwitch:
+                    //鏈烘鎵�
+                case SPK.MechanicalArm:
                     {
                         foreach (var dic in dicList)
                         {
@@ -1590,6 +1538,16 @@
                                             break;
                                         }
                                         button2.Text = value + "%";
+                                    }
+                                    break;
+                                case "cct":
+                                    {
+                                        if (button3 == null)
+                                        {
+                                            //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+                                            break;
+                                        }
+                                        button3.Text = value + "k";
                                     }
                                     break;
                             }
@@ -2107,6 +2065,7 @@
                     }
                     break;
                 case SPK.SenesorMegahealth:
+                case SPK.SensorMmvPose:
                     {
                         foreach (var dic in dicList)
                         {
@@ -2178,20 +2137,20 @@
                             {
                                 button1.Text = dic["value"]?.ToString();
                             }
-                        }
-                    }
-                    break;
-                case SPK.doorgate:
-                    {
-                        foreach (var dic in dicList)
-                        {
-                            if (dic["key"] == "user_id")
+                            else if (dic["key"] == "volume")
                             {
                                 button2.Text = dic["value"]?.ToString();
                             }
                         }
                     }
                     break;
+                case SPK.doorgate:
+                    {
+                        string value = this.GetKeyValue("user_id", dicList);
+                        button2.Text = this.GetFaceItem(value, device.deviceId).userName;
+                    }
+                    break;
+              
             }
         }
         /// <summary>
@@ -2214,6 +2173,32 @@
 
             }
             return valueStr;
+        }
+        /// <summary>
+        /// 鑾峰彇Key鍊�
+        /// </summary>
+        /// <param name="dicList">娉ㄦ剰:姘歌繙榛樿绗竴涓厓绱�</param>
+        /// <returns></returns>
+        public string GetKey(List<Dictionary<string, string>> dicList)
+        {
+            if (dicList.Count == 0)
+            {
+                return "";
+            }
+            return dicList[0]["key"].ToString();
+        }
+        /// <summary>
+        /// 鑾峰彇value鍊�
+        /// </summary>
+        /// <param name="dicList">娉ㄦ剰:姘歌繙榛樿绗竴涓厓绱�</param>
+        /// <returns></returns>
+        public string GetValue(List<Dictionary<string, string>> dicList)
+        {
+            if (dicList.Count == 0)
+            {
+                return "";
+            }
+            return dicList[0]["value"].ToString();
         }
         /// <summary>
         ///鑾峰彇鑷姩鍖栧悕绉�
@@ -2274,22 +2259,16 @@
                             //鍖哄埆涓嶅悓璁惧锛屾樉绀轰笉鍚岃澶囩姸鎬�
                             switch (device.spk)
                             {
+                                case SPK.MechanicalArm:
                                 case SPK.AirSwitch:
                                 case SPK.LightSwitch:
                                     {//寮�鍏崇伅
-
-                                        foreach (var dic in dicList)
+                                        string value = this.GetValue(dicList);
+                                        stateStr = Language.StringByID(StringId.offLogic);
+                                        if (value == "on")
                                         {
-                                            string value = dic["value"];
-                                            if (value == "on")
-                                            {
-                                                stateStr = Language.StringByID(StringId.onLogic);
+                                            stateStr = Language.StringByID(StringId.onLogic);
 
-                                            }
-                                            else
-                                            {
-                                                stateStr = Language.StringByID(StringId.offLogic);
-                                            }
                                         }
                                     }
                                     break;
@@ -2351,18 +2330,12 @@
                                 case SPK.FloorHeatStandard:
                                 case SPK.HvacFloorHeat:
                                     {
-                                        foreach (var dic in dicList)
+                                        string value = this.GetValue(dicList);
+                                        stateStr = Language.StringByID(StringId.offLogic);
+                                        if (value == "on")
                                         {
-                                            string value = dic["value"];
-                                            if (value == "on")
-                                            {
-                                                stateStr = Language.StringByID(StringId.onLogic);
+                                            stateStr = Language.StringByID(StringId.onLogic);
 
-                                            }
-                                            else if (value == "off")
-                                            {
-                                                stateStr = Language.StringByID(StringId.offLogic);
-                                            }
                                         }
 
                                     }
@@ -2471,7 +2444,9 @@
         /// <returns></returns>
         private string GetTimeText(string strTimeValue)
         {
-            var timeValue = int.Parse(strTimeValue);
+            //鍥犱负璋冭瘯杞欢涓婁紶涓虹┖杩�;
+            string intTimeValue = string.IsNullOrEmpty(strTimeValue) ? "0" : strTimeValue;
+            var timeValue = int.Parse(intTimeValue);
             string state = "";
             var minutes = timeValue / 60;
             var seconds = timeValue % 60;
@@ -2545,6 +2520,11 @@
                             strtext = Language.StringByID(StringId.co2) + new PublicInterface { }.GetString("co2", value);
                         }
                         break;
+                    case "pm10":
+                        {
+                            strtext = Language.StringByID(StringId.pm10) + new PublicInterface { }.GetString("pm25", value);
+                        }
+                        break;
                     case "pm25":
                         {
                             strtext = Language.StringByID(StringId.pm25) + new PublicInterface { }.GetString("pm25", value);
@@ -2567,13 +2547,13 @@
         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)
+            for (int i=0;i<inputedit.condition.Count;i++)
             {
+                var dic = inputedit.condition[i];
                 string comparator = dic["comparator"];
                 stateValue = dic["value"];
                 switch (key)
@@ -2590,7 +2570,7 @@
                             {
                                 titleInt = StringId.wendudiyu;
                             }
-                            conditionDeviceFunList.InputBoxAction(device, titleInt, indexVulae, true, stateValue);
+                            ConditionDeviceFunList.Current.InputBoxAction(device, titleInt, indexVulae, true, stateValue);
                         }
                         break;
                     case "humidity":
@@ -2604,27 +2584,32 @@
                             {
                                 titleInt = StringId.shidudiyu;
                             }
-                            conditionDeviceFunList.InputBoxAction(device, titleInt, indexVulae, true, stateValue);
+                            ConditionDeviceFunList.Current.InputBoxAction(device, titleInt, indexVulae, true, stateValue);
                         }
                         break;
                     case "co2":
                         {
-                            conditionDeviceFunList.PmCo2TvocAction(thisView, device, "co2", StringId.co2, indexVulae, true, stateValue);
+                            ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "co2", StringId.co2, indexVulae, true, stateValue);
+                        }
+                        break;
+                    case "pm10":
+                        {
+                            ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "pm10", StringId.pm10, indexVulae, true, stateValue);
                         }
                         break;
                     case "pm25":
                         {
-                            conditionDeviceFunList.PmCo2TvocAction(thisView, device, "pm25", StringId.pm25, indexVulae, true, stateValue);
+                            ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "pm25", StringId.pm25, indexVulae, true, stateValue);
                         }
                         break;
                     case "tvoc":
                         {
-                            conditionDeviceFunList.PmCo2TvocAction(thisView, device, "tvoc", StringId.tvoc, indexVulae, true, stateValue);
+                            ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "tvoc", StringId.tvoc, indexVulae, true, stateValue);
                         }
                         break;
                     case "hcho":
                         {
-                            conditionDeviceFunList.PmCo2TvocAction(thisView, device, "hcho", StringId.Formaldehyde, indexVulae, true, stateValue);
+                            ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "hcho", StringId.Formaldehyde, indexVulae, true, stateValue);
                         }
                         break;
                 }
@@ -2634,8 +2619,8 @@
         /// 鏌ユ壘鎸囧畾userId
         /// </summary>
         /// <param name="userId"></param>
-        /// <returns></returns>
-        public Face FaceItem(string userId, string deviceId)
+        /// <returns></returns> 
+        public Face GetFaceItem(string userId, string deviceId)
         {
             if (Send.Current.faceList.Count == 0)
             {

--
Gitblit v1.8.0