From a1730187c168a5d0bd54eb27c1083eb1cc98be96 Mon Sep 17 00:00:00 2001
From: duheng <2784771470@qq.com>
Date: 星期一, 23 九月 2024 10:41:43 +0800
Subject: [PATCH] 修改命名

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/PumpMatchingCtrl.cs |   54 +++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 47 insertions(+), 7 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/PumpMatchingCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/PumpMatchingCtrl.cs
index ced9648..8163e8a 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/PumpMatchingCtrl.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/PumpMatchingCtrl.cs
@@ -10,20 +10,60 @@
             this.gridView1.OptionsView.ShowGroupPanel = false;
         }
 
-        private List<PumpMatchingViewModel> _allBindingList = null;
+        private List<PumpFormViewModel> _allBindingList = new List<PumpFormViewModel>();
 
-        public List<PumpMatchingViewModel> SetBindingData(List<PumpMatchingViewModel> pumpMatchingViewModel, List<PumpMainVmo> pumpMainVmos, out List<PumpMatchingViewModel> errorList)
+        /// <summary>
+        /// 鐐瑰嚮浜嬩欢
+        /// </summary>
+        public event Action<string> RowClickEvent;
+
+        public void SetBindingData(List<PumpMatchingViewModel> pumpMatchingViewModel)
         {
-            errorList = null;
-            List<PumpMatchingViewModel> _allBindingList = new List<PumpMatchingViewModel>();
+            if (pumpMatchingViewModel != null)
+            {
+                foreach (var item in pumpMatchingViewModel)
+                {
+                    _allBindingList.Add(new PumpFormViewModel(item));
+                }
+            }
+            this.pumpFormViewModelBindingSource.DataSource = _allBindingList;
+        }
+
+        public async Task<List<PumpMatchingViewModel>> SetMatching(List<PumpMatchingViewModel> pumpMatchingViewModel, List<PumpMainVmo> pumpMainVmos)
+        {
+            var finishList = new List<PumpMatchingViewModel>();
             if (pumpMatchingViewModel == null)
                 return null;
             foreach (var item in pumpMatchingViewModel)
             {
-                var result = AsstesAutoMatchingHelper.PumpMatching(item, pumpMainVmos);
+                var result = await AssetsMatchingHelper.MatchingPumps(item, pumpMainVmos);
+                if (result != null)
+                {
+                    finishList.Add(result);
+                }
+                else
+                {
+                    finishList.Add(item);
+                }
             }
-            this.pumpMatchingViewModelBindingSource.DataSource = _allBindingList;
-            return _allBindingList;
+            _allBindingList.Clear();
+            foreach (var item in finishList)
+            {
+                _allBindingList.Add(new PumpFormViewModel(item));
+            }
+            this.pumpFormViewModelBindingSource.ResetBindings(false);
+            return finishList;
+        }
+
+        //琛岀偣鍑讳簨浠�
+        private void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
+        {
+            var row = this.gridView1.GetCurrentViewModel(_allBindingList);
+            if (row == null)
+            {
+                return;
+            }
+            this.RowClickEvent?.Invoke(row.Code);
         }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3