Shuxia Ning
2024-12-02 0fd4a678c2218c42d383e964a6b4aca975aa7b7a
WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/01-pump-main/XhsPumpMainPhartPanel.cs
@@ -1,6 +1,4 @@
using Yw.WinFrmUI.Phart;
namespace HStation.WinFrmUI.PhartRelation
namespace HStation.WinFrmUI.PhartRelation
{
    public partial class XhsPumpMainPhartPanel : DocumentPage
    {
@@ -13,7 +11,7 @@
            this.pumpPerformInfoCtrl1.SetDesignPointEvent += (q, h) =>
            {
                _design_pt = new Yw.Geometry.Point2d(q, h);
                this.xtrPerform2dChart1.CalcDesignPointByQ(q, h);
                this.xtrPerform2dChart1.SetEquipPt(_design_pt);
            };
            this.xtrPerform2dChart1.OnCalcQueryPoint += (gropu_pt) =>
            {
@@ -181,7 +179,7 @@
        //Excel 导入
        private void barBtnImportByExcel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var dlg = new Yw.WinFrmUI.Phart.ImportPumpPerform2dByExcelDlg();
            var dlg = new Yw.WinFrmUI.Phart.PumpImportByExcelDlg();
            dlg.ReloadDataEvent += async (other_name, qh, qe, qp) =>
            {
                var bol = await Import(other_name, qh, qe, qp);
@@ -199,13 +197,13 @@
                var bol = await Import(other_name, qh, qe, qp);
                return bol;
            };
            dlg.ShowDialog();
            dlg.ShowDialog();
        }
        //单点 导入
        private void barBtnImportByOnePoint_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var dlg = new Yw.WinFrmUI.Phart.ImportPumpPerform2dByOnePointDlg();
            var dlg = new Yw.WinFrmUI.Phart.PumpImportByOnePointDlg();
            if (_pump_main != null)
            {
                dlg.Set(_pump_main.RatedFlow, _pump_main.RatedHead, _pump_main.RatedSpeed, _pump_main.RatedEfficiency);
@@ -319,7 +317,7 @@
                qp = new Yw.Pump.CurveQP(Yw.Pump.eFeatType.Cubic, points_qp);
            }
            var dlg = new Yw.WinFrmUI.Phart.PumpPerform2dEditDlg();
            var dlg = new Yw.WinFrmUI.Phart.PumpEditChartDlg();
            dlg.SetBindingData(qh, qe, qp);
            dlg.ReloadDataEvent += async (new_qh, new_qe, new_qp) =>
            {
@@ -414,19 +412,119 @@
                return;
            }
            var vm = new Yw.WinFrmUI.Phart.PumpVariableSpeedViewModel();
            //var vm = new Yw.WinFrmUI.Phart.PumpVariableSpeedViewModel();
            //vm.Id = _xhs_phart_diagram_ex_std_dto.ID.ToString();
            //vm.Name = $"{_pump_main.RatedSpeed}";
            //vm.RatedSpeed = _pump_main.RatedSpeed;
            //vm.CurrentSpeed = _pump_main.RatedSpeed;
            //vm.CurrentHz = 50;
            //vm.Qh = tuple.Item1;
            //vm.Qe = tuple.Item2;
            //vm.Qp = tuple.Item3;
            //var dlg = new PumpVariableSpeedChartDlg();
            //dlg.SetBindingData(vm, null);
            //dlg.ShowDialog();
            //var vm = new Yw.WinFrmUI.Phart.PumpWorkViewModel();
            //vm.Id = _xhs_phart_diagram_ex_std_dto.ID.ToString();
            //vm.Name = $"{_pump_main.RatedSpeed}";
            //vm.RatedSpeed = _pump_main.RatedSpeed;
            //vm.CurrentSpeed = _pump_main.RatedSpeed/2;
            //vm.CurrentHz = 50/2;
            //vm.Qh = tuple.Item1;
            //vm.Qe = tuple.Item2;
            //vm.Qp = tuple.Item3;
            //vm.WorkPoint = new Yw.Geometry.Point2d(15,16);
            //var vm1 = new Yw.WinFrmUI.Phart.PumpWorkViewModel();
            //vm1.Id = _xhs_phart_diagram_ex_std_dto.ID.ToString()+"1";
            //vm1.Name = $"{_pump_main.RatedSpeed}";
            //vm1.RatedSpeed = _pump_main.RatedSpeed;
            //vm1.CurrentSpeed = _pump_main.RatedSpeed / 1.6;
            //vm1.CurrentHz = 50 /1.6;
            //vm1.Qh = tuple.Item1;
            //vm1.Qe = tuple.Item2;
            //vm1.Qp = tuple.Item3;
            //vm1.WorkPoint = new Yw.Geometry.Point2d(12, 19);
            //var dlg = new PumpWorkComparisonChartDlg();
            //dlg.SetBindingData(new List<Yw.WinFrmUI.Phart.PumpWorkViewModel>() { vm,vm1});
            //dlg.ShowDialog();
            var vm = new Yw.WinFrmUI.Phart.PumpWorkViewModel();
            vm.Id = _xhs_phart_diagram_ex_std_dto.ID.ToString();
            vm.Name = $"{_pump_main.RatedSpeed}";
            //vm.IsBp = pump_mian.;
            vm.RatedSpeed = _pump_main.RatedSpeed;
            vm.CurrentSpeed = _pump_main.RatedSpeed;
            vm.CurrentHz = 50;
            vm.CurrentSpeed = _pump_main.RatedSpeed / 2;
            vm.CurrentHz = 50 / 2;
            vm.Qh = tuple.Item1;
            vm.Qe = tuple.Item2;
            vm.Qp = tuple.Item3;
            vm.RunStatus = true;
            vm.WorkPoint = new Yw.Geometry.Point2d(15, 16);
            var dlg = new PumpVariableSpeedChartDlg();
            dlg.SetBindingData(vm, null);
            var dlg = new PumpWorkChartDlg();
            dlg.SetBindingData(vm);
            dlg.ShowDialog();
        }
        //复制并延长
        private void barBtnCopyAndExpand_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_xhs_phart_diagram_ex_std_dto == null)
            {
                return;
            }
            var diagram = _xhs_phart_diagram_ex_std_dto.Diagram;
            if (diagram == null)
            {
                return;
            }
            var graph_list = diagram.GraphList;
            if (graph_list == null || !graph_list.Any())
            {
                return;
            }
            var graph_qh = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQH);
            var graph_qe = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQE);
            var graph_qp = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQP);
            if (graph_qh == null)
            {
                return;
            }
            Yw.Pump.CurveQH qh = null;
            Yw.Pump.CurveQE qe = null;
            Yw.Pump.CurveQP qp = null;
            List<Yw.Geometry.Point2d> points_qh = null, points_qe = null, points_qp = null;
            points_qh = PhartPerformCurveHelper.GetFeatPointList(graph_qh.GraphType, graph_qh.GeometryInfo, 12, null);
            qh = new Yw.Pump.CurveQH(Yw.Pump.eFeatType.Cubic, points_qh);
            if (graph_qe != null)
            {
                points_qe = PhartPerformCurveHelper.GetFeatPointList(graph_qe.GraphType, graph_qe.GeometryInfo, 12, null);
                qe = new Yw.Pump.CurveQE(Yw.Pump.eFeatType.Cubic, points_qe);
            }
            if (graph_qp != null)
            {
                points_qp = PhartPerformCurveHelper.GetFeatPointList(graph_qp.GraphType, graph_qp.GeometryInfo, 12, null);
                qp = new Yw.Pump.CurveQP(Yw.Pump.eFeatType.Cubic, points_qp);
            }
            var dlg = new PumpCurveExpandDlg();
            dlg.SetBindingData(qh, qe, qp);
            dlg.ReloadDataEvent += async (new_qh, new_qe, new_qp) =>
            {
                var other_name = $"{_xhs_phart_diagram_ex_std_dto.OtherName}-复制延长";
                var bol = await Import(other_name, new_qh, new_qe, new_qp);
                return bol;
            };
            dlg.ShowDialog();
        }
@@ -462,5 +560,7 @@
        #endregion 删除
        #endregion 操作
    }
}