From 3c08c6a18196f5802c623959bfcecdb7707cd13d Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 03 八月 2023 13:30:07 +0800
Subject: [PATCH] 0-10v小模块bug修复,

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicSeriesSettingPage.cs |  125 +++++++++++++++++++++++++++++++----------
 HDL_ON/DAL/DriverLayer/UdpSocket.cs                               |    2 
 HDL_ON/DAL/Server/HttpUtil.cs                                     |    4 
 HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs          |    2 
 HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs                     |   23 ++++++-
 HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs              |    3 
 SiriIntents/Server/HttpUtil.cs                                    |    4 
 7 files changed, 121 insertions(+), 42 deletions(-)

diff --git a/HDL_ON/DAL/DriverLayer/UdpSocket.cs b/HDL_ON/DAL/DriverLayer/UdpSocket.cs
index 4bb4c7f..17acf0f 100644
--- a/HDL_ON/DAL/DriverLayer/UdpSocket.cs
+++ b/HDL_ON/DAL/DriverLayer/UdpSocket.cs
@@ -125,9 +125,9 @@
                 Console.WriteLine("asyncBeginReceive " + relinkCount	);
 				if (relinkCount == 0)
 				{
+					relinkCount = 1;
 					asyncBeginReceive();
 				}
-				relinkCount = 1;
                 Console.WriteLine($"asyncBeginReceive {e.Message}");
             } 
 		}
diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs
index f356d18..2ef648a 100644
--- a/HDL_ON/DAL/Server/HttpUtil.cs
+++ b/HDL_ON/DAL/Server/HttpUtil.cs
@@ -18,8 +18,8 @@
         /// 鍥哄畾鍩熷悕,姝e紡鐜
         /// 鍏叡鍩熷悕灏辫繎瑙f瀽
         /// </summary>
-        public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
-        //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
+        //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
+        public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
         const string APP_KEY = "HDL-HOME-APP-TEST";
         const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss";
         //public const string GlobalRequestHttpsHost = "http://59.41.255.150:7777";//mmmm
diff --git a/HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs b/HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs
index 30afa04..6bc91dc 100644
--- a/HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs
@@ -378,9 +378,9 @@
             //鏃ユ湡
             var btnDatetime = new Button()
             {
-                X = Application.GetRealWidth(259),
+                X = Application.GetRealWidth(249),
                 Y = btnTilte.Bottom + Application.GetRealHeight(4),
-                Width = Application.GetRealWidth(100),
+                Width = Application.GetRealWidth(110),
                 Height = Application.GetRealHeight(17),
                 TextAlignment = TextAlignment.CenterRight,
                 TextColor = CSS_Color.PromptingColor1,
@@ -406,7 +406,7 @@
             };
 
 
-            btnDatetime.Text = GetUnixToDateTime(pushMessageInfo.createTime);
+            btnDatetime.Text = GetUnixToDateTime2(pushMessageInfo.createTime);
 
             EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
             {
@@ -438,6 +438,23 @@
         }
 
         /// <summary>
+        /// 鏃堕棿鏍煎紡杞崲澶勭悊
+        /// </summary>
+        /// <param name="time">姣鏃堕棿鎴�</param>
+        /// <returns></returns>
+        string GetUnixToDateTime2(long time)
+        {
+            try
+            {
+                return Utlis.UnixToDateTimeWithFormatMS(time, "yyyy-MM-dd HH:mm");
+            }
+            catch (Exception ex)
+            {
+                return "";
+            }
+        }
+
+        /// <summary>
         /// 鍒犻櫎鎺ㄩ�佹秷鎭�
         /// <param name="pushMessageInfo"></param>
         /// <param name="rowView"></param>
diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs
index 9eba782..dc454e8 100644
--- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs
+++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs
@@ -143,7 +143,7 @@
                 //}.Show(MainPage.BaseView);
                 return;
             }
-            if (function.spk == SPK.LightDimming || function.spk == SPK.LightRGB)
+            if (function.spk == SPK.LightDimming || function.spk == SPK.LightRGB || function.spk == SPK.LightCCT)
             {
                 dimmerControlBar.OnStartTrackingTouchEvent = (sender, e) => {
                     onDimmerBar = true;
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs
index f50d241..52ec4a5 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs
@@ -54,7 +54,8 @@
 
             var colorfulRgbList = FunctionList.List.GetLightList().FindAll((obj) => obj.spk == SPK.LightRGB
             && obj.GetAttributes().Contains(FunctionAttributeKey.Colorful));
-            if (colorfulRgbList.Count > 0)
+            //var seriesList = FunctionList.List.GetSeries();
+            if (colorfulRgbList.Count > 0 || FunctionList.List.GetSeries().Count>0)
             {
                 LogicView.SelectTypeView seriesView = new LogicView.SelectTypeView();
                 seriesView.frameLayout.Y = securityView.frameLayout.Bottom;
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicSeriesSettingPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicSeriesSettingPage.cs
index c25a654..a8dc5e0 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicSeriesSettingPage.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicSeriesSettingPage.cs
@@ -26,10 +26,58 @@
             };
             bodyView.AddChidren(contentView);
 
+            #region 鎵惧嚭鎵�鏈夊簭鍒楃殑oid
+            List<string> oidList = new List<string>();
+
+            foreach (var rgb in list)
+            {
+                var oid = rgb.sid.Substring(0, 16);
+                if (!oidList.Contains(oid))
+                {
+                    oidList.Add(oid);
+                }
+            }
+
             var seriesList = FunctionList.List.GetSeries();
 
-            foreach(var rgb in list)
+            foreach(var temp in seriesList)
             {
+                var oid = temp.sid.Substring(0, 16);
+                if (!oidList.Contains(oid))
+                {
+                    oidList.Add(oid);
+                }
+            }
+            #endregion
+
+
+            //Dictionary<string, List<string>> deviceList = new Dictionary<string, List<string>>();
+            //foreach(var oid in oidList)
+            //{
+            //    var sidList = FunctionList.List.
+
+            //    if (!deviceList.ContainsKey(oid))
+            //    {
+            //        deviceList.Add(oid)
+            //    }
+            //}
+
+            foreach(var oid in oidList)
+            {
+                Function rgb = null;
+                rgb = list.Find((obj) => obj.sid.Substring(0, 16) == oid);
+                if(rgb == null)
+                {
+                    rgb = FunctionList.List.GetLightList().Find((obj) => obj.spk == SPK.LightRGB && obj.sid.Substring(0, 16) == oid);
+                    if (rgb == null)
+                    {
+                        rgb = FunctionList.List.GetLightList().Find((obj) => obj.spk == SPK.LightCCT && obj.sid.Substring(0, 16) == oid);
+                        if (rgb == null)
+                        {
+                            rgb = FunctionList.List.GetLightList().Find((obj) => obj.spk == SPK.LightDimming && obj.sid.Substring(0, 16) == oid);
+                        }
+                    }
+                }
                 var titleView = new FrameLayout()
                 {
                     Height = Application.GetRealHeight(44),
@@ -49,37 +97,40 @@
                 };
                 titleView.AddChidren(btnViewTitle);
 
-                var autoColorfulView = new FrameLayout()
+                if (rgb.GetAttribute(FunctionAttributeKey.Colorful) != null)
                 {
-                    Height = Application.GetRealHeight(44),
-                    BackgroundColor = CSS.CSS_Color.MainBackgroundColor,
-                };
-                contentView.AddChidren(autoColorfulView);
-                autoColorfulView.AddChidren(new Button() { Width = Application.GetRealWidth(343), Gravity = Gravity.BottomCenter, Height = 1, BackgroundColor = CSS.CSS_Color.DividingLineColor, Y = Application.GetRealHeight(44) - 1 });
+                    var autoColorfulView = new FrameLayout()
+                    {
+                        Height = Application.GetRealHeight(44),
+                        BackgroundColor = CSS.CSS_Color.MainBackgroundColor,
+                    };
+                    contentView.AddChidren(autoColorfulView);
+                    autoColorfulView.AddChidren(new Button() { Width = Application.GetRealWidth(343), Gravity = Gravity.BottomCenter, Height = 1, BackgroundColor = CSS.CSS_Color.DividingLineColor, Y = Application.GetRealHeight(44) - 1 });
 
-                Button btnAutoColorfulRight = new Button()
-                {
-                    X = Application.GetRealWidth(339),
-                    Gravity = Gravity.CenterVertical,
-                    Width = Application.GetMinRealAverage(16),
-                    Height = Application.GetMinRealAverage(16),
-                    UnSelectedImagePath = "Public/Right.png",
-                };
-                autoColorfulView.AddChidren(btnAutoColorfulRight);
+                    Button btnAutoColorfulRight = new Button()
+                    {
+                        X = Application.GetRealWidth(339),
+                        Gravity = Gravity.CenterVertical,
+                        Width = Application.GetMinRealAverage(16),
+                        Height = Application.GetMinRealAverage(16),
+                        UnSelectedImagePath = "Public/Right.png",
+                    };
+                    autoColorfulView.AddChidren(btnAutoColorfulRight);
 
-                var btnAutoColorfulTitle = new Button()
-                {
-                    X = Application.GetRealWidth(16),
-                    TextAlignment = TextAlignment.CenterLeft,
-                    TextSize = CSS.CSS_FontSize.TextFontSize,
-                    TextColor = CSS.CSS_Color.FirstLevelTitleColor,
-                    TextID = StringId.Auto,
-                };
-                autoColorfulView.AddChidren(btnAutoColorfulTitle);
-                btnAutoColorfulTitle.MouseUpEventHandler = (sender, e) =>
-                {
-                    LoadEditDialog_OnOff(rgb.sid,true);
-                };
+                    var btnAutoColorfulTitle = new Button()
+                    {
+                        X = Application.GetRealWidth(16),
+                        TextAlignment = TextAlignment.CenterLeft,
+                        TextSize = CSS.CSS_FontSize.TextFontSize,
+                        TextColor = CSS.CSS_Color.FirstLevelTitleColor,
+                        TextID = StringId.Auto,
+                    };
+                    autoColorfulView.AddChidren(btnAutoColorfulTitle);
+                    btnAutoColorfulTitle.MouseUpEventHandler = (sender, e) =>
+                    {
+                        LoadEditDialog_OnOff(rgb.sid, true);
+                    };
+                }
 
                 var rgbSeriesList = seriesList.FindAll((obj) => obj.sid.Substring(0, 16) == rgb.sid.Substring(0, 16));
                 foreach(var rgbSeries in rgbSeriesList)
@@ -252,6 +303,10 @@
 
 
                 Output outputDevice = new Output();
+                outputDevice.target_type = "1";
+                outputDevice.sid = sid;
+                outputDevice.delay = "0";
+
                 List<Dictionary<string, string>> dicSateteList = new List<Dictionary<string, string>>();
 
                 Dictionary<string, string> diction = new Dictionary<string, string>();
@@ -268,10 +323,16 @@
 
                 outputDevice.status = dicSateteList;
 
-                var oldTemp = Logic.currlogic.output.Find((obj) => obj.sid.Substring(0, 16) == sid.Substring(0, 16));
-                if (oldTemp != null)
+                try
                 {
-                    Logic.currlogic.output.Remove(oldTemp);
+                    var oldTemp = Logic.currlogic.output.Find((obj) => obj.sid != null && obj.sid.Length > 16 && obj.sid.Substring(0, 16) == sid.Substring(0, 16));
+                    if (oldTemp != null)
+                    {
+                        Logic.currlogic.output.Remove(oldTemp);
+                    }
+                }catch(Exception ex)
+                {
+                    MainPage.Log($"鑷姩鍖栦繚瀛樿窇椹伅鏁版嵁寮傚父:{ex.Message}");
                 }
                 Logic.currlogic.output.Add(outputDevice);
 
diff --git a/SiriIntents/Server/HttpUtil.cs b/SiriIntents/Server/HttpUtil.cs
index 8d4483c..dc7aca0 100644
--- a/SiriIntents/Server/HttpUtil.cs
+++ b/SiriIntents/Server/HttpUtil.cs
@@ -16,8 +16,8 @@
         /// 鍥哄畾鍩熷悕,姝e紡鐜
         /// 鍏叡鍩熷悕灏辫繎瑙f瀽
         /// </summary>
-        public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
-        //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
+        //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
+        public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
         const string APP_KEY = "HDL-HOME-APP-TEST";
         const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss";
         //public const string GlobalRequestHttpsHost = "http://59.41.255.150:7777";//mmmm

--
Gitblit v1.8.0