| | |
| | | this.gridView2.SetNormalView(); |
| | | } |
| | | |
| | | public class PhartViewModel |
| | | { |
| | | public long ID { get; set; } |
| | | public string OtherName { get; set; } |
| | | public int Importance { get; set; } |
| | | public int SortCode { get; set; } |
| | | } |
| | | |
| | | |
| | | private List<PumpSingleMatchingViewModel> _allBindingList = null; |
| | | |
| | | private BLL.AssetsPumpMain _pumpBll = null; |
| | |
| | | private List<PhartViewModel> _allPhartList = null; |
| | | private readonly Lazy<BLL.XhsPumpMainPhartMappingExtensions> _bll_ex = new(); |
| | | |
| | | private PumpMatchingViewModel _pumpMatchingViewModel; |
| | | private HydroPumpMatchingViewModel _pumpMatchingViewModel; |
| | | |
| | | public async void SetBindingData(PumpMatchingViewModel pumpMatchingViewModel) |
| | | public async void SetBindingData(HydroPumpMatchingViewModel pumpMatchingViewModel) |
| | | { |
| | | _pumpMatchingViewModel = pumpMatchingViewModel; |
| | | _allBindingList = new List<PumpSingleMatchingViewModel>(); |
| | |
| | | _allBindingList.Add(new PumpSingleMatchingViewModel(Main)); |
| | | } |
| | | this.gridControl2.DataSource = _allBindingList; |
| | | this.searchControl1.Text = pumpMatchingViewModel.ModelType; |
| | | this.searchControl1.Text = pumpMatchingViewModel.ModelType; |
| | | for (int i = 0; i < _allBindingList.Count; i++) |
| | | { |
| | | if (long.TryParse(pumpMatchingViewModel.DbId, out long dbID)) |
| | |
| | | //泵型号列表选择项切换事件 |
| | | private async void gridView2_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) |
| | | { |
| | | _allPhartList = new List<PhartViewModel>(); |
| | | var vm = this.gridView2.GetCurrentViewModel(_allBindingList); |
| | | if (vm != null) |
| | | { |
| | |
| | | _pumpMatchingViewModel.MatchingRatedP = vm.RatedPower; |
| | | _pumpMatchingViewModel.MatchingRatedQ = vm.RatedFlow; |
| | | var list = await _bll_ex.Value.GetByPumpMainID(vm.ID); |
| | | _allPhartList = new List<PhartViewModel>(); |
| | | if (list != null && list.Any()) |
| | | { |
| | | foreach (var item in list) |
| | |
| | | } |
| | | } |
| | | } |
| | | if (_pumpMatchingViewModel.MatchingCurveDbId != null) |
| | | this.phartViewModelBindingSource.DataSource = _allPhartList; |
| | | if (_pumpMatchingViewModel.CurveDbId != null) |
| | | { |
| | | for (int i = 0; i < _allPhartList.Count; i++) |
| | | { |
| | | if (_allBindingList[i].ID.ToString() == _pumpMatchingViewModel.MatchingCurveDbId) |
| | | if (_allPhartList[i].ID.ToString() == _pumpMatchingViewModel.CurveDbId) |
| | | { |
| | | gridView1.FocusedRowHandle = i; |
| | | } |
| | | } |
| | | } |
| | | this.gridControl1.DataSource = _allPhartList; |
| | | this.phartViewModelBindingSource.ResetBindings(false); |
| | | } |
| | | |
| | | //曲线列表选择项切换事件 |
| | |
| | | if (graph_qh != null) |
| | | { |
| | | var points_qh = PhartPerformCurveHelper.GetFeatPointList(graph_qh.GraphType, graph_qh.GeometryInfo, 100, null); |
| | | _pumpMatchingViewModel.MatchingCurveQH = new List<CurvePointMatchingViewModel>(); |
| | | _pumpMatchingViewModel.MatchingCurveQH = new List<HydroCurvePointViewModel>(); |
| | | foreach (var item in points_qh) |
| | | { |
| | | _pumpMatchingViewModel.MatchingCurveQH.Add(new CurvePointMatchingViewModel(item.X, item.Y)); |
| | | _pumpMatchingViewModel.MatchingCurveQH.Add(new HydroCurvePointViewModel(item.X, item.Y)); |
| | | } |
| | | } |
| | | if (graph_qe != null) |
| | | { |
| | | var points_qe = PhartPerformCurveHelper.GetFeatPointList(graph_qe.GraphType, graph_qe.GeometryInfo, 100, null); |
| | | _pumpMatchingViewModel.MatchingCurveQE = new List<CurvePointMatchingViewModel>(); |
| | | _pumpMatchingViewModel.MatchingCurveQE = new List<HydroCurvePointViewModel>(); |
| | | foreach (var item in points_qe) |
| | | { |
| | | _pumpMatchingViewModel.MatchingCurveQE.Add(new CurvePointMatchingViewModel(item.X, item.Y)); |
| | | _pumpMatchingViewModel.MatchingCurveQE.Add(new HydroCurvePointViewModel(item.X, item.Y)); |
| | | } |
| | | } |
| | | if (graph_qp != null) |
| | | { |
| | | var points_qp = PhartPerformCurveHelper.GetFeatPointList(graph_qp.GraphType, graph_qp.GeometryInfo, 100, null); |
| | | _pumpMatchingViewModel.MatchingCurveQP = new List<CurvePointMatchingViewModel>(); |
| | | _pumpMatchingViewModel.MatchingCurveQP = new List<HydroCurvePointViewModel>(); |
| | | foreach (var item in points_qp) |
| | | { |
| | | _pumpMatchingViewModel.MatchingCurveQP.Add(new CurvePointMatchingViewModel(item.X, item.Y)); |
| | | _pumpMatchingViewModel.MatchingCurveQP.Add(new HydroCurvePointViewModel(item.X, item.Y)); |
| | | } |
| | | } |
| | | } |