Shuxia Ning
2024-10-23 7a42ac37f5b5c93e6e11b2b6e50902044d0edee0
WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-pump/02-analy/SinglePumpAnalyInfoCtrl.cs
@@ -1,4 +1,6 @@
namespace HStation.WinFrmUI.Xhs
using Yw.WinFrmUI.Phart;
namespace HStation.WinFrmUI.Xhs
{
    public partial class SinglePumpAnalyInfoCtrl : DevExpress.XtraEditors.XtraUserControl
    {
@@ -7,7 +9,9 @@
            InitializeComponent();
            this.gridView1.SetNormalEditView();
            this.gridView2.SetNormalView();
            this.gridView3.SetNormalView();
            this.gridView3.SetNormalView();
            this.gridView1.ShowingEditor += GridView1_ShowingEditor;
            this.repColor.ColorAlignment = DevExpress.Utils.HorzAlignment.Center;
            this.repColor.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
@@ -15,15 +19,18 @@
            this.colName.OptionsColumn.AllowEdit = false;
            this.colName.OptionsColumn.ReadOnly = true;
            this.colName.Visible = false;
            this.colColor.OptionsColumn.AllowEdit = false;
            this.colColor.OptionsColumn.ReadOnly = true;
            this.gridView1.ShowingEditor += GridView1_ShowingEditor; ;
            this.colCurrentSpeed.OptionsColumn.AllowEdit = false;
            this.colCurrentSpeed.OptionsColumn.ReadOnly = true;
        }
@@ -56,12 +63,28 @@
            this.singlePumpAnalyViewModelBindingSource.DataSource = _all_binding_list;
            this.singlePumpAnalyViewModelBindingSource.ResetBindings(false);
            this.gridView1.BestFitColumns();
            this.gridView2.BestFitColumns();
            this.gridView3.BestFitColumns();
        }
        public void SetDesignPoint(double flow, double head)
        {
            this.txtDesignQ.EditValue = flow;
            this.txtDesignH.EditValue = head;
        }
        public void Add(SinglePumpAnalyViewModel vm)
        {
            if (_all_binding_list == null)
                _all_binding_list = new List<SinglePumpAnalyViewModel>();
            _all_binding_list.Add(vm);
            this.singlePumpAnalyViewModelBindingSource.DataSource = _all_binding_list;
            this.singlePumpAnalyViewModelBindingSource.ResetBindings(false);
            this.gridView1.BestFitColumns();
            this.gridView2.BestFitColumns();
            this.gridView3.BestFitColumns();
        }
        /// <summary>
@@ -79,7 +102,9 @@
        //验证
        private void GridView1_ShowingEditor(object sender, CancelEventArgs e)
        {
            if (this.gridView1.FocusedColumn != this.colCurrentHz)
            if (this.gridView1.FocusedColumn == this.colCurrentHz
                || this.gridView1.FocusedColumn == this.colExtendRatio
                || this.gridView1.FocusedColumn == this.colCurrentSpeed)
            {
                var vm = this.gridView1.GetFocusedRow() as SinglePumpAnalyViewModel;
                if (vm.IsDefault)
@@ -88,34 +113,35 @@
                }
            }
        }
        //值变换
        private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
        {
            if (e.Column == this.colCurrentHz)
            {
                var vm = this.gridView1.GetRow(e.RowHandle) as SinglePumpAnalyViewModel;
                if (vm.CurrentHz < 10 || vm.CurrentHz > 50)
                {
                    return;
                }
                vm.Calc();
                this.SetEvent?.Invoke(vm.Id,vm.CurrentHz,vm.ExtendRatio, vm.QhCalc, vm.QeCalc, vm.QpCalc);
            }
                this.singlePumpAnalyViewModelBindingSource.ResetBindings(false);
                this.SetEvent?.Invoke(vm.Id, vm.CurrentHz, vm.ExtendRatio, vm.QhCalc, vm.QeCalc, vm.QpCalc);
            }
            else if (e.Column == this.colExtendRatio)
            {
                var vm = this.gridView1.GetRow(e.RowHandle) as SinglePumpAnalyViewModel;
                vm.Calc();
                this.singlePumpAnalyViewModelBindingSource.ResetBindings(false);
                this.SetEvent?.Invoke(vm.Id, vm.CurrentHz, vm.ExtendRatio, vm.QhCalc, vm.QeCalc, vm.QpCalc);
            }
        }
        /// <summary>
        /// 设置查询信息
        /// </summary>
        /// <param name="id"></param>
        /// <param name="query_pt"></param>
        /// </summary>
        public void SetQueryInfo(string id, Yw.WinFrmUI.Phart.PumpGroupPt query_pt)
        {
            if (query_pt == null)
@@ -132,6 +158,32 @@
            this.singlePumpAnalyViewModelBindingSource.ResetBindings(false);
        }
        /// <summary>
        /// 设置设计点信息
        /// </summary>
        public void SetSectPointList(List<Yw.WinFrmUI.Phart.PumpSectPointViewModel> vm_list)
        {
            if (_all_binding_list == null || !_all_binding_list.Any())
                return;
            _all_binding_list.ForEach(vm =>
            {
                vm.SectQ = string.Empty;
                vm.SectH = string.Empty;
                vm.SectE = string.Empty;
                vm.SectP = string.Empty;
                var pt = vm_list?.Find(x => x.Id == vm.Id);
                if (pt != null)
                {
                    vm.SectQ = pt.QueryQ;
                    vm.SectH = pt.QueryH;
                    vm.SectE = pt.QueryE;
                    vm.SectP = pt.QueryP;
                };
            });
            this.singlePumpAnalyViewModelBindingSource.ResetBindings(false);
        }
        //设置设计点
        private void btnSetDesignPoint_Click(object sender, EventArgs e)
        {