From 47fbfe1cd58bb82b45dfc0a5398799bd856b1fb0 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期四, 25 十一月 2021 11:45:12 +0800
Subject: [PATCH] 2021-11-25=01

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs |  134 ++++++++++++++++++++------------------------
 1 files changed, 60 insertions(+), 74 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
index a260eab..ea0ee18 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
@@ -158,9 +158,8 @@
         MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
       });
     }
-
     /// <summary>
-    /// 鍦扮悊鍥存爮View
+    /// 娣诲姞鍦扮悊鍥存爮
     /// </summary>
     /// <param name="flMain">Fl main.</param>
     /// <param name="edit">If set to <c>true</c> edit.</param>
@@ -170,9 +169,8 @@
       ///閫氳繃璋冭瘯瀹濈粰鐨勭粡绾害<鏍囧噯GPS>
       double latitude = Entity.DB_ResidenceData.Instance.CurrentRegion.latitude;//绾害
       double longitude = Entity.DB_ResidenceData.Instance.CurrentRegion.longitude;//缁忓害
-                                                                                  //WGS84鍧愭爣杞珮寰峰潗鏍�
       LogicMethod.CurrLogicMethod.WGS84_to_GCJ02(Entity.DB_ResidenceData.Instance.CurrentRegion.longitude, Entity.DB_ResidenceData.Instance.CurrentRegion.latitude, out longitude, out latitude);
-      int r = 500;//鍗婂緞
+      int r = 500;//榛樿鍗婂緞
       if (edit)
       {
         for (var i = 0; i < Logic.currlogic.input.Count; i++)
@@ -192,18 +190,18 @@
             //绂诲紑鍦扮偣
             strname = Language.StringByID(StringId.likai);
           }
-          //鍐嶄竴娆$紪杈戝湴鐞嗗洿鏍�<鎺т欢鏆傛椂涓嶆敮鎸佹樉绀鸿褰曚笂涓�娆$殑鐘舵��>
-          //if (!string.IsNullOrEmpty(input.geo_fence.latitude) && !string.IsNullOrEmpty(input.geo_fence.longitude))
-          //{
-          //    //绾害
-          //    var latitude1 = Convert.ToDouble(input.geo_fence.latitude);
-          //    //缁忓害
-          //    var longitude1 = Convert.ToDouble(input.geo_fence.longitude);
-          //    //鍗婂緞
-          //    r = int.Parse(input.geo_fence.radius);
-          //    //WGS84鍧愭爣杞珮寰峰潗鏍�
-          //    LogicMethod.CurrLogicMethod.WGS84_to_GCJ02(longitude1, latitude1, out longitude, out latitude);
-          //}
+          //鍐嶄竴娆$紪杈戝湴鐞嗗洿鏍� <鎺т欢鏆傛椂涓嶆敮鎸佹樉绀鸿褰曚笂涓�娆$殑鐘舵��>
+          if (!string.IsNullOrEmpty(input.geo_fence.latitude) && !string.IsNullOrEmpty(input.geo_fence.longitude))
+          {
+            ////绾害
+            //var latitude1 = Convert.ToDouble(input.geo_fence.latitude);
+            ////缁忓害
+            //var longitude1 = Convert.ToDouble(input.geo_fence.longitude);
+            //鍗婂緞
+            r = int.Parse(input.geo_fence.radius);
+            //WGS84鍧愭爣杞珮寰峰潗鏍�
+            //LogicMethod.CurrLogicMethod.WGS84_to_GCJ02(longitude1, latitude1, out longitude, out latitude);
+          }
         }
       }
       PublicInterface publicInterface = new PublicInterface();
@@ -237,37 +235,8 @@
                        ((BaseActivity)Application.Activity).SetPermission((result3) =>
                        {
                          if (result3 == false) { return; }
-
                          //璋冪敤鏂规硶锛岃烦杞〉闈�
-                         GDMapKit.Show((mLatitude, mLongitude, mRadius, name) =>
-                          {
-                            //楂樺痉鍧愭爣杞琖GS84鍧愭爣(楂樺痉鍦板浘璁剧疆GPS)
-                            double out_lng, out_lat;
-                            LogicMethod.CurrLogicMethod.GCJ02_to_WGS84(mLongitude, mLatitude, out out_lng, out out_lat);
-                            Input input = new Input();
-                            input.sid = LogicMethod.CurrLogicMethod.NewSid();
-                            input.condition_type = "8";
-                            Dictionary<string, string> dic = new Dictionary<string, string>();
-                            LogicMethod.CurrLogicMethod.dictionary(dic, "key", "direction");
-                            LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
-                            LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
-                            LogicMethod.CurrLogicMethod.dictionary(dic, "value", valueStr);
-                            input.condition.Add(dic);
-                            //绾害
-                            input.geo_fence.latitude = out_lat.ToString();
-                            //缁忓害
-                            input.geo_fence.longitude = out_lng.ToString();
-                            //鍗婂緞<鍗曚綅绫�>
-                            input.geo_fence.radius = mRadius.ToString();
-                            AddCondition(input);
-                            LogicMethod.CurrLogicMethod.RemoveAllView();
-                            AddLogic addLogic = new AddLogic();
-                            MainPage.BasePageView.AddChidren(addLogic);
-                            addLogic.Show();
-                            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-
-                          }, strname, Language.StringByID(StringId.save), true, latitude, longitude, r);
-
+                         Location(valueStr, strname, latitude, longitude, r);
                        }, "android.permission.READ_PHONE_STATE");
 
                   }, "android.permission.WRITE_EXTERNAL_STORAGE");
@@ -275,40 +244,57 @@
 #endif
 #if __IOS__
                //璋冪敤鏂规硶锛岃烦杞〉闈�
-               GDMapKit.Show((mLatitude, mLongitude, mRadius, name) =>
-               {
-                  //楂樺痉鍧愭爣杞琖GS84鍧愭爣(楂樺痉鍦板浘璁剧疆GPS)
-                  double out_lng, out_lat;
-            LogicMethod.CurrLogicMethod.GCJ02_to_WGS84(mLongitude, mLatitude, out out_lng, out out_lat);
-
-            Input input = new Input();
-            input.sid = LogicMethod.CurrLogicMethod.NewSid();
-            input.condition_type = "8";
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            LogicMethod.CurrLogicMethod.dictionary(dic, "key", "direction");
-            LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
-            LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
-            LogicMethod.CurrLogicMethod.dictionary(dic, "value", "arrive");
-            input.condition.Add(dic);
-                  //绾害
-                  input.geo_fence.latitude = out_lat.ToString();
-                  //缁忓害
-                  input.geo_fence.longitude = out_lng.ToString();
-                  //鍗婂緞<鍗曚綅绫�>
-                  input.geo_fence.radius = mRadius.ToString();
-            AddCondition(input);
-            LogicMethod.CurrLogicMethod.RemoveAllView();
-            AddLogic addLogic = new AddLogic();
-            MainPage.BasePageView.AddChidren(addLogic);
-            addLogic.Show();
-            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-          }, strname, Language.StringByID(StringId.save), true, latitude, longitude, r);
+                  Location(valueStr, strname, latitude, longitude, r);
 #endif
        });
 
 
     }
+    /// <summary>
+    /// 鍦扮悊鍥存爮View
+    /// </summary>
+    /// <param name="valueStr">杩涘叆(arrive)鎴栬�呯寮�(leave)</param>
+    /// <param name="strname"></param>
+    /// <param name="latitude">绾害</param>
+    /// <param name="longitude">缁忓害</param>
+    /// <param name="r">鍗婂緞(榛樿500绫�)</param>
+    private void Location(string valueStr, string strname, double latitude, double longitude, int r)
+    {
+      if (r == 0)
+      {
+        //鎸夐亾鐞嗚涓嶄細鍑虹幇
+        r = 500;
+      }
+      //璋冪敤鏂规硶锛岃烦杞〉闈�
+      GDMapKit.Show((mLatitude, mLongitude, mRadius, name) =>
+      {
+        //楂樺痉鍧愭爣杞琖GS84鍧愭爣(楂樺痉鍦板浘璁剧疆GPS)
+        double out_lng, out_lat;
+        LogicMethod.CurrLogicMethod.GCJ02_to_WGS84(mLongitude, mLatitude, out out_lng, out out_lat);
+        Input input = new Input();
+        input.sid = LogicMethod.CurrLogicMethod.NewSid();
+        input.condition_type = "8";
+        Dictionary<string, string> dic = new Dictionary<string, string>();
+        LogicMethod.CurrLogicMethod.dictionary(dic, "key", "direction");
+        LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
+        LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
+        LogicMethod.CurrLogicMethod.dictionary(dic, "value", valueStr);
+        input.condition.Add(dic);
+        //绾害
+        input.geo_fence.latitude = out_lat.ToString();
+        //缁忓害
+        input.geo_fence.longitude = out_lng.ToString();
+        //鍗婂緞<鍗曚綅绫�>
+        input.geo_fence.radius = mRadius.ToString();
+        AddCondition(input);
+        LogicMethod.CurrLogicMethod.RemoveAllView();
+        AddLogic addLogic = new AddLogic();
+        MainPage.BasePageView.AddChidren(addLogic);
+        addLogic.Show();
+        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
 
+      }, strname, Language.StringByID(StringId.save), true, latitude, longitude, r);
+    }
     /// <summary>
     /// 娣诲姞鏉′欢
     /// </summary>

--
Gitblit v1.8.0