From bc230c03cb961e8d5fb40131806fe795ecfbfa73 Mon Sep 17 00:00:00 2001 From: duheng <2784771470@qq.com> Date: 星期三, 06 十一月 2024 15:07:00 +0800 Subject: [PATCH] 修改曲线id命名 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/01-matching/03-valve/01-valvesinglematching/ValveSingleMatchingForm.cs | 179 ++++++++++++++++++++++++++++------------------------------- 1 files changed, 84 insertions(+), 95 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/01-matching/03-valve/01-valvesinglematching/ValveSingleMatchingForm.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/01-matching/03-valve/01-valvesinglematching/ValveSingleMatchingForm.cs index 1810d6b..ea80723 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/01-matching/03-valve/01-valvesinglematching/ValveSingleMatchingForm.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/01-matching/03-valve/01-valvesinglematching/ValveSingleMatchingForm.cs @@ -1,4 +1,6 @@ -锘縰sing HStation.WinFrmUI.PhartRelation; +锘縰sing HStation.WinFrmUI.Basic; +using HStation.WinFrmUI.PhartRelation; +using HStation.WinFrmUI.Xhs; namespace HStation.WinFrmUI { @@ -8,6 +10,7 @@ { InitializeComponent(); this.gridView1.SetNormalView(); + this.gridView3.SetNormalView(); } public class PhartViewModel @@ -22,133 +25,119 @@ { public long? Dbid { get; set; } public long? Curveid { get; set; } - public Vmo.XhsPumpMainPhartMappingExtensions Curveinfo { get; set; } + public Vmo.XhsValveMainPhartMappingExtensions Curveinfo { get; set; } } private List<ValveSingleMatchingViewModel> _allBindingList = null; - private BLL.AssetsPumpMain _pumpBll = null; + private BLL.AssetsValveMain _valveBll = null; private List<PhartViewModel> _allPhartList = null; - private readonly Lazy<BLL.XhsPumpMainPhartMappingExtensions> _bll_ex = new(); + private readonly Lazy<BLL.XhsValveMainPhartMappingExtensions> _bll_ex = new(); - private PumpMatchingViewModel _pumpMatchingViewModel; + private ValveMatchingViewModel _pumpMatchingViewModel; - public async void SetBindingData(PumpMatchingViewModel pumpMatchingViewModel) + public async void SetBindingData(ValveMatchingViewModel valveMatchingViewModel) { - _pumpMatchingViewModel = pumpMatchingViewModel; + _pumpMatchingViewModel = valveMatchingViewModel; _allBindingList = new List<ValveSingleMatchingViewModel>(); - _pumpBll = new BLL.AssetsPumpMain(); - var allAssetsPumpMain = await _pumpBll.GetAll(); + _valveBll = new BLL.AssetsValveMain(); + var allAssetsPumpMain = await _valveBll.GetAll(); foreach (var Main in allAssetsPumpMain) { _allBindingList.Add(new ValveSingleMatchingViewModel(Main)); } + + this.searchControl1.Text = valveMatchingViewModel.ModelType; for (int i = 0; i < _allBindingList.Count; i++) { - if (long.TryParse(pumpMatchingViewModel.DbId, out long dbID)) + if (long.TryParse(valveMatchingViewModel.DbId, out long dbID)) { if (_allBindingList[i].ID == dbID) { + this.gridView3.FocusedRowHandle = i; } } } - this.searchControl1.Text = pumpMatchingViewModel.ModelType; + this.valveSingleMatchingViewModelBindingSource.DataSource = _allBindingList; } - //鍒濆鍖栧浘琛ㄦ暟鎹� - private void InitChart(Vmo.XhsPumpMainPhartMappingExtensions dto) - { - if (dto == null) - { - return; - } - var diagram = dto.Diagram; - if (diagram == null) - { - return; - } - var graph_list = diagram.GraphList; - if (graph_list == null || !graph_list.Any()) - { - return; - } - - var graph_qh = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQH); - var graph_qe = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQE); - var graph_qp = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQP); - - if (graph_qp == null) - { - return; - } - - List<Yw.Geometry.Point2d> points_qh = null, points_qe = null, points_qp = null; - points_qh = PhartPerformCurveHelper.GetFeatPointList(graph_qh.GraphType, graph_qh.GeometryInfo, 12, null); - if (graph_qe != null) - points_qe = PhartPerformCurveHelper.GetFeatPointList(graph_qe.GraphType, graph_qe.GeometryInfo, 12, null); - if (graph_qp != null) - points_qp = PhartPerformCurveHelper.GetFeatPointList(graph_qp.GraphType, graph_qp.GeometryInfo, 12, null); - - var cubic_spline_qh = new Yw.Geometry.CubicSpline2d(points_qh); - var cubic_spline_qe = new Yw.Geometry.CubicSpline2d(points_qe); - var cubic_spline_qp = new Yw.Geometry.CubicSpline2d(points_qp); - - var disp_paras = diagram.DispParas; - var is_calc_disp_paras = string.IsNullOrWhiteSpace(disp_paras); - this.xtrPerform2dChart1.SetBindingData(cubic_spline_qh, cubic_spline_qe, cubic_spline_qp, disp_paras, is_calc_disp_paras); - } - - //娉靛瀷鍙峰垪琛ㄩ�夋嫨椤瑰垏鎹簨浠� + //闃�闂ㄥ瀷鍙峰垪琛ㄩ�夋嫨椤瑰垏鎹簨浠� private async void gridView2_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { - } - - //鏇茬嚎鍒楄〃閫夋嫨椤瑰垏鎹簨浠� - private async void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) - { - var vm = this.gridView1.GetCurrentViewModel(_allPhartList); + _allPhartList = new List<PhartViewModel>(); + var vm = this.gridView3.GetCurrentViewModel(_allBindingList); if (vm != null) { - var vmo = await _bll_ex.Value.GetByID(vm.ID); - if (vmo != null) + if (vm.SeriesType == HStation.Assets.eValveType.GPV) { - _pumpMatchingViewModel.MatchingCurveDbId = vm.ID.ToString(); - var graph_qh = vmo.Diagram.GraphList.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQH); - var graph_qe = vmo.Diagram.GraphList.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQE); - var graph_qp = vmo.Diagram.GraphList.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQP); - if (graph_qh != null) + layoutControlGroup2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; + } + else + { + layoutControlGroup2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; + } + _pumpMatchingViewModel.MatchingDbId = vm.ID.ToString(); + _pumpMatchingViewModel.MatchingModelType = vm.Name.ToString(); + if (double.TryParse(vm.Caliber, out double caliber)) + { + _pumpMatchingViewModel.MatchingDiameter = caliber; + } + _pumpMatchingViewModel.MatchingMinorLoss = vm.Coefficient; + _pumpMatchingViewModel.MatchingMaterial = vm.Material; + _pumpMatchingViewModel.MatchingValveType = vm.SeriesType; + _pumpMatchingViewModel.MatchingValveSetting = vm.ValveSetting; + var list = await _bll_ex.Value.GetByValveMainID(vm.ID); + if (list != null && list.Any()) + { + foreach (var item in list) { - var points_qh = PhartPerformCurveHelper.GetFeatPointList(graph_qh.GraphType, graph_qh.GeometryInfo, 100, null); - _pumpMatchingViewModel.MatchingCurveQH = new List<CurvePointMatchingViewModel>(); - foreach (var item in points_qh) - { - _pumpMatchingViewModel.MatchingCurveQH.Add(new CurvePointMatchingViewModel(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>(); - foreach (var item in points_qe) - { - _pumpMatchingViewModel.MatchingCurveQE.Add(new CurvePointMatchingViewModel(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>(); - foreach (var item in points_qp) - { - _pumpMatchingViewModel.MatchingCurveQP.Add(new CurvePointMatchingViewModel(item.X, item.Y)); - } + _allPhartList.Add(new PhartViewModel { ID = item.ID, OtherName = item.OtherName, Importance = item.Importance, SortCode = item.SortCode }); } } - InitChart(vmo); - return; } - this.xtrPerform2dChart1.SetBindingData(null, null, null, null, true); + if (_pumpMatchingViewModel.MatchingCurveDbId != null) + { + for (int i = 0; i < _allPhartList.Count; i++) + { + if (_allBindingList[i].ID.ToString() == _pumpMatchingViewModel.MatchingCurveDbId) + { + gridView1.FocusedRowHandle = i; + } + } + } + this.gridControl1.DataSource = _allPhartList; + } + + //鏌ョ湅鏇茬嚎 + private async void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) + { + 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) + { + _pumpMatchingViewModel.MatchingCurveDbId = 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; + } + } } } } \ No newline at end of file -- Gitblit v1.9.3