duheng
2024-10-25 03503e387f4d0f4c47b061b4cc1eeb2482ebaf33
WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/01-matching/03-valve/01-valvesinglematching/ValveSingleMatchingForm.cs
@@ -1,4 +1,6 @@
using HStation.WinFrmUI.PhartRelation;
using HStation.WinFrmUI.Basic;
using HStation.WinFrmUI.PhartRelation;
using HStation.WinFrmUI.Xhs;
namespace HStation.WinFrmUI
{
@@ -60,40 +62,6 @@
            this.valveSingleMatchingViewModelBindingSource.DataSource = _allBindingList;
        }
        //初始化图表数据
        private void InitChart(Vmo.XhsValveMainPhartMappingExtensions 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_ql = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.ValveQL);
            if (graph_ql == null)
            {
                return;
            }
            List<Yw.Geometry.Point2d> points_ql = null;
            points_ql = PhartPerformCurveHelper.GetFeatPointList(graph_ql.GraphType, graph_ql.GeometryInfo, 12, null);
            var cubic_spline_ql = new Yw.Geometry.CubicSpline2d(points_ql);
            var disp_paras = diagram.DispParas;
            var is_calc_disp_paras = string.IsNullOrWhiteSpace(disp_paras);
            this.xtrPerform2dChart1.SetBindingData(cubic_spline_ql, disp_paras, is_calc_disp_paras);
        }
        //阀门型号列表选择项切换事件
        private async void gridView2_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
@@ -101,6 +69,14 @@
            var vm = this.gridView3.GetCurrentViewModel(_allBindingList);
            if (vm != null)
            {
                if (vm.SeriesType == HStation.Assets.eAssetsValveSeriesType.GPV)
                {
                    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))
@@ -137,28 +113,37 @@
        //曲线列表选择项切换事件
        private async void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            var vm = this.gridView1.GetCurrentViewModel(_allPhartList);
            if (vm != null)
        }
        //查看曲线
        private async void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            if (e.Column == this.ColShowChart)
            {
                var vmo = await _bll_ex.Value.GetByID(vm.ID);
                if (vmo != null)
                var vm = this.gridView1.GetCurrentViewModel(_allPhartList);
                if (vm != null)
                {
                    _pumpMatchingViewModel.MatchingChartDbId = vm.ID.ToString();
                    var graph_qh = vmo.Diagram.GraphList.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.ValveQL);
                    if (graph_qh != null)
                    var vmo = await _bll_ex.Value.GetByID(vm.ID);
                    if (vmo != null)
                    {
                        var points_qh = PhartPerformCurveHelper.GetFeatPointList(graph_qh.GraphType, graph_qh.GeometryInfo, 100, null);
                        _pumpMatchingViewModel.MatchingCurveQL = new List<CurvePointMatchingViewModel>();
                        foreach (var item in points_qh)
                        _pumpMatchingViewModel.MatchingChartDbId = vm.ID.ToString();
                        var graph_qh = vmo.Diagram.GraphList.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.ValveQL);
                        if (graph_qh != null)
                        {
                            _pumpMatchingViewModel.MatchingCurveQL.Add(new CurvePointMatchingViewModel(item.X, item.Y));
                            var points_qh = PhartPerformCurveHelper.GetFeatPointList(graph_qh.GraphType, graph_qh.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;
                }
                InitChart(vmo);
                return;
            }
            this.xtrPerform2dChart1.SetBindingData(null, null, null, null, true);
        }
    }
}