From 504a7540001f5805938c83ed67a28d86d68b8808 Mon Sep 17 00:00:00 2001
From: duheng <2784771470@qq.com>
Date: 星期三, 30 十月 2024 01:00:25 +0800
Subject: [PATCH] 修改泵匹配选择逻辑

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/04-dlg/AddProjectDlg.cs |   58 +++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 49 insertions(+), 9 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/04-dlg/AddProjectDlg.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/04-dlg/AddProjectDlg.cs
index f8125e0..62a54b1 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/04-dlg/AddProjectDlg.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/04-dlg/AddProjectDlg.cs
@@ -1,18 +1,49 @@
-锘縩amespace HStation.WinFrmUI.Xhs
+锘縰sing HStation.Vmo;
+
+namespace HStation.WinFrmUI.Xhs
 {
     public partial class AddProjectDlg : DevExpress.XtraEditors.XtraForm
     {
         public AddProjectDlg()
         {
             InitializeComponent();
+            this.Load += AddProjectDlg_Load;
         }
 
-        public event Func<Vmo.Xhs.XhsProjectExtensions, Task<bool>> ReloadDataEvent;
+        private async void AddProjectDlg_Load(object sender, EventArgs e)
+        {
+            this.mapSetSimpleMarkerContainer1.SetMarkerEvent += MapSetSimpleMarkerContainer1_SetMarkerEvent;
+            await this.mapSetSimpleMarkerContainer1.InitialContainer();
+        }
+
+        public event Func<XhsProjectExtensionsVmo, Yw.Vmo.MapInfoVmo, Task<bool>> ReloadDataEvent;
+
+        private Yw.Model.Map.Marker _maker = null; //鍦板浘鐐逛俊鎭�
+
+        private Yw.Vmo.MapInfoVmo _mapinfo = null; //鍦板浘淇℃伅
 
         //鏁版嵁楠岃瘉
         private bool Valid()
         {
+            this.dxErrorProvider1.ClearErrors();
+            if (string.IsNullOrEmpty(TextProjectName.Text.Trim()))
+            {
+                this.dxErrorProvider1.SetError(this.TextProjectName, "蹇呭~椤�");
+                return false;
+            }
+            if (string.IsNullOrEmpty(TextCustomerName.Text.Trim()))
+            {
+                this.dxErrorProvider1.SetError(this.TextCustomerName, "蹇呭~椤�");
+                return false;
+            }
             return true;
+        }
+
+        //璁剧疆浣嶇疆
+        private void MapSetSimpleMarkerContainer1_SetMarkerEvent(Yw.Model.Map.Marker obj)
+        {
+            _maker = obj;
+            this.TextAddress.EditValue = obj.Address;
         }
 
         //纭畾
@@ -20,27 +51,36 @@
         {
             if (!Valid())
                 return;
-            var model = new Vmo.Xhs.XhsProjectExtensions();
-            model.Address = this.TextAdress.Text.Trim();
+            var model = new XhsProjectExtensionsVmo();
+            model.Address = this.TextAddress.Text.Trim();
             model.Customer = this.TextCustomerName.Text.Trim();
             model.Description = this.TextDescription.Text.Trim();
             model.Name = this.TextProjectName.Text.Trim();
             model.TagName = this.TextTagName.Text.Trim();
-            model.SiteList = new List<Vmo.Xhs.XhsProjectSite>
+            model.SiteList = new List<XhsProjectSiteVmo>
             {
-                new Vmo.Xhs.XhsProjectSite
+                new XhsProjectSiteVmo
                 {
                     Name=this.TextProjectName.Text,
                     Description=this.TextDescription.Text,
                 }
             };
-            if (await this.ReloadDataEvent.Invoke(model))
+            if (_maker != null)
             {
-                MessageBoxHelper.ShowSuccess("娣诲姞鎴愬姛!");
+                _mapinfo = new Yw.Vmo.MapInfoVmo();
+                _mapinfo.ObjectType = HStation.Xhs.DataType.XhsProject;
+                _mapinfo.Purpose = Yw.Map.Purpose.Location;
+                _mapinfo.Kind = Yw.Map.Kind.Gaodei;
+                _mapinfo.Shape = Yw.Map.Shape.Marker;
+                _mapinfo.Position = _maker.ToJson();
+            }
+            if (await this.ReloadDataEvent.Invoke(model, _mapinfo))
+            {
+                TipFormHelper.ShowSucceed("娣诲姞鎴愬姛!");
             }
             else
             {
-                MessageBoxHelper.ShowError("娣诲姞澶辫触!");
+                TipFormHelper.ShowError("娣诲姞澶辫触!");
             }
             this.DialogResult = DialogResult.OK;
             this.Close();

--
Gitblit v1.9.3