From 3f6685c77beeb12baf840733fb890860f4c26e7c Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期四, 25 七月 2024 17:25:59 +0800
Subject: [PATCH] 2024年07月25日17:24:45

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

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
index 91ba766..14b8c93 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -131,7 +131,7 @@
         /// <param name="dic">Dictionary绫�</param>
         /// <param name="key">鍋�</param>
         /// <param name="value">鍊�</param>
-        public void dictionary(Dictionary<string, string> dic, string key, string value)
+        public void dictionary(Dictionary<string, string> dic, string key, string value)  
         {
             if (dic.ContainsKey(key)) //鍒ゆ柇鏄惁瀛樺湪閿��
             {
@@ -187,7 +187,10 @@
             var list2 = this.GetVideoDeviceList();
             list.AddRange(list1);
             list.AddRange(list2);
+            list.AddRange(FunctionList.List.groupControls);
+#if DEBUG
             //GetTestDevice(ref list, true);
+#endif
             return list;
         }
         /// <summary>
@@ -203,7 +206,7 @@
                 function.spk = videoDevice.spk;
                 function.name = videoDevice.deviceName;
                 function.deviceId = videoDevice.deviceId;
-                function.online = videoDevice.status == "online";
+                function.setOnine( videoDevice.status == "online");
                 function.sid = videoDevice.sid;
                 var video = functionList.Find((o) => o.deviceId == function.deviceId);
                 if (video == null)
@@ -356,134 +359,25 @@
             {
                 return "MusicIcon/localMusic.png";
             }
-            else if (SPK.SensorPm10 == device.spk)
+            else if (SPK.SensorPm10 == device.spk
+                || SPK.SensorPirHold == device.spk
+               )
             {
                 return "LogicIcon/sensor.png";
             }
-            else if (SPK.DoorLock == device.spk)
+            else if (SPK.DoorLock == device.spk
+                || SPK.VideoDoorLock == device.spk)
             {
                 return "FunctionIcon/DoorLock/DoorLock.png";
             }
-            //LogicIcon/heatlogic.png"
+            else if (SPK.ElectricalTvHisense == device.spk)
+            {
+                return "LogicIcon/electricaltvhisense.png";
+            }
             return $"FunctionIcon/Icon/{device.IconName}.png";
 
         }
-        /// <summary>
-        /// 鑾峰彇璁惧绫诲瀷鍥炬爣(宸插純鐢� 2022骞�11鏈�25鏃�14:07:30)
-        /// </summary>
-        /// <param name="functionType">璁惧绫诲瀷</param>
-        /// <returns></returns>
-        public string GetIconPath(string spk)
-        {
-            string strPath = "";
-            switch (spk)
-            {
-                case SPK.IpCam_Imou:
-                    {
-                        strPath = $"FunctionIcon/Icon/{SPK.IpCam_Imou.Replace(".", "")}.png";
-                    }
-                    break;
-                case SPK.MechanicalArm:
-                    {
-                        strPath = "LogicIcon/lightloguc.png";
-                    }
-                    break;
-                case SPK.doorgate:
-                    {
-                        strPath = "VideoIcon/keshiduijiang.png";
-                    }
-                    break;
-                case SPK.AirSwitch:
-                    {
-                        strPath = "FunctionIcon/Icon/electricalbreaker.png";
-                    }
-                    break;
-                case SPK.PanelSocket:
-                case SPK.ElectricSocket:
-                    {
-                        strPath = "FunctionIcon/Icon/electricalsocket.png";
-                    }
-                    break;
-                case SPK.LightSwitch:
-                case SPK.LightRGB:
-                case SPK.LightRGBW:
-                case SPK.LightCCT:
-                case SPK.LightDimming:
-                    {
-                        strPath = "LogicIcon/lightloguc.png";
-                    }
-                    break;
-                case SPK.CurtainSwitch:
-                case SPK.CurtainRoller:
-                case SPK.CurtainTrietex:
-                case SPK.CurtainDream:
-                    {
-                        strPath = "LogicIcon/curtainlogic.png";
-                    }
-                    break;
-                case SPK.AcStandard:
-                case SPK.AcIr:
-                case SPK.HvacAC:
-                    {
-                        strPath = "LogicIcon/airconditionerlogic.png";
-                    }
-                    break;
-                case SPK.HvacCac:
-                    strPath = "FunctionIcon/Icon/hvaccac.png";
-                    break;
-                case SPK.FloorHeatStandard:
-                case SPK.HvacFloorHeat:
-                    {
-                        strPath = "LogicIcon/heatlogic.png";
-                    }
-                    break;
-                case SPK.AirFreshStandard:
-                case SPK.HvacAirFresh:
-                    {
-                        strPath = "LogicIcon/heatlogic.png";
-                    }
-                    break;
-                case SPK.SensorSmoke:
-                case SPK.SensorWater:
-                case SPK.SensorGas:
-                case SPK.SensorDryContact:
-                case SPK.SensorDryContact2:
-                case SPK.SensorShanLan:
-                case SPK.SensorDuiShe:
-                case SPK.SensorPir:
-                case SPK.SensorDoorWindow:
-                case SPK.SensorUtrasonic:
-                case SPK.SensorMmvPose:
-                case SPK.SenesorMegahealth:
-                case SPK.SenesorMegahealth2:
-                case SPK.SensorEnvironment:case SPK.SensorEnvironmentHailin:
-                case SPK.SensorEnvironment2:
-                case SPK.SensorEnvironment3:
-                case SPK.SensorTemperature:
-                case SPK.SensorHumidity:
-                case SPK.SensorCO2:
-                case SPK.SensorPm25:
-                case SPK.SensorTVOC:
-                case SPK.SensorHcho:
-                case SPK.SensorHelp:
-                    {
-                        strPath = "LogicIcon/sensor.png";
-                    }
-                    break;
-                case SPK.DoorLock:
-                    {
-                        strPath = "FunctionIcon/DoorLock/DoorLock.png";
-                    }
-                    break;
-                case SPK.MusicStandard:
-                case SPK.AvMusic:
-                    {
-                        strPath = "MusicIcon/localMusic.png";
-                    }
-                    break;
-            }
-            return strPath;
-        }
+       
         #region   鍔ㄤ竴鏀逛笁
         /// <summary>
         /// 璁惧绫诲瀷鐨勫垪琛�(鐏厜绫伙紝绐楀笜绫汇�傘�傘��)
@@ -494,7 +388,15 @@
         {
             List<string> deviceStrTypeList = new List<string>();
             deviceStrTypeList.Clear();
-           
+
+            //缇ゆ帶
+            var gp = deviceList.Find((device) =>
+                device.spk == SPK.GroupControl);
+            if (gp != null)
+            {
+                deviceStrTypeList.Add(Language.StringByID(StringId.GroupControl));
+            }
+
             ///鐏厜绫�
             var lightjosn = deviceList.Find((device) =>
             device.spk == SPK.LightSwitch
@@ -502,6 +404,7 @@
             || device.spk == SPK.LightCCT
             || device.spk == SPK.LightRGB
             || device.spk == SPK.LightRGBW
+            || device.spk == SPK.OtherCommon
             );
             if (lightjosn != null)
             {
@@ -519,7 +422,7 @@
                 deviceStrTypeList.Add(Language.StringByID(StringId.Curtain));
             }
             ///绌鸿皟绫�
-            var ac = deviceList.Find((device) => device.spk == SPK.AcStandard || device.spk == SPK.AcIr || device.spk == SPK.HvacAC);
+            var ac = deviceList.Find((device) => device.spk == SPK.AcStandard || device.spk == SPK.HvacAC|| device.spk == SPK.AcIr);
             if (ac != null)
             {
                 deviceStrTypeList.Add(Language.StringByID(StringId.AC));
@@ -561,6 +464,8 @@
                           || device.spk == SPK.SensorHcho
                           || device.spk == SPK.SensorHelp
                           || device.spk == SPK.SensorPm10
+                          || device.spk == SPK.SensorPirHold
+                          || device.spk == SPK.SensorLight
             );
             if (sensor != null)
             {
@@ -571,13 +476,15 @@
             device.spk == SPK.AirSwitch
             || device.spk == SPK.PanelSocket
             || device.spk == SPK.ElectricSocket
+            || device.spk == SPK.ElectricalTvHisense
             );
             if (electric != null)
             {
                 deviceStrTypeList.Add(Language.StringByID(StringId.Electric));
             }
             ///闂ㄩ攣绫�
-            var doorlock = deviceList.Find((device) => device.spk == SPK.DoorLock);
+            var doorlock = deviceList.Find((device) => device.spk == SPK.DoorLock
+            || device.spk == SPK.VideoDoorLock);
             if (doorlock != null)
             {
                 deviceStrTypeList.Add(Language.StringByID(StringId.DoorLock));
@@ -603,7 +510,7 @@
             }
             ///鎽勫儚澶寸被
             var camera = deviceList.Find((device) =>
-            device.spk == SPK.IpCam_Imou);
+            device.spk == SPK.IpCam_Imou || device.spk == SPK.Ev_Ipcam || device.spk == SPK.Peephole);
             if (camera != null)
             {
                 deviceStrTypeList.Add(Language.StringByID(StringId.shexiangtou));
@@ -631,6 +538,12 @@
                 functionTypeList.Add(SPK.AirSwitch);
                 functionTypeList.Add(SPK.PanelSocket);
                 functionTypeList.Add(SPK.ElectricSocket);
+                functionTypeList.Add(SPK.OtherCommon);
+            }
+            //缇ゆ帶
+            else if (deviceType == Language.StringByID(StringId.GroupControl))
+            {
+                functionTypeList.Add(SPK.GroupControl);
             }
             ///绐楀笜绫�
             else if (deviceType == Language.StringByID(StringId.Curtain))
@@ -684,6 +597,8 @@
                 functionTypeList.Add(SPK.SensorHcho);
                 functionTypeList.Add(SPK.SensorHelp);
                 functionTypeList.Add(SPK.SensorPm10);
+                functionTypeList.Add(SPK.SensorPirHold);
+                functionTypeList.Add(SPK.SensorLight);
 
 
             }
@@ -693,11 +608,13 @@
                 functionTypeList.Add(SPK.AirSwitch);
                 functionTypeList.Add(SPK.PanelSocket);
                 functionTypeList.Add(SPK.ElectricSocket);
+                functionTypeList.Add(SPK.ElectricalTvHisense);
             }
             ///闂ㄩ攣绫�
             else if (deviceType == Language.StringByID(StringId.DoorLock))
             {
                 functionTypeList.Add(SPK.DoorLock);
+                functionTypeList.Add(SPK.VideoDoorLock);
             }
             ///闊充箰绫�
             else if (deviceType == Language.StringByID(StringId.Music))
@@ -719,10 +636,15 @@
             else if (deviceType == Language.StringByID(StringId.shexiangtou))
             {
                 functionTypeList.Add(SPK.IpCam_Imou);
+                functionTypeList.Add(SPK.Ev_Ipcam);
+                functionTypeList.Add(SPK.Peephole);
             }
             else
             {
                 //鍏ㄩ儴鍖哄煙
+                functionTypeList.Add(SPK.GroupControl);
+                functionTypeList.Add(SPK.Peephole);
+                functionTypeList.Add(SPK.Ev_Ipcam);
                 functionTypeList.Add(SPK.LightSwitch);
                 functionTypeList.Add(SPK.LightDimming);
                 functionTypeList.Add(SPK.LightRGB);
@@ -776,6 +698,12 @@
                 functionTypeList.Add(SPK.MechanicalArm);
                 functionTypeList.Add(SPK.IpCam_Imou);
                 functionTypeList.Add(SPK.SensorPm10);
+                functionTypeList.Add(SPK.VideoDoorLock);
+                functionTypeList.Add(SPK.AcIr);
+                functionTypeList.Add(SPK.SensorPirHold);
+                functionTypeList.Add(SPK.ElectricalTvHisense);
+                functionTypeList.Add(SPK.SensorLight);
+                functionTypeList.Add(SPK.OtherCommon);
 
             }
 
@@ -794,6 +722,8 @@
             {
                 case condition_if:
                     {
+                        deviceTypeList.Add(SPK.Ev_Ipcam);
+                        deviceTypeList.Add(SPK.Peephole);
                         deviceTypeList.Add(SPK.LightSwitch);
                         deviceTypeList.Add(SPK.LightRGB);
                         deviceTypeList.Add(SPK.LightRGBW);
@@ -835,11 +765,16 @@
                         deviceTypeList.Add(SPK.doorgate);
                         deviceTypeList.Add(SPK.IpCam_Imou);
                         deviceTypeList.Add(SPK.SensorPm10);
+                        deviceTypeList.Add(SPK.VideoDoorLock);
+                        deviceTypeList.Add(SPK.AcIr);
+                        deviceTypeList.Add(SPK.SensorPirHold);
+                        deviceTypeList.Add(SPK.SensorLight);
 
                     }
                     break;
                 case target_if:
                     {
+                        deviceTypeList.Add(SPK.GroupControl);
                         deviceTypeList.Add(SPK.LightSwitch);
                         deviceTypeList.Add(SPK.LightRGB);
                         deviceTypeList.Add(SPK.LightRGBW);
@@ -858,6 +793,9 @@
                         deviceTypeList.Add(SPK.MusicStandard);
                         deviceTypeList.Add(SPK.AvMusic);
                         deviceTypeList.Add(SPK.MechanicalArm);
+                        deviceTypeList.Add(SPK.AcIr);
+                        deviceTypeList.Add(SPK.ElectricalTvHisense);
+                        deviceTypeList.Add(SPK.OtherCommon);
                     }
                     break;
             }
@@ -933,6 +871,63 @@
             get
             {
                 return Entity.DB_ResidenceData.Instance.CurrentRegion.isOtherShare;
+            }
+        }
+        /// <summary>
+        /// 鎷兼帴鏃堕棿鏍煎紡//"{h}h{m}min{s}s";
+        /// </summary>
+        /// <param name="totalSeconds">绉�(娌℃湁榛樿浼犲叆0)</param>
+        /// <returns></returns>
+        public string getTimeStr(string totalSeconds)
+        {
+            try
+            {
+                if (string.IsNullOrEmpty(totalSeconds))
+                {
+                    return "";
+                }
+                int time = int.Parse(totalSeconds);
+                int h = time / (60 * 60);
+                int m = time % (60 * 60) / 60;
+                int s = (time % (60 * 60) % 60);
+
+                if (h == 0 && m != 0 && s != 0)
+                {
+                    return $"{m}min{s}s";
+                }
+                else if (h == 0 && m == 0 && s != 0)
+                {
+                    return $"{s}s";
+                }
+                else if (h == 0 && m != 0 && s == 0)
+                {
+                    return $"{m}min";
+                }
+                else if (h != 0 && m == 0 && s != 0)
+                {
+                    return $"{h}h{s}s";
+                }
+                else if (h != 0 && m == 0 && s == 0)
+                {
+                    return $"{h}h";
+                }
+                else if (h != 0 && m != 0 && s == 0)
+                {
+                    return $"{h}h{m}min";
+                }
+                else if (h != 0 && m != 0 && s != 0)
+                {
+                    return $"{h}h{m}min{s}s";
+                }
+                else if (h == 0 && m == 0 && s == 0)
+                {
+                    return $"0s";
+                }
+                return "";
+            }
+            catch
+            {
+                return "";
             }
         }
 
@@ -1085,18 +1080,17 @@
                 //涓嶆槸涓昏处鍙风洿鎺ヨ繑鍥�
                 return;
             }
-            List<LogicData> logicDataList = new List<LogicData>();
+            List<LogicIdData> logicDataList = new List<LogicIdData>();
             logicDataList.Clear();
             System.Threading.Tasks.Task.Run(() =>
             {
                 try
                 {
                     //鑾峰彇閫昏緫ID鍒楄〃锛岀洰鍓嶉拡瀵规墍鏈�<澶囨敞:濡傛灉鍙拡瀵瑰綋鍓嶆墜鏈虹殑璇濓紝鍙互鐩存帴鎷跨紦瀛樻暟鎹嚜鍔ㄥ寲鍒楄〃閬嶅巻>
-                    var idStr = Send.Current.GetLogicIdList();
-                    if (idStr != null)
+                    var idStrList = Send.Current.GetLogicIdList(); 
+                    if (idStrList != null)
                     {
-                        var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data);
-                        logicDataList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date);
+                        logicDataList.AddRange(idStrList);
                     }
                     ///鏈夎嚜鍔ㄥ垪琛ㄦ墠澶勭悊
                     if (logicDataList.Count > 0)
@@ -1173,17 +1167,23 @@
             {
                 //妯℃嫙璁惧
                 var functions = new List<Function> {
-                 //new Entity.Function { sid = "1234567890", name = "瓒呭0娉紶鎰熷櫒", spk = Entity.SPK.SensorUtrasonic },
-                 // new Entity.Function { sid = "1234567891", name = "娓╁害浼犳劅鍣�", spk = Entity.SPK.SensorTemperature },
-                 //  new Entity.Function { sid = "1234567892", name = "婀垮害浼犳劅鍣�", spk = Entity.SPK.SensorHumidity },
-                    new Entity.Function { sid = "12345678933456", name = "璋冨厜鐏�", spk = Entity.SPK.LightDimming },
-                      new Entity.Function { sid = "1234567895444", name = "闈㈡澘", spk = Entity.SPK.PanelSocket },
-                      new Entity.Function { sid = "12345678968888", name = "pm10", spk = Entity.SPK.SensorPm10 },
+                 new Entity.Function { sid = "1234567890", name = "鍏夌収浼犳劅鍣�", spk = Entity.SPK.SensorLight },
+                  new Entity.Function { sid = "1234567891", name = "骞茶妭鐐�", spk = Entity.SPK.SensorDryContact },
+                   new Entity.Function { sid = "1234567892", name = "绱ф�ユ眰鍔╀紶鎰熷櫒", spk = Entity.SPK.SensorHelp },
+                        new Entity.Function { sid = "12345678921", name = "閫氱敤寮�鍏�", spk = Entity.SPK.OtherCommon },
+                    //new Entity.Function { sid = "12345678933456", name = "闂ㄩ攣", spk = Entity.SPK.DoorLock },
+                    //  new Entity.Function { sid = "1234567895444", name = "瑙嗛闂ㄩ攣", spk = Entity.SPK.VideoDoorLock },
+                      new Entity.Function { sid = "123456789688889", name = "浜轰綋瀛樺湪浼犳劅鍣�", spk = Entity.SPK.SensorPirHold },
+                      new Entity.Function { sid = "12345678968888", name = "娴嬭瘯鐚溂", spk = Entity.SPK.Peephole },
+                      new Entity.Function { sid = "12345678968889", name = "娴嬭瘯钀ょ煶鎽勫儚澶�", spk = Entity.SPK.Ev_Ipcam },
                       //  new Entity.Function { sid = "1234567897", name = "姣背娉紶鎰熷櫒1", spk = Entity.SPK.SenesorMegahealth2 },
                       // new Entity.Function { sid = "1234567899", name = "闂ㄧ浼犳劅鍣�", spk = Entity.SPK.SensorDoorWindow },
                       //  new Entity.Function { sid = "12345678991234", name = "HDL鏈烘鎵�", spk = Entity.SPK.MechanicalArm },
                       //    new Entity.Function { sid = "123456789912345", name = "娴锋浖鏈烘鎵�", spk = Entity.SPK.MechanicalArm },
-                      //        new Entity.Function { sid = "12345678991234566", name = "娴锋浖鏈烘鎵�", spk = Entity.SPK.MechanicalArm },
+                              new Entity.Function { sid = "12345678991234566844", name = "澶у崕鎽勫儚澶�", spk = Entity.SPK.IpCam_Imou },
+                                 new Entity.Function { sid = "12345678991234567", name = "RGB", spk = Entity.SPK.LightRGB },
+                                  new Entity.Function { sid = "123456789912345678", name = "RGBW", spk = Entity.SPK.LightRGBW },
+                                     new Function { spk = SPK.ElectricalTvHisense, name = "娴蜂俊鐢佃1",sid="123456789"},
             };
                 foreach (var function in functions)
                 {

--
Gitblit v1.8.0