From b495357449d805ecd5bed05895c24eac236077e1 Mon Sep 17 00:00:00 2001 From: duheng <2784771470@qq.com> Date: 星期五, 20 十二月 2024 16:42:08 +0800 Subject: [PATCH] 更新匹配方法 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/07-matching/00-core/AssetsMatchingHelper.cs | 151 +++++++++++++++++++++++++++++-------------------- 1 files changed, 89 insertions(+), 62 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 692c781..68d401d 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 @@ -1,6 +1,7 @@ 锘縰sing HStation.WinFrmUI.PhartRelation; using Swashbuckle.AspNetCore.SwaggerGen; using System.Linq; +using System.Windows.Input; using Yw.WinFrmUI.Q3d; namespace HStation.WinFrmUI @@ -265,62 +266,30 @@ 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) + if (list != null && list.Count > 0) { - InputModel.MatchingCurveQH.Add(new HydroCurvePointViewModel(item.X, item.Y)); + 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)); + } } - 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(); - InputModel.MatchingCurveDbId = maxImportanceItem.ID.ToString(); - var graph_qh = maxImportanceItem.Diagram.GraphList.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.QH); - var graph_qe = maxImportanceItem.Diagram.GraphList.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.QE); - var graph_qp = maxImportanceItem.Diagram.GraphList.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.QP); - if (graph_qh != null) - { - var points_qh = PhartPerformCurveHelper.GetFeatPointList(graph_qh.GraphType, graph_qh.GeometryInfo, 100, null); - InputModel.MatchingCurveQH = new List<HydroCurvePointViewModel>(); - foreach (var item in points_qh) - { - InputModel.MatchingCurveQH.Add(new HydroCurvePointViewModel(item.X, item.Y)); - } - } - if (graph_qe != null) - { - var points_qe = PhartPerformCurveHelper.GetFeatPointList(graph_qe.GraphType, graph_qe.GeometryInfo, 100, null); - InputModel.MatchingCurveQE = new List<HydroCurvePointViewModel>(); - foreach (var item in points_qe) - { - InputModel.MatchingCurveQE.Add(new HydroCurvePointViewModel(item.X, item.Y)); - } - } - if (graph_qp != null) - { - var points_qp = PhartPerformCurveHelper.GetFeatPointList(graph_qp.GraphType, graph_qp.GeometryInfo, 100, null); - InputModel.MatchingCurveQP = new List<HydroCurvePointViewModel>(); - foreach (var item in points_qp) - { - InputModel.MatchingCurveQP.Add(new HydroCurvePointViewModel(item.X, item.Y)); - } - } - }*/ return true; } return false; @@ -416,11 +385,28 @@ { if (input.CurveDbId == null) { - if ((int)input.ValveType == (int)HStation.Assets.eValveType.GPV) + var list = Task.Run(async () => await new BLL.PhartDiagramRelation().GetExByObjectTypeAndObjectID(HStation.Assets.DataType.ValveMain, vmo.ID)).Result; + if (list != null && list.Count > 0) { - } - else if ((int)vmo.ValveType == (int)HStation.Assets.eValveType.TCV) - { + var def = list.OrderByDescending(x => x.Importance).First(); + input.MatchingCurveDbId = def.ID.ToString(); + var curve = def.Diagram.GraphList[0].GetFeatPointList(); + if (vmo.ValveType == HStation.Assets.eValveType.GPV) + { + input.MatchingCurveQL = new List<HydroCurvePointViewModel>(); + foreach (var item in curve) + { + input.MatchingCurveQL.Add(new HydroCurvePointViewModel(item.X, item.Y)); + } + } + else if (vmo.ValveType == HStation.Assets.eValveType.TCV) + { + input.MatchingCurveOL = new List<HydroCurvePointViewModel>(); + foreach (var item in curve) + { + input.MatchingCurveOL.Add(new HydroCurvePointViewModel(item.X, item.Y)); + } + } } } if (input.MinorLoss < 0) @@ -445,11 +431,28 @@ input.MatchingModelType = vmo.Name; input.MatchingValveSetting = vmo.ValveSetting; input.MatchingValveType = (eValveType?)(int)vmo.ValveType; - if (vmo.ValveType == HStation.Assets.eValveType.GPV) + var list = Task.Run(async () => await new BLL.PhartDiagramRelation().GetExByObjectTypeAndObjectID(HStation.Assets.DataType.ValveMain, vmo.ID)).Result; + if (list != null && list.Count > 0) { - } - else if (vmo.ValveType == HStation.Assets.eValveType.TCV) - { + var def = list.OrderByDescending(x => x.Importance).First(); + input.MatchingCurveDbId = def.ID.ToString(); + var curve = def.Diagram.GraphList[0].GetFeatPointList(); + if (vmo.ValveType == HStation.Assets.eValveType.GPV) + { + input.MatchingCurveQL = new List<HydroCurvePointViewModel>(); + foreach (var item in curve) + { + input.MatchingCurveQL.Add(new HydroCurvePointViewModel(item.X, item.Y)); + } + } + else if (vmo.ValveType == HStation.Assets.eValveType.TCV) + { + input.MatchingCurveOL = new List<HydroCurvePointViewModel>(); + foreach (var item in curve) + { + input.MatchingCurveOL.Add(new HydroCurvePointViewModel(item.X, item.Y)); + } + } } } return true; @@ -1463,6 +1466,18 @@ input.MatchingMinLevel = vmo.MinLevel; if (input.CurveDbId == null) { + var list = Task.Run(async () => await new BLL.PhartDiagramRelation().GetExByObjectTypeAndObjectID(HStation.Assets.DataType.ValveMain, vmo.ID)).Result; + if (list != null && list.Count > 0) + { + var def = list.OrderByDescending(x => x.Importance).First(); + input.MatchingCurveDbId = def.ID.ToString(); + var curve = def.Diagram.GraphList[0].GetFeatPointList(); + input.MatchingVolCurve = new List<HydroCurvePointViewModel>(); + foreach (var item in curve) + { + input.MatchingVolCurve.Add(new HydroCurvePointViewModel(item.X, item.Y)); + } + } } } else @@ -1472,6 +1487,18 @@ input.MatchingDN = vmo.DN; input.MatchingMinLevel = vmo.MinLevel; input.MatchingOverFlow = vmo.OverFlow; + var list = Task.Run(async () => await new BLL.PhartDiagramRelation().GetExByObjectTypeAndObjectID(HStation.Assets.DataType.ValveMain, vmo.ID)).Result; + if (list != null && list.Count > 0) + { + var def = list.OrderByDescending(x => x.Importance).First(); + input.MatchingCurveDbId = def.ID.ToString(); + var curve = def.Diagram.GraphList[0].GetFeatPointList(); + input.MatchingVolCurve = new List<HydroCurvePointViewModel>(); + foreach (var item in curve) + { + input.MatchingVolCurve.Add(new HydroCurvePointViewModel(item.X, item.Y)); + } + } } return true; } -- Gitblit v1.9.3