From 1a0ddfcd1a24ed0a14d76362802c974e3d4c86c8 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 31 一月 2023 17:53:29 +0800
Subject: [PATCH] 空调进度控制问题修复

---
 HDL_ON/Entity/FunctionList.cs |   34 ++++++++++++++++++++++------------
 1 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs
index 450ef57..6060289 100644
--- a/HDL_ON/Entity/FunctionList.cs
+++ b/HDL_ON/Entity/FunctionList.cs
@@ -19,7 +19,7 @@
             try
             {
                 _FunctionList._IpCamImou = null;
-                _FunctionList.Clear();
+                _FunctionList.ClearDatas();
                 _FunctionList = null;
             }
             catch (Exception ex)
@@ -331,16 +331,24 @@
                     if (checkRepeat == true)
                     {
                         //妫�娴嬮噸澶�
-                        for (int i = 0; i < Functions.Count; i++)
+                        var same = Functions.FindAll((obj) => obj.deviceId == tempFunction.deviceId);
+                        if(same!= null)
                         {
-                            if (Functions[i].deviceId == tempFunction.deviceId)
+                            foreach(var sameTemp in same)
                             {
-                                //鍏堢Щ闄ゆ帀鍐嶅姞
-                                Functions.RemoveAt(i);
-                                Functions.Add(tempFunction);
-                                return;
+                                Functions.Remove(sameTemp);
                             }
                         }
+                        //for (int i = 0; i < Functions.Count; i++)
+                        //{
+                        //    if (Functions[i].deviceId == tempFunction.deviceId)
+                        //    {
+                        //        //鍏堢Щ闄ゆ帀鍐嶅姞
+                        //        Functions.RemoveAt(i);
+                        //        Functions.Add(tempFunction);
+                        //        return;
+                        //    }
+                        //}
                     }
                     Functions.Add(tempFunction);
                 }
@@ -444,14 +452,16 @@
         /// <summary>
         /// 娓呯┖璁惧鍔熻兘鍒楄〃
         /// </summary>
-        public void Clear()
+        public void ClearDatas()
         {
             try
             {
-                _IpCamImou.Clear();
-                _IpCamImou = null;
-                _FunctionList.Clear();
-                _FunctionList = null;
+                if (_IpCamImou != null)
+                {
+                    _IpCamImou.Clear();
+                    _IpCamImou = null;
+                }
+                _FunctionList = new FunctionList();
             }
             catch (Exception ex)
             {

--
Gitblit v1.8.0