duheng
2024-10-24 bb5865148234cad04ae31d4de9264f4209a3fa6d
WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-pump/02-analy/SinglePumpAnalyInfoCtrl.cs
@@ -1,6 +1,4 @@
using Yw.WinFrmUI.Phart;
namespace HStation.WinFrmUI.Xhs
namespace HStation.WinFrmUI.Xhs
{
    public partial class SinglePumpAnalyInfoCtrl : DevExpress.XtraEditors.XtraUserControl
    {
@@ -19,7 +17,7 @@
            this.colName.OptionsColumn.AllowEdit = false;
            this.colName.OptionsColumn.ReadOnly = true;
            this.colName.Visible = false;
            this.colColor.OptionsColumn.AllowEdit = false;
            this.colColor.OptionsColumn.ReadOnly = true;
@@ -30,27 +28,30 @@
        }
        /// <summary>
        /// 设置曲线
        /// </summary> 
        public event Action<string,double,double, Yw.Geometry.CubicSpline2d, Yw.Geometry.CubicSpline2d, Yw.Geometry.CubicSpline2d> SetEvent;
        public event Action<string, double, double, Yw.Geometry.CubicSpline2d, Yw.Geometry.CubicSpline2d, Yw.Geometry.CubicSpline2d> SetEvent;
        /// <summary>
        /// 设置曲线信息
        /// </summary> 
        public event Action<string,Color> SetInfoEvent;
        public event Action<string, Color> SetInfoEvent;
        /// <summary>
        /// 设置设计点
        /// </summary> 
        public event Action<double, double> SetDesignPointEvent;
        /// <summary>
        /// 保存事件
        /// </summary>
        public event Action<SinglePumpAnalyViewModel> SaveEvent;
        private List<SinglePumpAnalyViewModel> _all_binding_list = null;
        public void SetBindingData(List<SinglePumpAnalyViewModel> vm_list)
        {
            _all_binding_list = new List<SinglePumpAnalyViewModel>();
@@ -65,7 +66,6 @@
            this.gridView2.BestFitColumns();
            this.gridView3.BestFitColumns();
        }
        public void SetDesignPoint(double flow, double head)
        {
@@ -112,7 +112,7 @@
                }
            }
        }
        //值变换
        private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
@@ -127,7 +127,7 @@
                vm.Calc();
                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;
@@ -161,7 +161,7 @@
        /// 设置设计点信息
        /// </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 =>
@@ -173,11 +173,11 @@
                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;
                    vm.SectP = pt.QueryP;
                };
            });
            this.singlePumpAnalyViewModelBindingSource.ResetBindings(false);
@@ -194,6 +194,12 @@
            this.SetDesignPointEvent?.Invoke(design_q, design_h);
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (XtraMessageBox.Show("是否保存数据?", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) != DialogResult.Yes)
                return;
            var vm = _all_binding_list.Last();
            this.SaveEvent?.Invoke(vm);
        }
    }
}