duheng
2024-12-04 7079cbb505471a8d3251cac4e27c7a3841f8e656
WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/01-matching/09-Tank/TankSingleMatchingCtrl.cs
@@ -24,7 +24,7 @@
        {
            public long? Dbid { get; set; }
            public long? Curveid { get; set; }
            //     public Vmo.XhsTankMainPhartMappingExtensions Curveinfo { get; set; }
            //   public Vmo.XhsTankMainPhartMappingExtensions Curveinfo { get; set; }
        }
        private List<TankSingleMatchingViewModel> _allBindingList = null;
@@ -32,7 +32,7 @@
        private BLL.AssetsTankMain _TankBll = null;
        private List<PhartViewModel> _allPhartList = null;
        //  private readonly Lazy<BLL.XhsTankMainPhartMappingExtensions> _bll_ex = new();
        private readonly Lazy<BLL.AssetsTankCoefficient> _bll_ex = new();
        private HydroTankMatchingViewModel _pumpMatchingViewModel;
@@ -66,27 +66,22 @@
        //阀门型号列表选择项切换事件
        private async void gridView2_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            /*_allPhartList = new List<PhartViewModel>();
            _allPhartList = new List<PhartViewModel>();
            var vm = this.gridView3.GetCurrentViewModel(_allBindingList);
            if (vm != null)
            {
                if (vm.SeriesType == HStation.Assets.eTankType.GPV || vm.SeriesType == HStation.Assets.eTankType.TCV)
                {
                    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();
                var list = await _bll_ex.Value.GetByTankMainID(vm.ID);
                /*  _pumpMatchingViewModel.MatchingMinorLoss = vm.Coefficient;
                 _pumpMatchingViewModel.MatchingMaterial = vm.Material;
                 _pumpMatchingViewModel.MatchingTankType = (eTankType?)vm.SeriesType;
                 _pumpMatchingViewModel.MatchingTankSetting = vm.TankSetting;*/
                var list = await _bll_ex.Value.GetByMainID(vm.ID);
                if (list != null && list.Any())
                {
                    foreach (var item in list)
                    {
                        _allPhartList.Add(new PhartViewModel { ID = item.ID, OtherName = item.OtherName, Importance = item.Importance, SortCode = item.SortCode });
                        _allPhartList.Add(new PhartViewModel { ID = item.ID });
                    }
                }
            }
@@ -101,58 +96,38 @@
                }
            }
            this.gridControl1.DataSource = _allPhartList;
            this.gridView1.FocusInvalidRow();*/
            this.gridView1.FocusInvalidRow();
        }
        //查看曲线
        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 (e.Column == this.ColShowChart)
            {
                var vm = this.gridView1.GetCurrentViewModel(_allPhartList);
                 var vmo = await _bll_ex.Value.GetByID(vm.ID);
                 if (vmo != null)
                 {
                     var dlg = new TankChartShowDlg();
                     dlg.InitChart(vmo);
                     dlg.ShowDialog();
                 }
                 return;
             }*/
                var vmo = await _bll_ex.Value.GetByID(vm.ID);
                if (vmo != null)
                {
                    var dlg = new TankChartShowDlg();
                    dlg.InitChart(vmo.VolCurve);
                    dlg.ShowDialog();
                }
                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.TankQL);
                            var graph_ol = vmo.Diagram.GraphList.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.TankOL);
                            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;
                            }
                        }*/
            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();
            }
        }
    }
}