From 02498f7744e6fdc413e518f96b25f3635540dc6b Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 15 十一月 2022 11:27:38 +0800
Subject: [PATCH] 金茂科技系统更新

---
 HDL_ON/Entity/FunctionList.cs |   90 ++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 81 insertions(+), 9 deletions(-)

diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs
index 55d26a3..cdd06aa 100644
--- a/HDL_ON/Entity/FunctionList.cs
+++ b/HDL_ON/Entity/FunctionList.cs
@@ -24,7 +24,11 @@
                     var filePathList = FileUtlis.Files.ReadFiles();
                     foreach (var filePath in filePathList)
                     {
-                        _FunctionList.IniFunctionList(filePath);
+                        try
+                        {
+                            _FunctionList.IniFunctionList(filePath);
+                        }
+                        catch { }
                     }
                     #endregion
                 }
@@ -35,6 +39,34 @@
         /// 鍔熻兘鍒楄〃
         /// </summary>
         public List<Function> Functions = new List<Function>();
+        /// <summary>
+        /// 鏈烘鑷傚垪琛�
+        /// </summary>
+        /// <returns></returns>
+        public List<Function> GetMechanicalArmList()
+        {
+            return Functions.FindAll((obj) => obj.spk == SPK.MechanicalArm);
+        }
+
+        /// <summary>
+        /// 缁垮缓绉戞妧绯荤粺
+        /// 鎬绘帶鍒楄〃
+        /// </summary>
+        /// <returns></returns>
+        public List<Function> GetAcstParentList()
+        {
+            return Functions.FindAll((obj) => obj.spk == SPK.AcstParent);
+        }
+
+        /// <summary>
+        /// 缁垮缓绉戞妧绯荤粺
+        /// 瀛愭帶鍒楄〃
+        /// </summary>
+        /// <returns></returns>
+        public List<Function> GetAcstSubList()
+        {
+            return Functions.FindAll((obj) => obj.spk == SPK.AcstSub);
+        }
 
         /// <summary>
         /// 绌鸿皟鍒楄〃
@@ -98,6 +130,22 @@
             return Functions.FindAll((obj) => spkList.Contains(obj.spk));
         }
 
+        List<InverterInfo> _inverterList = new List<InverterInfo>();
+        /// <summary>
+        /// 鍏変紡鍒楄〃
+        /// </summary>
+        public List<Function> InverterList()
+        {
+            //get
+            //{
+            //    return _inverterList;
+            //}
+            //set
+            //{
+            //    _inverterList = value;
+            //}
+            return Functions.FindAll((obj) => obj.spk == SPK.Inverter);
+        }
         #region 瀹剁數鍒楄〃 electricals
         /// <summary>
         /// 瀹剁數鍒楄〃
@@ -312,25 +360,33 @@
                 switch (brandType)
                 {
                     case SPK.BrandType.Hdl:
-                        foreach (var function in Functions)
+                        try
                         {
-                            if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(function.spk))
+                            foreach (var function in Functions)
                             {
-                                resultFunctions.Add(function);
+                                if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(function.spk))
+                                {
+                                    resultFunctions.Add(function);
+                                }
                             }
                         }
+                        catch { }
                         break;
 
                     case SPK.BrandType.Tuya:
                         lock (Functions)
                         {
-                            foreach (var function in Functions)
+                            try
                             {
-                                if (SPK.Get3tySpk(SPK.BrandType.Tuya).Contains(function.spk))
+                                foreach (var function in Functions)
                                 {
-                                    resultFunctions.Add(function);
+                                    if (SPK.Get3tySpk(SPK.BrandType.Tuya).Contains(function.spk))
+                                    {
+                                        resultFunctions.Add(function);
+                                    }
                                 }
                             }
+                            catch { }
                         }
                         break;
                 }
@@ -459,12 +515,26 @@
 
                     if(DriverLayer.Control.Ins.GatewayOnline_Local)
                     {
+
+                        //List<Function> functions = GetDeviceFunctionList(SPK.BrandType.Hdl);
+                        //var sss = functions.OrderBy((obj) => obj.collect);
+
+                        List<Function> readList = new List<Function>();
                         foreach (var function in GetDeviceFunctionList(SPK.BrandType.Hdl))
                         {
+                            readList.Add(function);
                             MainPage.Log($"璇诲彇鍔熻兘鐘舵�侊細{function.name} : {function.sid} ");
-                            Control.Ins.SendReadCommand(function);
+                            if (readList.Count > 9)
+                            {
+                                Control.Ins.SendReadCommand(readList);
+                                readList.Clear();
+                            }
                         }
-                        if(DB_ResidenceData.Instance.GatewayType == 1)
+                        if (readList.Count > 0)
+                        {
+                            Control.Ins.SendReadCommand(readList);
+                        }
+                        if (DB_ResidenceData.Instance.GatewayType == 1)
                         {
                             Dictionary<string, string> pairs = new Dictionary<string, string>();
                             string sendId = Control.Ins.msg_id.ToString();
@@ -481,6 +551,8 @@
                         var page = new List<string>();
                         int count = 0;
 
+                        //List<Function> functions = GetDeviceFunctionList(SPK.BrandType.Hdl);
+                        //var sss = functions.OrderBy((obj) => obj.collect);
                         foreach (var function in GetDeviceFunctionList(SPK.BrandType.Hdl))
                         {
                             page.Add(function.deviceId);

--
Gitblit v1.8.0