| | |
| | | |
| | | #endregion |
| | | |
| | | #region 冷却塔 |
| | | |
| | | vm.Coolings = hydroInfo.Coolings?.Select(x => Create(x, hydroInfo)).ToList(); |
| | | |
| | | #endregion |
| | | |
| | | #region 水表 |
| | | |
| | | vm.Meters = hydroInfo.Meters?.Select(x => Create(x, hydroInfo)).ToList(); |
| | |
| | | return default; |
| | | } |
| | | return new HydroHydrantMatchingViewModel(visualViewModel); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 冷却塔 |
| | | |
| | | /// <summary> |
| | | /// 创建冷却塔自动匹配ViewModel |
| | | /// </summary> |
| | | public static HydroCoolingMatchingViewModel Create(HydroCoolingInfo visualInfo, HydroModelInfo hydroInfo) |
| | | { |
| | | if (visualInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | return new HydroCoolingMatchingViewModel(visualInfo, hydroInfo); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 创建冷却塔自动匹配ViewModel |
| | | /// </summary> |
| | | public static HydroCoolingMatchingViewModel Create(HydroCoolingViewModel visualViewModel) |
| | | { |
| | | if (visualViewModel == null) |
| | | { |
| | | return default; |
| | | } |
| | | return new HydroCoolingMatchingViewModel(visualViewModel); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 消火栓 |
| | | |
| | | if (hydroInfo.Coolings != null && hydroInfo.Coolings.Count > 0) |
| | | { |
| | | if (matchingInfo.Coolings != null && matchingInfo.Coolings.Count > 0) |
| | | { |
| | | hydroInfo.Coolings.ForEach(x => |
| | | { |
| | | var matching = matchingInfo.Coolings.Find(t => t.Code == x.Code); |
| | | if (Apply(hydroInfo, x, matching)) |
| | | { |
| | | result = true; |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 水表 |
| | | |
| | | if (hydroInfo.Meters != null && hydroInfo.Meters.Count > 0) |
| | |
| | | curvevol.ModelType = string.Empty; |
| | | curvevol.DbLocked = false; |
| | | curvevol.DbId = matching.MatchingCurveDbId; |
| | | curvevol.CurveType = Yw.WinFrmUI.HydroCurve.TankVol; |
| | | curvevol.CurveType = Yw.WinFrmUI.HydroCurveType.CurveVol; |
| | | curvevol.CurveData = matching.MatchingVolCurve?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); |
| | | if (hydroInfo.Curves == null) |
| | | { |
| | |
| | | result = true; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | hydroInfo.Curves?.RemoveAll(x => x.Code == visual.VolCurve); |
| | | visual.VolCurve = string.Empty; |
| | | } |
| | | } |
| | | return result; |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 冷却塔 |
| | | |
| | | /// <summary> |
| | | /// 应用 |
| | | /// </summary> |
| | | public static bool Apply(HydroCoolingViewModel visualViewModel, HydroCoolingMatchingViewModel matching) |
| | | { |
| | | var bol = Apply(visualViewModel.HydroInfo, visualViewModel.Vmo, matching); |
| | | visualViewModel.UpdateProperty(); |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 应用 |
| | | /// </summary> |
| | | public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroCoolingInfo visual, HydroCoolingMatchingViewModel matching) |
| | | { |
| | | if (hydroInfo == null) |
| | | { |
| | | return false; |
| | | } |
| | | if (visual == null) |
| | | { |
| | | return false; |
| | | } |
| | | if (matching == null) |
| | | { |
| | | return false; |
| | | } |
| | | visual.Name = matching.Name; |
| | | visual.DbLocked = matching.DbLocked; |
| | | visual.DbId = matching.DbId; |
| | | visual.ModelType = matching.ModelType; |
| | | visual.Material = matching.Material; |
| | | visual.Caliber = matching.Caliber; |
| | | visual.MinorLoss = matching.MinorLoss; |
| | | visual.Coefficient = matching.Coefficient; |
| | | visual.LowerLimit = matching.LowerLimit; |
| | | |
| | | bool result = false; |
| | | if (!visual.DbLocked) |
| | | { |
| | | if (!string.IsNullOrEmpty(matching.MatchingModelType)) |
| | | { |
| | | visual.ModelType = matching.MatchingModelType; |
| | | result = true; |
| | | } |
| | | if (!string.IsNullOrEmpty(matching.MatchingDbId)) |
| | | { |
| | | visual.DbId = matching.MatchingDbId; |
| | | result = true; |
| | | } |
| | | if (matching.MatchingCaliber.HasValue) |
| | | { |
| | | visual.Caliber = matching.MatchingCaliber.Value; |
| | | result = true; |
| | | } |
| | | if (!string.IsNullOrEmpty(matching.MatchingMaterial)) |
| | | { |
| | | visual.Material = matching.MatchingMaterial; |
| | | result = true; |
| | | } |
| | | if (matching.MatchingMinorLoss.HasValue) |
| | | { |
| | | visual.MinorLoss = matching.MatchingMinorLoss.Value; |
| | | result = true; |
| | | } |
| | | if (matching.MatchingCoefficient.HasValue) |
| | | { |
| | | visual.Coefficient = matching.MatchingCoefficient.Value; |
| | | result = true; |
| | | } |
| | | if (matching.MatchingLowerLimit.HasValue) |
| | | { |
| | | visual.LowerLimit = matching.MatchingLowerLimit.Value; |
| | | result = true; |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 水表 |
| | | |
| | | /// <summary> |
| | |
| | | curveqh.ModelType = string.Empty; |
| | | curveqh.DbLocked = false; |
| | | curveqh.DbId = matching.MatchingCurveDbId; |
| | | curveqh.CurveType = Yw.WinFrmUI.HydroCurve.PumpQH; |
| | | curveqh.CurveType = Yw.WinFrmUI.HydroCurveType.CurveQH; |
| | | curveqh.CurveData = matching.MatchingCurveQH?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); |
| | | if (hydroInfo.Curves == null) |
| | | { |
| | |
| | | curveqp.ModelType = string.Empty; |
| | | curveqp.DbLocked = false; |
| | | curveqp.DbId = matching.MatchingCurveDbId; |
| | | curveqp.CurveType = Yw.WinFrmUI.HydroCurve.PumpQP; |
| | | curveqp.CurveType = Yw.WinFrmUI.HydroCurveType.CurveQP; |
| | | curveqp.CurveData = matching.MatchingCurveQP?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); |
| | | if (hydroInfo.Curves == null) |
| | | { |
| | |
| | | curveqe.ModelType = string.Empty; |
| | | curveqe.DbLocked = false; |
| | | curveqe.DbId = matching.MatchingCurveDbId; |
| | | curveqe.CurveType = Yw.WinFrmUI.HydroCurve.PumpQE; |
| | | curveqe.CurveType = Yw.WinFrmUI.HydroCurveType.CurveQE; |
| | | curveqe.CurveData = matching.MatchingCurveQE?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); |
| | | if (hydroInfo.Curves == null) |
| | | { |
| | |
| | | if (!string.IsNullOrEmpty(matching.MatchingModelType)) |
| | | { |
| | | visual.ModelType = matching.MatchingModelType; |
| | | visual.UpdatePropStatus(nameof(visual.ModelType), ePropStatus.Matching, "通过基础数据匹配修复"); |
| | | result = true; |
| | | } |
| | | if (!string.IsNullOrEmpty(matching.MatchingDbId)) |
| | | { |
| | | visual.DbId = matching.MatchingDbId; |
| | | visual.UpdatePropStatus(nameof(visual.DbId), ePropStatus.Matching, "通过基础数据匹配修复"); |
| | | result = true; |
| | | } |
| | | if (!string.IsNullOrEmpty(matching.MatchingMaterial)) |
| | | { |
| | | visual.Material = matching.MatchingMaterial; |
| | | visual.UpdatePropStatus(nameof(visual.Material), ePropStatus.Matching, "通过基础数据匹配修复"); |
| | | result = true; |
| | | } |
| | | if (matching.MatchingDiameter.HasValue) |
| | | { |
| | | visual.Diameter = matching.MatchingDiameter.Value; |
| | | visual.UpdatePropStatus(nameof(visual.Diameter), ePropStatus.Matching, "通过基础数据匹配修复"); |
| | | result = true; |
| | | } |
| | | if (matching.MatchingMinorLoss.HasValue) |
| | | { |
| | | visual.MinorLoss = matching.MatchingMinorLoss.Value; |
| | | visual.UpdatePropStatus(nameof(visual.MinorLoss), ePropStatus.Matching, "通过基础数据匹配修复"); |
| | | result = true; |
| | | } |
| | | if (matching.MatchingValveType.HasValue) |
| | | { |
| | | visual.ValveType = HydroValveTypeEnumHelper.GetValveTypeCode(matching.MatchingValveType.Value); |
| | | visual.UpdatePropStatus(nameof(visual.ValveType), ePropStatus.Matching, "通过基础数据匹配修复"); |
| | | result = true; |
| | | } |
| | | switch (visual.ValveType) |
| | |
| | | if (!string.IsNullOrEmpty(matching.MatchingValveSetting)) |
| | | { |
| | | visual.ValveSetting = matching.MatchingValveSetting; |
| | | visual.UpdatePropStatus(nameof(visual.ValveSetting), ePropStatus.Matching, "通过基础数据匹配修复"); |
| | | result = true; |
| | | } |
| | | } |
| | |
| | | if (!string.IsNullOrEmpty(matching.MatchingValveSetting)) |
| | | { |
| | | visual.ValveSetting = matching.MatchingValveSetting; |
| | | visual.UpdatePropStatus(nameof(visual.ValveSetting), ePropStatus.Matching, "通过基础数据匹配修复"); |
| | | result = true; |
| | | } |
| | | } |
| | |
| | | if (!string.IsNullOrEmpty(matching.MatchingValveSetting)) |
| | | { |
| | | visual.ValveSetting = matching.MatchingValveSetting; |
| | | visual.UpdatePropStatus(nameof(visual.ValveSetting), ePropStatus.Matching, "通过基础数据匹配修复"); |
| | | result = true; |
| | | } |
| | | } |
| | |
| | | if (!string.IsNullOrEmpty(matching.MatchingValveSetting)) |
| | | { |
| | | visual.ValveSetting = matching.MatchingValveSetting; |
| | | visual.UpdatePropStatus(nameof(visual.ValveSetting), ePropStatus.Matching, "通过基础数据匹配修复"); |
| | | result = true; |
| | | } |
| | | } |
| | |
| | | curveol.ModelType = visual.ModelType; |
| | | curveol.DbLocked = false; |
| | | curveol.DbId = matching.MatchingCurveDbId; |
| | | curveol.CurveType = Yw.WinFrmUI.HydroCurve.ValveOL; |
| | | curveol.CurveType = Yw.WinFrmUI.HydroCurveType.CurveOL; |
| | | curveol.CurveData = matching.MatchingCurveOL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); |
| | | if (hydroInfo.Curves == null) |
| | | { |
| | |
| | | if (!curveol.DbLocked) |
| | | { |
| | | curveol.DbId = matching.MatchingCurveDbId; |
| | | curveol.CurveType = Yw.WinFrmUI.HydroCurveType.CurveOL; |
| | | curveol.CurveData = matching.MatchingCurveOL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); |
| | | result = true; |
| | | } |
| | |
| | | { |
| | | if (!string.IsNullOrEmpty(matching.MatchingCurveDbId)) |
| | | { |
| | | //阀门开度损失系数曲线 |
| | | //水头损失曲线 |
| | | var curveql = hydroInfo.Curves?.Find(x => x.Code == visual.ValveSetting); |
| | | if (curveql == null) |
| | | { |
| | |
| | | curveql.ModelType = visual.ModelType; |
| | | curveql.DbLocked = false; |
| | | curveql.DbId = matching.MatchingCurveDbId; |
| | | curveql.CurveType = Yw.WinFrmUI.HydroCurve.ValveOL; |
| | | curveql.CurveType = Yw.WinFrmUI.HydroCurveType.CurveQL; |
| | | curveql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); |
| | | if (hydroInfo.Curves == null) |
| | | { |
| | |
| | | if (!curveql.DbLocked) |
| | | { |
| | | curveql.DbId = matching.MatchingCurveDbId; |
| | | curveql.CurveType = Yw.WinFrmUI.HydroCurveType.CurveQL; |
| | | curveql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); |
| | | result = true; |
| | | } |
| | |
| | | curvevql.ModelType = string.Empty; |
| | | curvevql.DbLocked = false; |
| | | curvevql.DbId = matching.MatchingCurveDbId; |
| | | curvevql.CurveType = Yw.WinFrmUI.HydroCurve.ExchangerQL; |
| | | curvevql.CurveType = Yw.WinFrmUI.HydroCurveType.CurveQL; |
| | | curvevql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); |
| | | if (hydroInfo.Curves == null) |
| | | { |
| | |
| | | if (!string.IsNullOrEmpty(matching.MatchingModelType)) |
| | | { |
| | | visual.ModelType = matching.MatchingModelType; |
| | | visual.UpdatePropStatus(nameof(visual.ModelType), ePropStatus.Normal, "匹配修复"); |
| | | result = true; |
| | | } |
| | | if (!string.IsNullOrEmpty(matching.MatchingDbId)) |
| | | { |
| | | visual.DbId = matching.MatchingDbId; |
| | | visual.UpdatePropStatus(nameof(visual.DbId), ePropStatus.Normal, "匹配修复"); |
| | | result = true; |
| | | } |
| | | if (!string.IsNullOrEmpty(matching.MatchingMaterial)) |
| | | { |
| | | visual.Material = matching.MatchingMaterial; |
| | | visual.UpdatePropStatus(nameof(visual.Material), ePropStatus.Normal, "匹配修复"); |
| | | result = true; |
| | | } |
| | | if (matching.MatchingDiameter.HasValue) |
| | | { |
| | | visual.Diameter = matching.MatchingDiameter.Value; |
| | | visual.UpdatePropStatus(nameof(visual.Diameter), ePropStatus.Normal, "匹配修复"); |
| | | result = true; |
| | | } |
| | | if (matching.MatchingMinorLoss.HasValue) |
| | | { |
| | | visual.MinorLoss = matching.MatchingMinorLoss.Value; |
| | | visual.UpdatePropStatus(nameof(visual.MinorLoss), ePropStatus.Normal, "匹配修复"); |
| | | result = true; |
| | | } |
| | | |
| | |
| | | curvevql.ModelType = string.Empty; |
| | | curvevql.DbLocked = false; |
| | | curvevql.DbId = matching.MatchingCurveDbId; |
| | | curvevql.CurveType = Yw.WinFrmUI.HydroCurve.CompressorQL; |
| | | curvevql.CurveType = Yw.WinFrmUI.HydroCurveType.CurveQL; |
| | | curvevql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); |
| | | if (hydroInfo.Curves == null) |
| | | { |