| | |
| | | using DevExpress.XtraBars; |
| | | using HStation.WinFrmUI.PhartRelation; |
| | | using System.Data; |
| | | |
| | | namespace HStation.WinFrmUI |
| | |
| | | public string OtherName { get; set; } |
| | | public int Importance { get; set; } |
| | | public int SortCode { get; set; } |
| | | public PhartDiagramExGraphList Diagram { get; set; } |
| | | |
| | | public long DiagramID { get; set; } |
| | | } |
| | | |
| | | private HydroPumpMatchingViewModel _pump_matching_vm = null; |
| | | private List<PumpSingleMatchingViewModel> _pump_mian_vm_list = null; |
| | | private List<PhartViewModel> _phart_vm_list = null; |
| | | private Vmo.AssetsPumpMainVmo _pumpVmo; |
| | | |
| | | private readonly Lazy<BLL.AssetsPumpMain> _pump_main_bll = new(); |
| | | private readonly Lazy<BLL.XhsPumpMainPhartMappingExtensions> _phart_ex_bll = new(); |
| | | private readonly Lazy<BLL.PhartDiagramRelation> _phart_ex_bll = new(); |
| | | |
| | | public event Action<HydroPumpMatchingViewModel> ReloadDataEvent; |
| | | |
| | |
| | | } |
| | | |
| | | this.gridControlPumpMain.DataSource = _pump_mian_vm_list; |
| | | this.gridControlPumpMain.RefreshDataSource(); |
| | | this.gridViewPumpMain.BestFitColumns(); |
| | | this.gridViewPumpMain.FocusedRowHandle = sel_index; |
| | | // this.gridControlPumpMain.RefreshDataSource(); |
| | | } |
| | | |
| | | private void barBtnOK_ItemClick(object sender, ItemClickEventArgs e) |
| | |
| | | return; |
| | | } |
| | | |
| | | var diagram = phart.Diagram; |
| | | if (!OutPtList |
| | | (diagram, |
| | | out List<Yw.Geometry.Point2d> qh_pt_list, |
| | | out List<Yw.Geometry.Point2d> qe_pt_list, |
| | | out List<Yw.Geometry.Point2d> qp_pt_list |
| | | )) |
| | | { |
| | | return; |
| | | } |
| | | _pump_matching_vm.MatchingDbId = pump_mian.ID.ToString(); |
| | | _pump_matching_vm.MatchingModelType = pump_mian.Name.ToString(); |
| | | _pump_matching_vm.MatchingRatedH = pump_mian.RatedHead; |
| | | _pump_matching_vm.MatchingRatedN = pump_mian.RatedSpeed; |
| | | _pump_matching_vm.MatchingRatedP = pump_mian.RatedPower; |
| | | _pump_matching_vm.MatchingRatedQ = pump_mian.RatedFlow; |
| | | |
| | | _pump_matching_vm.MatchingCurveDbId = phart.ID.ToString(); |
| | | _pump_matching_vm.MatchingCurveQH = qh_pt_list.Select(x => new HydroCurvePointViewModel(x.X, x.Y)).ToList(); |
| | | _pump_matching_vm.MatchingCurveQE = qe_pt_list?.Select(x => new HydroCurvePointViewModel(x.X, x.Y)).ToList(); |
| | | _pump_matching_vm.MatchingCurveQP = qp_pt_list?.Select(x => new HydroCurvePointViewModel(x.X, x.Y)).ToList(); |
| | | |
| | | this.ReloadDataEvent?.Invoke(_pump_matching_vm); |
| | | this.Close(); |
| | | } |
| | |
| | | var pump_main = this.gridViewPumpMain.GetCurrentViewModel(_pump_mian_vm_list); |
| | | if (pump_main != null) |
| | | { |
| | | var phart_list = await _phart_ex_bll.Value.GetByPumpMainID(pump_main.ID); |
| | | var vmo = await new BLL.AssetsPumpMain().GetByID(pump_main.ID); |
| | | _pumpVmo = vmo; |
| | | var phart_list = await _phart_ex_bll.Value.GetByObjectTypeAndObjectID(HStation.Assets.DataType.PumpMain, pump_main.ID); |
| | | if (phart_list != null && phart_list.Any()) |
| | | { |
| | | foreach (var item in phart_list) |
| | |
| | | vm.OtherName = item.OtherName; |
| | | vm.Importance = item.Importance; |
| | | vm.SortCode = item.SortCode; |
| | | vm.Diagram = item.Diagram; |
| | | // vm.Diagram = item.Diagram; |
| | | vm.DiagramID = item.DiagramID; |
| | | _phart_vm_list.Add(vm); |
| | | } |
| | | } |
| | | } |
| | | |
| | | this.gridViewCurve.FocusInvalidRow(); |
| | | this.gridControlCurve.DataSource = _phart_vm_list; |
| | | this.gridControlCurve.RefreshDataSource(); |
| | | this.phartViewModelBindingSource.DataSource = _phart_vm_list; |
| | | //this.gridControlCurve.DataSource = _phart_vm_list; |
| | | //this.gridViewCurve.RefreshData(); |
| | | this.phartViewModelBindingSource.ResetBindings(false); |
| | | //this.gridViewCurve.FocusInvalidRow(); |
| | | gridViewCurve_FocusedRowChanged(null, null); |
| | | } |
| | | |
| | | private void gridViewCurve_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) |
| | | private async void gridViewCurve_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) |
| | | { |
| | | var phart = this.gridViewCurve.GetCurrentViewModel(_phart_vm_list); |
| | | if (phart == null) |
| | | { |
| | | this.xtrPerform2dChart1.InitialChartData(); |
| | | //TipFormHelper.ShowWarn("无曲线"); |
| | | //this.pumpChartViewCtrl1.SetBindingData(null, 0); |
| | | this.pumpChartViewCtrl1.ClearBindingData(); |
| | | return; |
| | | } |
| | | |
| | | var diagram = phart.Diagram; |
| | | if (!OutPtList |
| | | (diagram, |
| | | out List<Yw.Geometry.Point2d> qh_pt_list, |
| | | out List<Yw.Geometry.Point2d> qe_pt_list, |
| | | out List<Yw.Geometry.Point2d> qp_pt_list |
| | | )) |
| | | var list = Task.Run(async () => await new BLL.PhartDiagramRelation().GetExByObjectTypeAndObjectID(HStation.Assets.DataType.PumpMain, _pumpVmo.ID)).Result; |
| | | if (list != null && list.Count > 0) |
| | | { |
| | | this.xtrPerform2dChart1.InitialChartData(); |
| | | return; |
| | | var def = list.OrderByDescending(x => x.Importance).First(); |
| | | _pump_matching_vm.MatchingCurveDbId = def.ID.ToString(); |
| | | var diagram = def.Diagram.GetDefaultVmo(); |
| | | var qh = diagram.QH.GetFeatPointList(); |
| | | var qp = diagram.QP.GetFeatPointList(); |
| | | var qe = diagram.QE.GetFeatPointList(); |
| | | _pump_matching_vm.MatchingCurveQH = new List<HydroCurvePointViewModel>(); |
| | | _pump_matching_vm.MatchingCurveQP = new List<HydroCurvePointViewModel>(); |
| | | _pump_matching_vm.MatchingCurveQE = new List<HydroCurvePointViewModel>(); |
| | | foreach (var item in qh) |
| | | { |
| | | _pump_matching_vm.MatchingCurveQH.Add(new HydroCurvePointViewModel(item.X, item.Y)); |
| | | } |
| | | foreach (var item in qp) |
| | | { |
| | | _pump_matching_vm.MatchingCurveQP.Add(new HydroCurvePointViewModel(item.X, item.Y)); |
| | | } |
| | | foreach (var item in qe) |
| | | { |
| | | _pump_matching_vm.MatchingCurveQE.Add(new HydroCurvePointViewModel(item.X, item.Y)); |
| | | } |
| | | } |
| | | |
| | | var cubic_spline_qh = new Yw.Geometry.CubicSpline2d(qh_pt_list); |
| | | var cubic_spline_qe = new Yw.Geometry.CubicSpline2d(qe_pt_list); |
| | | var cubic_spline_qp = new Yw.Geometry.CubicSpline2d(qp_pt_list); |
| | | 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 bool OutPtList( |
| | | PhartDiagramExGraphList diagram, |
| | | out List<Yw.Geometry.Point2d> qh_pt_list, |
| | | out List<Yw.Geometry.Point2d> qe_pt_list, |
| | | out List<Yw.Geometry.Point2d> qp_pt_list |
| | | ) |
| | | { |
| | | qh_pt_list = null; |
| | | qe_pt_list = null; |
| | | qp_pt_list = null; |
| | | |
| | | var graph_qh = diagram.GraphList.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQH); |
| | | var graph_qe = diagram.GraphList.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQE); |
| | | var graph_qp = diagram.GraphList.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQP); |
| | | if (graph_qh == null) |
| | | { |
| | | this.xtrPerform2dChart1.InitialChartData(); |
| | | return false; |
| | | } |
| | | |
| | | qh_pt_list = PhartPerformCurveHelper.GetFeatPointList(graph_qh.GraphType, graph_qh.GeometryInfo, 100, null); |
| | | if (graph_qe != null) |
| | | { |
| | | qe_pt_list = PhartPerformCurveHelper.GetFeatPointList(graph_qe.GraphType, graph_qe.GeometryInfo, 100, null); |
| | | } |
| | | if (graph_qp != null) |
| | | { |
| | | qp_pt_list = PhartPerformCurveHelper.GetFeatPointList(graph_qp.GraphType, graph_qp.GeometryInfo, 100, null); |
| | | } |
| | | |
| | | return true; |
| | | var vmo = await BLLFactory<Yw.BLL.PhartDiagramExtensions>.Instance.GetByID(phart.DiagramID); |
| | | this.pumpChartViewCtrl1.SetBindingData(vmo, _pumpVmo.RatedSpeed); |
| | | } |
| | | } |
| | | } |