From 649f0223cf1bacbc3df0eada80a839b0d58c7039 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期二, 06 七月 2021 09:46:06 +0800
Subject: [PATCH] 更新温居城自动化代码

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs              |  242 ++++++++++
 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs          |  382 ++++++++++++++-
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SelectTypeView.cs     |    2 
 HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs       |  368 ++++++++++++---
 HDL_ON/UI/UI2/3-Intelligence/Automation/Time3.cs                        |   12 
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TimeView.cs           |   28 +
 HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs          |   10 
 HDL_ON/UI/UI2/3-Intelligence/Automation 2.zip                           |    0 
 HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs                    |   12 
 HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs                      |   16 
 HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs                          |    2 
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs                  |   72 ++-
 HDL_ON/UI/UI2/3-Intelligence/Automation/OnePortAutomation.cs            |    6 
 HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs                        |    4 
 HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs                     |    6 
 HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs                         |   12 
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/AddOutputInputView.cs |   43 +
 HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs           |   81 --
 HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs                     |   22 
 HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs                   |   12 
 HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs             |   12 
 21 files changed, 1,061 insertions(+), 283 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation 2.zip b/HDL_ON/UI/UI2/3-Intelligence/Automation 2.zip
new file mode 100644
index 0000000..29f5c62
--- /dev/null
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation 2.zip
Binary files differ
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
index 2bc0a26..13d98be 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
@@ -252,7 +252,7 @@
                         ) =>
                     {
                         Logic.currlogic.name = logicName;
-                        Logic.currlogic.sid = LogicMethod.NewSid();
+                        Logic.currlogic.sid = LogicMethod.CurrLogicMethod.NewSid();
                         loading.Start();
                         new System.Threading.Thread(() =>
                         {
@@ -295,7 +295,7 @@
                                         }
 
                                         Logic.LogicList.Add(Logic.currlogic);
-                                        LogicMethod.RemoveAllView();
+                                        LogicMethod.CurrLogicMethod.RemoveAllView();
                                         MainView.MainShow();
                                     }
                                     else if (responsePackNew != null && responsePackNew.Code == "14005")
@@ -335,7 +335,7 @@
                                 loading.Hide();
                                 if (responsePackNew != null && responsePackNew.Code == "0")
                                 {
-                                    LogicMethod.RemoveAllView();
+                                    LogicMethod.CurrLogicMethod.RemoveAllView();
                                     MainView.MainShow();
                                 }
                                 else if (responsePackNew != null && responsePackNew.Code == "14005")
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs
index d185e19..cdb06f7 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs
@@ -85,7 +85,7 @@
         /// </summary>
         public void SceneMethod()
         {
-            var sceneList = LogicMethod.GetSceneList();
+            var sceneList = LogicMethod.CurrLogicMethod.GetSceneList();
             List<string> nameList = new List<string>();
             for (int i = 0; i < sceneList.Count; i++) {
                 var scene = sceneList[i];
@@ -101,7 +101,7 @@
                 //娌″暐浣滅敤锛屼负浜嗗彂閫佹暟鎹牸寮忕粺涓�;
                 outputDevice.status = new List<Dictionary<string, string>> { new Dictionary<string, string> { { "key", "scene" }, { "value", "0" } } };
                 AddOutput(outputDevice);
-                LogicMethod.RemoveAllView();
+                LogicMethod.CurrLogicMethod.RemoveAllView();
                 AddLogic addLogic = new AddLogic();
                 MainPage.BasePageView.AddChidren(addLogic);
                 addLogic.Show();
@@ -168,11 +168,11 @@
                     return;
                 }
                 Output outputTime= new Output();
-                outputTime.sid = LogicMethod.NewSid();
+                outputTime.sid = LogicMethod.CurrLogicMethod.NewSid();
                 outputTime.target_type = "3";
                 Dictionary<string, string> dic = new Dictionary<string, string>();
-                LogicMethod.dictionary(dic, "key", "delay");
-                LogicMethod.dictionary(dic, "value", timepoint);
+                LogicMethod.CurrLogicMethod.dictionary(dic, "key", "delay");
+                LogicMethod.CurrLogicMethod.dictionary(dic, "value", timepoint);
                 outputTime.status.Add(dic);
                 if (edit)
                 {
@@ -187,7 +187,7 @@
                     AddOutput(outputTime);
                 }
                 fLayout.RemoveFromParent();
-                LogicMethod.RemoveAllView();
+                LogicMethod.CurrLogicMethod.RemoveAllView();
                 AddLogic addLogic = new AddLogic();
                 MainPage.BasePageView.AddChidren(addLogic);
                 addLogic.Show();
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs
index 4176826..2ea187d 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs
@@ -81,13 +81,13 @@
         private void AddDic(string value)
         {
             Input input = new Input();
-            input.sid = LogicMethod.NewSid();
+            input.sid = LogicMethod.CurrLogicMethod.NewSid();
             input.condition_type = "9";
             Dictionary<string, string> dic = new Dictionary<string, string>();
-            LogicMethod.dictionary(dic, "key", "air_quality");
-            LogicMethod.dictionary(dic, "comparator", "=");
-            LogicMethod.dictionary(dic, "data_type", "string");
-            LogicMethod.dictionary(dic, "value", value);
+            LogicMethod.CurrLogicMethod.dictionary(dic, "key", "air_quality");
+            LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
+            LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
+            LogicMethod.CurrLogicMethod.dictionary(dic, "value", value);
             input.condition.Add(dic);
             AddCondition(input);
         }
@@ -121,7 +121,7 @@
                 Logic.currlogic.input.Add(input);
             }
 
-            LogicMethod.RemoveAllView();
+            LogicMethod.CurrLogicMethod.RemoveAllView();
             AddLogic addLogic = new AddLogic();
             MainPage.BasePageView.AddChidren(addLogic);
             addLogic.Show();
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
index 5b55584..e2ec5ee 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -3,6 +3,7 @@
 using System.Collections.Generic;
 using HDL_ON.Entity;
 
+
 namespace HDL_ON.UI.UI2.Intelligence.Automation
 {
     public class ConditionDeviceFunList : FrameLayout
@@ -19,6 +20,7 @@
         /// 瀹氫箟涓�涓彉閲忥紝璁板綍閫変腑鐘舵��
         /// </summary>
         private string selectedState = "unknown";
+
         public void Show(Entity.Function device, int index, bool edit)
         {
             #region 鐣岄潰甯冨眬
@@ -69,6 +71,7 @@
                         }
                     }
                     break;
+                //姘存蹈浼犳劅鍣�
                 case SPK.SensorWater:
                     {
                         LogicView.FunTypeView view = new LogicView.FunTypeView();
@@ -85,7 +88,9 @@
 
                     }
                     break;
+                //鐑熼浘浼犳劅鍣�
                 case SPK.SensorSmoke:
+                //鐕冩皵浼犳劅鍣�
                 case SPK.SensorGas:
                     {
                         LogicView.FunTypeView view = new LogicView.FunTypeView();
@@ -102,6 +107,7 @@
 
                     }
                     break;
+                //骞叉帴鐐�
                 case SPK.SensorDryContact:
                     {
                         LogicView.FunTypeView view = new LogicView.FunTypeView();
@@ -118,8 +124,11 @@
 
                     }
                     break;
+                //绾㈠鐝婃爮浼犳劅鍣�
                 case SPK.SensorShanLan:
+                //绾㈠瀵瑰皠浼犳劅鍣�
                 case SPK.SensorDuiShe:
+                //绾㈠绉诲姩浼犳劅鍣�
                 case SPK.SensorPir:
                     {
                         LogicView.FunTypeView view = new LogicView.FunTypeView();
@@ -135,6 +144,7 @@
                         }
                     }
                     break;
+                //闂ㄧ獥浼犳劅鍣�
                 case SPK.SensorDoorWindow:
                     {
                         LogicView.FunTypeView view = new LogicView.FunTypeView();
@@ -150,7 +160,8 @@
                         }
                     }
                     break;
-                case SPK.SensorUtrasonic:
+                //瓒呭0娉紶鎰熷櫒
+                case SPK.SensoruUtrasonic:
                     {
 
                         LogicView.FunTypeView view = new LogicView.FunTypeView();
@@ -175,10 +186,11 @@
                         }
                     }
                     break;
+                //姣背娉紶鎰熷櫒
                 case SPK.SenesorMegahealth:
                     {
                         LogicView.FunTypeView view = new LogicView.FunTypeView();
-                        view.btnText.TextID = StringId.mubiaozhuangtai ;//鐩爣鐘舵��
+                        view.btnText.TextID = StringId.mubiaozhuangtai;//鐩爣鐘舵��
                         fLayout.AddChidren(view.FLayoutView());
                         view.btnClick.MouseUpEventHandler += (sender, e) =>
                         {
@@ -190,7 +202,72 @@
                         }
                     }
                     break;
+                //鐜妫�娴嬩紶鎰熷櫒
+                case SPK.SenesorEnvironment:
+                    {
+                        #region 鐣岄潰
+                        ///娓╁害
+                        LogicView.FunTypeView wenuView = new LogicView.FunTypeView();
+                        wenuView.btnText.TextID = StringId.wendu;
+                        fLayout.AddChidren(wenuView.FLayoutView());
+                        ///婀垮害
+                        LogicView.FunTypeView shiduView = new LogicView.FunTypeView();
+                        shiduView.frameLayout.Y = wenuView.frameLayout.Bottom;
+                        shiduView.btnText.TextID = StringId.shidu;
+                        fLayout.AddChidren(shiduView.FLayoutView());
+                        ///pm2.5
+                        LogicView.FunTypeView pm25View = new LogicView.FunTypeView();
+                        pm25View.frameLayout.Y = shiduView.frameLayout.Bottom;
+                        pm25View.btnText.TextID = StringId.pm25;
+                        fLayout.AddChidren(pm25View.FLayoutView());
+                        ///co2
+                        LogicView.FunTypeView co2View = new LogicView.FunTypeView();
+                        co2View.frameLayout.Y = pm25View.frameLayout.Bottom;
+                        co2View.btnText.TextID = StringId.co2;
+                        fLayout.AddChidren(co2View.FLayoutView());
+                        ///tvoc
+                        LogicView.FunTypeView tvocView = new LogicView.FunTypeView();
+                        tvocView.frameLayout.Y = co2View.frameLayout.Bottom;
+                        tvocView.btnText.TextID = StringId.tvoc;
+                        fLayout.AddChidren(tvocView.FLayoutView());
+                        #endregion
+                        #region 鐐瑰嚮浜嬩欢
+                        ///娓╁害鐐瑰嚮浜嬩欢
+                        wenuView.btnClick.MouseUpEventHandler += (sender, e) =>
+                        {
+                            new PublicInterface { }.ViewZuHe(this, StringId.wendugaoyu, StringId.wendudiyu, (intText, view) =>
+                            {
+                                InputBoxAction(device,intText, index, edit);
+                            });
+                        };
+                        ///婀垮害鐐瑰嚮浜嬩欢
+                        shiduView.btnClick.MouseUpEventHandler += (sender, e) =>
+                        {
+                            new PublicInterface { }.ViewZuHe(this, StringId.shidugaoyu, StringId.shidudiyu, (intText, view) =>
+                            {
+                                InputBoxAction(device,intText, index, edit);
+                            });
 
+                        };
+                        ///pm2.5鐐瑰嚮浜嬩欢
+                        pm25View.btnClick.MouseUpEventHandler += (sender, e) =>
+                        {
+                            PmCo2TvocAction(this,device, "pm25",StringId.pm25, index,edit);
+                        };
+                        ///co2鐐瑰嚮浜嬩欢
+                        co2View.btnClick.MouseUpEventHandler += (sender, e) =>
+                        {
+                            PmCo2TvocAction(this,device, "co2", StringId.co2, index, edit);
+                        };
+                        ///tvoc鐐瑰嚮浜嬩欢
+                        tvocView.btnClick.MouseUpEventHandler += (sender, e) =>
+                        {
+                            PmCo2TvocAction(this,device, "tvoc", StringId.tvoc, index, edit);
+
+                        };
+                        #endregion
+                    }
+                    break;
             }
             #region  淇濆瓨
             ///淇濆瓨View
@@ -200,55 +277,65 @@
             this.AddChidren(saveView.FLayoutView());
             saveView.btnClick.MouseUpEventHandler += (sen, e) =>
             {
-                if (selectedState != "unknown")
-                {
-                    Input inputDevice = new Input();
-                    inputDevice.condition_type = "3";
-                    inputDevice.sid = device.sid;
-                    inputDevice.condition = dicSateteList;
-                    if (edit)
-                    {
-                        //绉婚櫎鏃ф暟鎹�
-                        Logic.currlogic.input.RemoveAt(index);
-                        //鏂版暟鎹彃鍏ユ棫鏁版嵁鐨勪綅缃�;
-                        Logic.currlogic.input.Insert(index, inputDevice);
-                    }
-                    else
-                    {
-                        //娣诲姞涓�涓潯浠�
-                        AddCondition(inputDevice);
-                    }
-                }
-                else
-                {
-                    if (!edit)
-                    {
-                        //鎻愮ず鐢ㄦ埛
-                        return;
-                    }
-                    this.RemoveFromParent();
-                    return;
-                }
-                LogicMethod.RemoveAllView();
-
-                if (MainView.IsGatewayType)
-                { //A缃戝叧
-                    var addLogic = new AddLogic();
-                    MainPage.BasePageView.AddChidren(addLogic);
-                    addLogic.Show();
-                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-                }
-                else
-                {
-                    //涓�绔彛缃戝叧
-                    var onePortAutomation = new OnePortAutomation();
-                    MainPage.BasePageView.AddChidren(onePortAutomation);
-                    onePortAutomation.Show();
-                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-                }
+                Save(device,index, edit);
             };
 
             #endregion
+
+        }
+        /// <summary>
+        /// 淇濆瓨杈撳叆鏉′欢
+        /// </summary>
+        /// <param name="index">绱㈠紩鍊�</param>
+        /// <param name="edit"></param>
+        private void Save(Entity.Function device,int index, bool edit)
+        {
+            
+            if (selectedState != "unknown")
+            {
+                Input inputDevice = new Input();
+                inputDevice.condition_type = "3";
+                inputDevice.sid = device.sid;
+                inputDevice.condition = dicSateteList;
+                if (edit)
+                {
+                    //绉婚櫎鏃ф暟鎹�
+                    Logic.currlogic.input.RemoveAt(index);
+                    //鏂版暟鎹彃鍏ユ棫鏁版嵁鐨勪綅缃�;
+                    Logic.currlogic.input.Insert(index, inputDevice);
+                }
+                else
+                {
+                    //娣诲姞涓�涓潯浠�
+                    AddCondition(inputDevice);
+                }
+            }
+            else
+            {
+                if (!edit)
+                {
+                    //鎻愮ず鐢ㄦ埛
+                    return;
+                }
+                this.RemoveFromParent();
+                return;
+            }
+            LogicMethod.CurrLogicMethod.RemoveAllView();
+            if (MainView.IsGatewayType)
+            { //A缃戝叧
+                var addLogic = new AddLogic();
+                MainPage.BasePageView.AddChidren(addLogic);
+                addLogic.Show();
+                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+            }
+            else
+            {
+                //涓�绔彛缃戝叧
+                var onePortAutomation = new OnePortAutomation();
+                MainPage.BasePageView.AddChidren(onePortAutomation);
+                onePortAutomation.Show();
+                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+            }
 
         }
         /// <summary>
@@ -258,7 +345,8 @@
         /// <param name="button">閫変腑鐘舵�佹樉绀烘枃鏈珺tn鎺т欢</param>
         /// <param name="btnText1">灞炴�х姸鎬佸�兼枃鏈�1</param>
         /// <param name="btnText2">灞炴�х姸鎬佸�兼枃鏈�2</param>
-        private void DeviceView(Entity.Function device,Button button,int btnText1,int btnText2) { 
+        private void DeviceView(Entity.Function device, Button button, int btnText1, int btnText2)
+        {
             FrameLayout frame = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTrans60lucence };
             this.AddChidren(frame);
             LogicView.SwitchView switchView = new LogicView.SwitchView();
@@ -278,7 +366,7 @@
                     case SPK.SensorDuiShe:
                     case SPK.SensorPir:
                     case SPK.SensorDoorWindow:
-                    case SPK.SensorUtrasonic:
+                    case SPK.SensoruUtrasonic:
                         {
                             keyVlaue = "status";
                         }
@@ -359,10 +447,99 @@
                 //鏄剧ず鏂囨湰
                 button.TextID = intValue;
                 selectedState = device.spk + "_" + value;
-                AddDictionary(keyVlaue, value);
+                AddDictionary(keyVlaue, value, "string");
 
             });
 
+        }
+        /// <summary>
+        /// 娓╁害,婀垮害寮规璁剧疆鍊�
+        /// </summary>
+        /// <param name="textInt">鏂囨湰</param>
+        /// <param name="stateValue">缂栬緫涔嬪墠鐨勭姸鎬佸��,榛樿涓�20</param>
+        public void InputBoxAction(Entity.Function device, int textInt, int index, bool edit, string stateValue = "20")
+        {
+            if (edit)
+            {
+                Input inputs = Logic.currlogic.input[index];
+                //娓呴櫎涔嬪墠鏃ф暟鎹�
+                dicSateteList.Clear();
+                if (inputs.condition.Count != 0)
+                {
+                    //鏈夋暟鎹噸鏂拌祴鍊�
+                    dicSateteList = inputs.condition;
+                }
+            }
+            new LogicView.TipPopView { }.InputBox(textInt, stateValue, (value) =>
+            {
+                string keyValue = "20";
+                string data_type = "integer";
+                string comparator = "=";
+                switch (textInt)
+                {
+                    case StringId.wendugaoyu:
+                        {
+                            keyValue = "temperature";
+                            comparator = ">";
+                            data_type = "float";
+                        }
+                        break;
+                    case StringId.wendudiyu:
+                        {
+                            keyValue = "temperature";
+                            comparator = "<";
+                            data_type = "float";
+                        }
+                        break;
+                    case StringId.shidugaoyu:
+                        {
+                            keyValue = "humidity";
+                            comparator = ">";
+                        }
+                        break;
+                    case StringId.shidudiyu:
+                        {
+                            keyValue = "humidity";
+                            comparator = "<";
+                        }
+                        break;
+                }
+                selectedState = device.spk + "_" + value;
+                AddDictionary(keyValue, value, data_type, comparator);
+                Save(device,index, edit);
+            });
+        }
+        /// PM2.5,Co2,Tvoc璁剧疆鍊�
+        /// </summary>
+        /// <param name="frame">褰撳墠鐣岄潰</param>
+        /// <param name="key">灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�<</param>
+        /// <param name="title">鏍囬鏂囨湰</param>
+        /// <param name="index"></param>
+        /// <param name="edit"></param>
+        /// <param name="stateValue">缂栬緫涔嬪墠鐨勭姸鎬佸��,榛樿涓�""</param>
+        public void PmCo2TvocAction(FrameLayout frame, Entity.Function device,string key,int title, int index, bool edit, string stateValue = "")
+        {
+            if (edit)
+            {
+                Input inputs = Logic.currlogic.input[index];
+                //娓呴櫎涔嬪墠鏃ф暟鎹�
+                dicSateteList.Clear();
+                if (inputs.condition.Count != 0)
+                {
+                    //鏈夋暟鎹噸鏂拌祴鍊�
+                    dicSateteList = inputs.condition;
+                }
+            }
+            PublicInterface view = new PublicInterface();  
+            var listStr = view.GetViewList(key); 
+            view.SingleSelectionShow(frame, listStr, Language.StringByID(title), view.GetString(key, stateValue)
+               , (text) =>
+               {
+                   var value = view.GetValue(key, text);
+                   selectedState = device.spk + "_"+ key;
+                   AddDictionary(key, value, "integer");
+                   Save(device,index, edit);
+               });
         }
         /// <summary>
         /// 鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
@@ -391,36 +568,28 @@
         /// </summary>
         /// <param name="KeyValue">璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�</param>
         /// <param name="selectedValue">鐘舵�佸��</param>
-        private void AddDictionary(string KeyValue, string selectedValue)
+        /// <param name="data_type">绫诲瀷</param>
+        /// <param name="comparator">姣旇緝鍏崇郴</param>
+        private void AddDictionary(string KeyValue, string selectedValue, string data_type, string comparator = "=")
         {
             //鏁版嵁灏佽
             Dictionary<string, string> dic = new Dictionary<string, string>();
-            LogicMethod.dictionary(dic, "key", KeyValue);
-            LogicMethod.dictionary(dic, "comparator", "=");
-            LogicMethod.dictionary(dic, "data_type", "string");
-            LogicMethod.dictionary(dic, "value", selectedValue);
-            AddDictionaryList(KeyValue, dic);
+            LogicMethod.CurrLogicMethod.dictionary(dic, "key", KeyValue);
+            LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", comparator);
+            LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", data_type);
+            LogicMethod.CurrLogicMethod.dictionary(dic, "value", selectedValue);
+            AddDictionaryList(dic);
         }
         /// <summary>
         /// 鏇存柊鏁版嵁鍒楄〃
         /// </summary>
-        /// <param name="keyValue">璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�</param> 
+        /// <param name="keyValue">璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�</param>
+        /// <param name="comparator">姣旇緝鍏崇郴</param>
         /// <param name="dictionary">娣诲姞閫変腑鏁版嵁</param>
         /// <returns></returns>
-        private void AddDictionaryList(string keyValue, Dictionary<string, string> dictionary) 
+        private void AddDictionaryList(Dictionary<string, string> dictionary)
         {
-            int indexValue = -1;
-            for (int i = 0; i < dicSateteList.Count; i++)
-            {
-                var dic = dicSateteList[i];
-                if (dic.ContainsValue(keyValue))
-                {
-                    //鍒ゆ柇鏄惁瀛樺湪
-                    indexValue = i;
-                    break;
-                }
-            }
-
+            var indexValue = IsContainsAll(dictionary, dicSateteList);
             if (indexValue != -1)
             {
                 //瀛樺湪绉婚櫎
@@ -446,8 +615,13 @@
             {
                 if (Logic.currlogic.input[i].sid == input.sid)
                 {
-                    indexValue = i;
-                    break;
+                    //鏈変簺璁惧姣旇緝鐗规畩锛堜緥濡傦細娴锋灄浼犳劅鍣ㄨ繕鏄鍒ゆ柇灞炴�у�硷紝娓╂箍搴﹀睘鎬ц繕瑕佸垽鏂瘮杈冨叧绯伙紝鎵嶈兘纭鏄惁宸茬粡瀛樺湪璇ユ潯浠讹紝鍏朵粬璁惧鏉′欢鐩存帴鐢╯id鍒ゆ柇鍗冲彲锛�
+                    //鍔犱竴绾у垽鏂槸涓哄吋瀹圭壒娈婅澶�
+                    if (IsContainsAll(input.condition, Logic.currlogic.input[i].condition))
+                    {
+                        indexValue = i;
+                        break;
+                    }
                 }
             }
 
@@ -462,5 +636,53 @@
             }
 
         }
+        /// <summary>
+        /// 鍒ゆ柇dictionaryB鍒楄〃鏄惁瀹屾暣鍖呭惈鍙︿竴涓猟ictionaryA
+        /// </summary>
+        /// <param name="dictionaryA">瀵硅薄</param>
+        /// <param name="dictionaryB">鍒楄〃</param>
+        /// <returns>杩斿洖鍒楄〃鐨勭储寮曞��</returns>
+        public int IsContainsAll(Dictionary<string, string> dictionaryA, List<Dictionary<string, string>> dictionaryB)
+        {
+            int valueInt = -1;
+            for (int i = 0; i < dictionaryB.Count; i++)
+            {
+                var dic = dictionaryB[i];
+                string key = dic["key"];
+                string comparatorValue = dic["comparator"];
+                if (dictionaryA["key"] == key && dictionaryA["comparator"] == comparatorValue)
+                {
+                    //鍒ゆ柇鏄惁瀛樺湪
+                    valueInt = i;
+                    break;
+                }
+            }
+            return valueInt;
+        }
+        /// <summary>
+        /// 鍒ゆ柇dictionaryB鏄惁瀹屾暣鍖呭惈鍙︿竴涓猟ictionaryA
+        /// </summary>
+        /// <param name="dictionaryA"></param>
+        /// <param name="dictionaryB"></param>
+        /// <returns></returns>
+        public bool IsContainsAll(List<Dictionary<string, string>> dictionaryA, List<Dictionary<string, string>> dictionaryB)
+        {
+
+            for (int i = 0; i < dictionaryA.Count; i++)
+            {
+                var dic = dictionaryA[i];
+                string key = dic["key"];
+                string comparatorValue = dic["comparator"];
+                var list = dictionaryB.FindAll((dictionary) => dictionary["key"] == key && dictionary["comparator"] == comparatorValue);
+                if (list.Count> 0)
+                {
+                    return true;
+                }
+
+            }
+            return false;
+        }
+
+       
     }
 }
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs
index b79e2b2..addf896 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs
@@ -81,7 +81,7 @@
                     Width = Application.GetRealWidth(144),
                     Height = Application.GetRealHeight(44 * 5),
                 };
-                var roomList = LogicMethod.GetGatewayRoomList(Language.StringByID(StringId.allAreas));
+                var roomList = LogicMethod.CurrLogicMethod.GetGatewayRoomList(Language.StringByID(StringId.allAreas));
                
                 if (roomList.Count > 5)
                 {
@@ -122,7 +122,7 @@
                         funAllAreaView.btnText2.Text = Language.StringByID(StringId.allFun);
                         selectedRoom = (areaView.btnClick.Tag as Entity.Room);
                         ///鑾峰彇鏄剧ず璁惧鍒楄〃
-                        var list = LogicMethod.GetFunctionDeviceList(areaView.btnClick.Tag as Entity.Room,if_type);
+                        var list = LogicMethod.CurrLogicMethod.GetFunctionDeviceList(areaView.btnClick.Tag as Entity.Room,if_type);
 
                         DeviceListView(vv, list);
                     };
@@ -138,9 +138,9 @@
             EventHandler<MouseEventArgs> funClick = (sender3, e3) =>{
 
                 //鑾峰彇鏈�缁堟樉绀哄垪琛�
-                var functionList = LogicMethod.GetFunctionDeviceList(selectedRoom, if_type);
+                var functionList = LogicMethod.CurrLogicMethod.GetFunctionDeviceList(selectedRoom, if_type);
                 //鑾峰彇璁惧鍒楄〃鐨勭被鍨嬶紙渚嬪锛氱伅鍏夌被锛岀獥甯樼被銆傘�傘�傦級
-                var deviceTypeList = LogicMethod.GetDeviceTypeList(functionList);
+                var deviceTypeList = LogicMethod.CurrLogicMethod.GetDeviceTypeList(functionList);
                 if (deviceTypeList.Count==0) {
                     //娌℃湁绫诲瀷鐩存帴杩斿洖鍘�;
                     return;
@@ -219,9 +219,9 @@
                         fLayout.RemoveFromParent();
                         funAllAreaView.btnText2.Text = areaView.btnClick.Tag.ToString();
                         ///鑾峰彇鍗曚釜绫诲瀷锛堜緥濡傦細鐏厜绫汇�傘�傦級璁惧FunctionType鍒楄〃
-                        var typeFunctionList = LogicMethod.GetDeviceTypeFunctionList(areaView.btnClick.Tag.ToString());
+                        var typeFunctionList = LogicMethod.CurrLogicMethod.GetDeviceTypeFunctionList(areaView.btnClick.Tag.ToString());
                         ///鑾峰彇鍗曚釜鐏厜绫诲瀷锛堜緥濡傦細鐏厜1,鐏厜2銆傘�傦級鏄剧ず璁惧鍒楄〃
-                        var lists = LogicMethod.GetShowDeviceList(typeFunctionList, functionList);
+                        var lists = LogicMethod.CurrLogicMethod.GetShowDeviceList(typeFunctionList, functionList);
                         DeviceListView(vv, lists);
                     };
                     if (deviceTypeList.Count - 1 == i)
@@ -234,7 +234,7 @@
             funAllAreaView.btnText2.MouseUpEventHandler += funClick;
             funAllAreaView.btnIcon2.MouseUpEventHandler += funClick;
             ///鑾峰彇鏄剧ず璁惧鍒楄〃
-            var deviceList = LogicMethod.GetFunctionDeviceList(selectedRoom, if_type);
+            var deviceList = LogicMethod.CurrLogicMethod.GetFunctionDeviceList(selectedRoom, if_type);
             DeviceListView(vv, deviceList);
 
         }
@@ -255,7 +255,7 @@
                 funView.btnLine.X = Application.GetRealWidth(16);
                 funView.btnLine.Width = Application.GetRealWidth(343);
                 verticalScrolView.AddChidren(funView.FLayoutView());
-                funView.btnIcon.UnSelectedImagePath = LogicMethod.GetIconPath(dev.spk);
+                funView.btnIcon.UnSelectedImagePath = LogicMethod.CurrLogicMethod.GetIconPath(dev.spk);
                 funView.btnDeviceName.Text = dev.name;
                 funView.btnRoomName.Text = dev.GetRoomListName();
                 funView.btnClick.MouseUpEventHandler += (sen,e) => {
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index cf14834..9357a40 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -20,12 +20,14 @@
                 ///鍚勭鏉′欢鐨刅iew
                 LogicView.AddOutputInputView inputView = new LogicView.AddOutputInputView();
                 inputView.FLayoutView(viewLayout);
+                //娣诲姞娌℃湁寤舵椂锛岄殣钘忓欢鏃舵寜閽�;
+                inputView.btnDelay.Visible = false;
                 ///璁板綍鏉′欢绫诲瀷
                 inputView.btnClick.Name = inputCondition.condition_type;
                 ///璁板綍鏉′欢绱㈠紩
-                inputView.btnClick.Tag = inputCondition.sid;
+                inputView.btnClick.Tag = inputCondition;
                 ///鏉′欢鐘舵�佹暟缁�
-                List<Dictionary<string, string>> dicList = inputCondition.condition as List<Dictionary<string, string>>;
+                List<Dictionary<string, string>> dicList = inputCondition.condition;
                 //鏄剧ず鏉′欢鍚勭绫诲瀷鐘舵��
                 switch (inputCondition.condition_type)
                 {
@@ -123,9 +125,9 @@
                     case "3":
                         {
                             //鐢╯id鎵惧埌璁惧锛�
-                            var device = LogicMethod.GetDevice(inputCondition.sid);
+                            var device = LogicMethod.CurrLogicMethod.GetDevice(inputCondition.sid);
                             //鐢ㄨ澶囩殑functionType绫诲瀷鎵惧埌瀵瑰簲鍥炬爣锛�
-                            inputView.btnIcon.UnSelectedImagePath = LogicMethod.GetIconPath(device.spk);
+                            inputView.btnIcon.UnSelectedImagePath = LogicMethod.CurrLogicMethod.GetIconPath(device.spk);
                             //鏄剧ず璁惧鍚嶇О
                             inputView.btnText.Text = device.name;
                             //鏀瑰彉璁惧鍚嶇О鏄剧ず鎺т欢瀹藉害
@@ -268,7 +270,7 @@
                                                     {
                                                         if (value == "true")
                                                         {
-                                                            str+= Language.StringByID(StringId.youren)+";";
+                                                            str += Language.StringByID(StringId.youren) + ";";
                                                         }
                                                         else
                                                         {
@@ -313,6 +315,65 @@
                                         }
                                     }
                                     break;
+                                case SPK.SensorEnvironment:
+                                    {
+                                        string strtext = "";
+                                        foreach (var dic in dicList)
+                                        {
+                                            string key = dic["key"];
+                                            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;
+                                            }
+                                            inputView.btnState.Text = strtext;
+                                        }
+
+
+                                    }
+                                    break;
 
                             }
                         }
@@ -332,7 +393,7 @@
                                 {
                                     case "outdoor_temp":
                                         {
-                                            strvalue = value;
+                                            strvalue = value + "鈩�";
                                             if (comparator == ">")
                                             {
                                                 strtext = Language.StringByID(StringId.wendugaoyu);
@@ -346,7 +407,7 @@
                                         break;
                                     case "outdoor_humity":
                                         {
-                                            strvalue = value;
+                                            strvalue = value + "%";
                                             if (comparator == ">")
                                             {
                                                 strtext = Language.StringByID(StringId.shidugaoyu);
@@ -361,7 +422,7 @@
                                     case "pm2.5":
                                         {
                                             strtext = Language.StringByID(StringId.PM25);
-                                            strvalue = new OutdoorEnvironment { }.GetString(value);
+                                            strvalue = new PublicInterface { }.GetString("pm25", value);
                                         }
                                         break;
 
@@ -447,17 +508,34 @@
                 inputView.btnClick.MouseUpEventHandler += (sen, e) =>
                 {
                     Button button = (Button)sen;
+                    //褰撳墠缂栬緫鐨勬潯浠�
+                    Input ckcliInput = inputView.btnClick.Tag as Input;
                     //鎵惧埌褰撳墠缂栬緫鐨勭储寮�
                     int indexVulae = 0;
                     for (int index = 0; index < Logic.currlogic.input.Count; index++)
                     {
                         Input input = Logic.currlogic.input[index];
-                        if (input.sid == inputView.btnClick.Tag.ToString())
+                        if (input.sid == ckcliInput.sid)
                         {
-                            //鐢ㄦ埛鍙兘鍒犻櫎鏁版嵁锛屼娇鍒楄〃绱㈠紩鍙戠敓鏀瑰彉锛�
-                            //閫氳繃鍞竴sid閲嶆柊鏌ユ壘鍒扮储寮曚笖鏇存柊绱㈠紩鍊�
-                            indexVulae = index;
-                            break;
+                            if (button.Name == "3")
+                            {
+                                //鏈変簺璁惧姣旇緝鐗规畩锛堜緥濡傦細娴锋灄浼犳劅鍣ㄨ繕鏄鍒ゆ柇灞炴�у�硷紝娓╂箍搴﹀睘鎬ц繕瑕佸垽鏂瘮杈冨叧绯伙紝鎵嶈兘纭鏄惁宸茬粡瀛樺湪璇ユ潯浠讹紝鍏朵粬璁惧鏉′欢鐩存帴鐢╯id鍒ゆ柇鍗冲彲锛�
+                                //鍔犱竴绾у垽鏂槸涓哄吋瀹圭壒娈婅澶�
+                                if (new ConditionDeviceFunList { }.IsContainsAll(ckcliInput.condition, input.condition))
+                                {
+                                    //鐢ㄦ埛鍙兘鍒犻櫎鏁版嵁锛屼娇鍒楄〃绱㈠紩鍙戠敓鏀瑰彉锛�
+                                    //閫氳繃鍞竴sid閲嶆柊鏌ユ壘鍒扮储寮曚笖鏇存柊绱㈠紩鍊�
+                                    indexVulae = index;
+                                    break;
+                                }
+                            }
+                            else
+                            {
+                                //鐢ㄦ埛鍙兘鍒犻櫎鏁版嵁锛屼娇鍒楄〃绱㈠紩鍙戠敓鏀瑰彉锛�
+                                //閫氳繃鍞竴sid閲嶆柊鏌ユ壘鍒扮储寮曚笖鏇存柊绱㈠紩鍊�
+                                indexVulae = index;
+                                break;
+                            }
                         }
                     }
                     //鏍囪缂栬緫鐘舵��
@@ -470,7 +548,7 @@
                                 Input _input = Logic.currlogic.input[indexVulae];
                                 if (_input.condition_type == "1")
                                 {
-                                    var dicLists = _input.condition as List<Dictionary<string, string>>;
+                                    var dicLists = _input.condition;
                                     foreach (var dic in dicLists)
                                     {
                                         string keyValue = dic["key"];
@@ -520,11 +598,78 @@
                         case "3":
                             {
                                 //鐢╯id鎵惧埌璁惧锛�
-                                var device = LogicMethod.GetDevice(inputCondition.sid);
-                                ConditionDeviceFunList deviceFunList = new ConditionDeviceFunList();
-                                MainPage.BasePageView.AddChidren(deviceFunList);
-                                deviceFunList.Show(device, indexVulae, edit);
-                                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                                var device = LogicMethod.CurrLogicMethod.GetDevice(inputCondition.sid);
+                                if (device.spk == SPK.SensorEnvironment)
+                                {
+                                    //杩欎釜璁惧姣旇緝鐗规畩
+                                    ConditionDeviceFunList conditionDeviceFunList = new ConditionDeviceFunList();
+                                    ///褰撳墠鐨勭储寮曞�兼暟鎹璞�
+                                    Input inputedit = Logic.currlogic.input[indexVulae];
+                                    ///鐘舵�佸��
+                                    string stateValue = "";
+                                    foreach (var dic in inputedit.condition)
+                                    {
+                                        string key = dic["key"];
+                                        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;
+                                        }
+                                    }
+
+                                }
+                                else
+                                {
+                                    ConditionDeviceFunList deviceFunList = new ConditionDeviceFunList();
+                                    MainPage.BasePageView.AddChidren(deviceFunList);
+                                    deviceFunList.Show(device, indexVulae, edit);
+                                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                                }
                             }
                             break;
                         case "4":
@@ -638,22 +783,23 @@
                 ///璁板綍鏉′欢绱㈠紩
                 targetView.btnClick.Tag = outputTarget.sid;
                 ///鏉′欢鐘舵�佹暟缁�
-                List<Dictionary<string, string>> dicList = outputTarget.status as List<Dictionary<string, string>>;
+                List<Dictionary<string, string>> dicList = outputTarget.status;
+                //鏄剧ず鐘舵�佸��
+                string stateStr = "";
                 //鏄剧ず杈撳嚭鏉′欢鍚勭绫诲瀷鐘舵��
                 switch (outputTarget.target_type)
                 {
                     case "1":
                         {
                             //鐢╯id鎵惧埌璁惧锛�
-                            var device = LogicMethod.GetDevice(outputTarget.sid);
+                            var device = LogicMethod.CurrLogicMethod.GetDevice(outputTarget.sid);
                             //鐢ㄨ澶囩殑functionType绫诲瀷鎵惧埌瀵瑰簲鍥炬爣锛�
-                            targetView.btnIcon.UnSelectedImagePath = LogicMethod.GetIconPath(device.spk);
+                            targetView.btnIcon.UnSelectedImagePath = LogicMethod.CurrLogicMethod.GetIconPath(device.spk);
                             //鏄剧ず璁惧鍚嶇О
                             targetView.btnText.Text = device.name;
                             //鏀瑰彉璁惧鍚嶇О鏄剧ず鎺т欢瀹藉害
                             targetView.btnText.Width = Application.GetRealWidth(80);
-                            //绗竴涓彉閲忔樉绀虹姸鎬佸��
-                            string stateStr = "";
+
                             //鍖哄埆涓嶅悓璁惧锛屾樉绀轰笉鍚岃澶囩姸鎬�
                             switch (device.spk)
                             {
@@ -673,7 +819,6 @@
                                                 stateStr = Language.StringByID(StringId.offLogic);
                                             }
                                         }
-                                        targetView.btnState.Text = stateStr;
                                     }
                                     break;
                                 case SPK.LightRGB:
@@ -699,7 +844,7 @@
                                         {
                                             stateStr = brightness + "%";
                                         }
-                                        targetView.btnState.Text = stateStr;
+
                                     }
                                     break;
                                 case SPK.CurtainSwitch:
@@ -728,7 +873,6 @@
                                                     break;
                                             }
                                         }
-                                        targetView.btnState.Text = stateStr;
                                     }
                                     break;
                                 case SPK.AcStandard:
@@ -820,11 +964,11 @@
                                         }
                                         if (on_off != "" && on_off == "off")
                                         {
-                                            targetView.btnState.Text = Language.StringByID(StringId.offLogic);
+                                            stateStr = Language.StringByID(StringId.offLogic);
                                         }
                                         else
                                         {
-                                            targetView.btnState.Text = stateStr.TrimEnd(',');
+                                            stateStr = stateStr.TrimEnd(',');
 
                                         }
 
@@ -918,11 +1062,11 @@
                                         }
                                         if (on_off != "" && on_off == "off")
                                         {
-                                            targetView.btnState.Text = Language.StringByID(StringId.offLogic);
+                                            stateStr = Language.StringByID(StringId.offLogic);
                                         }
                                         else
                                         {
-                                            targetView.btnState.Text = stateStr.TrimEnd(',');
+                                            stateStr = stateStr.TrimEnd(',');
 
                                         }
                                     }
@@ -933,11 +1077,11 @@
                     case "2":
                         {
                             //鐢╯id鎵惧埌鍦烘櫙锛�
-                            var scene = LogicMethod.GetSecne(outputTarget.sid);
+                            var scene = LogicMethod.CurrLogicMethod.GetSecne(outputTarget.sid);
                             targetView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png";
                             targetView.btnNextIcon.Visible = false;
                             //鏄剧ず鍦烘櫙鍚嶇О
-                            targetView.btnText.Text = scene.name;
+                            stateStr = scene.name;
                         }
                         break;
                     case "3":
@@ -946,10 +1090,19 @@
                             foreach (var dic in dicList)
                             {
                                 string value = dic["value"];
-                                targetView.btnText.Text = value;
+                                stateStr = value;
                             }
                         }
                         break;
+                }
+
+                if (outputTarget.target_type == "1")
+                {
+                    targetView.btnState.Text =new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr;
+                }
+                else
+                {
+                    targetView.btnText.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr;
                 }
                 //鍐嶆缂栬緫鏉′欢鐘舵�佺偣鍑讳簨浠�
                 targetView.btnClick.MouseUpEventHandler += (sen, e) =>
@@ -975,7 +1128,7 @@
                         case "1":
                             {
                                 //鐢╯id鎵惧埌璁惧锛�
-                                var device = LogicMethod.GetDevice(outputTarget.sid);
+                                var device = LogicMethod.CurrLogicMethod.GetDevice(outputTarget.sid);
                                 TargetDeviceFunList deviceFunList = new TargetDeviceFunList();
                                 MainPage.BasePageView.AddChidren(deviceFunList);
                                 deviceFunList.Show(device, indexVulae, edit);
@@ -997,6 +1150,25 @@
                             }
                             break;
                     }
+                };
+                //寤舵椂鐐瑰嚮浜嬩欢
+                targetView.btnDelay.MouseUpEventHandler += (sen, e) =>
+                {
+
+                    InpOrOutLogicMethod inpOrOutLogicMethod = new InpOrOutLogicMethod();
+                    inpOrOutLogicMethod.Delayed(thisView, outputTarget, (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;
+                        }
+                    });
+
                 };
                 ///鍒犻櫎鎺т欢
                 targetView.btnDel.MouseUpEventHandler += (sender, e) =>
@@ -1059,7 +1231,11 @@
                                     break;
                                 case "brightness":
                                     {
-
+                                        if (button2 == null)
+                                        {
+                                            //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+                                            break;
+                                        }
                                         button2.Text = value + "%";
                                     }
                                     break;
@@ -1122,11 +1298,21 @@
                                     break;
                                 case "set_temp":
                                     {
+                                        if (button2 == null)
+                                        {
+                                            //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+                                            break;
+                                        }
                                         button2.Text = value + "鈩�";
                                     }
                                     break;
                                 case "mode":
                                     {
+                                        if (button3 == null)
+                                        {
+                                            //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+                                            break;
+                                        }
                                         switch (value)
                                         {
                                             case "cool":
@@ -1157,6 +1343,11 @@
                                     break;
                                 case "fan":
                                     {
+                                        if (button4 == null)
+                                        {
+                                            //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+                                            break;
+                                        }
                                         switch (value)
                                         {
                                             case "high":
@@ -1219,11 +1410,21 @@
                                     break;
                                 case "set_temp":
                                     {
+                                        if (button2 == null)
+                                        {
+                                            //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+                                            break;
+                                        }
                                         button2.Text = value + "鈩�";
                                     }
                                     break;
                                 case "mode":
                                     {
+                                        if (button3 == null)
+                                        {
+                                            //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+                                            break;
+                                        }
                                         switch (value)
                                         {
                                             case "day":
@@ -1455,7 +1656,7 @@
                     case "3":
                         {
                             //鐢╯id鎵惧埌璁惧锛�
-                            var device = LogicMethod.GetDevice(inputCondition.sid);
+                            var device = LogicMethod.CurrLogicMethod.GetDevice(inputCondition.sid);
                             name = device.name + "-";
                         }
                         break;
@@ -1470,7 +1671,7 @@
                     case "1":
                         {
                             //鐢╯id鎵惧埌璁惧锛�
-                            var device = LogicMethod.GetDevice(outputTarget.sid);
+                            var device = LogicMethod.CurrLogicMethod.GetDevice(outputTarget.sid);
                             //鏄剧ず璁惧鍚嶇О
                             name += device.name;
                             string stateStr = "";
@@ -1575,7 +1776,7 @@
                     case "2":
                         {
                             //鐢╯id鎵惧埌鍦烘櫙锛�
-                            var scene = LogicMethod.GetSecne(outputTarget.sid);
+                            var scene = LogicMethod.CurrLogicMethod.GetSecne(outputTarget.sid);
                             name += scene.name;
 
                         }
@@ -1585,5 +1786,108 @@
             catch { }
             return name;
         }
+
+
+        /// <summary>
+        /// 寤舵椂鏃堕棿鏂规硶
+        /// </summary>
+        /// <param name="fLayout">鍦ㄥ摢涓晫闈㈡樉绀�</param>
+        /// <param name="edit">锛坱rue=缂栬緫锛沠alse=鏂板缓锛�</param>
+        /// <param name="index">缂栬緫鏉′欢鐨勭储寮�</param>
+        private void Delayed(FrameLayout thisFLayout, Output output, Action<int> action)
+        {
+            FrameLayout fLayout = new FrameLayout
+            {
+                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
+            };
+            thisFLayout.AddChidren(fLayout);
+            LogicView.TimeView timePointView = new LogicView.TimeView();
+            timePointView.FLayoutView(fLayout);
+            EventHandler<MouseEventArgs> RemovefLayout = (sender, e1) =>
+            {
+                //绉婚櫎fLayout鐣岄潰
+                fLayout.RemoveFromParent();
+            };
+            //鍙栨秷鐐瑰嚮浜嬩欢
+            timePointView.btnCancel.MouseUpEventHandler += RemovefLayout;
+
+            //鍔犺浇鏁版嵁鐣岄潰鐨勮缃柟娉�(鍒楄〃浜掍笉鑱斿姩)
+            timePointView.mUIPickerView.setNPicker(timePointView.GetmStringList(), timePointView.GetsStringList(), null);
+            //榛樿鍒濆閫変腑鐘舵��
+            timePointView.mUIPickerView.setCurrentItems(0, 5, 0);
+            //瀹氫箟涓�涓眬閮ㄥ彉閲忚褰曢�変腑鏃堕棿
+            int timepoint = 5;
+
+            if (output.delay != "0")
+            {
+                int intValue = int.Parse(output.delay);
+                var m = intValue / 60;
+                var s = intValue % 60;
+
+                string timeValue = m.ToString() + ":" + s.ToString();
+                int mIndex = timePointView.GetValueIndex(timeValue, 0, 1, timePointView.GetmIntList());
+                int sIndex = timePointView.GetValueIndex(timeValue, 1, 0, timePointView.GetmIntList());
+                //鏇存柊鍒濆鐘舵��
+                timePointView.mUIPickerView.setCurrentItems(mIndex, sIndex, 0);
+                timepoint = intValue;
+            }
+
+
+            //閫変腑鏃堕棿鍥炶皟鏂规硶,鏃堕棿鍙樺寲涓�娆″洖璋冧竴娆�
+            timePointView.mUIPickerView.OnSelectChangeEvent += (index1, index2, index3) =>
+            {
+                string minuet = timePointView.GethStringList0()[index1].Split(' ')[0];
+                string second = timePointView.GetmStringList()[index2].Split(' ')[0];
+                int minuetIntValue = int.Parse(minuet);
+                int secondIntValue = int.Parse(second);
+                timepoint = minuetIntValue * 60 + secondIntValue;
+            };
+            //纭畾鐐瑰嚮浜嬩欢
+            timePointView.btnConfirm.MouseUpEventHandler += (sender, e3) =>
+            {
+                if (timepoint == 0)
+                {
+                    //鎻愮ず
+                    return;
+                }
+                fLayout.RemoveFromParent();
+                action(timepoint);
+            };
+        }
+        /// <summary>
+        /// 鑾峰彇鏃堕棿鏂囨湰鎻忚堪
+        /// </summary>
+        /// <param name="strTimeValue">鏃堕棿鍊硷紙鍗曚綅s绉掞級</param>
+        /// <returns></returns>
+        private string GetTimeText(string strTimeValue)
+        {
+            var timeValue = int.Parse(strTimeValue);
+            string state = "";
+            var minutes = timeValue / 60;
+            var seconds = timeValue % 60;
+            if (minutes != 0)
+            {
+                if (seconds == 0)
+                {
+                    state = minutes.ToString() + Language.StringByID(StringId.minute);
+                }
+                else
+                {
+                    state = minutes.ToString() + Language.StringByID(StringId.minute) + seconds.ToString() + Language.StringByID(StringId.s);
+                }
+            }
+            else
+            {
+                if (seconds != 0)
+                {
+                    state = seconds.ToString() + Language.StringByID(StringId.s);
+                }
+            }
+            if (!string.IsNullOrEmpty(state)) {
+                state = Language.StringByID(StringId.delayLogic) + state;
+            }
+            return state;
+        }
+
     }
 }
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs
index d392722..f076168 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs
@@ -112,6 +112,10 @@
         /// </summary>
         public string sid = "";
         /// <summary>
+        /// 閫昏緫杈撳嚭鐩爣寤舵椂闂�(鍗曚綅鐢ㄧ)
+        /// </summary>
+        public string delay = "0";
+        /// <summary>
         /// 閫昏緫杈撳嚭鐩爣绫诲瀷
         /// 璁惧=1;
         /// 鍦烘櫙=2;
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
index d40c649..da993e1 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -8,6 +8,22 @@
 
     public class LogicMethod
     {
+
+        private static LogicMethod logicMethod = null;
+
+        public static LogicMethod CurrLogicMethod
+        {
+            get
+            {
+                if (logicMethod == null)
+                {
+                    return new LogicMethod();
+                }
+                return logicMethod;
+            }
+
+        }
+
         /// <summary>
         /// 琛ㄧず鏄潯浠�
         /// </summary>
@@ -19,15 +35,15 @@
         /// <summary>
         /// 绉婚櫎鎵�鏈�"Logic"鐣岄潰
         /// </summary>
-        public static void RemoveAllView()
+        public void RemoveAllView()
         {
             MainPage.BasePageView.RemoveViewByTag("Logic");
         }
-       
+
         /// <summary> Converts an array of bytes into a formatted string of hex digits (ex: E4 CA B2)</summary>
         /// <param name="data"> The array of bytes to be translated into a string of hex digits. </param>
         /// <returns> Returns a well formatted string of hex digits with spacing. </returns>
-        static string byteArrayToHexString(byte[] data)
+        public string byteArrayToHexString(byte[] data)
         {
             System.Text.StringBuilder sb = new System.Text.StringBuilder();
             foreach (byte b in data)
@@ -46,7 +62,7 @@
   * @param i 涓�涓猧nt鏁板瓧
   * @return byte[]
   */
-        public static byte[] int2ByteArray(int i)
+        public byte[] int2ByteArray(int i)
         {
             byte[] result = new byte[4];
             result[0] = (byte)((i >> 24) & 0xFF);
@@ -59,7 +75,7 @@
         /// 鑾峰彇鏃堕棿鎴�
         /// </summary>
         /// <returns></returns>
-        static int getTimeStamp()
+        public int getTimeStamp()
         {
             TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
             return (int)ts.TotalSeconds;
@@ -67,7 +83,7 @@
         /// <summary>
         /// 鐢熸垚閫昏緫sid鏂规硶
         /// </summary>
-        public static string NewSid()
+        public string NewSid()
         {
             string logicId = "";
             try
@@ -111,7 +127,7 @@
         /// <param name="dic">Dictionary绫�</param>
         /// <param name="key">鍋�</param>
         /// <param name="value">鍊�</param>
-        public static void dictionary(Dictionary<string, string> dic, string key, string value)
+        public void dictionary(Dictionary<string, string> dic, string key, string value)
         {
             if (dic.ContainsKey(key)) //鍒ゆ柇鏄惁瀛樺湪閿��
             {
@@ -125,7 +141,7 @@
         /// 鑾峰彇缃戝叧鎴块棿鍒楄〃
         /// </summary>
         /// <returns></returns>
-        public static List<HDL_ON.Entity.Room> GetGatewayRoomList()
+        public List<HDL_ON.Entity.Room> GetGatewayRoomList()
         {
             return HDL_ON.Entity.SpatialInfo.CurrentSpatial.RoomList;
         }
@@ -133,7 +149,7 @@
         /// 鑾峰彇缃戝叧鎴块棿鍒楄〃
         /// </summary>
         /// <returns></returns>
-        public static List<HDL_ON.Entity.Room> GetGatewayRoomList(string name)
+        public List<HDL_ON.Entity.Room> GetGatewayRoomList(string name)
         {
             List<Entity.Room> roomList = new List<Entity.Room>();
             Entity.Room room1 = new Entity.Room();
@@ -158,7 +174,7 @@
         /// 鑾峰彇缃戝叧璁惧鍒楄〃
         /// </summary>
         /// <returns></returns>
-        public static List<HDL_ON.Entity.Function> GetGatewayDeviceList()
+        public List<HDL_ON.Entity.Function> GetGatewayDeviceList()
         {
             return Entity.FunctionList.List.GetDeviceFunctionList();
         }
@@ -166,7 +182,7 @@
         /// 鑾峰彇缃戝叧鍦烘櫙鍒楄〃
         /// </summary>
         /// <returns></returns>
-        public static List<HDL_ON.Entity.Scene> GetSceneList()
+        public List<HDL_ON.Entity.Scene> GetSceneList()
         {
             return HDL_ON.Entity.FunctionList.List.scenes;
         }
@@ -175,7 +191,7 @@
         /// </summary>
         /// <param name="room">褰撳墠鎴块棿</param>
         /// <returns></returns>
-        public static List<HDL_ON.Entity.Function> GetRoomDevice(HDL_ON.Entity.Room room)
+        public List<HDL_ON.Entity.Function> GetRoomDevice(HDL_ON.Entity.Room room)
         {
             List<HDL_ON.Entity.Function> deviceLists = new List<Entity.Function>();
             List<HDL_ON.Entity.Function> lists = GetGatewayDeviceList();
@@ -205,7 +221,7 @@
         /// </summary>
         /// <param name="sid">璁惧鍞竴鏍囪瘑</param>
         /// <returns></returns>
-        public static HDL_ON.Entity.Function GetDevice(string sid)
+        public HDL_ON.Entity.Function GetDevice(string sid)
         {
             HDL_ON.Entity.Function device = new Entity.Function() { name = "Unknown" };
             List<HDL_ON.Entity.Function> deviceLists = GetGatewayDeviceList();
@@ -226,7 +242,7 @@
         /// </summary>
         /// <param name="sid">鍦烘櫙鍞竴鏍囪瘑</param>
         /// <returns></returns>
-        public static HDL_ON.Entity.Scene GetSecne(string sid)
+        public HDL_ON.Entity.Scene GetSecne(string sid)
         {
             HDL_ON.Entity.Scene scene = new Entity.Scene() { name = "Unknown" };
             List<HDL_ON.Entity.Scene> sceneLists = GetSceneList();
@@ -246,7 +262,7 @@
         /// </summary>
         /// <param name="device">璁惧</param>
         /// <returns></returns>
-        public static string GetGetRoomName(HDL_ON.Entity.Function device)
+        public string GetGetRoomName(HDL_ON.Entity.Function device)
         {
             string roomName = "";
             List<HDL_ON.Entity.Room> roomLists = GetGatewayRoomList();
@@ -268,7 +284,7 @@
         /// </summary>
         /// <param name="functionType">璁惧绫诲瀷</param>
         /// <returns></returns>
-        public static string GetIconPath(string functionType)
+        public string GetIconPath(string functionType)
         {
             string strPath = "";
             switch (functionType)
@@ -309,6 +325,7 @@
                 case SPK.SensorDoorWindow:
                 case SPK.SensoruUtrasonic:
                 case SPK.SenesorMegahealth:
+                case SPK.SenesorEnvironment:
                     {
                         strPath = "LogicIcon/sensor.png";
                     }
@@ -322,7 +339,7 @@
         /// </summary>
         /// <param name="deviceList">璁惧鍒楄〃</param>
         /// <returns></returns>
-        public static List<string> GetDeviceTypeList(List<HDL_ON.Entity.Function> deviceList)
+        public List<string> GetDeviceTypeList(List<HDL_ON.Entity.Function> deviceList)
         {
             List<string> deviceStrTypeList = new List<string>();
             deviceStrTypeList.Clear();
@@ -367,6 +384,7 @@
             || device.spk == SPK.SensorDoorWindow
             || device.spk == SPK.SensoruUtrasonic
             || device.spk == SPK.SenesorMegahealth
+            || device.spk == SPK.SenesorEnvironment
             );
             if (sensor != null)
             {
@@ -380,7 +398,7 @@
         /// </summary>
         /// <param name="deviceType">璁惧绫诲瀷(鐏厜绫伙紝绐楀笜绫汇��)</param>
         /// <returns></returns>
-        public static List<string> GetDeviceTypeFunctionList(string deviceType)
+        public List<string> GetDeviceTypeFunctionList(string deviceType)
         {
             List<string> functionTypeList = new List<string>();
             if (deviceType == Language.StringByID(StringId.Lights))
@@ -417,6 +435,8 @@
                 functionTypeList.Add(SPK.SensorDoorWindow);
                 functionTypeList.Add(SPK.SensoruUtrasonic);
                 functionTypeList.Add(SPK.SenesorMegahealth);
+                functionTypeList.Add(SPK.SenesorEnvironment);
+
 
             }
             return functionTypeList;
@@ -426,7 +446,7 @@
         /// 鏉′欢/鐩爣鏀寔璁惧
         /// </summary>
         /// <returns></returns>
-        public static List<string> GetSupportEquipment(string if_type)
+        public List<string> GetSupportEquipment(string if_type)
         {
             List<string> deviceTypeList = new List<string>();
             switch (if_type)
@@ -453,6 +473,8 @@
                         deviceTypeList.Add(SPK.SensorDoorWindow);
                         deviceTypeList.Add(SPK.SensoruUtrasonic);
                         deviceTypeList.Add(SPK.SenesorMegahealth);
+                        deviceTypeList.Add(SPK.SenesorEnvironment);
+
                     }
                     break;
                 case target_if:
@@ -479,7 +501,7 @@
         /// <param name="functionType">婧愭暟鎹垪琛�1</param>
         /// <param name="deviceList">婧愭暟鎹垪琛�2</param>
         /// <returns></returns>
-        public static List<Entity.Function> GetShowDeviceList(List<string> functionType, List<HDL_ON.Entity.Function> deviceList)
+        public List<Entity.Function> GetShowDeviceList(List<string> functionType, List<HDL_ON.Entity.Function> deviceList)
         {
             List<HDL_ON.Entity.Function> devList = new List<Entity.Function>();
             for (int i = 0; i < deviceList.Count; i++)
@@ -501,7 +523,7 @@
         /// <param name="room">褰撳墠鎴块棿</param>
         /// <param name="str">鍒ゆ柇绗︼紙琛ㄧず=杈撳叆璁惧鍜岃緭鍑鸿澶囷級</param>
         /// <returns></returns>
-        public static List<Entity.Function> GetFunctionDeviceList(Entity.Room room, string str)
+        public List<Entity.Function> GetFunctionDeviceList(Entity.Room room, string str)
         {
             List<string> functionTypeList = GetSupportEquipment(str);
             //杩斿洖鎴块棿璁惧鍒楄〃
@@ -513,7 +535,7 @@
         /// <summary>
         /// 缃戝叧ID(鑾峰彇鍢変箰缃戝叧ID)
         /// </summary>
-        public static string GatewayId
+        public string GatewayId
         {
             get
             {
@@ -527,7 +549,7 @@
         /// <summary>
         /// 浣忓畢ID
         /// </summary>
-        public static string HomeId
+        public string HomeId
         {
             get
             {
@@ -537,12 +559,14 @@
         /// <summary>
         /// 鏄惁涓哄叾浠栦富鐢ㄦ埛鍒嗕韩杩囨潵鐨勪綇瀹�
         /// </summary>
-        public static bool IsOthreShare
+        public bool IsOthreShare
         {
             get
             {
                 return Entity.DB_ResidenceData.Instance.CurrentRegion.isOtherShare;
             }
         }
+
+
     }
 }
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/AddOutputInputView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/AddOutputInputView.cs
index 37e2d2d..9f8dc40 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/AddOutputInputView.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/AddOutputInputView.cs
@@ -7,11 +7,11 @@
         /// <summary>
         /// 涓绘帶浠禫iew
         /// </summary>
-        public FrameLayout frameLayout= new FrameLayout
+        public FrameLayout frameLayout = new FrameLayout
         {
             Height = Application.GetRealHeight(44),
             Width = Application.GetRealWidth(343),
-           BackgroundColor= CSS.CSS_Color.view,
+            BackgroundColor = CSS.CSS_Color.view,
             X = Application.GetRealWidth(LogicView.TextSize.left16),
         };
 
@@ -23,28 +23,28 @@
             Height = Application.GetRealHeight(43),
             Width = Application.GetRealWidth(343),
             LineColor = CSS.CSS_Color.viewTranslucence,
-            SubViewWidth=Application.GetRealWidth(68),
+            SubViewWidth = Application.GetRealWidth(68),
         };
         /// <summary>
         /// 锛堟潯浠舵垨鑰呯洰鏍囷級鍥炬爣
         /// </summary>
-        public Button btnIcon= new Button
+        public Button btnIcon = new Button
         {
-            Width= Application.GetRealWidth(28),
-            Height =Application.GetRealWidth(28),
+            Width = Application.GetRealWidth(28),
+            Height = Application.GetRealWidth(28),
             //Y = Application.GetRealHeight(8),
             X = Application.GetRealWidth(TextSize.left12),
-            
+
         };
         /// <summary>
         /// 锛堟潯浠舵垨鑰呯洰鏍囷級鏂囨湰鎻忚堪
         /// </summary>
-        public Button btnText= new Button
+        public Button btnText = new Button
         {
             TextSize = TextSize.text14,
             Width = Application.GetRealWidth(250),
             Height = Application.GetRealHeight(20),
-            TextColor= CSS.CSS_Color.textColor,
+            TextColor = CSS.CSS_Color.textColor,
             //Y=Application.GetRealHeight(12),
             X = Application.GetRealWidth(52),
         };
@@ -58,9 +58,9 @@
             Width = Application.GetRealWidth(130),
             Height = Application.GetRealHeight(17),
             TextColor = CSS.CSS_Color.textCancelColor,
-            Y=Application.GetRealHeight(14),
+            Y = Application.GetRealHeight(14),
             X = Application.GetRealWidth(165),
-            TextAlignment=TextAlignment.CenterRight,
+            TextAlignment = TextAlignment.CenterRight,
         };
 
         /// <summary>
@@ -81,13 +81,26 @@
         /// </summary>
         public Button btnLine = new Button
         {
-            Width=Application.GetRealWidth(279),
-            Y = Application.GetRealHeight(44-1),
+            Width = Application.GetRealWidth(279),
+            Y = Application.GetRealHeight(44 - 1),
             X = Application.GetRealWidth(52),
             Height = 1,
             BackgroundColor = CSS.CSS_Color.viewLine,
 
         };
+        /// <summary>
+        /// 寤舵椂
+        /// </summary>
+        public Button btnDelay = new Button
+        {
+            BackgroundColor = CSS.CSS_Color.AuxiliaryColor1,
+            TextID = StringId.delayLogic,
+            TextSize = LogicView.TextSize.text16,
+            TextColor = CSS.CSS_Color.view,
+        };
+        /// <summary>
+        /// 鍒犻櫎
+        /// </summary>
         public Button btnDel = new Button
         {
             BackgroundColor = CSS.CSS_Color.textRedColor,
@@ -95,7 +108,6 @@
             TextSize = LogicView.TextSize.text16,
             TextColor = CSS.CSS_Color.view,
         };
-       
         public Button btnClick = new Button
         {
             Height = Application.GetRealHeight(44),
@@ -117,12 +129,13 @@
             rowLayout.AddChidren(btnText);
             rowLayout.AddChidren(btnState);
             rowLayout.AddChidren(btnNextIcon);
+            rowLayout.AddRightView(btnDelay);
             rowLayout.AddRightView(btnDel);
             rowLayout.AddChidren(btnClick);
             btnLine.Y = frameLayout.Height - 1;
             frameLayout.AddChidren(btnLine);
 
         }
-      
+
     }
 }
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SelectTypeView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SelectTypeView.cs
index a674af7..dd2ea61 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SelectTypeView.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SelectTypeView.cs
@@ -132,5 +132,7 @@
             frameLayout.AddChidren(btnClick);
             return frameLayout;
         }
+       
+
     }
 }
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TimeView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TimeView.cs
index a36dc65..a79324c 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TimeView.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TimeView.cs
@@ -72,7 +72,6 @@
         /// </summary>
         /// <returns></returns>
         public void FLayoutView(FrameLayout fLayout)
-        //public void FLayoutView(FrameLayout fLayout, string currState, Action<string> action)
         {
            
             fLayout.AddChidren(frameLayout);
@@ -80,7 +79,6 @@
             frameLayout.AddChidren(btnCancel);
             frameLayout.AddChidren(btnConfirm);
             frameLayout.AddChidren(btnLine);
-            //TimePoint(fLayout, action,currState);
         }
         /// <summary>
         /// 閫変腑鏃堕棿鐨勬柟娉�
@@ -248,6 +246,32 @@
 
             return mList;
         }
+        /// <summary> 
+        /// 鑾峰彇60绉掑垪琛�
+        /// </summary>
+        /// <returns></returns>
+        public List<string> GetsStringList()
+        {
+            //鍒濆鍖栧垪琛�
+            var mList = new List<string>();
+            for (int i = 0; i < 60; i++)
+            {
+                if (i < 10)
+                {
+                    var a = "0" + i.ToString();
+                    //娣诲姞鏁版嵁
+                    mList.Add(a + " " + Language.StringByID(StringId.s));
+                }
+                else
+                {
+                    //娣诲姞鏁版嵁
+                    mList.Add(i.ToString() + " " + Language.StringByID(StringId.s));
+                }
+
+            }
+
+            return mList;
+        }
 
         /// <summary>
         /// 鑾峰彇023灏忔椂鍒楄〃
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/OnePortAutomation.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/OnePortAutomation.cs
index 4610303..37d4567 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/OnePortAutomation.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/OnePortAutomation.cs
@@ -199,7 +199,7 @@
                         ) =>
                     {
                         Logic.currlogic.name = logicName;
-                        Logic.currlogic.sid = LogicMethod.NewSid();
+                        Logic.currlogic.sid = LogicMethod.CurrLogicMethod.NewSid();
                         loading.Start();
                         new System.Threading.Thread(() =>
                         {
@@ -242,7 +242,7 @@
                                         }
 
                                         Logic.LogicList.Add(Logic.currlogic);
-                                        LogicMethod.RemoveAllView();
+                                        LogicMethod.CurrLogicMethod.RemoveAllView();
                                         MainView.MainShow();
                                     }
                                     else if (responsePackNew != null && responsePackNew.Code == "14005")
@@ -282,7 +282,7 @@
                                 loading.Hide();
                                 if (responsePackNew != null && responsePackNew.Code == "0")
                                 {
-                                    LogicMethod.RemoveAllView();
+                                    LogicMethod.CurrLogicMethod.RemoveAllView();
                                     MainView.MainShow();
                                 }
                                 else if (responsePackNew != null && responsePackNew.Code == "14005")
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs
index 5781fc1..d8930a7 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs
@@ -75,7 +75,7 @@
             pmhigherView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
             pmhigherView.btnText.TextID = StringId.PM25;
             viewLayout.AddChidren(pmhigherView.FLayoutView());
-          
+
 
             #endregion
 
@@ -110,7 +110,7 @@
                 PmAction(this);
 
             };
-          
+
 
             #endregion
         }
@@ -119,7 +119,7 @@
         /// </summary>
         /// <param name="textInt">鏂囨湰</param>
         /// <param name="stateValue">缂栬緫涔嬪墠鐨勭姸鎬佸��,榛樿涓�20</param>
-        public void InputBoxAction(int textInt,string stateValue="20")
+        public void InputBoxAction(int textInt, string stateValue = "20")
         {
             new LogicView.TipPopView { }.InputBox(textInt, stateValue, (value) =>
             {
@@ -164,31 +164,11 @@
         public void PmAction(FrameLayout frame, string stateValue = "")
         {
             PublicInterface pmView = new PublicInterface();
-            var pmListStr = pmView.GetViewList("pm2.5");
-            pmView.SingleSelectionShow(frame, pmListStr, Language.StringByID(StringId.PM25), GetString(stateValue)
+            var pmListStr = pmView.GetViewList("pm25");
+            pmView.SingleSelectionShow(frame, pmListStr, Language.StringByID(StringId.PM25), pmView.GetString("pm25", stateValue)
                , (text) =>
                {
-                   string value = "";
-                   if (text == Language.StringByID(StringId.pmyou))
-                   {
-                       value = "10";
-                   }
-                   else if (text == Language.StringByID(StringId.pmliang))
-                   {
-                       value = "50";
-                   }
-                   else if (text == Language.StringByID(StringId.pmqingdu))
-                   {
-                       value = "90";
-                   }
-                   else if (text == Language.StringByID(StringId.pmzhongdu))
-                   {
-                       value = "130";
-                   }
-                   else if (text == Language.StringByID(StringId.pmzhongduwuran))
-                   {
-                       value = "170";
-                   }
+                   var value= pmView.GetValue("pm25", text);
                    AddDic("pm2.5", "=", value);
                });
         }
@@ -201,13 +181,13 @@
         private void AddDic(string keyValue, string comparator, string value)
         {
             Input input = new Input();
-            input.sid = LogicMethod.NewSid();
+            input.sid = LogicMethod.CurrLogicMethod.NewSid();
             input.condition_type = "4";
             Dictionary<string, string> dic = new Dictionary<string, string>();
-            LogicMethod.dictionary(dic, "key", keyValue);
-            LogicMethod.dictionary(dic, "comparator", comparator);
-            LogicMethod.dictionary(dic, "data_type", "float");
-            LogicMethod.dictionary(dic, "value", value);
+            LogicMethod.CurrLogicMethod.dictionary(dic, "key", keyValue);
+            LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", comparator);
+            LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "float");
+            LogicMethod.CurrLogicMethod.dictionary(dic, "value", value);
             input.condition.Add(dic);
             AddCondition(input, keyValue, comparator);
         }
@@ -217,7 +197,7 @@
         /// <param name="input"></param>
         /// <param name="keyValue"></param>
         /// <param name="comparator">姣旇緝鍏崇郴</param>
-        private void AddCondition(Input input, string keyValue,string comparator)
+        private void AddCondition(Input input, string keyValue, string comparator)
         {
             ///璁板綍绱㈠紩鍊�
             int index = -1;
@@ -247,7 +227,7 @@
                 Logic.currlogic.input.Add(input);
             }
 
-            LogicMethod.RemoveAllView();
+            LogicMethod.CurrLogicMethod.RemoveAllView();
             AddLogic addLogic = new AddLogic();
             MainPage.BasePageView.AddChidren(addLogic);
             addLogic.Show();
@@ -261,7 +241,7 @@
         /// <param name="keyValue"></param>
         /// <param name="comparator">姣旇緝鍏崇郴</param>
         /// <returns></returns>
-        private bool ExistKey(List<Dictionary<string, string>> dicList, string keyValue, string comparator) 
+        private bool ExistKey(List<Dictionary<string, string>> dicList, string keyValue, string comparator)
         {
             for (int i = 0; i < dicList.Count; i++)
             {
@@ -277,37 +257,6 @@
             return false;
         }
 
-
-        public string GetString(string strValue)
-        {
-            string text = "";
-            int intValue = 0;
-            if (strValue != "")
-            {
-                intValue = int.Parse(strValue);
-            }
-            if (intValue > 0 && intValue < 35)
-            {
-                text = Language.StringByID(StringId.pmyou);
-            }
-            else if (intValue > 35 && intValue < 75)
-            {
-                text = Language.StringByID(StringId.pmliang);
-            }
-            else if (intValue > 75 && intValue < 115)
-            {
-                text = Language.StringByID(StringId.pmqingdu);
-            }
-            else if (intValue > 115 && intValue < 150)
-            {
-                text = Language.StringByID(StringId.pmzhongdu);
-            }
-            else if (intValue > 150)
-            {
-                text = Language.StringByID(StringId.pmzhongduwuran);
-            }
-
-            return text;
-        }
+     
     }
 }
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
index 18ec0c8..4683464 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
@@ -16,6 +16,10 @@
         /// <param name="textSize">鏄剧ず鏂囨湰瀛椾綋澶у皬</param>
         public void SingleSelectionShow(FrameLayout frame, List<string> list, string titleText, string stateText, Action<string> action, int textSize = LogicView.TextSize.text14)
         {
+            if (list == null)
+            {
+                return;
+            }
             FrameLayout frameLayout = new FrameLayout
             {
                 BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
@@ -75,7 +79,7 @@
             };
 
         }
-       
+
         /// <summary>
         /// 澶氶�夋嫨
         /// </summary>
@@ -259,7 +263,8 @@
         /// <param name="list">鏄剧ず鏁版嵁婧�</param>
         /// <param name="titleText">鏍囬</param>
         /// <param name="action">杩斿洖鍊肩储寮曞��</param>
-        public void FrameOrVv(FrameLayout frame, List<string>list, int titleText,Action<int> action) { 
+        public void FrameOrVv(FrameLayout frame, List<string> list, int titleText, Action<int> action)
+        {
 
             int line = 0;
             if (list.Count == 0 || list.Count > 5)
@@ -396,7 +401,7 @@
         /// <param name="stateList">涔嬪墠鐘舵�佹暟鎹簮</param>
         /// <param name="titleText">鏍囬</param>
         /// <param name="action">杩斿洖鍊肩储寮曞��</param>
-        public void FrameOrVvList(FrameLayout frame, List<string> list,List<string>stateList, int titleText, Action<List<string>> action)
+        public void FrameOrVvList(FrameLayout frame, List<string> list, List<string> stateList, int titleText, Action<List<string>> action)
         {
 
             int line = 0;
@@ -495,7 +500,8 @@
                 {
                     verticalRefresh.AddChidren(checkView.FLayoutView());
                 }
-                if (stateList.Contains(strName)) {
+                if (stateList.Contains(strName))
+                {
                     checkView.btnClick.IsSelected = true;
                     checkView.btnCheckIcon.IsSelected = true;
                     selecetdList.Add(strName);
@@ -539,6 +545,63 @@
 
         }
 
+        /// <summary>
+        /// 娓╂箍搴︾粍鍚堢晫闈�
+        /// </summary>
+        /// <param name="frameLayout">鐖舵帶浠�</param>
+        /// <param name="text1">鏍囬鏂囨湰1</param>
+        /// <param name="text2">鏍囬鏂囨湰2</param>
+        /// <param name="action">鍥炶皟鍑芥暟</param>
+        public void ViewZuHe(FrameLayout frameLayout, int text1, int text2, Action<int, FrameLayout> action)
+        {
+
+            FrameLayout frame = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewMiddle };
+            frameLayout.AddChidren(frame);
+            LogicView.TopView topView = new LogicView.TopView();
+            topView.topNameBtn.TextID = StringId.wendu;
+            frame.AddChidren(topView.FLayoutView());
+            topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
+            {
+                frame.RemoveFromParent();
+            };
+            FrameLayout viewLayout = new FrameLayout
+            {
+                Y = Application.GetRealHeight(64),
+                Width = Application.GetRealWidth(LogicView.TextSize.view375),
+                Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64),
+                BackgroundColor = CSS.CSS_Color.viewMiddle,
+            };
+            frame.AddChidren(viewLayout);
+
+            //娓�,婀垮害楂樹簬
+            LogicView.SelectTypeView temperaturehigherView = new LogicView.SelectTypeView();
+            temperaturehigherView.btnIcon.Visible = false;
+            temperaturehigherView.btnText.X = Application.GetRealWidth(16);
+            temperaturehigherView.btnLine.X = Application.GetRealWidth(16);
+            temperaturehigherView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
+            temperaturehigherView.btnText.TextID = text1;
+            viewLayout.AddChidren(temperaturehigherView.FLayoutView());
+            //娓�,婀垮害浣庝簬
+            LogicView.SelectTypeView temperatureunderView = new LogicView.SelectTypeView();
+            temperatureunderView.frameLayout.Y = temperaturehigherView.frameLayout.Bottom;
+            temperatureunderView.btnIcon.Visible = false;
+            temperatureunderView.btnText.X = Application.GetRealWidth(16);
+            temperatureunderView.btnLine.X = Application.GetRealWidth(16);
+            temperatureunderView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
+            temperatureunderView.btnText.TextID = text2;
+            viewLayout.AddChidren(temperatureunderView.FLayoutView());
+
+            //娓�,婀垮害楂樹簬
+            temperaturehigherView.btnClick.MouseUpEventHandler += (sen, e) =>
+            {
+                action(text1, frame);
+            };
+            //娓�,婀垮害浣庝簬
+            temperatureunderView.btnClick.MouseUpEventHandler += (sen, e) =>
+            {
+                action(text2, frame);
+            };
+        }
 
         /// <summary>
         /// 鑾峰彇鐣岄潰鍒楄〃
@@ -613,7 +676,7 @@
                       };
                     }
                     break;
-                case "pm2.5":
+                case "pm25":
                     {
                         list = new List<string> {
              Language.StringByID(StringId.pmyou),
@@ -621,6 +684,24 @@
              Language.StringByID(StringId.pmqingdu),
              Language.StringByID(StringId.pmzhongdu),
              Language.StringByID(StringId.pmzhongduwuran),
+                      };
+                    }
+                    break;
+                case "co2":
+                    {
+                        list = new List<string> {
+             Language.StringByID(StringId.zhengchang),
+             Language.StringByID(StringId.piangao),
+             Language.StringByID(StringId.chaobiao),
+                      };
+                    }
+                    break;
+                case "tvoc":
+                    {
+                        list = new List<string> {
+             Language.StringByID(StringId.zhengchang),
+             Language.StringByID(StringId.chaobiao),
+             Language.StringByID(StringId.yanzhong),
                       };
                     }
                     break;
@@ -798,6 +879,157 @@
 
             return stateList;
         }
+        /// <summary>
+        /// 鏁板�艰繑鍥炴枃鏈�
+        /// </summary>
+        /// <param name="type">绫诲瀷</param>
+        /// <param name="strValue">鍊�</param>
+        /// <returns></returns>
+        public string GetString(string type, string strValue)
+        {
+            string text = "";
+            int intValue = 0;
+            if (strValue != "")
+            {
+                intValue = int.Parse(strValue);
+            }
+
+            switch (type)
+            {
+                case "pm25":
+                    {
+
+                        if (intValue > 0 && intValue < 35)
+                        {
+                            text = Language.StringByID(StringId.pmyou);
+                        }
+                        else if (intValue > 35 && intValue < 75)
+                        {
+                            text = Language.StringByID(StringId.pmliang);
+                        }
+                        else if (intValue > 75 && intValue < 115)
+                        {
+                            text = Language.StringByID(StringId.pmqingdu);
+                        }
+                        else if (intValue > 115 && intValue < 150)
+                        {
+                            text = Language.StringByID(StringId.pmzhongdu);
+                        }
+                        else if (intValue > 150)
+                        {
+                            text = Language.StringByID(StringId.pmzhongduwuran);
+                        }
+                    }
+                    break;
+                case "co2":
+                    {
+
+                        if (intValue > 0 && intValue < 800)
+                        {
+                            text = Language.StringByID(StringId.zhengchang);
+                        }
+                        else if (intValue > 800 && intValue < 1100)
+                        {
+                            text = Language.StringByID(StringId.piangao);
+                        }
+                        else if (intValue > 1100)
+                        {
+                            text = Language.StringByID(StringId.chaobiao);
+                        }
+                    }
+                    break;
+                case "tvoc":
+                    {
+
+                        if (intValue >=1 && intValue <= 3)
+                        {
+                            text = Language.StringByID(StringId.zhengchang);
+                        }
+                        else if (intValue >=4 && intValue<=6)
+                        {
+                            text = Language.StringByID(StringId.chaobiao);
+                        }
+                        else if (intValue >= 7 && intValue <= 9)
+                        {
+                            text = Language.StringByID(StringId.yanzhong);
+                        }
+                    }
+                    break;
+            }
+            return text;
+        }
+
+        /// <summary>
+        /// 鏈枃杩斿洖鏁板�艰繑鍥�
+        /// </summary>
+        /// <param name="type">绫诲瀷</param>
+        /// <param name="text">鏂囨湰</param>
+        /// <returns></returns>
+        public string GetValue(string type, string text)
+        {
+            string value = "";
+            switch (type)
+            {
+                case "pm25":
+                    {
+                        if (text == Language.StringByID(StringId.pmyou))
+                        {
+                            value = "10";
+                        }
+                        else if (text == Language.StringByID(StringId.pmliang))
+                        {
+                            value = "50";
+                        }
+                        else if (text == Language.StringByID(StringId.pmqingdu))
+                        {
+                            value = "90";
+                        }
+                        else if (text == Language.StringByID(StringId.pmzhongdu))
+                        {
+                            value = "130";
+                        }
+                        else if (text == Language.StringByID(StringId.pmzhongduwuran))
+                        {
+                            value = "170";
+                        }
+                    }
+                    break;
+                case "co2":
+                    {
+                        if (text == Language.StringByID(StringId.zhengchang))
+                        {
+                            value = "400";
+                        }
+                        else if (text == Language.StringByID(StringId.piangao))
+                        {
+                            value = "850";
+                        }
+                        else if (text == Language.StringByID(StringId.chaobiao))
+                        {
+                            value = "1200";
+                        }
+                    }
+                    break;
+                case "tvoc":
+                    {
+                        if (text == Language.StringByID(StringId.zhengchang))
+                        {
+                            value = "2";
+                        }
+                        else if (text == Language.StringByID(StringId.chaobiao))
+                        {
+                            value = "5";
+                        }
+                        else if (text == Language.StringByID(StringId.yanzhong))
+                        {
+                            value = "8";
+                        }
+                    }
+                    break;
+
+            }
+            return value;
+        }
 
 
     }
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
index 28e66fa..193f4c7 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
@@ -37,7 +37,7 @@
         /// <returns></returns>
         public static ResponsePackNew GetLogicIdList() 
         {
-            var jObject = new JObject { { "homeId", LogicMethod.HomeId } };
+            var jObject = new JObject { { "homeId", LogicMethod.CurrLogicMethod.HomeId } };
             var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_List);
             //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken
             if (responsePackNew.Code == StateCode.TOKEN_EXPIRED)
@@ -114,6 +114,7 @@
                 {
                     var outputTypeJOb = new JObject { };
                     outputTypeJOb.Add("sid", dictionary.sid);
+                    outputTypeJOb.Add("delay", dictionary.delay);
                     outputTypeJOb.Add("target_type", dictionary.target_type);
                     var statusArray = new JArray { };
                     foreach (var dic in dictionary.status)
@@ -153,7 +154,7 @@
                 var logicjArray = new JArray { };
                 var logicIfon = new JObject { };
                 logicIfon.Add("sid", logic.sid);
-                logicIfon.Add("gatewayId", LogicMethod.GatewayId);
+                logicIfon.Add("gatewayId", LogicMethod.CurrLogicMethod.GatewayId);
                 logicIfon.Add("name", logic.name);
                 logicIfon.Add("relation", logic.relation);
                 logicIfon.Add("enable", logic.enable);
@@ -163,7 +164,7 @@
                 logicIfon.Add("noticeConfig", noticeConfigJObject);
                 logicIfon.Add("pushConfigs", pushConfigsArray);
                 logicjArray.Add(logicIfon);
-                var jObject = new JObject { { "homeId", LogicMethod.HomeId }, { "logics", logicjArray } };
+                var jObject = new JObject { { "homeId", LogicMethod.CurrLogicMethod.HomeId }, { "logics", logicjArray } };
                 responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Add,5);
                 //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken
                 if (responsePackNew.Code == StateCode.TOKEN_EXPIRED)
@@ -226,6 +227,7 @@
                 {
                     var outputTypeJOb = new JObject { };
                     outputTypeJOb.Add("sid", dictionary.sid);
+                    outputTypeJOb.Add("delay", dictionary.delay);
                     outputTypeJOb.Add("target_type", dictionary.target_type);
                     var statusArray = new JArray { };
                     foreach (var dic in dictionary.status)
@@ -266,7 +268,7 @@
                 var logicIfon = new JObject { };
                 logicIfon.Add("userLogicId", logic.userLogicId);
                 logicIfon.Add("sid", logic.sid);
-                logicIfon.Add("gatewayId", LogicMethod.GatewayId);
+                logicIfon.Add("gatewayId", LogicMethod.CurrLogicMethod.GatewayId);
                 logicIfon.Add("name", logic.name);
                 logicIfon.Add("relation", logic.relation);
                 logicIfon.Add("enable", logic.enable);
@@ -277,7 +279,7 @@
                 logicIfon.Add("pushConfigs", pushConfigsArray);
 
                 logicjArray.Add(logicIfon);
-                var jObject = new JObject { { "homeId", LogicMethod.HomeId }, { "logics", logicjArray } };
+                var jObject = new JObject { { "homeId", LogicMethod.CurrLogicMethod.HomeId }, { "logics", logicjArray } };
                 responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Update,5);
                 //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken
                 if (responsePackNew.Code == StateCode.TOKEN_EXPIRED)
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs
index 442dae4..7113132 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs
@@ -118,7 +118,7 @@
                                 loading.Hide();
                                 if (responsePackNew != null && responsePackNew.Code == "0")
                                 {
-                                    LogicMethod.RemoveAllView();
+                                    LogicMethod.CurrLogicMethod.RemoveAllView();
                                     Logic.LogicList.Remove(Logic.currlogic);
                                     MainView.MainShow();
                                     //鍙戦�佸垹闄ら�昏緫鍛戒护锛�
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
index 2bc0fba..ecd18e9 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
@@ -387,6 +387,8 @@
 
                     if (edit)
                     {
+                        //鏇存柊寤舵椂鏃堕棿
+                        outputDevice.delay = Logic.currlogic.output[index].delay;
                         //绉婚櫎鏃ф暟鎹�
                         Logic.currlogic.output.RemoveAt(index);
                         //鏂版暟鎹彃鍏ユ棫鏁版嵁鐨勪綅缃�;
@@ -408,7 +410,7 @@
                     this.RemoveFromParent();
                     return;
                 }
-                LogicMethod.RemoveAllView();
+                LogicMethod.CurrLogicMethod.RemoveAllView();
                 AddLogic addLogic = new AddLogic();
                 MainPage.BasePageView.AddChidren(addLogic);
                 addLogic.Show();
@@ -514,7 +516,7 @@
         private void GetEditState(Entity.Function device, int index, Button button1, Button button2, Button button3, Button button4)
         {
             Output outputs = Logic.currlogic.output[index];
-            var dicList = outputs.status as List<Dictionary<string, string>>;
+            var dicList = outputs.status;
             //娓呴櫎涔嬪墠鏃ф暟鎹�
             dicSateteList.Clear();
             if (dicList.Count != 0)
@@ -533,8 +535,8 @@
         {
             //鏁版嵁灏佽
             Dictionary<string, string> dic = new Dictionary<string, string>();
-            LogicMethod.dictionary(dic, "key", KeyValue);
-            LogicMethod.dictionary(dic, "value", selectedValue);
+            LogicMethod.CurrLogicMethod.dictionary(dic, "key", KeyValue);
+            LogicMethod.CurrLogicMethod.dictionary(dic, "value", selectedValue);
             AddDictionaryList(KeyValue, dic);
         }
         /// <summary>
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Time3.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Time3.cs
index 7d58572..3ace301 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Time3.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Time3.cs
@@ -222,13 +222,13 @@
         private void AddDic(string keyValue, string value, bool edit, int index)
         {
             Input inputTime = new Input();
-            inputTime.sid = LogicMethod.NewSid();
+            inputTime.sid = LogicMethod.CurrLogicMethod.NewSid();
             inputTime.condition_type = "1";
             Dictionary<string, string> dic = new Dictionary<string, string>();
-            LogicMethod.dictionary(dic, "key", keyValue);
-            LogicMethod.dictionary(dic, "comparator", "=");
-            LogicMethod.dictionary(dic, "data_type", "string");
-            LogicMethod.dictionary(dic, "value", value);
+            LogicMethod.CurrLogicMethod.dictionary(dic, "key", keyValue);
+            LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
+            LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
+            LogicMethod.CurrLogicMethod.dictionary(dic, "value", value);
             inputTime.condition.Add(dic);
             AddCondition(inputTime, edit, index);
         }
@@ -250,7 +250,7 @@
                 //娣诲姞涓�涓柊鐨勬椂闂存潯浠�
                 Logic.currlogic.input.Add(input);
             }
-            LogicMethod.RemoveAllView();
+            LogicMethod.CurrLogicMethod.RemoveAllView();
             AddLogic addLogic = new AddLogic();
             MainPage.BasePageView.AddChidren(addLogic);
             addLogic.Show();
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs
index ee08deb..fb0a481 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs
@@ -129,13 +129,13 @@
             timePointView.FLayoutView(fLayout);
             timePointView.TimePoint(fLayout, editTime, (timeValue)=>{
                 Input inputTime = new Input();
-                inputTime.sid = LogicMethod.NewSid();
+                inputTime.sid = LogicMethod.CurrLogicMethod.NewSid();
                 inputTime.condition_type = "1";
                 Dictionary<string, string> dic = new Dictionary<string, string>();
-                LogicMethod.dictionary(dic, "key", "timepoint");
-                LogicMethod.dictionary(dic, "comparator", "=");
-                LogicMethod.dictionary(dic, "data_type", "string");
-                LogicMethod.dictionary(dic, "value", timeValue);
+                LogicMethod.CurrLogicMethod.dictionary(dic, "key", "timepoint");
+                LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
+                LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
+                LogicMethod.CurrLogicMethod.dictionary(dic, "value", timeValue);
                 inputTime.condition.Add(dic);
                 AddCondition(inputTime, edit, index);
             });
@@ -252,13 +252,13 @@
                 }
 
                 Input inputTime = new Input();
-                inputTime.sid = LogicMethod.NewSid();
+                inputTime.sid = LogicMethod.CurrLogicMethod.NewSid();
                 inputTime.condition_type = "2";
                 Dictionary<string, string> dic = new Dictionary<string, string>();
-                LogicMethod.dictionary(dic, "key", "timesection");
-                LogicMethod.dictionary(dic, "comparator", "=");
-                LogicMethod.dictionary(dic, "data_type", "string");
-                LogicMethod.dictionary(dic, "value", btnStartTimeText.Text + "-" + btnEndTimeText.Text);
+                LogicMethod.CurrLogicMethod.dictionary(dic, "key", "timesection");
+                LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
+                LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
+                LogicMethod.CurrLogicMethod.dictionary(dic, "value", btnStartTimeText.Text + "-" + btnEndTimeText.Text);
                 inputTime.condition.Add(dic);
                 AddCondition(inputTime, edit, index);
 
@@ -349,7 +349,7 @@
                 //娣诲姞涓�涓柊鐨勬椂闂存潯浠�
                 Logic.currlogic.input.Add(input);
             }
-            LogicMethod.RemoveAllView();
+            LogicMethod.CurrLogicMethod.RemoveAllView();
             AddLogic addLogic = new AddLogic();
             MainPage.BasePageView.AddChidren(addLogic);
             addLogic.Show();
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs
index fbe50e2..7bbf196 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs
@@ -78,13 +78,13 @@
         private void AddDic(string value)
         {
             Input input = new Input(); 
-            input.sid = LogicMethod.NewSid();
+            input.sid = LogicMethod.CurrLogicMethod.NewSid();
             input.condition_type = "6";
             Dictionary<string, string> dic = new Dictionary<string, string>();
-            LogicMethod.dictionary(dic, "key", "weather");
-            LogicMethod.dictionary(dic, "comparator", "=");
-            LogicMethod.dictionary(dic, "data_type", "string");
-            LogicMethod.dictionary(dic, "value", value);
+            LogicMethod.CurrLogicMethod.dictionary(dic, "key", "weather");
+            LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
+            LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
+            LogicMethod.CurrLogicMethod.dictionary(dic, "value", value);
             input.condition.Add(dic);
             AddCondition(input);
         }
@@ -118,7 +118,7 @@
                 Logic.currlogic.input.Add(input);
             }
 
-            LogicMethod.RemoveAllView();
+            LogicMethod.CurrLogicMethod.RemoveAllView();
             AddLogic addLogic = new AddLogic();
             MainPage.BasePageView.AddChidren(addLogic);
             addLogic.Show();

--
Gitblit v1.8.0