From d538cbe6f5e307122c37cde69b999dc9df30731a Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期五, 22 七月 2022 17:24:32 +0800
Subject: [PATCH] 2022年07月22日17:24:23

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

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
index 9044957..c0f23e1 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -147,7 +147,9 @@
         /// <returns></returns>
         public List<HDL_ON.Entity.Room> GetGatewayRoomList()
         {
-            return HDL_ON.Entity.SpatialInfo.CurrentSpatial.RoomList;
+            return   HDL_ON.Entity.SpatialInfo.CurrentSpatial.RoomList;
+
+            
         }
         /// <summary>
         /// 鑾峰彇缃戝叧鎴块棿鍒楄〃
@@ -180,7 +182,9 @@
         /// <returns></returns>
         public List<HDL_ON.Entity.Function> GetGatewayDeviceList()
         {
-            return Entity.FunctionList.List.GetDeviceFunctionList();
+            var list = Entity.FunctionList.List.GetDeviceFunctionList();
+            return GetTestDevice(list, true);
+            //return list;
         }
         /// <summary>
         /// 鑾峰彇鍦烘櫙鍒楄〃
@@ -586,7 +590,7 @@
             ///闂ㄩ攣绫�
             else if (deviceType == Language.StringByID(StringId.DoorLock))
             {
-                functionTypeList.Add(SPK.DoorLock); 
+                functionTypeList.Add(SPK.DoorLock);
             }
             else
             {
@@ -943,57 +947,57 @@
             {
                 try
                 {
-              //鑾峰彇閫昏緫ID鍒楄〃锛岀洰鍓嶉拡瀵规墍鏈�<澶囨敞:濡傛灉鍙拡瀵瑰綋鍓嶆墜鏈虹殑璇濓紝鍙互鐩存帴鎷跨紦瀛樻暟鎹嚜鍔ㄥ寲鍒楄〃閬嶅巻>
-              var idStr = Send.GetLogicIdList();
+                    //鑾峰彇閫昏緫ID鍒楄〃锛岀洰鍓嶉拡瀵规墍鏈�<澶囨敞:濡傛灉鍙拡瀵瑰綋鍓嶆墜鏈虹殑璇濓紝鍙互鐩存帴鎷跨紦瀛樻暟鎹嚜鍔ㄥ寲鍒楄〃閬嶅巻>
+                    var idStr = Send.GetLogicIdList();
                     if (idStr.Code == "0" && idStr.Data != null && idStr.Data.ToString() != "")
                     {
                         var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data);
                         logicDataList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date);
                     }
-              ///鏈夎嚜鍔ㄥ垪琛ㄦ墠澶勭悊
-              if (logicDataList.Count > 0)
+                    ///鏈夎嚜鍔ㄥ垪琛ㄦ墠澶勭悊
+                    if (logicDataList.Count > 0)
                     {
-                  ///閬嶅巻鎵�鏈夊垪琛�
-                  for (int i = 0; i < logicDataList.Count; i++)
+                        ///閬嶅巻鎵�鏈夊垪琛�
+                        for (int i = 0; i < logicDataList.Count; i++)
                         {
                             var logicDate = logicDataList[i];
-                      ///鑷姩鍖栨病鏈夐厤缃湴鐞嗗洿鏍忎笉澶勭悊
-                      if (string.IsNullOrEmpty(logicDate.geo_fence.latitude) || string.IsNullOrEmpty(logicDate.geo_fence.longitude))
+                            ///鑷姩鍖栨病鏈夐厤缃湴鐞嗗洿鏍忎笉澶勭悊
+                            if (string.IsNullOrEmpty(logicDate.geo_fence.latitude) || string.IsNullOrEmpty(logicDate.geo_fence.longitude))
                             {
-                          //缁忕含搴︿负绌�,璁や负鑷姩鍖栨病鏈夐厤缃湴鐞嗗洿鏍忥紝涓嶅鐞�;
-                          continue;
+                                //缁忕含搴︿负绌�,璁や负鑷姩鍖栨病鏈夐厤缃湴鐞嗗洿鏍忥紝涓嶅鐞�;
+                                continue;
                             }
-                      //鑷姩鍖栭厤缃緭鍏ユ潯浠剁含搴�
-                      double lat = Convert.ToDouble(logicDate.geo_fence.latitude.Replace(",", "."));
-                      //鑷姩鍖栭厤缃緭鍏ユ潯浠剁粡搴�
-                      double lon = Convert.ToDouble(logicDate.geo_fence.longitude.Replace(",", "."));
-                      //鑷姩鍖栭厤缃緭鍏ユ潯浠�<鍦扮悊鍥存爮鍗婂緞><鍗曚綅锛屽叕閲屻�佸崈绫�.绫�>
-                      int radius = int.Parse(logicDate.geo_fence.radius);
-                      //璁$畻2涓粡绾害涔嬮棿鐨勮窛绂�
-                      int r = Infrastructure.Service.Helper.CalculatedDistance.Distance(out_lat, out_lng, lat, lon);
-                      //瀹氫箟涓�涓眬閮ㄥ彉閲�
-                      string direction = string.Empty;
-                      //涓ょ偣璺濈灏忎簬閰嶇疆璺濈<鏃㈣嚜鍔ㄥ寲閰嶇疆杈撳叆鏉′欢鍦扮悊鍥存爮鍗婂緞>,璇存槑杩涘叆鍖哄煙
-                      if (r < radius)
+                            //鑷姩鍖栭厤缃緭鍏ユ潯浠剁含搴�
+                            double lat = Convert.ToDouble(logicDate.geo_fence.latitude.Replace(",", "."));
+                            //鑷姩鍖栭厤缃緭鍏ユ潯浠剁粡搴�
+                            double lon = Convert.ToDouble(logicDate.geo_fence.longitude.Replace(",", "."));
+                            //鑷姩鍖栭厤缃緭鍏ユ潯浠�<鍦扮悊鍥存爮鍗婂緞><鍗曚綅锛屽叕閲屻�佸崈绫�.绫�>
+                            int radius = int.Parse(logicDate.geo_fence.radius);
+                            //璁$畻2涓粡绾害涔嬮棿鐨勮窛绂�
+                            int r = Infrastructure.Service.Helper.CalculatedDistance.Distance(out_lat, out_lng, lat, lon);
+                            //瀹氫箟涓�涓眬閮ㄥ彉閲�
+                            string direction = string.Empty;
+                            //涓ょ偣璺濈灏忎簬閰嶇疆璺濈<鏃㈣嚜鍔ㄥ寲閰嶇疆杈撳叆鏉′欢鍦扮悊鍥存爮鍗婂緞>,璇存槑杩涘叆鍖哄煙
+                            if (r < radius)
                             {
-                          //鍒拌揪鏌愬湴
-                          direction = "arrive";
+                                //鍒拌揪鏌愬湴
+                                direction = "arrive";
                             }
                             else
                             {
-                          //绂诲紑
-                          direction = "leave";
+                                //绂诲紑
+                                direction = "leave";
                             }
-                      ///閬嶅巻缂撳瓨鍒楄〃<涓嶄负绌鸿鏄庢暟鎹凡缁忔帹閫佽繃锛屼笉鍐嶆帹閫�>
-                      var isPush = pushList.Find((o) => o.homeId == HomeId && o.userId == UserInfo.Current.ID && o.userLogicId == logicDate.userLogicId && o.arriveOnLeave == direction);
+                            ///閬嶅巻缂撳瓨鍒楄〃<涓嶄负绌鸿鏄庢暟鎹凡缁忔帹閫佽繃锛屼笉鍐嶆帹閫�>
+                            var isPush = pushList.Find((o) => o.homeId == HomeId && o.userId == UserInfo.Current.ID && o.userLogicId == logicDate.userLogicId && o.arriveOnLeave == direction);
                             if (isPush == null)
                             {
-                          //鎺ㄩ�佺粰浜戠鏄惁鎴愬姛
-                          bool push = Send.GeoFenceStateReport(logicDate.userLogicId, logicDate.sid, direction);
+                                //鎺ㄩ�佺粰浜戠鏄惁鎴愬姛
+                                bool push = Send.GeoFenceStateReport(logicDate.userLogicId, logicDate.sid, direction);
                                 if (push)
                                 {
-                              ///娣诲姞鍒版帹閫佸垪琛�
-                              pushList.Add(new Push
+                                    ///娣诲姞鍒版帹閫佸垪琛�
+                                    pushList.Add(new Push
                                     {
                                         homeId = HomeId,
                                         userId = UserInfo.Current.ID,
@@ -1014,6 +1018,27 @@
         /// 鎺ㄩ�佸垪琛�<杩欓噷鏁版嵁宸茬粡鎺ㄩ�佽繃>
         /// </summary>
         private static List<Push> pushList = new List<Push>();
+        /// <summary>
+        /// 鑾峰彇妯℃嫙鐨勮澶囧垪琛�
+        /// </summary>
+        /// <param name="isBool">鏄惁寮�鍚�</param>
+        /// <returns></returns>
+        private List<Entity.Function> GetTestDevice(List<HDL_ON.Entity.Function> list, bool isBool)
+        {
+            if (isBool)
+            {
+                Entity.Function function = new Entity.Function { sid = "0123456789", name = "瓒呭0娉紶鎰熷櫒", spk = Entity.SPK.SensorUtrasonic };
+                var device = list.Find((o) => { return o.sid == function.sid; });
+                if (device == null)
+                {
+                    list.Add(function);
+                }
+
+            }
+            return list;
+
+
+        }
 
     }
     public class Push

--
Gitblit v1.8.0