From 687a3dfd095bc8c099b7fa6e65f0dc699fdc8f1d Mon Sep 17 00:00:00 2001
From: Shuxia Ning <NingShuxia0927@outlook.com>
Date: 星期三, 08 一月 2025 13:57:33 +0800
Subject: [PATCH] 冲突

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/07-matching/02-pump/01-pumpsinglematching/PumpSingleMatchingCtrl.cs |   99 +++++++++++++------------------------------------
 1 files changed, 26 insertions(+), 73 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/07-matching/02-pump/01-pumpsinglematching/PumpSingleMatchingCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/07-matching/02-pump/01-pumpsinglematching/PumpSingleMatchingCtrl.cs
index bcd9d67..35dae65 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/07-matching/02-pump/01-pumpsinglematching/PumpSingleMatchingCtrl.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/07-matching/02-pump/01-pumpsinglematching/PumpSingleMatchingCtrl.cs
@@ -1,6 +1,4 @@
-锘縰sing HStation.WinFrmUI.PhartRelation;
-
-namespace HStation.WinFrmUI
+锘縩amespace HStation.WinFrmUI
 {
     public partial class PumpSingleMatchingCtrl : DevExpress.XtraEditors.XtraUserControl
     {
@@ -16,7 +14,7 @@
         private BLL.AssetsPumpMain _pumpBll = null;
 
         private List<PhartViewModel> _allPhartList = null;
-        private readonly Lazy<BLL.XhsPumpMainPhartMappingExtensions> _bll_ex = new();
+        private readonly Lazy<BLL.PhartDiagramRelation> _bll_ex = new();
 
         private HydroPumpMatchingViewModel _pumpMatchingViewModel;
 
@@ -45,46 +43,9 @@
         }
 
         //鍒濆鍖栧浘琛ㄦ暟鎹�
-        private void InitChart(Vmo.XhsPumpMainPhartMappingExtensions dto)
+        private void InitChart(Yw.Vmo.PhartDiagramExGraphListVmo vmo, double speed = 0)
         {
-            if (dto == null)
-            {
-                return;
-            }
-            var diagram = 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_qp == null)
-            {
-                return;
-            }
-
-            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);
-            if (graph_qe != null)
-                points_qe = PhartPerformCurveHelper.GetFeatPointList(graph_qe.GraphType, graph_qe.GeometryInfo, 12, null);
-            if (graph_qp != null)
-                points_qp = PhartPerformCurveHelper.GetFeatPointList(graph_qp.GraphType, graph_qp.GeometryInfo, 12, null);
-
-            var cubic_spline_qh = new Yw.Geometry.CubicSpline2d(points_qh);
-            var cubic_spline_qe = new Yw.Geometry.CubicSpline2d(points_qe);
-            var cubic_spline_qp = new Yw.Geometry.CubicSpline2d(points_qp);
-
-            var disp_paras = diagram.DispParas;
-            var is_calc_disp_paras = string.IsNullOrWhiteSpace(disp_paras);
-            this.xtrPerform2dChart1.SetBindingData(cubic_spline_qh, cubic_spline_qe, cubic_spline_qp, disp_paras, is_calc_disp_paras);
+            this.pumpChartViewCtrl1.SetBindingData(vmo, speed);
         }
 
         //娉靛瀷鍙峰垪琛ㄩ�夋嫨椤瑰垏鎹簨浠�
@@ -99,13 +60,14 @@
                 _pumpMatchingViewModel.MatchingRatedN = vm.RatedSpeed;
                 _pumpMatchingViewModel.MatchingRatedP = vm.RatedPower;
                 _pumpMatchingViewModel.MatchingRatedQ = vm.RatedFlow;
-                var list = await _bll_ex.Value.GetByPumpMainID(vm.ID);
+                var list = await BLLFactory<HStation.BLL.PhartDiagramRelation>.Instance
+                 .GetByObjectTypeAndObjectID(HStation.Assets.DataType.PumpMain, vm.ID);
                 _allPhartList = new List<PhartViewModel>();
                 if (list != null && list.Any())
                 {
                     foreach (var item in list)
                     {
-                        _allPhartList.Add(new PhartViewModel { ID = item.ID, OtherName = item.OtherName, Importance = item.Importance, SortCode = item.SortCode });
+                        _allPhartList.Add(new PhartViewModel { ID = item.ID, OtherName = item.OtherName, Importance = item.Importance, SortCode = item.SortCode, DiagramID = item.DiagramID });
                     }
                 }
             }
@@ -129,45 +91,36 @@
             var vm = this.gridView1.GetCurrentViewModel(_allPhartList);
             if (vm != null)
             {
-                var vmo = await _bll_ex.Value.GetByID(vm.ID);
-                if (vmo != null)
+                var list = Task.Run(async () => await new BLL.PhartDiagramRelation().GetExByObjectTypeAndObjectID(HStation.Assets.DataType.PumpMain, vm.ID)).Result;
+                if (list != null && list.Count > 0)
                 {
-                    _pumpMatchingViewModel.MatchingCurveDbId = vm.ID.ToString();
-                    var graph_qh = vmo.Diagram.GraphList.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQH);
-                    var graph_qe = vmo.Diagram.GraphList.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQE);
-                    var graph_qp = vmo.Diagram.GraphList.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQP);
-                    if (graph_qh != null)
+                    var def = list.OrderByDescending(x => x.Importance).First();
+                    _pumpMatchingViewModel.MatchingCurveDbId = def.ID.ToString();
+                    var diagram = def.Diagram.GetDefaultVmo();
+                    var qh = diagram.QH.GetFeatPointList();
+                    var qp = diagram.QP.GetFeatPointList();
+                    var qe = diagram.QE.GetFeatPointList();
+                    _pumpMatchingViewModel.MatchingCurveQH = new List<HydroCurvePointViewModel>();
+                    _pumpMatchingViewModel.MatchingCurveQP = new List<HydroCurvePointViewModel>();
+                    _pumpMatchingViewModel.MatchingCurveQE = new List<HydroCurvePointViewModel>();
+                    foreach (var item in qh)
                     {
-                        var points_qh = PhartPerformCurveHelper.GetFeatPointList(graph_qh.GraphType, graph_qh.GeometryInfo, 100, null);
-                        _pumpMatchingViewModel.MatchingCurveQH = new List<HydroCurvePointViewModel>();
-                        foreach (var item in points_qh)
-                        {
-                            _pumpMatchingViewModel.MatchingCurveQH.Add(new HydroCurvePointViewModel(item.X, item.Y));
-                        }
+                        _pumpMatchingViewModel.MatchingCurveQH.Add(new HydroCurvePointViewModel(item.X, item.Y));
                     }
-                    if (graph_qe != null)
+                    foreach (var item in qp)
                     {
-                        var points_qe = PhartPerformCurveHelper.GetFeatPointList(graph_qe.GraphType, graph_qe.GeometryInfo, 100, null);
-                        _pumpMatchingViewModel.MatchingCurveQE = new List<HydroCurvePointViewModel>();
-                        foreach (var item in points_qe)
-                        {
-                            _pumpMatchingViewModel.MatchingCurveQE.Add(new HydroCurvePointViewModel(item.X, item.Y));
-                        }
+                        _pumpMatchingViewModel.MatchingCurveQP.Add(new HydroCurvePointViewModel(item.X, item.Y));
                     }
-                    if (graph_qp != null)
+                    foreach (var item in qe)
                     {
-                        var points_qp = PhartPerformCurveHelper.GetFeatPointList(graph_qp.GraphType, graph_qp.GeometryInfo, 100, null);
-                        _pumpMatchingViewModel.MatchingCurveQP = new List<HydroCurvePointViewModel>();
-                        foreach (var item in points_qp)
-                        {
-                            _pumpMatchingViewModel.MatchingCurveQP.Add(new HydroCurvePointViewModel(item.X, item.Y));
-                        }
+                        _pumpMatchingViewModel.MatchingCurveQE.Add(new HydroCurvePointViewModel(item.X, item.Y));
                     }
                 }
+                var vmo = await BLLFactory<Yw.BLL.PhartDiagramExtensions>.Instance.GetByID(vm.DiagramID);
                 InitChart(vmo);
                 return;
             }
-            this.xtrPerform2dChart1.SetBindingData(null, null, null, null, false);
+            this.pumpChartViewCtrl1.SetBindingData(null, 0);
         }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3