From 4d95d752823b1f5362c5d639001444b260b90395 Mon Sep 17 00:00:00 2001
From: Shuxia Ning <NingShuxia0927@outlook.com>
Date: 星期五, 10 一月 2025 16:12:57 +0800
Subject: [PATCH] 阀门曲线 导入 编辑控件

---
 WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/02-edit/PumpChartExcelEditCtrl.cs |   54 +++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 47 insertions(+), 7 deletions(-)

diff --git a/WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/02-edit/PumpChartExcelEditCtrl.cs b/WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/02-edit/PumpChartExcelEditCtrl.cs
index 3bdcf83..de5d19d 100644
--- a/WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/02-edit/PumpChartExcelEditCtrl.cs
+++ b/WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/02-edit/PumpChartExcelEditCtrl.cs
@@ -47,9 +47,10 @@
             List<Yw.Geometry.Point2d> def_qp_pt_list,
             Yw.Ahart.eFeatType feat_type_qh = Ahart.eFeatType.Cubic,
             Yw.Ahart.eFeatType feat_type_qe = Ahart.eFeatType.Cubic,
-            Yw.Ahart.eFeatType feat_type_qp = Ahart.eFeatType.Cubic)
+            Yw.Ahart.eFeatType feat_type_qp = Ahart.eFeatType.Cubic,
+            Yw.Ahart.eCurveType curve_type = Ahart.eCurveType.QH)
         {
-            _edit_curve_type = Ahart.eCurveType.QH;
+            _edit_curve_type = curve_type;
 
             _feat_type_qh = feat_type_qh;
             _def_qh_pt_list = def_qh_pt_list?.Select(x => new Geometry.Point2d(x.X, x.Y)).ToList();
@@ -244,17 +245,56 @@
             if (_def_qh_pt_list == null || !_def_qh_pt_list.Any())
                 return;
             List<Yw.Geometry.Point2d> def_pt_list = null;
+            Yw.Ahart.eFeatType feat_type = Ahart.eFeatType.Cubic;
             switch (_edit_curve_type)
             {
-                case Ahart.eCurveType.QH: def_pt_list = _def_qh_pt_list; break;
-                case Ahart.eCurveType.QE: def_pt_list = _def_qe_pt_list; break;
-                case Ahart.eCurveType.QP: def_pt_list = _def_qp_pt_list; break;
+                case Ahart.eCurveType.QH: def_pt_list = _def_qh_pt_list; feat_type=_feat_type_qh; break;
+                case Ahart.eCurveType.QE: def_pt_list = _def_qe_pt_list; feat_type = _feat_type_qe; break;
+                case Ahart.eCurveType.QP: def_pt_list = _def_qp_pt_list; feat_type = _feat_type_qp; break;
             }
             var row = this.gridView1.GetCurrentViewModel(def_pt_list);
             if (row == null)
                 return;
-            if (def_pt_list.Count <= 4)
-                return;
+            var count = def_pt_list.Count - 1;
+            switch (feat_type)
+            {
+                case Ahart.eFeatType.Cubic:
+                    {
+                        if (count < 4)
+                        {
+                            TipFormHelper.ShowInfo("鐐规暟灏戜簬4涓偣");
+                            return;
+                        }
+                    }
+                    break;
+                case Ahart.eFeatType.Through:
+                    {
+                        if (count < 1)
+                        {
+                            TipFormHelper.ShowInfo("鐐规暟灏戜簬1涓偣");
+                            return;
+                        }
+                    }
+                    break;
+                case Ahart.eFeatType.Quadratic:
+                    {
+                        if (count < 3)
+                        {
+                            TipFormHelper.ShowInfo("鐐规暟灏戜簬3涓偣");
+                            return;
+                        }
+                    }
+                    break;
+                case Ahart.eFeatType.Quartic:
+                    {
+                        if (count < 5)
+                        {
+                            TipFormHelper.ShowInfo("鐐规暟灏戜簬5涓偣");
+                            return;
+                        }
+                    }
+                    break;
+            }
             def_pt_list.Remove(row);
             this.bindingSource1.ResetBindings(false);
             SetChart(_def_qh_pt_list, _def_qe_pt_list, _def_qp_pt_list, _feat_type_qh, _feat_type_qe, _feat_type_qp, _edit_curve_type);

--
Gitblit v1.9.3