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/ValveMatchingCtrl.cs | 48 +++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 39 insertions(+), 9 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ValveMatchingCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ValveMatchingCtrl.cs index ab4586e..02e02cf 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ValveMatchingCtrl.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ValveMatchingCtrl.cs @@ -10,30 +10,60 @@ this.gridView1.OptionsView.ShowGroupPanel = false; } - private BLL.AdaptingManage _adaptingBll; + private List<ValveFormViewModel> _allBindingList = new List<ValveFormViewModel>(); - private List<ValveMatchingViewModel> _allBindingList = null; + /// <summary> + /// 鐐瑰嚮浜嬩欢 + /// </summary> + public event Action<string> RowClickEvent; - public List<ValveMatchingViewModel> SetBindingData(List<ValveMatchingViewModel> inputs) + public void SetBindingData(List<ValveMatchingViewModel> valveMatchingViewModels) { + if (valveMatchingViewModels != null) + { + foreach (var item in valveMatchingViewModels) + { + _allBindingList.Add(new ValveFormViewModel(item)); + } + this.valveFormViewModelBindingSource.DataSource = _allBindingList; + } + } + + public List<ValveMatchingViewModel> SetMatching(List<ValveMatchingViewModel> inputs, List<ValveMainVmo> alllist) + { + if (inputs == null) + return null; var finishList = new List<ValveMatchingViewModel>(); - _adaptingBll = new BLL.AdaptingManage(); - var alllist = _adaptingBll.GetAll().Result; foreach (var item in inputs) { - var result = AsstesAutoMatchingHelper.AutoMatching(item, alllist); + var result = AssetsMatchingHelper.MatchingValves(item, alllist); if (result != null) { finishList.Add(result); } else { + finishList.Add(item); } } - _allBindingList = finishList; - this.valveMatchingViewModelBindingSource.DataSource = _allBindingList; - this.valveMatchingViewModelBindingSource.ResetBindings(false); + _allBindingList.Clear(); + foreach (var item in finishList) + { + _allBindingList.Add(new ValveFormViewModel(item)); + } + this.valveFormViewModelBindingSource.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