From 4a27caa5a0d8f4eef667cc9ed0d1c01ea7329298 Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期五, 20 十二月 2024 21:47:27 +0800
Subject: [PATCH] 增加冷却塔匹配

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/07-matching/00-core/AssetsMatchingHelper.cs |   74 ++++++++++++++++---------------------
 1 files changed, 32 insertions(+), 42 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/07-matching/00-core/AssetsMatchingHelper.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/07-matching/00-core/AssetsMatchingHelper.cs
index 9526295..ba84062 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/07-matching/00-core/AssetsMatchingHelper.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/07-matching/00-core/AssetsMatchingHelper.cs
@@ -39,6 +39,7 @@
             var AssetsHydrantMain = new BLL.AssetsHydrantMain();
             var AssetsPressmeterMain = new BLL.AssetsPressmeterMain();
             var AssetsTranslationMain = new BLL.AssetsTranslationMain();
+            var AssetsCoolingMain = new BLL.AssetsCoolingMain();
             try
             {
                 var allPump = Task.Run(async () => await AssetsPumpMain.GetAll()).Result;
@@ -58,6 +59,7 @@
                 var allHydrantMain = Task.Run(async () => await AssetsHydrantMain.GetAll()).Result;
                 var allPressmeterMain = Task.Run(async () => await AssetsPressmeterMain.GetAll()).Result;
                 var allTranslationMain = Task.Run(async () => await AssetsTranslationMain.GetAll()).Result;
+                var allCoolingMain = Task.Run(async () => await AssetsCoolingMain.GetAll()).Result;
                 //娉靛尮閰�
                 foreach (var item in assetsAutoMatchingView.Pumps)
                 {
@@ -110,6 +112,15 @@
                 foreach (var item in assetsAutoMatchingView.Nozzles)
                 {
                     if (MatchingSprinkler(item, allSprinkler))
+                    {
+                        IsMaching = true;
+                    }
+                }
+
+                //鍠峰ご鍖归厤
+                foreach (var item in assetsAutoMatchingView.Coolings)
+                {
+                    if (Matching(item, allCoolingMain))
                     {
                         IsMaching = true;
                     }
@@ -265,6 +276,27 @@
                 InputModel.MatchingDbId = vmo.ID.ToString();
                 InputModel.MatchingModelType = vmo.Name;
                 var list = Task.Run(async () => await new BLL.PhartDiagramRelation().GetExByObjectTypeAndObjectID(HStation.Assets.DataType.PumpMain, vmo.ID)).Result;
+                var def = list.OrderByDescending(x => x.Importance).First();
+                InputModel.MatchingCurveDbId = def.ID.ToString();
+                var diagram = def.Diagram.GetDefaultVmo();
+                var qh = diagram.QH.GetFeatPointList();
+                var qp = diagram.QP.GetFeatPointList();
+                var qe = diagram.QE.GetFeatPointList();
+                InputModel.MatchingCurveQH = new List<HydroCurvePointViewModel>();
+                InputModel.MatchingCurveQP = new List<HydroCurvePointViewModel>();
+                InputModel.MatchingCurveQE = new List<HydroCurvePointViewModel>();
+                foreach (var item in qh)
+                {
+                    InputModel.MatchingCurveQH.Add(new HydroCurvePointViewModel(item.X, item.Y));
+                }
+                foreach (var item in qp)
+                {
+                    InputModel.MatchingCurveQP.Add(new HydroCurvePointViewModel(item.X, item.Y));
+                }
+                foreach (var item in qe)
+                {
+                    InputModel.MatchingCurveQE.Add(new HydroCurvePointViewModel(item.X, item.Y));
+                }
                 /*     if (list != null && list.Count > 0)
                      {
                          var maxImportanceItem = list.OrderByDescending(x => x.Importance).First();
@@ -397,23 +429,9 @@
                     {
                         if ((int)input.ValveType == (int)HStation.Assets.eValveType.GPV)
                         {
-                            var curveList = Task.Run(async () => await new BLL.AssetsValveFactor().GetByMainID(vmo.ID)).Result;
-                            if (curveList != null && curveList.Count > 0)
-                            {
-                                input.MatchingCurveDbId = curveList.First().ID.ToString();
-                                var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().MinorLossCurve);
-                                input.MatchingCurveQL = pt_list;
-                            }
                         }
                         else if ((int)vmo.ValveType == (int)HStation.Assets.eValveType.TCV)
                         {
-                            var curveList = Task.Run(async () => await new BLL.AssetsValveFactor().GetByMainID(vmo.ID)).Result;
-                            if (curveList != null && curveList.Count > 0)
-                            {
-                                input.MatchingCurveDbId = curveList.First().ID.ToString();
-                                var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().OpenLossCurve);
-                                input.MatchingCurveOL = pt_list;
-                            }
                         }
                     }
                     if (input.MinorLoss < 0)
@@ -440,23 +458,9 @@
                     input.MatchingValveType = (eValveType?)(int)vmo.ValveType;
                     if (vmo.ValveType == HStation.Assets.eValveType.GPV)
                     {
-                        var curveList = Task.Run(async () => await new BLL.AssetsValveFactor().GetByMainID(vmo.ID)).Result;
-                        if (curveList != null && curveList.Count > 0)
-                        {
-                            input.MatchingCurveDbId = curveList.First().ID.ToString();
-                            var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().MinorLossCurve);
-                            input.MatchingCurveQL = pt_list;
-                        }
                     }
                     else if (vmo.ValveType == HStation.Assets.eValveType.TCV)
                     {
-                        var curveList = Task.Run(async () => await new BLL.AssetsValveFactor().GetByMainID(vmo.ID)).Result;
-                        if (curveList != null && curveList.Count > 0)
-                        {
-                            input.MatchingCurveDbId = curveList.First().ID.ToString();
-                            var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().OpenLossCurve);
-                            input.MatchingCurveOL = pt_list;
-                        }
                     }
                 }
                 return true;
@@ -1470,13 +1474,6 @@
                         input.MatchingMinLevel = vmo.MinLevel;
                     if (input.CurveDbId == null)
                     {
-                        var curveList = Task.Run(async () => await new BLL.AssetsTankCoefficient().GetByMainID(vmo.ID)).Result;
-                        if (curveList != null && curveList.Count > 0)
-                        {
-                            input.MatchingCurveDbId = curveList.First().ID.ToString();
-                            var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().VolCurve);
-                            input.MatchingVolCurve = pt_list;
-                        }
                     }
                 }
                 else
@@ -1486,13 +1483,6 @@
                     input.MatchingDN = vmo.DN;
                     input.MatchingMinLevel = vmo.MinLevel;
                     input.MatchingOverFlow = vmo.OverFlow;
-                    var curveList = Task.Run(async () => await new BLL.AssetsTankCoefficient().GetByMainID(vmo.ID)).Result;
-                    if (curveList != null && curveList.Count > 0)
-                    {
-                        input.MatchingCurveDbId = curveList.First().ID.ToString();
-                        var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().VolCurve);
-                        input.MatchingVolCurve = pt_list;
-                    }
                 }
                 return true;
             }

--
Gitblit v1.9.3