From 21c97aab9153758bebfc9b3944859b0eec271c76 Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期三, 25 九月 2024 16:31:19 +0800
Subject: [PATCH] 一些简单的尝试

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ThreeLinkMatchingCtrl.cs |   50 +++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 41 insertions(+), 9 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ThreeLinkMatchingCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ThreeLinkMatchingCtrl.cs
index 6de0b0c..2e2a2ef 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ThreeLinkMatchingCtrl.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ThreeLinkMatchingCtrl.cs
@@ -12,28 +12,60 @@
             this.gridView1.OptionsView.ShowGroupPanel = false;
         }
 
-        private List<ThreeLinkMatchingViewModel> _allBindingList = null;
+        private List<ThreeLinkFormViewModel> _allBindingList = new List<ThreeLinkFormViewModel>();
 
-        public List<ThreeLinkMatchingViewModel> SetBindingData(List<ThreeLinkMatchingViewModel> inputs, List<AdaptingManageVmo> alllist)
+        /// <summary>
+        /// 鐐瑰嚮浜嬩欢
+        /// </summary>
+        public event Action<string> RowClickEvent;
+
+        public void SetBindingData(List<ThreeLinkMatchingViewModel> threeLinkMatchingViewModels)
+        {
+            if (threeLinkMatchingViewModels != null)
+            {
+                foreach (var item in threeLinkMatchingViewModels)
+                {
+                    _allBindingList.Add(new ThreeLinkFormViewModel(item));
+                }
+                this.threeLinkFormViewModelBindingSource.DataSource = _allBindingList;
+            }
+        }
+
+        public List<ThreeLinkMatchingViewModel> SetMatching(List<ThreeLinkMatchingViewModel> inputs, List<AdaptingManageVmo> alllist)
         {
             if (inputs == null || inputs.Count == 0)
                 return null;
-            var finishList = new List<ThreeLinkMatchingViewModel>();
+            var resultList = new List<ThreeLinkMatchingViewModel>();
             foreach (var item in inputs)
             {
-                var result = AsstesAutoMatchingHelper.AutoMatching(item, alllist);
+                var result = AssetsMatchingHelper.MatchingThreeLink(item, alllist);
                 if (result != null)
                 {
-                    finishList.Add(result);
+                    resultList.Add(result);
                 }
                 else
                 {
+                    resultList.Add(item);
                 }
             }
-            _allBindingList = finishList;
-            this.threeLinkMatchingViewModelBindingSource.DataSource = _allBindingList;
-            this.threeLinkMatchingViewModelBindingSource.ResetBindings(false);
-            return finishList;
+            _allBindingList.Clear();
+            foreach (var item in resultList)
+            {
+                _allBindingList.Add(new ThreeLinkFormViewModel(item));
+            }
+            this.threeLinkFormViewModelBindingSource.ResetBindings(false);
+            return resultList;
+        }
+
+        //琛岀偣鍑讳簨浠�
+        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