From d2ccacb3317aa6310f1b1bb5eb19fbdecba39ff9 Mon Sep 17 00:00:00 2001
From: duheng <2286773002@qq.com>
Date: 星期四, 27 三月 2025 11:50:43 +0800
Subject: [PATCH] 增加设施最高楼层标高字段

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/02-map/SetXhsProjectMapLocationWizardPage.cs |  165 +++++++++++++++++++++++++-----------------------------
 1 files changed, 77 insertions(+), 88 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/02-map/SetXhsProjectMapLocationWizardPage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/02-map/SetXhsProjectMapLocationWizardPage.cs
index 518da8d..9c8659d 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/02-map/SetXhsProjectMapLocationWizardPage.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/02-map/SetXhsProjectMapLocationWizardPage.cs
@@ -1,48 +1,48 @@
-锘縰sing HStation.Vmo;
-using NPOI.HSSF.Record;
-
-namespace HStation.WinFrmUI
+锘縩amespace HStation.WinFrmUI
 {
-    public partial class SetXhsProjectMapLocationWizardPage : DevExpress.XtraEditors.XtraUserControl, Yw.WinFrmUI.IWizardPage<ImportXhsProjectViewModel>
+    public partial class SetXhsProjectMapLocationWizardPage : DevExpress.XtraEditors.XtraUserControl, Yw.WinFrmUI.IWizardPageAsync<ImportXhsProjectViewModel>
     {
         public SetXhsProjectMapLocationWizardPage()
         {
             InitializeComponent();
             this.layoutControl1.SetupLayoutControl();
+            this.mapSetSimpleMarkerContainer1.LoadCompletedEvent += MapSetSimpleMarkerContainer1_LoadCompletedEvent;
+            this.mapSetSimpleMarkerContainer1.SetMarkerEvent += MapSetSimpleMarkerContainer1_SetMarkerEvent;
         }
 
-        private ImportXhsProjectViewModel _vm = null;
+        /// <summary>
+        /// 椤甸潰鐘舵�佸彂鐢熸敼鍙樹簨浠�
+        /// </summary>
+        public event Action PageStateChangedEvent;
+
+        private ImportXhsProjectViewModel _vm = null;//鎿嶄綔瀵硅薄
+        private bool _isInitialize = false;//鏄惁鍒濆鍖�
 
         /// <summary>
         /// 鍒濆鍖�
         /// </summary>
-        public async void InitialPage(ImportXhsProjectViewModel t)
+        public async void InitialPage(ImportXhsProjectViewModel vm)
         {
-            _vm = t;
-            this.mapSetSimpleMarkerContainer1.LoadCompletedEvent += MapSetSimpleMarkerContainer1_LoadCompletedEvent;
-            this.mapSetSimpleMarkerContainer1.SetMarkerEvent += MapSetSimpleMarkerContainer1_SetMarkerEvent;
+            if (_isInitialize)
+            {
+                return;
+            }
+            _vm = vm;
+            _isInitialize = true;
+            this.txtAddress.EditValue = vm.Project.Address;
             await this.mapSetSimpleMarkerContainer1.InitialContainer();
-            PageStateChangedEvent.Invoke();
         }
 
-        /// <summary>
-        /// 鏄惁鍒濆鍖�
-        /// </summary>
-        public bool IsInitialize
-        {
-            get { return _isInitialize; }
-        }
-
-        private bool _isInitialize = false;
-
-        public event Action PageStateChangedEvent;
 
         /// <summary>
         /// 鏄惁鍏佽涓婁竴姝�
         /// </summary>
         public bool AllowPrev
         {
-            get { return true; }
+            get
+            {
+                return true;
+            }
         }
 
         /// <summary>
@@ -50,8 +50,10 @@
         /// </summary>
         public bool AllowNext
         {
-            get { return true; }
-            set { }
+            get
+            {
+                return true;
+            }
         }
 
         /// <summary>
@@ -59,7 +61,10 @@
         /// </summary>
         public bool AllowCancel
         {
-            get { return true; }
+            get
+            {
+                return true;
+            }
         }
 
         /// <summary>
@@ -67,110 +72,94 @@
         /// </summary>
         public bool AllowComplete
         {
-            get { return false; }
-            set { }
+            get
+            {
+                return false;
+            }
         }
 
         /// <summary>
         /// 鑳藉惁涓婁竴姝�
         /// </summary>
-        public bool CanPrev()
+        public Task<bool> CanPrev()
         {
-            return true;
+            return Task.Run(() => true);
         }
 
         /// <summary>
         /// 鑳藉惁涓嬩竴姝�
         /// </summary>
-        public bool CanNext()
+        public Task<bool> CanNext()
         {
-            return true;
+            return Task.Run(() =>
+            {
+                if (string.IsNullOrEmpty(_vm.Project.Address))
+                {
+                    _vm.Project.Address = this.txtAddress.Text.Trim();
+                }
+                return true;
+            });
         }
 
         /// <summary>
         /// 鑳藉惁鍙栨秷
         /// </summary>
-        public bool CanCancel()
+        public Task<bool> CanCancel()
         {
-            return true;
+            return Task.Run(() => true);
         }
 
         /// <summary>
         /// 鑳藉惁瀹屾垚
         /// </summary>
-        public bool CanComplete()
+        public Task<bool> CanComplete()
         {
-            Task<bool> task = Task.Run(async () => await InsertProject());
-            var bol = task.GetAwaiter();
-            return true;
-        }
-
-        private async Task<bool> InsertProject()
-        {
-            var bllXhsProjectExtensions = new BLL.XhsProjectExtensions();
-            var project = new XhsProjectExtensionsVmo();
-            project.NO = _vm.NO;
-            project.Name = _vm.Name;
-            project.Address = _vm.Address;
-            project.Customer = _vm.Customer;
-            project.Flags = _vm.Flags;
-            project.TagName = _vm.TagName;
-            project.Description = _vm.Description;
-            project.SiteList = new List<XhsProjectSiteVmo>() {
-                new XhsProjectSiteVmo(){
-                    Name=_vm.Name,
-                    Description=_vm.Description
-                }
-            };
-            var projectId = await bllXhsProjectExtensions.Insert(project);
-            if (projectId > 1)
-            {
-                _vm.ProjectID = projectId;
-                if (_vm.Location != null)
-                {
-                    var mapInfo = new Yw.Vmo.MapInfoVmo();
-                    mapInfo.ObjectType = HStation.Xhs.DataType.XhsProject;
-                    mapInfo.ObjectID = projectId;
-                    mapInfo.ObjectName = project.Name;
-                    mapInfo.Purpose = Yw.Map.Purpose.Location;
-                    mapInfo.Kind = Yw.Map.Kind.Gaodei;
-                    mapInfo.Shape = Yw.Map.Shape.Marker;
-                    mapInfo.Position = _vm.Location.ToJson();
-                    var mapInfoId = await new Yw.BLL.MapInfo().Insert(mapInfo);
-                    if (mapInfoId < 1)
-                    {
-                        return false;
-                    }
-                    else
-                    {
-                        return true;
-                    }
-                }
-            }
-            return true;
+            return Task.Run(() => false);
         }
 
         //鍦板浘鍔犺浇瀹屾垚
         private async void MapSetSimpleMarkerContainer1_LoadCompletedEvent()
         {
-            if (_vm == null)
+            if (!_isInitialize)
             {
                 return;
             }
-            if (_vm.Location != null)
+            if (_vm.MapInfo != null)
             {
-                await this.mapSetSimpleMarkerContainer1.LoadMarker(_vm.Location);
+                var marker = Yw.Model.Map.Marker.ToModel(_vm.MapInfo.Position);
+                if (marker != null)
+                {
+                    await this.mapSetSimpleMarkerContainer1.LoadMarker(marker);
+                    if (string.IsNullOrEmpty(this.txtAddress.Text.Trim()))
+                    {
+                        this.txtAddress.EditValue = marker.Address;
+                    }
+                }
+
             }
+            await this.mapSetSimpleMarkerContainer1.SearchAddress();
         }
 
         //璁剧疆浣嶇疆
         private void MapSetSimpleMarkerContainer1_SetMarkerEvent(Yw.Model.Map.Marker obj)
         {
-            if (_vm != null)
+            if (!_isInitialize)
             {
-                _vm.Location = obj;
+                return;
             }
+            if (_vm.MapInfo == null)
+            {
+                _vm.MapInfo = new Yw.Vmo.MapInfoVmo();
+                _vm.MapInfo.ObjectType = HStation.Xhs.DataType.XhsProject;
+                _vm.MapInfo.ObjectID = _vm.Project.ID;
+                _vm.MapInfo.ObjectName = _vm.Project.Name;
+                _vm.MapInfo.Purpose = Yw.Map.Purpose.Location;
+                _vm.MapInfo.Kind = Yw.Map.Kind.Gaodei;
+                _vm.MapInfo.Shape = Yw.Map.Shape.Marker;
+            }
+            _vm.MapInfo.Position = obj.ToJson();
             this.txtAddress.EditValue = obj.Address;
         }
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3