| | |
| | | using 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; |
| | | using System.Data; |
| | | using Yw.Pump; |
| | | using Yw.WinFrmUI.Phart; |
| | | |
| | | namespace HStation.WinFrmUI |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public partial class SimulationPumpParallelCtrl : DevExpress.XtraEditors.XtraUserControl |
| | | { |
| | | public SimulationPumpParallelCtrl() |
| | |
| | | /// </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); |
| | | } |
| | | |
| | | //状态改变事件 |
| | |
| | | { |
| | | 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); |
| | | } |
| | | |
| | | //保存 |
| | |
| | | { |
| | | 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, |
| | |
| | | this.pumpParallelChart1.SetDesignPoint(q, h); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |