From 330e3ae4cdd1e9facb14b6ea2b3e609166c04fd3 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期二, 12 一月 2021 16:00:27 +0800
Subject: [PATCH] 2021-1-12-1

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs      |   13 +
 HDL-ON_iOS/Resources/Language.ini                               |    7 
 HDL-ON_Android/Assets/Language.ini                              |    9 +
 .vs/HDL_APP_Project/xs/sqlite3/storage.ide-shm                  |    0 
 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs  |  118 ++++++++++++++
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs |   43 +++--
 HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs   |  231 +++++++++++++++++++++++++---
 HDL_ON/Common/R.cs                                              |    8 +
 .vs/HDL_APP_Project/xs/sqlite3/storage.ide                      |    0 
 .vs/HDL_APP_Project/xs/UserPrefs.xml                            |   28 +-
 .vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal                  |    0 
 HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs     |   10 
 12 files changed, 404 insertions(+), 63 deletions(-)

diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml
index addc8a9..67e3082 100644
--- a/.vs/HDL_APP_Project/xs/UserPrefs.xml
+++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,37 +1,35 @@
 锘�<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default">
   <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.D4411691-F5B8-40F4-97C1-964F33115DBC" />
-  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs">
+  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs">
     <Files>
-      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs" Line="386" Column="56" />
-      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs" />
-      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/Weather.cs" Line="7" Column="16" />
-      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs" />
-      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs" Line="428" Column="34" />
-      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs" Line="94" Column="51" />
+      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs" Line="302" Column="72" />
+      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs" Line="1" Column="1" />
+      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/Weather.cs" Line="62" Column="67" />
+      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs" Line="6" Column="36" />
+      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs" Line="264" Column="70" />
     </Files>
     <Pads>
       <Pad Id="ProjectPad">
         <State name="__root__">
           <Node name="HDL_APP_Project" expanded="True">
             <Node name="HDL_ON" expanded="True">
+              <Node name="Common" expanded="True" />
               <Node name="UI" expanded="True">
                 <Node name="UI2" expanded="True">
                   <Node name="3-Intelligence" expanded="True">
                     <Node name="Automation" expanded="True">
-                      <Node name="LogicView" expanded="True">
-                        <Node name="TipPopView.cs" selected="True" />
-                      </Node>
+                      <Node name="LogicView" expanded="True" />
+                      <Node name="InpOrOutLogicMethod.cs" selected="True" />
                     </Node>
                   </Node>
                 </Node>
               </Node>
             </Node>
             <Node name="HDL-ON_Android" expanded="True">
-              <Node name="Assets" expanded="True">
-                <Node name="Phone" expanded="True">
-                  <Node name="LogicIcon" expanded="True" />
-                </Node>
-              </Node>
+              <Node name="Assets" expanded="True" />
+            </Node>
+            <Node name="HDL-ON_iOS" expanded="True">
+              <Node name="Resources" expanded="True" />
             </Node>
           </Node>
         </State>
diff --git a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide
index 7f4fef9..67c1851 100644
--- a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide
+++ b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide
Binary files differ
diff --git a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-shm b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-shm
index b5a78e8..c73269f 100644
--- a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-shm
+++ b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-shm
Binary files differ
diff --git a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal
index ed1186c..eb216f1 100644
--- a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal
+++ b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal
Binary files differ
diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini
index 0e530c5..0de03e7 100644
--- a/HDL-ON_Android/Assets/Language.ini
+++ b/HDL-ON_Android/Assets/Language.ini
@@ -561,6 +561,15 @@
 7098=鏅村ぉ
 7099=澶氫簯
 7100=涓嬮洦
+7101=*璇峰湪杩欎釜鑼冨洿(1~100)璁剧疆鍊笺��
+7102=杩樻病鏈夎缃�笺��
+7103=浼�:0~35ug/m鲁
+7104=鑹�:35~75ug/m鲁
+7105=杞诲害姹℃煋:75~115ug/m鲁
+7106=涓害姹℃煋:115~150ug/m鲁
+7107=閲嶅害姹℃煋:>150ug/m鲁
+
+
 
 
 9000=璇蜂娇鐢ㄦ柊鐨勬墜鏈鸿处鍙风櫥褰旳PP
diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini
index 0e530c5..9a5866c 100644
--- a/HDL-ON_iOS/Resources/Language.ini
+++ b/HDL-ON_iOS/Resources/Language.ini
@@ -561,6 +561,13 @@
 7098=鏅村ぉ
 7099=澶氫簯
 7100=涓嬮洦
+7101=*璇峰湪杩欎釜鑼冨洿(1~100)璁剧疆鍊笺��
+7102=杩樻病鏈夎缃�笺��
+7103=浼�:0~35ug/m鲁
+7104=鑹�:35~75ug/m鲁
+7105=杞诲害姹℃煋:75~115ug/m鲁
+7106=涓害姹℃煋:115~150ug/m鲁
+7107=閲嶅害姹℃煋:>150ug/m鲁
 
 
 9000=璇蜂娇鐢ㄦ柊鐨勬墜鏈鸿处鍙风櫥褰旳PP
diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs
index b08bfd4..99da5bb 100644
--- a/HDL_ON/Common/R.cs
+++ b/HDL_ON/Common/R.cs
@@ -555,6 +555,14 @@
         public const int clearday =7098;
         public const int cloudy= 7099;
         public const int rain = 7100;
+        public const int setvalue = 7101;
+        public const int nullvalue = 7102;
+        public const int pmyou = 7103;
+        public const int pmliang = 7104;
+        public const int pmqingdu= 7105;
+        public const int pmzhongdu = 7106;
+        public const int pmzhongduwuran= 7107;
+
 
 
         #region LE鏂板
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index 47fb936..bcd03de 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -170,6 +170,60 @@
                             }
                         }
                         break;
+                    case "4":
+                        {
+                            inputView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png";
+                            string strtext = "";
+                            string strvalue = "";
+                            foreach (var dic in dicList)
+                            {
+                                string key = dic["key"];
+                                string comparator = dic["comparator"];
+                                string value = dic["value"];
+
+                                switch (key)
+                                {
+                                    case "outdoor_temp":
+                                        {
+                                            strvalue = value;
+                                            if (comparator==">") {
+                                                strtext = Language.StringByID(StringId.wendugaoyu);
+                                            }
+                                            else  if(comparator == "<"){
+                                                strtext = Language.StringByID(StringId.wendudiyu);
+                                            }
+
+                                        }
+                                        break;
+                                    case "outdoor_humity":
+                                        {
+                                            strvalue = value;
+                                            if (comparator == ">")
+                                            {
+                                                strtext = Language.StringByID(StringId.shidugaoyu);
+                                            }
+                                            else if (comparator == "<")
+                                            {
+                                                strtext = Language.StringByID(StringId.shidudiyu);
+                                            }
+
+                                        }
+                                        break;
+                                    case "pm2.5":
+                                        {
+                                            strtext = Language.StringByID(StringId.PM25);
+                                            strvalue = new OutdoorEnvironment { }.GetString(value);
+                                        }
+                                        break;
+
+                                }
+
+                               
+                            }
+                            inputView.btnText.Text = strtext;
+                            inputView.btnState.Text = strvalue;
+                        }
+                        break;
                     case "6":
                         {
                             inputView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png";
@@ -223,7 +277,6 @@
                             break;
                         }
                     }
-
                     //鏍囪缂栬緫鐘舵��
                     bool edit = true;
                     switch (button.Name)
@@ -291,6 +344,69 @@
                                 MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                             }
                             break;
+                        case "4":
+                            {
+                                ///褰撳墠鐨勭储寮曞�兼暟鎹璞�
+                                Input inputedit = Logic.currlogic.input[indexVulae];
+                                ///鐘舵�佸��
+                                string stateValue = "";
+                                ///鐘舵�佸�兼枃鏈�
+                                int intValue = -1;
+                                foreach (var dic in inputedit.condition)
+                                {
+                                    string key = dic["key"];
+                                    string comparator = dic["comparator"];
+                                    stateValue = dic["value"];
+                                    switch (key)
+                                    {
+                                        case "outdoor_temp":
+                                            {
+                                                if (comparator == ">")
+                                                {
+                                                    intValue=StringId.wendugaoyu;
+                                                }
+                                                else if (comparator == "<")
+                                                {
+                                                    intValue = StringId.wendudiyu;
+                                                  
+                                                }
+
+                                            }
+                                            break;
+                                        case "outdoor_humity":
+                                            {
+
+                                                if (comparator == ">")
+                                                {
+                                                    intValue = StringId.shidugaoyu;
+                                                }
+                                                else if (comparator == "<")
+                                                {
+                                                    intValue = StringId.shidudiyu;
+                                                }
+
+                                            }
+                                            break;
+                                        case "pm2.5":
+                                            {
+                                                intValue = StringId.PM25;
+                                            }
+                                            break;
+
+                                    }
+                                }
+                                OutdoorEnvironment outdoorEnvironment = new OutdoorEnvironment();
+                                if (intValue == StringId.PM25)
+                                {
+                                    outdoorEnvironment.PmAction(thisView, stateValue);
+                                }
+                                else
+                                {
+                                    outdoorEnvironment.InputBoxAction(intValue, stateValue);
+                                }
+
+                            }
+                            break;
                         case "6":
                             {
 
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs
index 4bf15c4..227b2e0 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs
@@ -361,9 +361,8 @@
         /// </summary>
         /// <param name="titleId">鏍囬鏂囨湰</param>
         /// <param name="tnputEditTxet">鏄剧ず鏂囨湰</param>
-        /// <param name="errorId_IsNullOrEmpty">杈撳叆妗嗘湰鏂囦负绌鸿嚜瀹氫箟鎻愮ず閿欒鏂囨湰</param>
         /// <param name="confirmAction">鍥炶皟鍑芥暟</param>
-        public void InputBox1(int titleId, string tnputEditTxet, int errorId_IsNullOrEmpty, Action<string> confirmAction)
+        public void InputBox(int titleId, string tnputEditTxet, Action<string> confirmAction)
         {
             Dialog dialog = new Dialog()
             {
@@ -425,13 +424,7 @@
                 IsNumberKeyboardType=true,
             };
             editBjView.AddChidren(editText);
-
-            editText.MouseUpEventHandler += (sen, e) =>
-            {
-                if (!editText.Foucs)
-                    editText.Foucs = true;
-
-            };
+         
             Button btn_subtract = new Button
             {
                 X = Application.GetRealWidth(17),
@@ -452,27 +445,29 @@
             whiteView.AddChidren(btn_add);
             btn_subtract.MouseUpEventHandler += (sender, e) =>
             {
+                
                 string editTextValue = editText.Text;
                 if (!string.IsNullOrEmpty(editTextValue))
                 {
                     int intValue = int.Parse(editTextValue);
-                    if (intValue - 1 >= 0)
+                    if (intValue>1)
                     {
                         editText.Text = (intValue - 1).ToString();
-                        editText.Foucs = false;
+                       
                     }
                 }
+               
             };
             btn_add.MouseUpEventHandler += (sender, e) =>
             {
+                
                 string editTextValue = editText.Text;
                 if (!string.IsNullOrEmpty(editTextValue))
                 {
                     int intValue = int.Parse(editTextValue);
-                    if (intValue - 1 <= 100)
+                    if (intValue <100)
                     {
                         editText.Text = (intValue + 1).ToString();
-                        editText.Foucs = false;
                     }
                 }
             };
@@ -529,9 +524,22 @@
 
             btnConfirm.MouseUpEventHandler += (sender, e) =>
             {
+                string errorId_IsNullOrEmpty = "";
                 if (string.IsNullOrEmpty(editText.Text.Trim()))
                 {
-
+                    errorId_IsNullOrEmpty = Language.StringByID(StringId.nullvalue);
+                }
+                else
+                {
+                    var editTextValue = editText.Text.Trim();
+                    int intValue = int.Parse(editTextValue);
+                    if (intValue <= 0 || intValue > 100)
+                    {
+                        errorId_IsNullOrEmpty = Language.StringByID(StringId.setvalue);
+                    }
+                }
+                if (errorId_IsNullOrEmpty!="")
+                {
                     whiteView.Height = Application.GetRealHeight(183);
                     btnLine.Y = whiteView.Height - Application.GetRealHeight(44 + 1);
                     btnCancel.Y = btnLine.Bottom;
@@ -539,17 +547,16 @@
                     btnConfirm.Y = btnLine.Bottom;
                     btnConfirm.Gravity = Gravity.BottomRight;
 
-                    btnTip.X = Application.GetRealWidth(24);
+                    btnTip.X = Application.GetRealWidth(53);
                     btnTip.Y = editBjView.Bottom + Application.GetRealHeight(12);
-                    btnTip.Width = Application.GetRealWidth(222);
+                    btnTip.Width = Application.GetRealWidth(200);
                     btnTip.Height = Application.GetRealHeight(17);
-                    btnTip.Text = Language.StringByID(errorId_IsNullOrEmpty);
+                    btnTip.Text = errorId_IsNullOrEmpty;
                     btnTip.TextColor = CSS_Color.textRedColor;
                     btnTip.TextSize = TextSize.text12;
                     btnTip.TextAlignment = TextAlignment.CenterLeft;
                     return;
                 }
-
 
                 confirmAction(editText.Text.Trim());
                 dialog.Close();
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs
index f21e81e..b5166a6 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs
@@ -1,5 +1,6 @@
 锘縰sing System;
 using Shared;
+using System.Collections.Generic;
 namespace HDL_ON.UI.UI2.Intelligence.Automation
 {
     public class OutdoorEnvironment : FrameLayout
@@ -48,7 +49,7 @@
 
             //婀垮害楂樹簬
             LogicView.SelectTypeView humidityhigherView = new LogicView.SelectTypeView();
-            humidityhigherView.frameLayout.Y = temperatureunderView.frameLayout.Bottom+Application.GetRealHeight(8);
+            humidityhigherView.frameLayout.Y = temperatureunderView.frameLayout.Bottom + Application.GetRealHeight(8);
             humidityhigherView.btnIcon.Visible = false;
             humidityhigherView.btnText.X = Application.GetRealWidth(16);
             humidityhigherView.btnLine.X = Application.GetRealWidth(16);
@@ -65,24 +66,16 @@
             humidityunderView.btnText.TextID = StringId.shidudiyu;
             viewLayout.AddChidren(humidityunderView.FLayoutView());
 
-            //PM2.5楂樹簬
+            //PM2.5
             LogicView.SelectTypeView pmhigherView = new LogicView.SelectTypeView();
             pmhigherView.frameLayout.Y = humidityunderView.frameLayout.Bottom + Application.GetRealHeight(8);
             pmhigherView.btnIcon.Visible = false;
             pmhigherView.btnText.X = Application.GetRealWidth(16);
             pmhigherView.btnLine.X = Application.GetRealWidth(16);
             pmhigherView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
-            pmhigherView.btnText.TextID = StringId.pmgaoyu;
+            pmhigherView.btnText.TextID = StringId.PM25;
             viewLayout.AddChidren(pmhigherView.FLayoutView());
-            //PM2.5浣庝簬
-            LogicView.SelectTypeView pmunderView = new LogicView.SelectTypeView();
-            pmunderView.frameLayout.Y = pmhigherView.frameLayout.Bottom;
-            pmunderView.btnIcon.Visible = false;
-            pmunderView.btnText.X = Application.GetRealWidth(16);
-            pmunderView.btnLine.X = Application.GetRealWidth(16);
-            pmunderView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
-            pmunderView.btnText.TextID = StringId.pmdiyu;
-            viewLayout.AddChidren(pmunderView.FLayoutView());
+          
 
             #endregion
 
@@ -90,41 +83,231 @@
             //娓╁害楂樹簬
             temperaturehigherView.btnClick.MouseUpEventHandler += (sen, e) =>
             {
+                InputBoxAction(StringId.wendugaoyu);
 
-                new LogicView.TipPopView { }.InputBox1(1,"",1,(s)=> { });
             };
             //娓╁害浣庝簬
             temperatureunderView.btnClick.MouseUpEventHandler += (sen, e) =>
             {
-              
+                InputBoxAction(StringId.wendudiyu);
             };
 
             //婀垮害楂樹簬
             humidityhigherView.btnClick.MouseUpEventHandler += (sen, e) =>
             {
-               
 
+                InputBoxAction(StringId.shidugaoyu);
             };
             //婀垮害浣庝簬
             humidityunderView.btnClick.MouseUpEventHandler += (sen, e) =>
             {
-               
+                InputBoxAction(StringId.shidudiyu);
             };
 
-            //PM2.5楂樹簬
+            //PM2.5
             pmhigherView.btnClick.MouseUpEventHandler += (sen, e) =>
             {
-               
+                PmAction(this);
 
             };
-            //PM2.5浣庝簬
-            pmunderView.btnClick.MouseUpEventHandler += (sen, e) =>
-            {
-               
-            };
+          
 
             #endregion
         }
-       
+        /// <summary>
+        /// 娓╁害,婀垮害寮规璁剧疆鍊�
+        /// </summary>
+        /// <param name="textInt">鏂囨湰</param>
+        /// <param name="stateValue">缂栬緫涔嬪墠鐨勭姸鎬佸��,榛樿涓�20</param>
+        public void InputBoxAction(int textInt,string stateValue="20")
+        {
+            new LogicView.TipPopView { }.InputBox(textInt, stateValue, (value) =>
+            {
+                string keyValue = "";
+                string comparator = "=";
+                switch (textInt)
+                {
+                    case StringId.wendugaoyu:
+                        {
+                            keyValue = "outdoor_temp";
+                            comparator = ">";
+                        }
+                        break;
+                    case StringId.wendudiyu:
+                        {
+                            keyValue = "outdoor_temp";
+                            comparator = "<";
+                        }
+                        break;
+                    case StringId.shidugaoyu:
+                        {
+                            keyValue = "outdoor_humity";
+                            comparator = ">";
+                        }
+                        break;
+                    case StringId.shidudiyu:
+                        {
+                            keyValue = "outdoor_humity";
+                            comparator = "<";
+                        }
+                        break;
+                }
+
+                AddDic(keyValue, comparator, value);
+            });
+        }
+        /// <summary>
+        /// 娓╁害,婀垮害寮规璁剧疆鍊�
+        /// </summary>
+        /// <param name="frame">褰撳墠鐣岄潰</param>
+        /// <param name="stateValue">缂栬緫涔嬪墠鐨勭姸鎬佸��,榛樿涓�""</param>
+        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)
+               , (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";
+                   }
+                   AddDic("pm2.5", "=", value);
+               });
+        }
+        /// <summary>
+        /// 灏佽鏁版嵁
+        /// </summary>
+        /// <param name="keyValue">绫诲瀷鍊�(pm2.5锛沷utdoor_temp锛沷utdoor_humity)</param>
+        /// <param name="comparator">姣旇緝鍏崇郴</param>
+        /// <param name="value">鍊�</param>
+        private void AddDic(string keyValue, string comparator, string value)
+        {
+            Input input = new Input();
+            input.sid = LogicMethod.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);
+            input.condition.Add(dic);
+            AddCondition(input, keyValue, comparator);
+        }
+        /// <summary>
+        /// 娣诲姞鏉′欢
+        /// </summary>
+        /// <param name="input"></param>
+        /// <param name="keyValue"></param>
+        /// <param name="comparator">姣旇緝鍏崇郴</param>
+        private void AddCondition(Input input, string keyValue,string comparator)
+        {
+            ///璁板綍绱㈠紩鍊�
+            int index = -1;
+            for (var i = 0; i < Logic.currlogic.input.Count; i++)
+            {
+                var condition_type = Logic.currlogic.input[i].condition_type;
+                if (condition_type == "4")
+                {
+                    var dicList = Logic.currlogic.input[i].condition;
+                    if (ExistKey(dicList, keyValue, comparator))
+                    {
+                        ///鎵惧埌鏍囪绱㈠紩锛岄��鍑哄惊鐜綋
+                        index = i;
+                        break;
+                    }
+                }
+            }
+            if (index != -1)
+            {
+                //绉婚櫎鏃ф暟鎹�
+                Logic.currlogic.input.RemoveAt(index);
+                //鏂版暟鎹彃鍏ユ棫鏁版嵁鐨勪綅缃�
+                Logic.currlogic.input.Insert(index, input);
+            }
+            else
+            {
+                Logic.currlogic.input.Add(input);
+            }
+
+            LogicMethod.RemoveAllView();
+            AddLogic addLogic = new AddLogic();
+            MainPage.BasePageView.AddChidren(addLogic);
+            addLogic.Show();
+            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+
+        }
+        /// <summary>
+        /// 鍒ゆ柇鏄惁瀛樺湪Key
+        /// </summary>
+        /// <param name="dicList"></param>
+        /// <param name="keyValue"></param>
+        /// <param name="comparator">姣旇緝鍏崇郴</param>
+        /// <returns></returns>
+        private bool ExistKey(List<Dictionary<string, string>> dicList, string keyValue, string comparator) 
+        {
+            for (int i = 0; i < dicList.Count; i++)
+            {
+                var dic = dicList[i];
+                string key = dic["key"];
+                string comparatorValue = dic["comparator"];
+                if (key == keyValue && comparatorValue == comparator)
+                {
+                    //鍒ゆ柇鏄惁瀛樺湪
+                    return true;
+                }
+            }
+            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 efc5426..536cc06 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
@@ -462,6 +462,17 @@
                       };
                     }
                     break;
+                case "pm2.5":
+                    {
+                        list = new List<string> {
+             Language.StringByID(StringId.pmyou),
+             Language.StringByID(StringId.pmliang),
+             Language.StringByID(StringId.pmqingdu),
+             Language.StringByID(StringId.pmzhongdu),
+             Language.StringByID(StringId.pmzhongduwuran),
+                      };
+                    }
+                    break;
 
             }
             return list;
@@ -636,5 +647,7 @@
 
             return stateList;
         }
+
+
     }
 }
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs
index 34870f5..c8a71b6 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs
@@ -99,16 +99,16 @@
         /// <param name="value"></param>
         private void AddDic(string value)
         {
-            Input inputTime = new Input();
-            inputTime.sid = LogicMethod.NewSid();
-            inputTime.condition_type = "6";
+            Input input = new Input(); 
+            input.sid = LogicMethod.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);
-            inputTime.condition.Add(dic);
-            AddCondition(inputTime);
+            input.condition.Add(dic);
+            AddCondition(input);
         }
         /// <summary>
         /// 娣诲姞鏉′欢

--
Gitblit v1.8.0