lixiaojun
2024-12-17 39b6a686ab59135e63a44ab206fd8ca361878f91
WinFrmUI/HStation.WinFrmUI.Xhs.Core/00-core/AssetsMatchingHelper.cs
@@ -4,7 +4,7 @@
{
    public class AssetsMatchingHelper
    {
        private readonly Lazy<BLL.XhsPumpMainPhartMappingExtensions> _bll_ex = new();
        private readonly Lazy<BLL.PhartDiagramRelation> _bll_ex = new();
        private const double _caliberTolerance = 10.0;
        private const double _speedTolerance = 100;
        private const double _flowTolerance = 10;
@@ -261,14 +261,14 @@
                InputModel.MatchingRatedP = vmo.RatedPower;
                InputModel.MatchingDbId = vmo.ID.ToString();
                InputModel.MatchingModelType = vmo.Name;
                var list = Task.Run(async () => await new BLL.XhsPumpMainPhartMappingExtensions().GetByPumpMainID(vmo.ID)).Result;
                var list = Task.Run(async () => await new BLL.PhartDiagramRelation().GetExByObjectTypeAndObjectID(HStation.Assets.DataType.PumpMain, vmo.ID)).Result;
                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.PumpQH);
                    var graph_qe = maxImportanceItem.Diagram.GraphList.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQE);
                    var graph_qp = maxImportanceItem.Diagram.GraphList.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQP);
                    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);
@@ -345,6 +345,8 @@
                }
                else if (absoluteMatching.Count == 1)
                {
                    isNotarize = true;
                    vmo = absoluteMatching.First();
                }
                else
@@ -352,6 +354,8 @@
            }
            else if (nameMatching.Count == 1)
            {
                isNotarize = true;
                vmo = nameMatching.First();
            }
            else
@@ -375,6 +379,8 @@
                }
                else if (absoluteMatching.Count == 1)
                {
                    isNotarize = true;
                    vmo = absoluteMatching.First();
                }
                else
@@ -386,7 +392,7 @@
                {
                    if (input.CurveDbId == null)
                    {
                        if (vmo.ValveType == HStation.Assets.eValveType.GPV)
                        if ((int)input.ValveType == (int)HStation.Assets.eValveType.GPV)
                        {
                            var curveList = Task.Run(async () => await new BLL.AssetsValveCoefficient().GetByMainID(vmo.ID)).Result;
                            if (curveList != null && curveList.Count > 0)
@@ -396,7 +402,7 @@
                                input.MatchingCurveQL = pt_list;
                            }
                        }
                        else if (vmo.ValveType == HStation.Assets.eValveType.TCV)
                        else if ((int)vmo.ValveType == (int)HStation.Assets.eValveType.TCV)
                        {
                            var curveList = Task.Run(async () => await new BLL.AssetsValveCoefficient().GetByMainID(vmo.ID)).Result;
                            if (curveList != null && curveList.Count > 0)
@@ -415,6 +421,10 @@
                        input.MatchingDiameter = vmo.Caliber;
                    if (input.ValveSetting == null)
                        input.MatchingValveSetting = vmo.ValveSetting;
                    if (input.DbId == null)
                    {
                        input.MatchingDbId = vmo.ID.ToString();
                    }
                }
                else
                {
@@ -490,6 +500,8 @@
                }
                else if (absoluteMatching.Count == 1)
                {
                    isNotarize = true;
                    vmo = absoluteMatching.First();
                }
                else
@@ -497,6 +509,8 @@
            }
            else if (nameMatching.Count == 1)
            {
                isNotarize = true;
                vmo = nameMatching.First();
            }
            else
@@ -520,6 +534,7 @@
                }
                else if (absoluteMatching.Count == 1)
                {
                    isNotarize = true;
                    vmo = absoluteMatching.First();
                }
                else
@@ -535,6 +550,24 @@
                        input.MatchingMaterial = vmo.Material;
                    if (input.MinorLoss < 0)
                        input.MatchingMinorLoss = vmo.MinorLoss;
                    switch (input.eAlgorithmType)
                    {
                        case eAlgorithmType.Hazen:
                            input.MatchingRoughness = vmo.Hazen;
                            break;
                        case eAlgorithmType.Manning:
                            input.MatchingRoughness = vmo.Manning;
                            break;
                        case eAlgorithmType.Darcy:
                            input.MatchingRoughness = vmo.Darcy;
                            break;
                        default:
                            input.MatchingRoughness = vmo.Hazen;
                            break;
                    }
                }
                else
                {
@@ -604,6 +637,7 @@
                }
                else if (absoluteMatching.Count == 1)
                {
                    isNotarize = true;
                    vmo = absoluteMatching.First();
                }
                else
@@ -611,6 +645,7 @@
            }
            else if (nameMatching.Count == 1)
            {
                isNotarize = true;
                vmo = nameMatching.First();
            }
            else
@@ -625,7 +660,6 @@
                    //取默认
                    if (defaultList.Count > 0)
                    {
                        isNotarize = true;
                        vmo = defaultList.First();
                    }
                    else if (defaultList.Count <= 0)
@@ -635,6 +669,8 @@
                }
                else if (absoluteMatching.Count == 1)
                {
                    isNotarize = true;
                    vmo = absoluteMatching.First();
                }
                else
@@ -721,6 +757,8 @@
                }
                else if (absoluteMatching.Count == 1)
                {
                    isNotarize = true;
                    vmo = absoluteMatching.First();
                }
                else
@@ -728,6 +766,8 @@
            }
            else if (nameMatching.Count == 1)
            {
                isNotarize = true;
                vmo = nameMatching.First();
            }
            else
@@ -751,6 +791,8 @@
                }
                else if (absoluteMatching.Count == 1)
                {
                    isNotarize = true;
                    vmo = absoluteMatching.First();
                }
                else
@@ -821,6 +863,8 @@
                }
                else if (absoluteMatching.Count == 1)
                {
                    isNotarize = true;
                    vmo = absoluteMatching.First();
                }
                else
@@ -828,6 +872,8 @@
            }
            else if (nameMatching.Count == 1)
            {
                isNotarize = true;
                vmo = nameMatching.First();
            }
            else
@@ -851,6 +897,8 @@
                }
                else if (absoluteMatching.Count == 1)
                {
                    isNotarize = true;
                    vmo = absoluteMatching.First();
                }
                else
@@ -919,6 +967,8 @@
                }
                else if (absoluteMatching.Count == 1)
                {
                    isNotarize = true;
                    vmo = absoluteMatching.First();
                }
                else
@@ -926,6 +976,8 @@
            }
            else if (nameMatching.Count == 1)
            {
                isNotarize = true;
                vmo = nameMatching.First();
            }
            else
@@ -949,6 +1001,8 @@
                }
                else if (absoluteMatching.Count == 1)
                {
                    isNotarize = true;
                    vmo = absoluteMatching.First();
                }
                else
@@ -1017,6 +1071,8 @@
                }
                else if (absoluteMatching.Count == 1)
                {
                    isNotarize = true;
                    vmo = absoluteMatching.First();
                }
                else
@@ -1024,6 +1080,8 @@
            }
            else if (nameMatching.Count == 1)
            {
                isNotarize = true;
                vmo = nameMatching.First();
            }
            else
@@ -1046,6 +1104,8 @@
                }
                else if (absoluteMatching.Count == 1)
                {
                    isNotarize = true;
                    vmo = absoluteMatching.First();
                }
                else
@@ -1130,6 +1190,8 @@
                }
                else if (absoluteMatching.Count == 1)
                {
                    isNotarize = true;
                    vmo = absoluteMatching.First();
                }
                else
@@ -1137,6 +1199,8 @@
            }
            else if (nameMatching.Count == 1)
            {
                isNotarize = true;
                vmo = nameMatching.First();
            }
            else
@@ -1159,6 +1223,8 @@
                }
                else if (absoluteMatching.Count == 1)
                {
                    isNotarize = true;
                    vmo = absoluteMatching.First();
                }
                else
@@ -1244,6 +1310,8 @@
                }
                else if (absoluteMatching.Count == 1)
                {
                    isNotarize = true;
                    vmo = absoluteMatching.First();
                }
                else
@@ -1251,6 +1319,8 @@
            }
            else if (nameMatching.Count == 1)
            {
                isNotarize = true;
                vmo = nameMatching.First();
            }
            else
@@ -1274,6 +1344,8 @@
                }
                else if (absoluteMatching.Count == 1)
                {
                    isNotarize = true;
                    vmo = absoluteMatching.First();
                }
                else
@@ -1336,6 +1408,8 @@
            }
            else if (nameMatching.Count == 1)
            {
                isNotarize = true;
                vmo = nameMatching.First();
            }
            else
@@ -1414,6 +1488,8 @@
            }
            else if (nameMatching.Count == 1)
            {
                isNotarize = true;
                vmo = nameMatching.First();
            }
            else
@@ -1473,6 +1549,8 @@
            }
            else if (nameMatching.Count == 1)
            {
                isNotarize = true;
                vmo = nameMatching.First();
            }
            else
@@ -1539,6 +1617,8 @@
                }
                else if (absoluteMatching.Count == 1)
                {
                    isNotarize = true;
                    vmo = absoluteMatching.First();
                }
                else
@@ -1569,6 +1649,8 @@
                }
                else if (absoluteMatching.Count == 1)
                {
                    isNotarize = true;
                    vmo = absoluteMatching.First();
                }
                else
@@ -1629,6 +1711,8 @@
            }
            else if (nameMatching.Count == 1)
            {
                isNotarize = true;
                vmo = nameMatching.First();
            }
            else
@@ -1695,6 +1779,8 @@
                }
                else if (absoluteMatching.Count == 1)
                {
                    isNotarize = true;
                    vmo = absoluteMatching.First();
                }
                else
@@ -1702,6 +1788,8 @@
            }
            else if (nameMatching.Count == 1)
            {
                isNotarize = true;
                vmo = nameMatching.First();
            }
            else
@@ -1724,6 +1812,8 @@
                }
                else if (absoluteMatching.Count == 1)
                {
                    isNotarize = true;
                    vmo = absoluteMatching.First();
                }
                else