From aed01bdfb53f21d5cf5365feb563087f855ed4fe Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期日, 26 九月 2021 20:01:15 +0800
Subject: [PATCH] 2021-9-26-01

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 53 insertions(+), 7 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
index bd54b23..4b91725 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -13,6 +13,10 @@
             Tag = "Logic";
         }
         /// <summary>
+        /// 褰撳墠閫変腑鐨勫姛鑳�
+        /// </summary>
+        private Entity.Function function = null;
+        /// <summary>
         /// 瀹氫箟涓�涓褰曢�変腑璁惧鐘舵�佸垪琛紱
         /// </summary>
         private List<Dictionary<string, string>> dicSateteList = new List<Dictionary<string, string>>();
@@ -23,6 +27,7 @@
 
         public void Show(Entity.Function device, int index, bool edit)
         {
+            this.function = device;
             #region 鐣岄潰甯冨眬
             this.BackgroundColor = CSS.CSS_Color.viewMiddle;
             LogicView.TopView topView = new LogicView.TopView();
@@ -467,23 +472,47 @@
                 switch (device.spk)
                 {
                     //浼犳劅鍣�
+                    case SPK.SensorGas:
                     case SPK.SensorWater:
                     case SPK.SensorSmoke:
-                    case SPK.SensorGas:
-                    case SPK.SensorDryContact:
-                    case SPK.SensorShanLan:
-                    case SPK.SensorDuiShe:
-                    case SPK.SensorPir:
+                        {
+                            keyVlaue = "status";
+                            if (!Is_SpkAttribute(keyVlaue)) {
+                                keyVlaue = "alarm_status";
+                            } 
+                        };
+                        break;
                     case SPK.SensorDoorWindow:
+                    case SPK.SensorDryContact:
+                        {
+                            keyVlaue = "status";
+                            if (!Is_SpkAttribute(keyVlaue))
+                            {
+                                keyVlaue = "contact_status";
+                            }
+                        }
+                        break;
+                    case SPK.SensorDuiShe:
+                    case SPK.SensorShanLan:
+                    case SPK.SensorPir:
                     case SPK.SensorUtrasonic:
                         {
                             keyVlaue = "status";
+                            if (!Is_SpkAttribute(keyVlaue))
+                            {
+                                keyVlaue = "people_status";
+                            }
+
                         }
                         break;
                     case SPK.SenesorMegahealth:
                     case SPK.SenesorMegahealth2:
                         {
                             keyVlaue = "action_state";
+                            if (!Is_SpkAttribute(keyVlaue))
+                            {
+                                keyVlaue = "megahealth_state";
+                            }
                         }
                         break;
 
@@ -657,8 +686,10 @@
                        case SPK.SensorTVOC:
                        case SPK.SensorHcho:
                            {
-                               ///鍏徃浼犳劅鍣╧ey鐨勫仴鍊兼槸鈥渧alue鈥濓紱
-                               key = "value";
+                               if (!Is_SpkAttribute(key))
+                               {
+                                   key = "value";
+                               }
                            }
                            break;
                    }
@@ -808,6 +839,21 @@
             return false;
         }
 
+        /// <summary>
+        /// 璇嗗埆浣跨敤鍔熻兘鏄惁瀛樺湪灞炴��
+        /// </summary>
+        /// <param name="key">璁惧灞炴�э紝浜戦泙涓婂畾涔夊ソ鐨�</param>
+        /// <returns></returns>
+        private bool Is_SpkAttribute(string key) {
+            ///淇敼鏂板睘鎬�
+            ///璇嗗埆浣跨敤鍔熻兘鏄惁瀛樺湪灞炴��
+            var job = this.function.GetAttribute(key);
+            if (job != null)
+            {
+                return true;
+            }
+            return false;
+        }
        
     }
 }

--
Gitblit v1.8.0