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 |   63 ++++++++++++++++++++++---------
 1 files changed, 44 insertions(+), 19 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 da03732..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,
@@ -218,5 +242,6 @@
             this.pumpParallelChart1.SetDesignPoint(q, h);
         }
 
+
     }
 }

--
Gitblit v1.9.3