| | |
| | | { |
| | | 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; |
| | |
| | | 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); |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (nameMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = nameMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | { |
| | | 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) |
| | |
| | | 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) |
| | |
| | | input.MatchingDiameter = vmo.Caliber; |
| | | if (input.ValveSetting == null) |
| | | input.MatchingValveSetting = vmo.ValveSetting; |
| | | if (input.DbId == null) |
| | | { |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (nameMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = nameMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | 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 |
| | | { |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (nameMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | vmo = nameMatching.First(); |
| | | } |
| | | else |
| | |
| | | //取默认 |
| | | if (defaultList.Count > 0) |
| | | { |
| | | isNotarize = true; |
| | | vmo = defaultList.First(); |
| | | } |
| | | else if (defaultList.Count <= 0) |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (nameMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = nameMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (nameMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = nameMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (nameMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = nameMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (nameMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = nameMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (nameMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = nameMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (nameMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = nameMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (nameMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = nameMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (nameMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = nameMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (nameMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = nameMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (nameMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = nameMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (nameMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = nameMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |