| | |
| | | using HStation.WinFrmUI.Basic; |
| | | using HStation.WinFrmUI.PhartRelation; |
| | | using HStation.WinFrmUI.PhartRelation; |
| | | using HStation.WinFrmUI.Xhs; |
| | | |
| | | namespace HStation.WinFrmUI |
| | |
| | | private List<PhartViewModel> _allPhartList = null; |
| | | private readonly Lazy<BLL.XhsValveMainPhartMappingExtensions> _bll_ex = new(); |
| | | |
| | | private ValveMatchingViewModel _pumpMatchingViewModel; |
| | | private HydroValveMatchingViewModel _pumpMatchingViewModel; |
| | | |
| | | public async void SetBindingData(ValveMatchingViewModel valveMatchingViewModel) |
| | | private List<HydroCurvePointViewModel> _currentCurvePoint; |
| | | |
| | | public async void SetBindingData(HydroValveMatchingViewModel valveMatchingViewModel) |
| | | { |
| | | _pumpMatchingViewModel = valveMatchingViewModel; |
| | | _allBindingList = new List<ValveSingleMatchingViewModel>(); |
| | |
| | | { |
| | | _allBindingList.Add(new ValveSingleMatchingViewModel(Main)); |
| | | } |
| | | |
| | | this.searchControl1.Text = valveMatchingViewModel.ModelType; |
| | | this.valveSingleMatchingViewModelBindingSource.DataSource = _allBindingList; |
| | | this.searchControl1.Text = _pumpMatchingViewModel.ModelType; |
| | | for (int i = 0; i < _allBindingList.Count; i++) |
| | | { |
| | | if (long.TryParse(valveMatchingViewModel.DbId, out long dbID)) |
| | |
| | | } |
| | | } |
| | | } |
| | | this.valveSingleMatchingViewModelBindingSource.DataSource = _allBindingList; |
| | | _currentCurvePoint = new List<HydroCurvePointViewModel>(); |
| | | } |
| | | |
| | | //阀门型号列表选择项切换事件 |
| | |
| | | var vm = this.gridView3.GetCurrentViewModel(_allBindingList); |
| | | if (vm != null) |
| | | { |
| | | if (vm.SeriesType == HStation.Assets.eAssetsValveSeriesType.GPV) |
| | | if (vm.SeriesType == HStation.Assets.eValveType.GPV || vm.SeriesType == HStation.Assets.eValveType.TCV) |
| | | { |
| | | layoutControlGroup2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; |
| | | } |
| | |
| | | } |
| | | _pumpMatchingViewModel.MatchingMinorLoss = vm.Coefficient; |
| | | _pumpMatchingViewModel.MatchingMaterial = vm.Material; |
| | | _pumpMatchingViewModel.MatchingValveLift = vm.ValveLift; |
| | | _pumpMatchingViewModel.MatchingValveType = vm.SeriesType.ToString(); |
| | | _pumpMatchingViewModel.MatchingValveType = (eValveType?)vm.SeriesType; |
| | | _pumpMatchingViewModel.MatchingValveSetting = vm.ValveSetting; |
| | | var list = await _bll_ex.Value.GetByValveMainID(vm.ID); |
| | | if (list != null && list.Any()) |
| | |
| | | } |
| | | } |
| | | } |
| | | if (_pumpMatchingViewModel.MatchingChartDbId != null) |
| | | if (_pumpMatchingViewModel.MatchingCurveDbId != null) |
| | | { |
| | | for (int i = 0; i < _allPhartList.Count; i++) |
| | | { |
| | | if (_allBindingList[i].ID.ToString() == _pumpMatchingViewModel.MatchingChartDbId) |
| | | if (_allBindingList[i].ID.ToString() == _pumpMatchingViewModel.MatchingCurveDbId) |
| | | { |
| | | gridView1.FocusedRowHandle = i; |
| | | } |
| | | } |
| | | } |
| | | this.gridControl1.DataSource = _allPhartList; |
| | | this.gridView1.FocusInvalidRow(); |
| | | } |
| | | |
| | | //查看曲线 |
| | |
| | | if (e.Column == this.ColShowChart) |
| | | { |
| | | var vm = this.gridView1.GetCurrentViewModel(_allPhartList); |
| | | if (vm != null) |
| | | |
| | | var vmo = await _bll_ex.Value.GetByID(vm.ID); |
| | | if (vmo != null) |
| | | { |
| | | var vmo = await _bll_ex.Value.GetByID(vm.ID); |
| | | if (vmo != null) |
| | | { |
| | | _pumpMatchingViewModel.MatchingChartDbId = vm.ID.ToString(); |
| | | var graph_ql = vmo.Diagram.GraphList.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.ValveQL); |
| | | if (graph_ql != null) |
| | | { |
| | | var points_qh = PhartPerformCurveHelper.GetFeatPointList(graph_ql.GraphType, graph_ql.GeometryInfo, 100, null); |
| | | _pumpMatchingViewModel.MatchingCurveQL = new List<CurvePointMatchingViewModel>(); |
| | | foreach (var item in points_qh) |
| | | { |
| | | _pumpMatchingViewModel.MatchingCurveQL.Add(new CurvePointMatchingViewModel(item.X, item.Y)); |
| | | } |
| | | } |
| | | } |
| | | var dlg = new ValveChartShowDlg(); |
| | | dlg.InitChart(vmo); |
| | | dlg.ShowDialog(); |
| | | return; |
| | | } |
| | | return; |
| | | } |
| | | } |
| | | |
| | | private async void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) |
| | | { |
| | | var vm = this.gridView1.GetCurrentViewModel(_allPhartList); |
| | | _currentCurvePoint.Clear(); |
| | | if (vm == null) |
| | | return; |
| | | var vmo = await _bll_ex.Value.GetByID(vm.ID); |
| | | if (vmo != null) |
| | | { |
| | | _pumpMatchingViewModel.MatchingCurveDbId = vm.ID.ToString(); |
| | | var graph_ql = vmo.Diagram.GraphList.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.ValveQL); |
| | | var graph_ol = vmo.Diagram.GraphList.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.ValveOL); |
| | | if (graph_ql != null) |
| | | { |
| | | var points_qh = PhartPerformCurveHelper.GetFeatPointList(graph_ql.GraphType, graph_ql.GeometryInfo, 100, null); |
| | | foreach (var item in points_qh) |
| | | { |
| | | _currentCurvePoint.Add(new HydroCurvePointViewModel(item.X, item.Y)); |
| | | } |
| | | _pumpMatchingViewModel.MatchingCurveQL = _currentCurvePoint; |
| | | } |
| | | if (graph_ol != null) |
| | | { |
| | | var points_qh = PhartPerformCurveHelper.GetFeatPointList(graph_ol.GraphType, graph_ol.GeometryInfo, 100, null); |
| | | foreach (var item in points_qh) |
| | | { |
| | | _currentCurvePoint.Add(new HydroCurvePointViewModel(item.X, item.Y)); |
| | | } |
| | | _pumpMatchingViewModel.MatchingCurveOL = _currentCurvePoint; |
| | | } |
| | | } |
| | | } |