From 4446901f8ecde9b6e593d871465e89662ad58965 Mon Sep 17 00:00:00 2001
From: duheng <2784771470@qq.com>
Date: 星期四, 05 十二月 2024 10:06:58 +0800
Subject: [PATCH] 修改单独匹配命名

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/04-scheme/01-add/01-set/03-pipe/SetSchemePipeListCtrl.cs |  276 ++++++++++++++----------------------------------------
 1 files changed, 72 insertions(+), 204 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/04-scheme/01-add/01-set/03-pipe/SetSchemePipeListCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/04-scheme/01-add/01-set/03-pipe/SetSchemePipeListCtrl.cs
index 41dee6c..bd614cb 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/04-scheme/01-add/01-set/03-pipe/SetSchemePipeListCtrl.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/04-scheme/01-add/01-set/03-pipe/SetSchemePipeListCtrl.cs
@@ -2,26 +2,43 @@
 
 namespace HStation.WinFrmUI
 {
-    public partial class SetSchemePipeListCtrl : DevExpress.XtraEditors.XtraUserControl, IHydroParterList
+    public partial class SetSchemePipeListCtrl : DevExpress.XtraEditors.XtraUserControl, ISetSchemeParterList
     {
         public SetSchemePipeListCtrl()
         {
             InitializeComponent();
+            this.layoutControl1.SetupLayoutControl();
             this.gridView1.SetNormalView(30);
             this.gridView1.RegistCustomDrawRowIndicator(40);
             this.gridView1.BorderStyle = BorderStyles.NoBorder;
-            this.layoutControl1.SetupLayoutControl();
-            InitialLinkStatus();
+            this.generalSearchAndSelectCtrl1.SearchEvent += () =>
+            {
+                Search();
+            };
+            this.generalSearchAndSelectCtrl1.ClearEvent += () =>
+            {
+                Clear();
+            };
+            this.generalSearchAndSelectCtrl1.SelectEvent += () =>
+            {
+                TipFormHelper.Show(eTipStatus.Info, "鎵归噺閫夋嫨寰呮洿鏂�");
+            };
         }
 
         /// <summary>
         /// 姘村姏鐐瑰嚮浜嬩欢
         /// </summary>
         public event Action<Yw.Model.HydroParterInfo> HydroClickEvent;
+
         /// <summary>
         /// 姘村姏鏀瑰彉浜嬩欢
         /// </summary>
         public event Action<List<HydroParterInfo>> HydroChangedEvent;
+
+        /// <summary>
+        /// 姘村姏璁板綍鏀瑰彉浜嬩欢
+        /// </summary>
+        public event Action<SetSchemeParterRecord> HydroRecordChangedEvent;
 
         /// <summary>
         /// 鏄剧ず鏌ヨ闈㈡澘
@@ -43,8 +60,12 @@
             get { return _allList != null && _allList.Count > 0; }
         }
 
+        //姘村姏淇℃伅
+        private Yw.Model.HydroModelInfo _hydroInfo = null;
+
         //鎵�鏈夊垪琛�
         private List<HydroPipeViewModel> _allList = null;
+
         //鎵�鏈夌粦瀹氬垪琛�
         private List<HydroPipeViewModel> _allBindingList = null;
 
@@ -53,6 +74,7 @@
         /// </summary>
         public void SetBindingData(HydroModelInfo hydroInfo)
         {
+            _hydroInfo = hydroInfo;
             _allList = new List<HydroPipeViewModel>();
             if (hydroInfo != null && hydroInfo.Pipes != null && hydroInfo.Pipes.Count > 0)
             {
@@ -68,7 +90,7 @@
         /// <summary>
         /// 缁戝畾鏁版嵁
         /// </summary>
-        public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo, List<HydroCalcuResult> allCalcuResultList)
+        public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo, List<HydroCalcuVisualResult> allCalcuResultList)
         {
             _allList = new List<HydroPipeViewModel>();
             if (hydroInfo != null && hydroInfo.Pipes != null && hydroInfo.Pipes.Count > 0)
@@ -149,7 +171,7 @@
         /// <summary>
         /// 鏇存柊璁$畻灞炴��
         /// </summary>
-        public void UpdateCalcuProperty(List<HydroCalcuResult> allCalcuResultList)
+        public void UpdateCalcuProperty(List<HydroCalcuVisualResult> allCalcuResultList)
         {
             if (allCalcuResultList != null && allCalcuResultList.Count > 0)
             {
@@ -205,215 +227,61 @@
         }
 
         //璁剧疆
-        private void Set()
+        private void SelectChange()
         {
             Search();
-            if (_allBindingList == null || _allBindingList.Count < 1)
+            var row = this.gridView1.GetFocusedRow() as HydroPipeViewModel;
+            if (row == null)
             {
                 XtraMessageBox.Show("鏃犲彲璁剧疆绠¢亾鏁版嵁");
                 return;
             }
-            var dlg = new SetHydroPipeDlg();
-            dlg.SetBindingData(_allBindingList.Select(x => x.Vmo).ToList());
-            dlg.ReloadDataEvent += (list) =>
-            {
-                _allBindingList.ForEach(x =>
-                {
-                    x.UpdateProperty();
-                });
-                this.hydroPipeViewModelBindingSource.ResetBindings(false);
-                var allParterList = _allBindingList.Select(x => x.Vmo as HydroParterInfo).ToList();
-                this.HydroChangedEvent?.Invoke(allParterList);
-            };
-            dlg.ShowDialog();
-        }
-
-        /// <summary>
-        /// 璁剧疆绠�鍗曟樉绀烘ā寮�
-        /// </summary>
-        public void SetSimpleView()
-        {
-            this.groupForHead.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
-            this.colDbLocked.Visible = false;
-            this.colName.Visible = true;
-            this.colCode.Visible = true;
-            this.colModelType.Visible = true;
-            this.colLinkStatus.Visible = false;
-            this.colMaterial.Visible = true;
-            this.colDiameter.Visible = true;
-            this.colLength.Visible = false;
-            this.colRoughness.Visible = false;
-            this.colMinorLoss.Visible = false;
-            this.colCalcuFlow.Visible = false;
-            this.colCalcuVelocity.Visible = false;
-            this.colCalcuHeadLoss.Visible = false;
-            this.colHasDb.Visible = false;
-            this.colFlags.Visible = true;
-            this.colDescription.Visible = true;
-            this.colSet.Visible = false;
-        }
-
-        /// <summary>
-        /// 璁剧疆姝e父鏄剧ず妯″紡
-        /// </summary>
-        public void SetNormalView()
-        {
-            this.groupForHead.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
-            this.colDbLocked.Visible = true;
-            this.colName.Visible = true;
-            this.colCode.Visible = true;
-            this.colModelType.Visible = true;
-            this.colLinkStatus.Visible = true;
-            this.colMaterial.Visible = true;
-            this.colDiameter.Visible = true;
-            this.colLength.Visible = true;
-            this.colRoughness.Visible = true;
-            this.colMinorLoss.Visible = true;
-            this.colCalcuFlow.Visible = false;
-            this.colCalcuVelocity.Visible = false;
-            this.colCalcuHeadLoss.Visible = false;
-            this.colHasDb.Visible = true;
-            this.colFlags.Visible = true;
-            this.colDescription.Visible = true;
-            this.colSet.Visible = true;
-        }
-
-        /// <summary>
-        /// 璁剧疆璁$畻鏄剧ず妯″紡
-        /// </summary>
-        public void SetCalcuView()
-        {
-            this.groupForHead.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
-            this.colDbLocked.Visible = true;
-            this.colName.Visible = true;
-            this.colCode.Visible = true;
-            this.colModelType.Visible = true;
-            this.colLinkStatus.Visible = true;
-            this.colMaterial.Visible = true;
-            this.colDiameter.Visible = true;
-            this.colLength.Visible = true;
-            this.colRoughness.Visible = true;
-            this.colMinorLoss.Visible = true;
-            this.colCalcuFlow.Visible = true;
-            this.colCalcuVelocity.Visible = true;
-            this.colCalcuHeadLoss.Visible = true;
-            this.colHasDb.Visible = true;
-            this.colFlags.Visible = true;
-            this.colDescription.Visible = true;
-            this.colSet.Visible = true;
-        }
-
-        /// <summary>
-        /// 璁剧疆鎵归噺璁剧疆妯″紡
-        /// </summary>
-        public void SetBulkSetView()
-        {
-            this.groupForHead.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
-            this.colDbLocked.Visible = true;
-            this.colName.Visible = true;
-            this.colCode.Visible = true;
-            this.colModelType.Visible = true;
-            this.colLinkStatus.Visible = true;
-            this.colMaterial.Visible = true;
-            this.colDiameter.Visible = true;
-            this.colLength.Visible = true;
-            this.colRoughness.Visible = true;
-            this.colMinorLoss.Visible = true;
-            this.colCalcuFlow.Visible = false;
-            this.colCalcuVelocity.Visible = false;
-            this.colCalcuHeadLoss.Visible = false;
-            this.colHasDb.Visible = true;
-            this.colFlags.Visible = true;
-            this.colDescription.Visible = true;
-            this.colSet.Visible = true;
         }
 
         private void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
         {
-            var row = this.gridView1.GetRow(e.RowHandle) as HydroPipeViewModel;
-            if (row == null)
-            {
-                return;
-            }
+            /* var row = this.gridView1.GetRow(e.RowHandle) as HydroPipeViewModel;
+             if (row == null)
+             {
+                 return;
+             }
 
-            if (e.Column == this.colSet)
-            {
-                var dlg = new SetHydroPipeDlg();
-                dlg.SetBindingData(row.Vmo);
-                dlg.ReloadDataEvent += (list) =>
-                {
-                    row.UpdateProperty();
-                    this.gridView1.RefreshRow(e.RowHandle);
-                    this.HydroChangedEvent?.Invoke(new List<Yw.Model.HydroParterInfo>() { row.Vmo });
-                };
-                dlg.ShowDialog();
-            }
-            else
-            {
-                this.HydroClickEvent?.Invoke(row.Vmo);
-            }
+             if (e.Column == this.colSelect)
+             {
+                 var input = AssetsMatchingParasHelper.Create(_hydroInfo, row.Vmo, null);
+                 var dlg = new SimulationPipeSingleMatchingDlg();
+                 dlg.SetBindingData(input);
+                 dlg.ReloadDataEvent += (output) =>
+                 {
+                     var bol = AssetsMatchingParasHelper.Apply(_hydroInfo, output);
+                     if (bol)
+                     {
+                         row.UpdateProperty();
+                         this.gridView1.RefreshRow(e.RowHandle);
+                         this.HydroChangedEvent?.Invoke(new List<Yw.Model.HydroParterInfo>() { row.Vmo });
+
+                         var record = new SetSchemeParterRecord();
+                         record.Name = row.Vmo.Name;
+                         record.Code = row.Vmo.Code;
+                         record.Catalog = Yw.Hydro.ParterCatalog.Pipe;
+                         record.MatchingModel = output;
+
+                         record.Items = new List<SetSchemeParterRecordItem>() {
+                         new() {Name="鍨嬪彿",BeforeValue=$"{output.ModelType}",AfterValue=$"{output.MatchingModelType}"},
+                         new() {Name="鏉愭枡",BeforeValue=$"{output.Material}",AfterValue=$"{output.MatchingMaterial}"},
+                         new() {Name="鐩村緞锛坢m锛�",BeforeValue=$"{output.Diameter}",AfterValue=$"{output.MatchingDiameter}"},
+                         new() {Name="绮楃硻绯绘暟",BeforeValue=$"{output.Roughness}",AfterValue=$"{output.MatchingRoughness}"},
+                         new() {Name="灞�闃荤郴鏁�",BeforeValue=$"{output.MinorLoss}",AfterValue=$"{output.MatchingMinorLoss}"},
+                         };
+                         this.HydroRecordChangedEvent?.Invoke(record);
+                     }
+                 };
+                 dlg.ShowDialog();
+             }
+             else
+             {
+                 this.HydroClickEvent?.Invoke(row.Vmo);
+             }*/
         }
-
-
-        //鍒濆鍖栫娈电姸鎬�
-        private void InitialLinkStatus()
-        {
-            this.imgCmbLinkStatus.Properties.BeginUpdate();
-            this.imgCmbLinkStatus.Properties.Items.Clear();
-            this.imgCmbLinkStatus.Properties.Items.Add("鍏ㄩ儴", string.Empty, -1);
-            this.imgCmbLinkStatus.Properties.Items.Add(HydroLinkStatusHelper.GetStatusName(Yw.Hydro.LinkStatus.Open), Yw.Hydro.LinkStatus.Open, -1);
-            this.imgCmbLinkStatus.Properties.Items.Add(HydroLinkStatusHelper.GetStatusName(Yw.Hydro.LinkStatus.Closed), Yw.Hydro.LinkStatus.Closed, -1);
-            this.imgCmbLinkStatus.Properties.EndUpdate();
-        }
-
-
-        #region BtnClick
-
-        private void buttonEditSearch_ButtonClick(object sender, ButtonPressedEventArgs e)
-        {
-            var obj = e.Button.Tag;
-            if (obj is string tag)
-            {
-                BtnClick(tag);
-            }
-        }
-
-        private void buttonEditSet_ButtonClick(object sender, ButtonPressedEventArgs e)
-        {
-            var obj = e.Button.Tag;
-            if (obj is string tag)
-            {
-                BtnClick(tag);
-            }
-        }
-
-        private void BtnClick(string tag)
-        {
-            switch (tag)
-            {
-                case "Search":
-                    {
-                        Search();
-                    }
-                    break;
-                case "Clear":
-                    {
-                        Clear();
-                    }
-                    break;
-                case "Set":
-                    {
-                        Set();
-                    }
-                    break;
-                default:
-                    {
-
-                    }
-                    break;
-            }
-        }
-
-        #endregion
     }
-}
+}
\ No newline at end of file

--
Gitblit v1.9.3