From fb5f023820eb6783bd62d0d69d9afbd00cd3f426 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期一, 07 十二月 2020 16:50:47 +0800
Subject: [PATCH] 2020-12-07-1

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs |   70 +++++++----------------------------
 1 files changed, 14 insertions(+), 56 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
index 1dbe612..a8ec927 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -55,17 +55,22 @@
 
                 logicId = sOidBeginsWith + sTimeSpan;
 
-                logicId += "0A";
-                logicId += "0A01";
-                //0A01 鐗╂ā鍨嬩负閫昏緫锛� 0001 琛ㄧず 1 鍙烽�昏緫鍔熻兘
-                int iTopLogicId = 1;
+                logicId += "15";
+                logicId += "1501";
+                //1501 鐗╂ā鍨嬩负閫昏緫锛� 0001 琛ㄧず 1 鍙烽�昏緫鍔熻兘
+                int maxId = 1;
 
-                Random random = new Random();
-                iTopLogicId = random.Next(0, 255);
-                iTopLogicId += random.Next(0, 255);
 
-                logicId += iTopLogicId.ToString("X4");//閫昏緫鍙� 涓や釜byte 
-                logicId += "1100";
+                for (int i = 0; i < Logic.LogicList.Count; i++)
+                {
+                    string s = Logic.LogicList[i].sid.Substring(20, 4);
+                    int iThisSceneId = Convert.ToInt16(s, 16);
+                    if (iThisSceneId > maxId)
+                        maxId = iThisSceneId ;
+                }
+
+                logicId += (maxId+1).ToString("X4");//閫昏緫鍙� 涓や釜byte 
+                logicId += "0000";
             }
             catch
             {
@@ -73,53 +78,6 @@
             }
             return logicId;
         }
-
-        /// <summary>
-        /// 鐢熸垚閫昏緫sid鏂规硶
-        /// </summary>
-        //public static string NewSid()
-        //{
-        //    String sLogicid = "";
-        //    try
-        //    {
-        //        String sOidBeginsWith = "000101";//鍘傚晢 + 閫氳鏂瑰紡
-        //        //鐢熸垚4涓猙yte鏃堕棿鎴�
-        //        DateTime dt = DateTime.Now;
-        //        long sTimeSp = GateWay.ConvertDateTimeLong(dt);
-        //        string sTimeSpan = "";
-        //        GateWay.ConvertIntToByteArray(sTimeSp, ref sTimeSpan);
-        //        if (sTimeSpan.Length != 8) return sLogicid;
-        //        //闂撮殧10姣 閿欏紑鏃堕棿鎴�
-        //        HDLUDP.TimeBetwnNext(10);
-        //        sLogicid = sOidBeginsWith + sTimeSpan;
-        //        //1501 鐗╂ā鍨嬩负鑷姩鍖栵紝 0001 琛ㄧず 1 鍙疯嚜鍔ㄥ寲鍔熻兘
-        //        sLogicid += "15";
-        //        sLogicid += "1501";
-        //        //鑷姩鍖栧彿鑷
-        //        int iTopSceneId = 1;
-        //        if (myGateway.LogicResponse != null)
-        //        {
-        //            if (myGateway.LogicResponse.objects != null)
-        //            {
-        //                for (int i = 0; i < myGateway.LogicResponse.objects.Count; i++)
-        //                {
-        //                    string ccc = myGateway.LogicResponse.objects[i].sid.Substring(myGateway.LogicResponse.objects[i].sid.Length - 8, 4);
-        //                    int iThisSceneId = Convert.ToInt16(myGateway.LogicResponse.objects[i].sid.Substring(myGateway.LogicResponse.objects[i].sid.Length - 8, 4), 16);
-        //                    if (iThisSceneId >= iTopSceneId)
-        //                        iTopSceneId = iThisSceneId + 1;
-        //                }
-        //            }
-        //        }
-        //        sLogicid += iTopSceneId.ToString("X4");//鍦烘櫙鍙� 涓や釜byte 
-        //                                               //澶х被灏忕被娌℃湁鐢ㄥ埌 鍥哄畾涓�0
-        //        sLogicid += "0000";
-        //        return sLogicid;
-        //    }
-        //    catch
-        //    {
-        //        return sLogicid;
-        //    }
-        //}
 
         /// <summary>
         /// 灏佽Dictionary瀵硅薄

--
Gitblit v1.8.0