| | |
| | | { |
| | | 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); |
| | |
| | | //阀门匹配 |
| | | public static bool MatchingValve(HydroValveMatchingViewModel input, List<Vmo.AssetsValveMainVmo> valveMainVmos) |
| | | { |
| | | bool isNotarize = false; //是否确定 |
| | | if (valveMainVmos == null) |
| | | { |
| | | return true; |
| | |
| | | } |
| | | 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 (vmo != null) |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingDiameter = vmo.Caliber; |
| | | input.MatchingMaterial = vmo.Material; |
| | | input.MatchingModelType = vmo.Name; |
| | | input.MatchingValveSetting = vmo.ValveSetting; |
| | | input.MatchingValveType = (eValveType?)(int)vmo.ValveType; |
| | | if (vmo.ValveType == HStation.Assets.eValveType.GPV) |
| | | if (!isNotarize) |
| | | { |
| | | var curveList = Task.Run(async () => await new BLL.AssetsValveCoefficient().GetByMainID(vmo.ID)).Result; |
| | | if (curveList != null && curveList.Count > 0) |
| | | if (input.CurveDbId == null) |
| | | { |
| | | input.MatchingCurveDbId = curveList.First().ID.ToString(); |
| | | var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().MinorLossCurve); |
| | | input.MatchingCurveQL = pt_list; |
| | | 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.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.AssetsValveCoefficient().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) |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | } |
| | | if (!input.MatchingDiameter.HasValue) |
| | | input.MatchingDiameter = vmo.Caliber; |
| | | if (input.ValveSetting == null) |
| | | input.MatchingValveSetting = vmo.ValveSetting; |
| | | if (input.DbId == null) |
| | | { |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | } |
| | | } |
| | | else if (vmo.ValveType == HStation.Assets.eValveType.TCV) |
| | | else |
| | | { |
| | | var curveList = Task.Run(async () => await new BLL.AssetsValveCoefficient().GetByMainID(vmo.ID)).Result; |
| | | if (curveList != null && curveList.Count > 0) |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingDiameter = vmo.Caliber; |
| | | input.MatchingMaterial = vmo.Material; |
| | | input.MatchingModelType = vmo.Name; |
| | | input.MatchingValveSetting = vmo.ValveSetting; |
| | | input.MatchingValveType = (eValveType?)(int)vmo.ValveType; |
| | | if (vmo.ValveType == HStation.Assets.eValveType.GPV) |
| | | { |
| | | input.MatchingCurveDbId = curveList.First().ID.ToString(); |
| | | var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().OpenLossCurve); |
| | | input.MatchingCurveOL = pt_list; |
| | | var curveList = Task.Run(async () => await new BLL.AssetsValveCoefficient().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.AssetsValveCoefficient().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; |
| | |
| | | //管道匹配 |
| | | public static bool MatchingPipe(HydroPipeMatchingViewModel input, List<Vmo.AssetsPipeMainVmo> pipeLineMainVmos) |
| | | { |
| | | bool isNotarize = false; //是否确定 |
| | | if (pipeLineMainVmos == null) |
| | | { |
| | | return true; |
| | |
| | | } |
| | | 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 (vmo != null) |
| | | { |
| | | switch (input.eAlgorithmType) |
| | | if (!isNotarize) |
| | | { |
| | | case eAlgorithmType.Hazen: |
| | | input.MatchingRoughness = vmo.Hazen; |
| | | break; |
| | | if (input.DbId == null) |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | if (input.Material == null) |
| | | 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.Manning: |
| | | input.MatchingRoughness = vmo.Manning; |
| | | break; |
| | | |
| | | case eAlgorithmType.Darcy: |
| | | input.MatchingRoughness = vmo.Darcy; |
| | | break; |
| | | case eAlgorithmType.Darcy: |
| | | input.MatchingRoughness = vmo.Darcy; |
| | | break; |
| | | |
| | | default: |
| | | input.MatchingRoughness = vmo.Hazen; |
| | | break; |
| | | default: |
| | | input.MatchingRoughness = vmo.Hazen; |
| | | break; |
| | | } |
| | | } |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingMaterial = vmo.Material; |
| | | input.MatchingModelType = vmo.Name; |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | else |
| | | { |
| | | 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; |
| | | } |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingMaterial = vmo.Material; |
| | | input.MatchingModelType = vmo.Name; |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | } |
| | | return true; |
| | | } |
| | | return false; |
| | |
| | | //弯头匹配 |
| | | public static bool MatchingElbow(HydroElbowMatchingViewModel input, List<Vmo.AssetsElbowMainVmo> elbowMainVmos) |
| | | { |
| | | bool isNotarize = false; //是否确定 |
| | | if (elbowMainVmos == null || input == null || elbowMainVmos.Count == 0) |
| | | { |
| | | return true; |
| | |
| | | } |
| | | 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 (vmo != null) |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingMaterial = vmo.Material; |
| | | input.MatchingModelType = vmo.Name; |
| | | input.MatchingElbowType = (eElbowType?)(int)vmo.ElbowType; |
| | | input.MatchingBendingAngle = vmo.Angle; |
| | | if (!isNotarize) |
| | | { |
| | | if (!input.MinorLoss.HasValue) |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | } |
| | | if (input.DbId == null) |
| | | { |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | } |
| | | if (input.Material == null) |
| | | { |
| | | input.MatchingMaterial = vmo.Material; |
| | | } |
| | | if (input.ModelType == null) |
| | | { |
| | | input.MatchingModelType = vmo.Material; |
| | | } |
| | | if (!input.ElbowType.HasValue) |
| | | { |
| | | input.MatchingElbowType = (eElbowType?)(int)vmo.ElbowType; |
| | | } |
| | | if (!input.BendingAngle.HasValue) |
| | | { |
| | | input.MatchingBendingAngle = vmo.Angle; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingMaterial = vmo.Material; |
| | | input.MatchingModelType = vmo.Name; |
| | | input.MatchingElbowType = (eElbowType?)(int)vmo.ElbowType; |
| | | input.MatchingBendingAngle = vmo.Angle; |
| | | } |
| | | return true; |
| | | } |
| | | return false; |
| | |
| | | //三通匹配 |
| | | public static bool MatchingThreelink(HydroThreelinkMatchingViewModel input, List<Vmo.AssetsThreelinkMainVmo> threelinkVmos) |
| | | { |
| | | bool isNotarize = false; //是否确定 |
| | | Vmo.AssetsThreelinkMainVmo vmo = null; |
| | | if (threelinkVmos == null || input == null || threelinkVmos.Count == 0) |
| | | { |
| | |
| | | } |
| | | 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 (vmo != null) |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingMaterial = vmo.Material; |
| | | input.MatchingModelType = vmo.Name; |
| | | input.MatchingRunningThroughLoss = vmo.RunThroughMinorLoss; |
| | | input.MatchingBranchThroughLoss = vmo.BranchThroughMinorLoss; |
| | | if (!isNotarize) |
| | | { |
| | | if (!input.MinorLoss.HasValue) |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | if (input.DbId == null) |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | if (!input.RunningThroughLoss.HasValue) |
| | | input.MatchingRunningThroughLoss = vmo.RunThroughMinorLoss; |
| | | if (!input.MatchingBranchThroughLoss.HasValue) |
| | | input.MatchingRunningThroughLoss = vmo.BranchThroughMinorLoss; |
| | | } |
| | | else |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingMaterial = vmo.Material; |
| | | input.MatchingModelType = vmo.Name; |
| | | input.MatchingRunningThroughLoss = vmo.RunThroughMinorLoss; |
| | | input.MatchingBranchThroughLoss = vmo.BranchThroughMinorLoss; |
| | | } |
| | | return true; |
| | | } |
| | | return false; |
| | |
| | | //四通匹配 |
| | | public static bool MatchingFourlink(HydroFourlinkMatchingViewModel input, List<Vmo.AssetsFourlinkMainVmo> fourLinkVmos) |
| | | { |
| | | bool isNotarize = false; //是否确定 |
| | | if (fourLinkVmos == null || input == null || fourLinkVmos.Count == 0) |
| | | { |
| | | return true; |
| | |
| | | } |
| | | 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 (vmo != null) |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingMaterial = vmo.Material; |
| | | input.MatchingModelType = vmo.Name; |
| | | if (!isNotarize) |
| | | { |
| | | if (!input.MinorLoss.HasValue) |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | if (input.DbId == null) |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | if (input.Material == null) |
| | | input.MatchingMaterial = vmo.Material; |
| | | if (input.ModelType == null) |
| | | input.MatchingModelType = vmo.Name; |
| | | } |
| | | else |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingMaterial = vmo.Material; |
| | | input.MatchingModelType = vmo.Name; |
| | | } |
| | | return true; |
| | | } |
| | | return false; |
| | |
| | | //喷头匹配 |
| | | public static bool MatchingSprinkler(HydroNozzleMatchingViewModel input, List<Vmo.AssetsSprinklerMainVmo> sprinklerVmos) |
| | | { |
| | | bool isNotarize = false; //是否确定 |
| | | if (sprinklerVmos == null || input == null || sprinklerVmos.Count == 0) |
| | | { |
| | | return true; |
| | |
| | | } |
| | | 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 (vmo != null) |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingMaterial = vmo.Material; |
| | | input.MatchingModelType = vmo.Name; |
| | | if (!isNotarize) |
| | | { |
| | | if (!input.MinorLoss.HasValue) |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | if (input.DbId == null) |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | if (input.Material == null) |
| | | input.MatchingMaterial = vmo.Material; |
| | | if (input.ModelType == null) |
| | | input.MatchingModelType = vmo.Name; |
| | | } |
| | | else |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingMaterial = vmo.Material; |
| | | input.MatchingModelType = vmo.Name; |
| | | } |
| | | return true; |
| | | } |
| | | return false; |
| | |
| | | //换热器匹配 |
| | | public static bool MatchingExchanger(HydroExchangerMatchingViewModel input, List<Vmo.AssetsExchangerMainVmo> exchangerVmos) |
| | | { |
| | | bool isNotarize = false; //是否确定 |
| | | |
| | | if (exchangerVmos == null || input == null || exchangerVmos.Count == 0) |
| | | { |
| | | return true; |
| | |
| | | } |
| | | 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 (vmo != null) |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingMaterial = vmo.Material; |
| | | input.MatchingModelType = vmo.Name; |
| | | var curveList = Task.Run(async () => await new BLL.AssetsCompressorCoefficient().GetByMainID(vmo.ID)).Result; |
| | | if (curveList != null && curveList.Count > 0) |
| | | if (!isNotarize) |
| | | { |
| | | input.MatchingCurveDbId = curveList.First().ID.ToString(); |
| | | var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().MinorLossCurve); |
| | | input.MatchingCurveQL = pt_list; |
| | | if (input.MinorLoss < 0) |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | if (input.DbId == null) |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | if (input.Material == null) |
| | | input.MatchingMaterial = vmo.Material; |
| | | if (input.ModelType == null) |
| | | input.MatchingModelType = vmo.Name; |
| | | if (input.CurveDbId == null) |
| | | { |
| | | var curveList = Task.Run(async () => await new BLL.AssetsExchangerCoefficient().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 |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingMaterial = vmo.Material; |
| | | input.MatchingModelType = vmo.Name; |
| | | var curveList = Task.Run(async () => await new BLL.AssetsExchangerCoefficient().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; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | |
| | | //空压机匹配 |
| | | public static bool MatchingCompressor(HydroCompressorMatchingViewModel input, List<Vmo.AssetsCompressorMainVmo> compressorVmos) |
| | | { |
| | | bool isNotarize = false; //是否确定 |
| | | if (compressorVmos == null || input == null || compressorVmos.Count == 0) |
| | | { |
| | | return true; |
| | |
| | | } |
| | | 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 (vmo != null) |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingMaterial = vmo.Material; |
| | | input.MatchingModelType = vmo.Name; |
| | | var curveList = Task.Run(async () => await new BLL.AssetsCompressorCoefficient().GetByMainID(vmo.ID)).Result; |
| | | if (curveList != null && curveList.Count > 0) |
| | | if (!isNotarize) |
| | | { |
| | | input.MatchingCurveDbId = curveList.First().ID.ToString(); |
| | | var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().MinorLossCurve); |
| | | input.MatchingCurveQL = pt_list; |
| | | if (input.MinorLoss < 0) |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | if (input.DbId == null) |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | if (input.Material == null) |
| | | input.MatchingMaterial = vmo.Material; |
| | | if (input.ModelType == null) |
| | | input.MatchingModelType = vmo.Name; |
| | | if (input.CurveDbId == null) |
| | | { |
| | | var curveList = Task.Run(async () => await new BLL.AssetsCompressorCoefficient().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 |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingMaterial = vmo.Material; |
| | | input.MatchingModelType = vmo.Name; |
| | | var curveList = Task.Run(async () => await new BLL.AssetsCompressorCoefficient().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; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | |
| | | //闷头匹配 |
| | | public static bool MatchingBlunthead(HydroBluntheadMatchingViewModel input, List<Vmo.AssetsBluntheadMainVmo> bluntheadVmos) |
| | | { |
| | | bool isNotarize = false; //是否确定 |
| | | if (bluntheadVmos == null || input == null || bluntheadVmos.Count == 0) |
| | | { |
| | | return true; |
| | |
| | | } |
| | | 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 (vmo != null) |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingMaterial = vmo.Material; |
| | | input.MatchingModelType = vmo.Name; |
| | | if (!isNotarize) |
| | | { |
| | | if (input.MinorLoss < 0) |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | if (input.DbId == null) |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | if (input.Material == null) |
| | | input.MatchingMaterial = vmo.Material; |
| | | if (input.ModelType == null) |
| | | input.MatchingModelType = vmo.Name; |
| | | } |
| | | else |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingMaterial = vmo.Material; |
| | | input.MatchingModelType = vmo.Name; |
| | | } |
| | | return true; |
| | | } |
| | | return false; |
| | |
| | | //水池匹配 |
| | | public static bool MatchingTank(HydroTankMatchingViewModel input, List<Vmo.AssetsTankMainVmo> tankVmos) |
| | | { |
| | | bool isNotarize = false; //是否确定 |
| | | if (tankVmos == null || input == null || tankVmos.Count == 0) |
| | | { |
| | | return true; |
| | |
| | | } |
| | | else if (nameMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = nameMatching.First(); |
| | | } |
| | | else |
| | | vmo = tankVmos.First(); |
| | | if (vmo != null) |
| | | { |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingModelType = vmo.Name; |
| | | 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) |
| | | if (!isNotarize) |
| | | { |
| | | input.MatchingCurveDbId = curveList.First().ID.ToString(); |
| | | var pt_list = Yw.JsonHelper.Json2Object<List<HydroCurvePointViewModel>>(curveList.First().VolCurve); |
| | | input.MatchingVolCurve = pt_list; |
| | | if (input.DbId == null) |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | if (input.ModelType == null) |
| | | input.MatchingModelType = vmo.Name; |
| | | if (input.DN < 0) |
| | | input.MatchingDN = vmo.DN; |
| | | if (input.MinLevel < 0) |
| | | 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 |
| | | { |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingModelType = vmo.Name; |
| | | 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; |
| | | } |
| | |
| | | //水表匹配 |
| | | public static bool MatchingMeter(HydroMeterMatchingViewModel input, List<Vmo.AssetsMeterMainVmo> MeterMainVmos) |
| | | { |
| | | bool isNotarize = false; //是否确定 |
| | | Vmo.AssetsMeterMainVmo vmo = null; |
| | | if (MeterMainVmos == null || input == null || MeterMainVmos.Count == 0) |
| | | { |
| | |
| | | } |
| | | else if (nameMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = nameMatching.First(); |
| | | } |
| | | else |
| | |
| | | |
| | | if (vmo != null) |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingModelType = vmo.Name; |
| | | if (!isNotarize) |
| | | { |
| | | if (input.MinorLoss < 0) |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | if (input.DbId == null) |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | if (input.ModelType == null) |
| | | input.MatchingModelType = vmo.Name; |
| | | } |
| | | else |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingModelType = vmo.Name; |
| | | } |
| | | return true; |
| | | } |
| | | return false; |
| | |
| | | //流量计匹配 |
| | | public static bool MatchingFlowmeter(HydroFlowmeterMatchingViewModel input, List<Vmo.AssetsFlowmeterMainVmo> FlowmeterMainVmos) |
| | | { |
| | | bool isNotarize = false; //是否确定 |
| | | if (FlowmeterMainVmos == null || input == null || FlowmeterMainVmos.Count == 0) |
| | | { |
| | | return true; |
| | |
| | | } |
| | | else if (nameMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = nameMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | if (vmo != null) |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingModelType = vmo.Name; |
| | | if (!isNotarize) |
| | | { |
| | | if (input.MinorLoss < 0) |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | if (input.DbId == null) |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | if (input.ModelType == null) |
| | | input.MatchingModelType = vmo.Name; |
| | | } |
| | | else |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingModelType = vmo.Name; |
| | | } |
| | | return true; |
| | | } |
| | | return false; |
| | |
| | | //消火栓匹配 |
| | | public static bool MatchingHydrant(HydroHydrantMatchingViewModel input, List<Vmo.AssetsHydrantMainVmo> hydrantVmos) |
| | | { |
| | | bool isNotarize = false; //是否确定 |
| | | if (hydrantVmos == null || input == null || hydrantVmos.Count == 0) |
| | | { |
| | | return true; |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | else if (absoluteMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = absoluteMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | if (vmo != null) |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingMaterial = vmo.Material; |
| | | input.MatchingModelType = vmo.Name; |
| | | if (!isNotarize) |
| | | { |
| | | if (input.MinorLoss < 0) |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | if (input.DbId == null) |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | if (input.ModelType == null) |
| | | input.MatchingModelType = vmo.Name; |
| | | } |
| | | else |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingMaterial = vmo.Material; |
| | | input.MatchingModelType = vmo.Name; |
| | | } |
| | | return true; |
| | | } |
| | | return false; |
| | |
| | | //压力表匹配 |
| | | public static bool MatchingPressmeter(HydroPressmeterMatchingViewModel input, List<Vmo.AssetsPressmeterMainVmo> pressmeterVmos) |
| | | { |
| | | bool isNotarize = false; //是否确定 |
| | | if (pressmeterVmos == null || input == null || pressmeterVmos.Count == 0) |
| | | { |
| | | return true; |
| | |
| | | } |
| | | else if (nameMatching.Count == 1) |
| | | { |
| | | isNotarize = true; |
| | | |
| | | vmo = nameMatching.First(); |
| | | } |
| | | else |
| | |
| | | } |
| | | if (vmo != null) |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingModelType = vmo.Name; |
| | | if (!isNotarize) |
| | | { |
| | | if (input.MinorLoss < 0) |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | if (input.DbId == null) |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | if (input.ModelType == null) |
| | | input.MatchingModelType = vmo.Name; |
| | | } |
| | | else |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingModelType = vmo.Name; |
| | | } |
| | | return true; |
| | | } |
| | | return false; |
| | |
| | | //过渡件匹配 |
| | | public static bool MatchingTranslation(HydroTranslationMatchingViewModel input, List<Vmo.AssetsTranslationMainVmo> translationVmos) |
| | | { |
| | | bool isNotarize = false; //是否确定 |
| | | |
| | | if (translationVmos == null || input == null || translationVmos.Count == 0) |
| | | { |
| | | return true; |
| | |
| | | } |
| | | 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 (vmo != null) |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingMaterial = vmo.Material; |
| | | input.MatchingModelType = vmo.Name; |
| | | input.MatchingDiameter = vmo.Diameter; |
| | | input.MatchingEndDiameter = vmo.EndDiameter; |
| | | input.MatchingStartDiameter = vmo.StartDiameter; |
| | | input.MatchingRoughness = vmo.Roughness; |
| | | if (!isNotarize) |
| | | { |
| | | if (input.MinorLoss < 0) |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | if (input.DbId == null) |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | if (input.ModelType == null) |
| | | input.MatchingModelType = vmo.Name; |
| | | if (input.Roughness < 0) |
| | | input.MatchingRoughness = vmo.Roughness; |
| | | if (input.EndDiameter < 0) |
| | | input.MatchingEndDiameter = vmo.EndDiameter; |
| | | if (input.StartDiameter < 0) |
| | | input.MatchingStartDiameter = vmo.StartDiameter; |
| | | if (input.Diameter < 0) |
| | | input.MatchingDiameter = vmo.Diameter; |
| | | } |
| | | else |
| | | { |
| | | input.MatchingMinorLoss = vmo.MinorLoss; |
| | | input.MatchingDbId = vmo.ID.ToString(); |
| | | input.MatchingMaterial = vmo.Material; |
| | | input.MatchingModelType = vmo.Name; |
| | | input.MatchingDiameter = vmo.Diameter; |
| | | input.MatchingEndDiameter = vmo.EndDiameter; |
| | | input.MatchingStartDiameter = vmo.StartDiameter; |
| | | input.MatchingRoughness = vmo.Roughness; |
| | | } |
| | | return true; |
| | | } |
| | | return false; |