From f11472b25796a83f70d526b13f2b0cba24c665f2 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期三, 06 五月 2020 18:00:09 +0800
Subject: [PATCH] 2020-05-06-3

---
 ZigbeeApp/Shared/Phone/Device/Logic/Method.cs |   38 ++++++++++++++++++++++++++++++++++++--
 1 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
index 3c2d150..c484111 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
@@ -766,9 +766,43 @@
 
             if (Config.Instance.Home.IsVirtually)
             {
-                Send.Zj(LogicView.IfString.Tag, Common.Logic.CurrentLogic);
+                if (CurrentLogic.LogicId == 0)
+                {
+                    bool d = false;
+                    for (int i = 1; i < 50; i++)
+                    {
+                        for (int j = 0; j < Common.Logic.LogicList.Count; j++)
+                        {
+                            if (i != Common.Logic.LogicList[j].LogicId)
+                            {
+                                CurrentLogic.LogicId = i;
+                                Common.Logic.LogicList.Add(CurrentLogic);
+                                d = true;
+                                break;
+                            }
+                        }
+                        if (d)
+                        {
+                            break;
+                        }
+                    }
+
+                }
+                else
+                {
+                    for (int j = 0; j < Common.Logic.LogicList.Count; j++)
+                    {
+                        if (j == Common.Logic.LogicList[j].LogicId)
+                        {
+                            Common.Logic.LogicList.RemoveAt(j);
+                            Common.Logic.LogicList.Insert(j,CurrentLogic);
+                            break;
+                        }
+                    }
+
+                }
+
                 //鑷姩鍖栭�昏緫鍒楄〃
-                Common.Logic.LogicList.Add(CurrentLogic);
             }
             else
             {

--
Gitblit v1.8.0