From 467578cbe7f027c14ceba0aed16fb827b94e2c65 Mon Sep 17 00:00:00 2001 From: duheng <2784771470@qq.com> Date: 星期五, 07 三月 2025 09:41:58 +0800 Subject: [PATCH] pbs-为登录静态类赋值 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/01-parallel/SimulationPumpParallelCtrl.cs | 107 +++++++++++++++++++++++++++++++++-------------------- 1 files changed, 66 insertions(+), 41 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/01-parallel/SimulationPumpParallelCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/01-parallel/SimulationPumpParallelCtrl.cs index 9115df9..471577e 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/01-parallel/SimulationPumpParallelCtrl.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/01-parallel/SimulationPumpParallelCtrl.cs @@ -1,20 +1,12 @@ -锘縰sing DevExpress.PivotGrid.PivotTable; -using DevExpress.XtraEditors; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using Yw.Geometry; +锘縰sing System.Data; using Yw.Pump; using Yw.WinFrmUI.Phart; namespace HStation.WinFrmUI { + /// <summary> + /// + /// </summary> public partial class SimulationPumpParallelCtrl : DevExpress.XtraEditors.XtraUserControl { public SimulationPumpParallelCtrl() @@ -37,16 +29,16 @@ /// </summary> public event Action<bool, string> ParallelStatusChangedEvent; + private List<HydroPumpListItemExtendViewModel> _allPumpList = null;//鎵�鏈夋按娉靛垪琛� + /// <summary> /// 缁戝畾鍒楄〃 /// </summary> public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo) { - this.hydroPumpListExtendGridCtrl1.SetBindingData(hydroInfo); - var allStateList = this.hydroPumpListExtendGridCtrl1.GetStateList(); - var allVmList = CreateParallelViewModels(allStateList); - this.pumpParallelChart1.SetBindingData(allVmList); + var allPumpList = hydroInfo?.Pumps?.Select(x => new HydroPumpListItemExtendViewModel(x, hydroInfo.Pumps, hydroInfo)).ToList(); + InitialGroups(allPumpList); } //鐘舵�佹敼鍙樹簨浠� @@ -54,6 +46,39 @@ { var allVmList = CreateParallelViewModels(allStateList); this.pumpParallelChart1.SetBindingData(allVmList); + } + + //鍒濆鍖栨墍鏈夊垎缁� + private void InitialGroups(List<HydroPumpListItemExtendViewModel> allStateList) + { + _allPumpList = allStateList?.ToList(); + var groups = _allPumpList?.Select(x => x.BeginGroup).Distinct().ToList(); + this.itemForPumpGroup.Visibility = groups != null && groups.Count > 1 ? DevExpress.XtraLayout.Utils.LayoutVisibility.Always + : DevExpress.XtraLayout.Utils.LayoutVisibility.Never; + this.imageComboBoxEdit1.Properties.BeginUpdate(); + this.imageComboBoxEdit1.Properties.Items.Clear(); + groups?.ForEach(x => + { + this.imageComboBoxEdit1.Properties.Items.Add(x, x, -1); + }); + this.imageComboBoxEdit1.SelectedIndex = groups != null && groups.Count > 0 ? 0 : -1; + this.imageComboBoxEdit1.Properties.EndUpdate(); + } + + //鍒嗙粍閫夋嫨鏀瑰彉 + private void imageComboBoxEdit1_SelectedValueChanged(object sender, EventArgs e) + { + var item = this.imageComboBoxEdit1.SelectedItem as ImageComboBoxItem; + if (item == null) + { + return; + } + var allBindingList = _allPumpList?.Where(x => x.BeginGroup == item.Value?.ToString()).ToList(); + if (allBindingList == null) + { + allBindingList = new List<HydroPumpListItemExtendViewModel>(); + } + this.hydroPumpListExtendGridCtrl1.SetBindingData(allBindingList); } //淇濆瓨 @@ -64,12 +89,11 @@ { return; } - var allStateList = this.hydroPumpListExtendGridCtrl1.GetStateList(); - if (allStateList == null || allStateList.Count < 1) + if (_allPumpList == null || _allPumpList.Count < 1) { return; } - var allSaveList = allStateList.Select(x => new SimulationPumpParallelSaveItemViewModel() + var allSaveList = _allPumpList.Select(x => new SimulationPumpParallelSaveItemViewModel() { Code = x.Code, LinkStatus = x.RunStatus ? Yw.Hydro.PumpStatus.Open : Yw.Hydro.PumpStatus.Closed, @@ -92,10 +116,10 @@ var vm = new PumpParallelViewModel(); vm.Id = item.Code; vm.Name = item.Name; - vm.RatedQ = item.Vmo.RatedQ.HasValue ? item.Vmo.RatedQ.Value : 0; - vm.RatedH = item.Vmo.RatedH.HasValue ? item.Vmo.RatedH.Value : 0; + vm.RatedQ = item.Vmo.RatedQ; + vm.RatedH = item.Vmo.RatedH; vm.RatedP = item.Vmo.RatedP; - vm.RatedN = item.Vmo.RatedN.HasValue ? item.Vmo.RatedN.Value : 0; + vm.RatedN = item.Vmo.RatedN; vm.RatedHz = item.Vmo.RatedHz; vm.CurrentHz = item.Hz; vm.CurrentN = Math.Round(item.Hz / item.Vmo.RatedHz * vm.RatedN, 1); @@ -109,15 +133,15 @@ var qh_pts = curveqh.CurveData?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); if (qh_pts != null && qh_pts.Count > 3) { - vm.CurveQH = new CubicSpline2d(qh_pts); + vm.CurveQH = qh_pts; var qh_current_pts = qh_pts.GetQHPointListByN(item.Vmo.RatedHz, item.Hz); - vm.CurrentCurveQH = new CubicSpline2d(qh_current_pts); + vm.CurrentCurveQH = qh_current_pts; if (item.Extend > 100) { - vm.CurrentExtendFlow = vm.CurrentCurveQH.MaxX; + vm.CurrentExtendFlow = vm.CurrentCurveQH.Max(x => x.X); extend = item.Extend / 100; - var qh_current_extend_pts = vm.CurrentCurveQH.GetPointListByXRatioRange(1, extend, 20); - vm.CurrentCurveQH = new CubicSpline2d(qh_current_extend_pts); + var qh_current_extend_pts = vm.CurrentCurveQH.GetExpandPointList(Yw.Ahart.eFeatType.Cubic, 1, extend, 20); + vm.CurrentCurveQH = qh_current_extend_pts; } } } @@ -125,16 +149,16 @@ var curveqp = item.HydroInfo.Curves?.Find(x => x.Code == item.Vmo.CurveQP); if (curveqp != null) { - var qppts = curveqp.CurveData?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); - if (qppts != null && qppts.Count > 3) + var qp_pts = curveqp.CurveData?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); + if (qp_pts != null && qp_pts.Count > 3) { - vm.CurveQP = new CubicSpline2d(qppts); - var sqppts = qppts.GetQHPointListByN(item.Vmo.RatedHz, item.Hz); - vm.CurrentCurveQP = new CubicSpline2d(sqppts); + vm.CurveQP = qp_pts; + var qp_current_pts = qp_pts.GetQPPointListByN(item.Vmo.RatedHz, item.Hz); + vm.CurrentCurveQP = qp_current_pts; if (extend > 1) { - var qp_current_extend_pts = vm.CurrentCurveQP.GetPointListByXRatioRange(1, extend, 20); - vm.CurrentCurveQP = new CubicSpline2d(qp_current_extend_pts); + var qp_current_extend_pts = vm.CurrentCurveQP.GetExpandPointList(Yw.Ahart.eFeatType.Cubic, 1, extend, 20); + vm.CurrentCurveQP = qp_current_extend_pts; } } } @@ -142,16 +166,16 @@ var curveqe = item.HydroInfo.Curves?.Find(x => x.Code == item.Vmo.CurveQE); if (curveqe != null) { - var qepts = curveqe.CurveData?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); - if (qepts != null && qepts.Count > 3) + var qe_pts = curveqe.CurveData?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); + if (qe_pts != null && qe_pts.Count > 3) { - vm.CurveQE = new CubicSpline2d(qepts); - var sqepts = qepts.GetQHPointListByN(item.Vmo.RatedHz, item.Hz); - vm.CurrentCurveQE = new CubicSpline2d(sqepts); + vm.CurveQE = qe_pts; + var qe_current_pts = qe_pts.GetQEPointListByN(item.Vmo.RatedHz, item.Hz); + vm.CurrentCurveQE = qe_current_pts; if (extend > 1) { - var qe_current_extend_pts = vm.CurrentCurveQE.GetPointListByXRatioRange(1, extend, 20); - vm.CurrentCurveQE = new CubicSpline2d(qe_current_extend_pts); + var qe_current_extend_pts = vm.CurrentCurveQE.GetExpandPointList(Yw.Ahart.eFeatType.Cubic, 1, extend, 20); + vm.CurrentCurveQE = qe_current_extend_pts; } } } @@ -218,5 +242,6 @@ this.pumpParallelChart1.SetDesignPoint(q, h); } + } } -- Gitblit v1.9.3