From 07c91e3b27d10bad17ad2f805aab7b74e24fad2b Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 06 十一月 2023 14:58:48 +0800
Subject: [PATCH] 场景增加配置自动化使能;安防增加干接点触发条件

---
 HDL_ON/Entity/Function/Scene.cs |  184 +++++++++++++++++++++++++++------------------
 1 files changed, 109 insertions(+), 75 deletions(-)

diff --git a/HDL_ON/Entity/Function/Scene.cs b/HDL_ON/Entity/Function/Scene.cs
index 35fba28..9065ef5 100644
--- a/HDL_ON/Entity/Function/Scene.cs
+++ b/HDL_ON/Entity/Function/Scene.cs
@@ -3,6 +3,7 @@
 using HDL_ON.Common;
 using HDL_ON.DAL.Server;
 using HDL_ON.UI;
+using HDL_ON.UI.UI2.Intelligence.Automation;
 using Shared;
 
 namespace HDL_ON.Entity
@@ -561,10 +562,23 @@
         /// <returns></returns>
         private Function ConvertFunctionObject()
         {
-            var localFunction = FunctionList.List.GetDeviceFunctionList().Find((obj) => obj.sid == sid);
-            if(localFunction == null)
+            if (type == "7")
             {
-                localFunction = FunctionList.List.groupControls.Find((obj) => obj.sid == sid);
+                var logic = Logic.LogicList.Find((obj) => obj.sid == sid);
+                if (logic != null) {
+                    _localFunction = new Function()
+                    {
+                        name = logic.name
+                    };
+                }
+            }
+            else
+            {
+                var localFunction = FunctionList.List.GetDeviceFunctionList().Find((obj) => obj.sid == sid);
+                if (localFunction == null)
+                {
+                    localFunction = FunctionList.List.groupControls.Find((obj) => obj.sid == sid);
+                }
             }
             return localFunction;
         }
@@ -577,91 +591,109 @@
         public string GetFunctionScnenInfo()
         {
             var sceneFunctionInfo = "";
-            foreach (var sfs in status)
+            if (type == "7")
             {
-                if (sfs.key == FunctionAttributeKey.OnOff)
+                foreach (var sfs in status)
                 {
-                    if (sfs.value == "off")
+                    if (sfs.key == "enable")
                     {
-                        return Language.StringByID(StringId.Close);
+                        if (sfs.value == "true")
+                            return Language.StringByID(StringId.OpenArm);
+                        else
+                        {
+                            return Language.StringByID(StringId.Close);
+                        }
                     }
                 }
             }
-            sceneFunctionInfo += Language.StringByID(StringId.Open) + " ";
+            else
+            {
+                foreach (var sfs in status)
+                {
+                    if (sfs.key == FunctionAttributeKey.OnOff)
+                    {
+                        if (sfs.value == "off")
+                        {
+                            return Language.StringByID(StringId.Close);
+                        }
+                    }
+                }
+                sceneFunctionInfo += Language.StringByID(StringId.Open) + " ";
 
-            var modeState = status.Find((obj) => obj.key == FunctionAttributeKey.Mode);
-            var tempState = status.Find((obj) => obj.key == FunctionAttributeKey.SetTemp);
-            var fanState = status.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed);
-            ////娴蜂俊鐢佃鐘舵��
-            //var hisenseTvState = status.Find((obj) => obj.key == "wol");
-            //if(hisenseTvState != null)
-            //{
-            //}
-            if (modeState != null)
-            {
-                sceneFunctionInfo += modeState.GetValueText() + " ";
-            }
-            if (tempState != null)
-            {
-                sceneFunctionInfo += tempState.GetValueText();
-                sceneFunctionInfo += tempState.GetUintString() + " ";
-            }
-            if (fanState != null)
-            {
-                sceneFunctionInfo += fanState.GetValueText() + " ";
-            }
-            var briState = status.Find((obj) => obj.key == FunctionAttributeKey.Brightness);
-            if (briState != null)
-            {
-                sceneFunctionInfo += briState.value + "%" + " ";
-            }
-            var perState = status.Find((obj) => obj.key == FunctionAttributeKey.Percent);
-            if (perState != null)
-            {
-                sceneFunctionInfo += perState.value + "%" + " ";
-            }
-            var cctState = status.Find((obj) => obj.key == FunctionAttributeKey.CCT);
-            if (cctState != null)
-            {
-                sceneFunctionInfo += cctState.value + "K" + " ";
-            }
-            var rgbState = status.Find((obj) => obj.key == FunctionAttributeKey.RGB);
-            if (rgbState != null)
-            {
-                //sceneFunctionInfo += new  cctState.value + "%" + " ";
-            }
+                var modeState = status.Find((obj) => obj.key == FunctionAttributeKey.Mode);
+                var tempState = status.Find((obj) => obj.key == FunctionAttributeKey.SetTemp);
+                var fanState = status.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed);
+                ////娴蜂俊鐢佃鐘舵��
+                //var hisenseTvState = status.Find((obj) => obj.key == "wol");
+                //if(hisenseTvState != null)
+                //{
+                //}
+                if (modeState != null)
+                {
+                    sceneFunctionInfo += modeState.GetValueText() + " ";
+                }
+                if (tempState != null)
+                {
+                    sceneFunctionInfo += tempState.GetValueText();
+                    sceneFunctionInfo += tempState.GetUintString() + " ";
+                }
+                if (fanState != null)
+                {
+                    sceneFunctionInfo += fanState.GetValueText() + " ";
+                }
+                var briState = status.Find((obj) => obj.key == FunctionAttributeKey.Brightness);
+                if (briState != null)
+                {
+                    sceneFunctionInfo += briState.value + "%" + " ";
+                }
+                var perState = status.Find((obj) => obj.key == FunctionAttributeKey.Percent);
+                if (perState != null)
+                {
+                    sceneFunctionInfo += perState.value + "%" + " ";
+                }
+                var cctState = status.Find((obj) => obj.key == FunctionAttributeKey.CCT);
+                if (cctState != null)
+                {
+                    sceneFunctionInfo += cctState.value + "K" + " ";
+                }
+                var rgbState = status.Find((obj) => obj.key == FunctionAttributeKey.RGB);
+                if (rgbState != null)
+                {
+                    //sceneFunctionInfo += new  cctState.value + "%" + " ";
+                }
 
 
-            var perAngle = status.Find((obj) => obj.key == FunctionAttributeKey.Angle);
-            if (perAngle != null)
-            {
-                sceneFunctionInfo += " " + perAngle.value + "掳";
-            }
+                var perAngle = status.Find((obj) => obj.key == FunctionAttributeKey.Angle);
+                if (perAngle != null)
+                {
+                    sceneFunctionInfo += " " + perAngle.value + "掳";
+                }
 
-            var perSetVolume = status.Find((obj) => obj.key == FunctionAttributeKey.SetVolume);
-            if (perSetVolume != null)
-            {
-                sceneFunctionInfo += " " + perSetVolume.value;
-            }
+                var perSetVolume = status.Find((obj) => obj.key == FunctionAttributeKey.SetVolume);
+                if (perSetVolume != null)
+                {
+                    sceneFunctionInfo += " " + perSetVolume.value;
+                }
 
-            var perSignal = status.Find((obj) => obj.key == FunctionAttributeKey.Signal);
-            if (perSignal != null)
-            {
-                var p = new HDL_ON.UI.UI2.Intelligence.Automation.PublicInterface();
-                string key = p.GetKey(p.GetHisenseSignalSourceDic(), perSignal.value);
-                sceneFunctionInfo += " " + key;
-            }
+                var perSignal = status.Find((obj) => obj.key == FunctionAttributeKey.Signal);
+                if (perSignal != null)
+                {
+                    var p = new HDL_ON.UI.UI2.Intelligence.Automation.PublicInterface();
+                    string key = p.GetKey(p.GetHisenseSignalSourceDic(), perSignal.value);
+                    sceneFunctionInfo += " " + key;
+                }
 
-            var perVolume =status.Find((obj) => obj.key == FunctionAttributeKey.Volume);
-            if (perVolume != null)
-            {
-                sceneFunctionInfo += " " + perVolume.value;
-            }
+                var perVolume = status.Find((obj) => obj.key == FunctionAttributeKey.Volume);
+                if (perVolume != null)
+                {
+                    sceneFunctionInfo += " " + perVolume.value;
+                }
 
-            var perSongName =status.Find((obj) => obj.key == FunctionAttributeKey.SongName);
-            if (perSongName != null)
-            {
-                sceneFunctionInfo += " " + perSongName.value;
+                var perSongName = status.Find((obj) => obj.key == FunctionAttributeKey.SongName);
+                if (perSongName != null)
+                {
+                    sceneFunctionInfo += " " + perSongName.value;
+                }
             }
             return sceneFunctionInfo;
         }
@@ -670,6 +702,8 @@
         /// 璁惧
         /// 鍦烘櫙 =scene
         /// 缇ゆ帶=5
+        /// 鑷姩鍖�=7
+        /// 
         /// </summary>
         public string type = "0";
     }

--
Gitblit v1.8.0