From 8ebe1a107a444f4925783e5e4795da46512cb51c Mon Sep 17 00:00:00 2001
From: duheng <2784771470@qq.com>
Date: 星期四, 26 九月 2024 15:07:18 +0800
Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/HStation/XHS.V1.0

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingParasHelper.cs |   92 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 92 insertions(+), 0 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingParasHelper.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingParasHelper.cs
index 684cb31..8b7492f 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingParasHelper.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingParasHelper.cs
@@ -168,6 +168,88 @@
 
                                 if (!string.IsNullOrEmpty(pumpMatching.MatchingCurveDbId))
                                 {
+                                    //娴侀噺鎵▼鏇茬嚎
+                                    var curveqh = hydroInfo.Curves?.Find(x => x.Code == pump.CurveQH);
+                                    if (curveqh == null)
+                                    {
+                                        var allParterList = hydroInfo.GetAllParters();
+                                        var parterNameList = allParterList?.Select(x => x.Code).Distinct().ToList();
+                                        curveqh.Catalog = Yw.Hydro.ParterCatalog.Curve;
+                                        curveqh.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", GetAllCodeList(hydroInfo));
+                                        curveqh.Name = "鍖归厤";
+                                        curveqh.ModelType = string.Empty;
+                                        curveqh.DbLocked = false;
+                                        curveqh.DbId = pumpMatching.MatchingCurveDbId;
+                                        curveqh.CurveType = Yw.WinFrmUI.HydroCurve.PumpQH;
+                                        curveqh.CurveData = pumpMatching.MatchingCurveQH?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
+                                        if (hydroInfo.Curves == null)
+                                        {
+                                            hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>();
+                                        }
+                                        hydroInfo.Curves.Add(curveqh);
+                                    }
+                                    else
+                                    {
+                                        if (!curveqh.DbLocked)
+                                        {
+                                            curveqh.DbId = pumpMatching.MatchingDbId;
+                                            curveqh.CurveData = pumpMatching.MatchingCurveQH?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
+                                        }
+                                    }
+
+                                    //娴侀噺鍔熺巼鏇茬嚎
+                                    var curveqp = hydroInfo.Curves?.Find(x => x.Code == pump.CurveQP);
+                                    if (curveqp == null)
+                                    {
+                                        curveqp.Catalog = Yw.Hydro.ParterCatalog.Curve;
+                                        curveqp.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", GetAllCodeList(hydroInfo));
+                                        curveqp.Name = "鍖归厤";
+                                        curveqp.ModelType = string.Empty;
+                                        curveqp.DbLocked = false;
+                                        curveqp.DbId = pumpMatching.MatchingCurveDbId;
+                                        curveqp.CurveType = Yw.WinFrmUI.HydroCurve.PumpQP;
+                                        curveqp.CurveData = pumpMatching.MatchingCurveQP?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
+                                        if (hydroInfo.Curves == null)
+                                        {
+                                            hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>();
+                                        }
+                                        hydroInfo.Curves.Add(curveqp);
+                                    }
+                                    else
+                                    {
+                                        if (!curveqp.DbLocked)
+                                        {
+                                            curveqp.DbId = pumpMatching.MatchingDbId;
+                                            curveqp.CurveData = pumpMatching.MatchingCurveQP?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
+                                        }
+                                    }
+
+                                    //娴侀噺鏁堢巼鏇茬嚎
+                                    var curveqe = hydroInfo.Curves?.Find(x => x.Code == pump.CurveQE);
+                                    if (curveqe == null)
+                                    {
+                                        curveqe.Catalog = Yw.Hydro.ParterCatalog.Curve;
+                                        curveqe.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", GetAllCodeList(hydroInfo));
+                                        curveqe.Name = "鍖归厤";
+                                        curveqe.ModelType = string.Empty;
+                                        curveqe.DbLocked = false;
+                                        curveqe.DbId = pumpMatching.MatchingCurveDbId;
+                                        curveqe.CurveType = Yw.WinFrmUI.HydroCurve.PumpQE;
+                                        curveqe.CurveData = pumpMatching.MatchingCurveQE?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
+                                        if (hydroInfo.Curves == null)
+                                        {
+                                            hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>();
+                                        }
+                                        hydroInfo.Curves.Add(curveqe);
+                                    }
+                                    else
+                                    {
+                                        if (!curveqe.DbLocked)
+                                        {
+                                            curveqe.DbId = pumpMatching.MatchingDbId;
+                                            curveqe.CurveData = pumpMatching.MatchingCurveQE?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList();
+                                        }
+                                    }
 
                                 }
                             }
@@ -423,6 +505,16 @@
             return result;
         }
 
+        //鑾峰彇鎵�鏈夌紪鐮佸垪琛�
+        private static List<string> GetAllCodeList(Yw.Model.HydroModelInfo hydroInfo)
+        {
+            if (hydroInfo == null)
+            {
+                return default;
+            }
+            var allParterList = hydroInfo.GetAllParters();
+            return allParterList?.Select(x => x.Code).Distinct().ToList();
+        }
 
     }
 }

--
Gitblit v1.9.3