From 884a8ce78b6d198a5878e85fc30cb85177e59826 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 08 八月 2023 10:04:36 +0800
Subject: [PATCH] 三相空开验收

---
 HDL_ON/Entity/Function/Function.cs |   97 ++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 80 insertions(+), 17 deletions(-)

diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs
index a5ec58e..105de09 100644
--- a/HDL_ON/Entity/Function/Function.cs
+++ b/HDL_ON/Entity/Function/Function.cs
@@ -445,20 +445,52 @@
         /// </summary>
         public bool collect = false;
 
-        private bool _online = false;
-        /// <summary>
-        /// 鏄惁鍦ㄧ嚎
-        /// </summary>
-        public bool online
-        {
+        private bool _online;
+        public bool online {
             get
             {
+                if (spk == SPK.AirSwitchP3)
+                {
+                    return _online;
+                }
                 return true;
             }
             set
             {
                 _online = value;
             }
+        }
+        ///// <summary>
+        ///// 鏄惁鍦ㄧ嚎
+        ///// </summary>
+        //public bool online
+        //{
+        //    get
+        //    {
+        //        if(spk == SPK.AirSwitchP3)
+        //        {
+        //            return _online;
+        //        }
+        //        return true;
+        //    }
+        //    set
+        //    {
+        //        _online = value;
+        //    }
+        //}
+
+        public bool isOnline()
+        {
+            if (spk == SPK.AirSwitchP3)
+            {
+                return online;
+            }
+            return true;
+        }
+
+        public void setOnine(bool isOnline)
+        {
+            online = isOnline;
         }
 
         /// <summary>
@@ -813,10 +845,10 @@
                     {
                         foreach (var temp in gc.sids)
                         {
-                            var light = FunctionList.List.GetLightList().Find((obj) => obj.sid == temp.sid);
-                            if (light != null)
+                            var tempDevice = FunctionList.List.GetLightList().Find((obj) => obj.sid == temp.sid);
+                            if (tempDevice != null)
                             {
-                                foreach (var attr in light.attributes)
+                                foreach (var attr in tempDevice.attributes)
                                 {
                                     if (list.Find((obj) => obj.key == attr.key) == null)
                                     {
@@ -850,27 +882,54 @@
                     sFunc.type = "5";
                 }
 
-                string us = "";
                 switch (attr.key)
                 {
                     case FunctionAttributeKey.SetTemp:
+                        var tt = GetAttribute(FunctionAttributeKey.TempType);
+                        if (tt == null)
+                        {
+                            attr.unit = "掳C";
+                        }
+                        else
+                        {
+                            if (tt.unit == string.Empty)
+                            {
+                                attr.unit = "掳C";
+                            }
+                            else
+                            {
+                                if (tt.unit == "C")
+                                {
+                                    attr.unit = "掳C";
+                                }
+                                else if (tt.unit == "F")
+                                {
+                                    attr.unit = "掳F";
+                                }
+                                else
+                                {
+                                    attr.unit = tt.unit;
+                                }
+                            }
+                        }
+                        break;
                     case FunctionAttributeKey.RoomTemp:
-                        us = "掳C";
+                        attr.unit = "掳C";
                         var tempType = attributes.Find((obj) => obj.key == FunctionAttributeKey.TempType);
                         if (tempType != null)
                         {
-                            us = tempType.curValue.ToString();
+                            attr.unit = tempType.curValue.ToString();
                         }
                         break;
                     case FunctionAttributeKey.Percent:
                     case FunctionAttributeKey.Brightness:
-                        us = "%";
+                        attr.unit = "%";
                         break;
                     case FunctionAttributeKey.CCT:
-                        us = "K";
+                        attr.unit = "K";
                         break;
                     case FunctionAttributeKey.Angle:
-                        us = "掳";
+                        attr.unit = "掳";
                         break;
                 }
 
@@ -934,13 +993,13 @@
                                 vv = 26;
                             }
                             sFunc.status.Add(new SceneFunctionStatus() {
-                                UintString = us,
+                                UintString = attr.unit,
                                 key = attr.key, value = Convert.ToInt32(vv).ToString(), max = attr.max, min = attr.min }) ;
                         }
                         else
                         {
                             sFunc.status.Add(new SceneFunctionStatus() {
-                                UintString = us,
+                                UintString = attr.unit,
                                 key = attr.key, value = attr.curValue.ToString(), max = attr.max, min = attr.min });
                         }
                         break;
@@ -1088,6 +1147,10 @@
         /// 浜戠璐熻矗鐢熸垚
         /// </summary>
         public string deviceId = "0";
+        /// <summary>
+        /// 鍦ㄧ嚎鐘舵��
+        /// </summary>
+        public bool online = true;
         public List<AttributesStatus> status = new List<AttributesStatus>();
     }
     /// <summary>

--
Gitblit v1.8.0