From 80ef0be2e44f42d6f7dc0f9c928de0dbe7362138 Mon Sep 17 00:00:00 2001 From: duheng <2784771470@qq.com> Date: 星期五, 07 二月 2025 15:05:14 +0800 Subject: [PATCH] 个人中心修改 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/07-matching/00-core/AssetsMatchingHelper.cs | 144 ++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 115 insertions(+), 29 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 e455e43..04eddc2 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,4 +1,8 @@ -锘縩amespace HStation.WinFrmUI +锘縰sing DevExpress.CodeParser; +using System.Text.Json; +using Yw.Ahart; + +namespace HStation.WinFrmUI { public class AssetsMatchingHelper { @@ -413,11 +417,6 @@ { input.MatchingMinorLoss = valve.MinorLoss; } - if (input.ValveSetting == null) - { - input.MatchingValveSetting = valve.ValveSetting; - } - input.MatchingValveType = eValveType.TCV; if (input.CurveDbId == null) { var list = Task.Run(async () => @@ -426,17 +425,38 @@ { var def = list.OrderByDescending(x => x.Importance).First(); input.MatchingCurveDbId = def.ID.ToString(); - var curve = def.Diagram.GraphList[0].GetFeatPointList(); - input.MatchingCurveQL = new List<HydroCurvePointViewModel>(); + //var curve = def.Diagram.GraphList[0].GetFeatPointList(); + //var curve1 = def.Diagram.GraphList[1].GetFeatPointList(); + //input.MatchingCurveQL = new List<HydroCurvePointViewModel>(); /* foreach (var item in curve) { input.MatchingCurveQL.Add(new HydroCurvePointViewModel(item.X, item.Y)); }*/ input.MatchingCurveOL = new List<HydroCurvePointViewModel>(); - foreach (var item in curve) + input.MatchingCurvesQL = new List<HydroFactorCurveViewModel>(); + for (int i = 0; i < def.Diagram.GraphList.Count; i++) { - input.MatchingCurveOL.Add(new HydroCurvePointViewModel(item.X, item.Y)); + var curve = def.Diagram.GraphList[i].GetFeatPointList(); + if (def.Diagram.GraphList[i].GraphType == 11) + { + var opening = Yw.WinFrmUI.PhartGraphHelper.GetGraphParas<Yw.WinFrmUI.Phart.QLGraphParasViewModel>((Yw.Ahart.eCurveType)def.Diagram.GraphList[i].GraphType, def.Diagram.GraphList[i].GraphParas); + var model = new HydroFactorCurveViewModel(); + model.CurveFactor = opening.Opening ?? 0; + model.CurveData = new List<HydroCurvePointViewModel>(); + foreach (var item in curve) + { + model.CurveData.Add(new HydroCurvePointViewModel(item.X, item.Y)); + } + input.MatchingCurvesQL.Add(model); + } + else if (def.Diagram.GraphList[i].GraphType == 12) + { + foreach (var item in curve) + { + input.MatchingCurveOL.Add(new HydroCurvePointViewModel(item.X, item.Y)); + } + } } } return true; @@ -528,7 +548,7 @@ } //鏍囩 - int flagWeight = 1; + int flagWeight = 1000; foreach (var item in pipeLineMainVmos) { if (item.Flags != null && item.Flags.Count > 0) @@ -643,7 +663,7 @@ } //鏍囩 - int flagWeight = 1; + int flagWeight = 1000; foreach (var item in threelinkVmos) { if (item.Flags != null && item.Flags.Count > 0) @@ -766,7 +786,7 @@ } //鏍囩 - int flagWeight = 1; + int flagWeight = 1000; foreach (var item in fourLinkVmos) { if (item.Flags != null && item.Flags.Count > 0) @@ -884,7 +904,7 @@ } //鏍囩 - int flagWeight = 1; + int flagWeight = 1000; foreach (var item in sprinklerVmos) { if (item.Flags != null && item.Flags.Count > 0) @@ -1002,7 +1022,7 @@ } //鏍囩 - int flagWeight = 1; + int flagWeight = 1000; foreach (var item in allExchangerList) { if (item.Flags != null && item.Flags.Count > 0) @@ -1141,7 +1161,7 @@ } //鏍囩 - int flagWeight = 1; + int flagWeight = 1000; foreach (var item in allCompressorList) { if (item.Flags != null && item.Flags.Count > 0) @@ -1280,7 +1300,7 @@ } //鏍囩 - int flagWeight = 1; + int flagWeight = 1000; foreach (var item in bluntheadVmos) { if (item.Flags != null && item.Flags.Count > 0) @@ -1365,7 +1385,7 @@ } //鏍囩 - int flagWeight = 1; + int flagWeight = 1000; foreach (var item in tankVmos) { if (item.Flags != null && item.Flags.Count > 0) @@ -1471,7 +1491,7 @@ } //鏍囩 - int flagWeight = 10; + int flagWeight = 1000; foreach (var item in allMeterList) { if (item.Flags != null && item.Flags.Count > 0) @@ -1548,7 +1568,7 @@ } //鏍囩 - int flagWeight = 10; + int flagWeight = 1000; foreach (var item in allFlowmeterList) { if (item.Flags != null && item.Flags.Count > 0) @@ -1658,7 +1678,7 @@ } //鏍囩 - int flagWeight = 1; + int flagWeight = 1000; foreach (var item in hydrantVmos) { if (item.Flags != null && item.Flags.Count > 0) @@ -1706,7 +1726,7 @@ { return false; } - + allElbowList = allElbowList.Where(x => x.Angle == 90).ToList(); //鏉冮噸瀛楀吀 var dict = new Dictionary<AssetsElbowMainVmo, double>(); foreach (var item in allElbowList) @@ -1727,7 +1747,40 @@ } } } - + //鍙e緞 + int caliberWeight = 1; + if (input.Caliber > 0) + { + foreach (var item in allElbowList) + { + if (item.Caliber.HasValue) + { + var diff = Math.Abs(item.Caliber.Value - input.Caliber); + dict[item] += diff / input.Caliber * 100 * caliberWeight; + } + } + } + // 瑙掑害 + int angleWeight = 1000; + if (input.BendingAngle > 0) + { + foreach (var item in allElbowList) + { + if (item.Angle > 0) + { + var count = Math.Abs(item.Angle.Value - input.BendingAngle); + if (count != 0) + { + dict[item] += (1.0 / count) * angleWeight; + } + else + { + // 濡傛灉 count 涓� 0锛岃〃绀哄畬鍏ㄥ尮閰嶏紝缁欎簣鏈�澶ф潈閲� + dict[item] += angleWeight * 100; + } + } + } + } // 鍏抽敭瀛� int keywordWeight = 1; foreach (var item in allElbowList) @@ -1743,7 +1796,7 @@ } //鏍囩 - int flagWeight = 10; + int flagWeight = 1000; foreach (var item in allElbowList) { if (item.Flags != null && item.Flags.Count > 0) @@ -1788,6 +1841,7 @@ public static bool Matching(HydroPressmeterMatchingViewModel input, List<AssetsPressmeterMainVmo> pressmeterVmos) { //杈撳叆鍙傛暟楠岃瘉 + if (input == null) { return false; @@ -1835,7 +1889,7 @@ } //鏍囩 - int flagWeight = 1; + int flagWeight = 1000; foreach (var item in pressmeterVmos) { if (item.Flags != null && item.Flags.Count > 0) @@ -1897,6 +1951,37 @@ } } + // 涓婃父鍜屼笅娓哥洿寰� + int diameterWeight = 100; + if (input.StartDiameter > 0 && input.EndDiameter > 0) + { + foreach (var item in translationVmos) + { + if (item.StartDiameter > 0 && item.EndDiameter > 0) + { + var startCount = Math.Abs(item.StartDiameter - input.StartDiameter); + var endCount = Math.Abs(item.EndDiameter - input.EndDiameter); + + if (startCount == 0 && endCount == 0) + { + // 濡傛灉 startCount 鍜� endCount 閮戒负 0锛岃〃绀哄畬鍏ㄥ尮閰嶏紝缁欎簣鏈�澶ф潈閲� + dict[item] += diameterWeight * 100; + } + else + { + // 鍚﹀垯锛屽垎鍒绠楁潈閲� + if (startCount != 0) + { + dict[item] += (1.0 / startCount) * diameterWeight; + } + if (endCount != 0) + { + dict[item] += (1.0 / endCount) * diameterWeight; + } + } + } + } + } //鏉愯川 int materialWeight = 5; if (!string.IsNullOrEmpty(input.Material)) @@ -1931,7 +2016,7 @@ } //鏍囩 - int flagWeight = 1; + int flagWeight = 1000; foreach (var item in translationVmos) { if (item.Flags != null && item.Flags.Count > 0) @@ -1953,11 +2038,11 @@ { input.MatchingMaterial = translation.Material; } - if (input.MinorLoss < 0) + if (input.MinorLoss <= 0) { input.MatchingMinorLoss = translation.MinorLoss; } - if (input.Roughness < 0) + if (input.Roughness <= 0) { input.MatchingRoughness = translation.Roughness; } @@ -1969,6 +2054,7 @@ { input.MatchingStartDiameter = translation.StartDiameter; } + input.MatchingTranslationType = (Yw.WinFrmUI.eTranslationType)(int)translation.TranslationType; return true; } @@ -2057,7 +2143,7 @@ } //鏍囩 - int flagWeight = 1; + int flagWeight = 1000; foreach (var item in allCoolingList) { if (item.Flags != null && item.Flags.Count > 0) -- Gitblit v1.9.3