| | |
| | | /// <summary> |
| | | /// 应用 |
| | | /// </summary> |
| | | public static bool Apply(HydroExchangerViewModel visualViewModel, HydroExchangerMatchingViewModel matching) |
| | | public static bool Apply |
| | | ( |
| | | HydroExchangerViewModel visualViewModel, |
| | | HydroExchangerMatchingViewModel matching, |
| | | HydroChangeHelper changeHelper = null, |
| | | HydroPropStatusHelper propStatusHelper = null |
| | | ) |
| | | { |
| | | var bol = Apply(visualViewModel.HydroInfo, visualViewModel.Vmo, matching); |
| | | var bol = Apply(visualViewModel.HydroInfo, visualViewModel.Vmo, matching, changeHelper, propStatusHelper); |
| | | visualViewModel.UpdateProperty(); |
| | | return bol; |
| | | } |
| | |
| | | /// <summary> |
| | | /// 应用 |
| | | /// </summary> |
| | | public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroExchangerInfo visual, HydroExchangerMatchingViewModel matching) |
| | | public static bool Apply |
| | | ( |
| | | Yw.Model.HydroModelInfo hydroInfo, |
| | | Yw.Model.HydroExchangerInfo visual, |
| | | HydroExchangerMatchingViewModel matching, |
| | | HydroChangeHelper changeHelper = null, |
| | | HydroPropStatusHelper propStatusHelper = null |
| | | ) |
| | | { |
| | | if (hydroInfo == null) |
| | | { |
| | |
| | | { |
| | | return false; |
| | | } |
| | | visual.Name = matching.Name; |
| | | visual.DbLocked = matching.DbLocked; |
| | | visual.DbId = matching.DbId; |
| | | visual.ModelType = matching.ModelType; |
| | | visual.Material = matching.Material; |
| | | visual.Diameter = matching.Diameter; |
| | | visual.MinorLoss = matching.MinorLoss; |
| | | //visual.Name = matching.Name; |
| | | //visual.DbLocked = matching.DbLocked; |
| | | //visual.DbId = matching.DbId; |
| | | //visual.ModelType = matching.ModelType; |
| | | //visual.Material = matching.Material; |
| | | //visual.Diameter = matching.Diameter; |
| | | //visual.MinorLoss = matching.MinorLoss; |
| | | |
| | | bool result = false; |
| | | if (!visual.DbLocked) |
| | | { |
| | | if (!string.IsNullOrEmpty(matching.MatchingModelType)) |
| | | { |
| | | if (visual.ModelType != matching.MatchingModelType) |
| | | { |
| | | changeHelper?.Append(visual, eChangeType.Update); |
| | | propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.ModelType), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改"); |
| | | } |
| | | visual.ModelType = matching.MatchingModelType; |
| | | result = true; |
| | | } |
| | | if (!string.IsNullOrEmpty(matching.MatchingDbId)) |
| | | { |
| | | if (visual.DbId != matching.MatchingDbId) |
| | | { |
| | | changeHelper?.Append(visual, eChangeType.Update); |
| | | propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.DbId), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改"); |
| | | } |
| | | visual.DbId = matching.MatchingDbId; |
| | | result = true; |
| | | } |
| | | if (!string.IsNullOrEmpty(matching.MatchingMaterial)) |
| | | { |
| | | if (visual.Material != matching.MatchingMaterial) |
| | | { |
| | | changeHelper?.Append(visual, eChangeType.Update); |
| | | propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.Material), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改"); |
| | | } |
| | | visual.Material = matching.MatchingMaterial; |
| | | result = true; |
| | | } |
| | | if (matching.MatchingDiameter.HasValue) |
| | | { |
| | | if (visual.Diameter != matching.MatchingDiameter.Value) |
| | | { |
| | | changeHelper?.Append(visual, eChangeType.Update); |
| | | propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.Diameter), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改"); |
| | | } |
| | | visual.Diameter = matching.MatchingDiameter.Value; |
| | | result = true; |
| | | } |
| | | if (matching.MatchingMinorLoss.HasValue) |
| | | { |
| | | if (visual.MinorLoss != matching.MatchingMinorLoss.Value) |
| | | { |
| | | changeHelper?.Append(visual, eChangeType.Update); |
| | | propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.MinorLoss), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改"); |
| | | } |
| | | visual.MinorLoss = matching.MatchingMinorLoss.Value; |
| | | result = true; |
| | | } |
| | |
| | | } |
| | | hydroInfo.Curves.Add(curvevql); |
| | | visual.CurveQL = curvevql.Code; |
| | | changeHelper?.Append(curvevql, eChangeType.Add); |
| | | changeHelper?.Append(visual, eChangeType.Update); |
| | | propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.CurveQL), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改"); |
| | | result = true; |
| | | } |
| | | else |
| | |
| | | { |
| | | curvevql.DbId = matching.MatchingCurveDbId; |
| | | curvevql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); |
| | | changeHelper?.Append(curvevql, eChangeType.Update); |
| | | result = true; |
| | | } |
| | | } |
| | |
| | | /// <summary> |
| | | /// 应用 |
| | | /// </summary> |
| | | public static bool Apply(HydroCompressorViewModel visualViewModel, HydroCompressorMatchingViewModel matching) |
| | | public static bool Apply |
| | | ( |
| | | HydroCompressorViewModel visualViewModel, |
| | | HydroCompressorMatchingViewModel matching, |
| | | HydroChangeHelper changeHelper = null, |
| | | HydroPropStatusHelper propStatusHelper = null |
| | | ) |
| | | { |
| | | var bol = Apply(visualViewModel.HydroInfo, visualViewModel.Vmo, matching); |
| | | var bol = Apply(visualViewModel.HydroInfo, visualViewModel.Vmo, matching, changeHelper, propStatusHelper); |
| | | visualViewModel.UpdateProperty(); |
| | | return bol; |
| | | } |
| | |
| | | /// <summary> |
| | | /// 应用 |
| | | /// </summary> |
| | | public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroCompressorInfo visual, HydroCompressorMatchingViewModel matching) |
| | | public static bool Apply |
| | | ( |
| | | Yw.Model.HydroModelInfo hydroInfo, |
| | | Yw.Model.HydroCompressorInfo visual, |
| | | HydroCompressorMatchingViewModel matching, |
| | | HydroChangeHelper changeHelper = null, |
| | | HydroPropStatusHelper propStatusHelper = null |
| | | ) |
| | | { |
| | | if (hydroInfo == null) |
| | | { |
| | |
| | | { |
| | | return false; |
| | | } |
| | | visual.Name = matching.Name; |
| | | visual.DbLocked = matching.DbLocked; |
| | | visual.DbId = matching.DbId; |
| | | visual.ModelType = matching.ModelType; |
| | | visual.Material = matching.Material; |
| | | visual.Diameter = matching.Diameter; |
| | | visual.MinorLoss = matching.MinorLoss; |
| | | //visual.Name = matching.Name; |
| | | //visual.DbLocked = matching.DbLocked; |
| | | //visual.DbId = matching.DbId; |
| | | //visual.ModelType = matching.ModelType; |
| | | //visual.Material = matching.Material; |
| | | //visual.Diameter = matching.Diameter; |
| | | //visual.MinorLoss = matching.MinorLoss; |
| | | |
| | | bool result = false; |
| | | if (!visual.DbLocked) |
| | | { |
| | | if (!string.IsNullOrEmpty(matching.MatchingModelType)) |
| | | { |
| | | if (visual.ModelType != matching.MatchingModelType) |
| | | { |
| | | changeHelper?.Append(visual, eChangeType.Update); |
| | | propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.ModelType), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改"); |
| | | } |
| | | visual.ModelType = matching.MatchingModelType; |
| | | result = true; |
| | | } |
| | | if (!string.IsNullOrEmpty(matching.MatchingDbId)) |
| | | { |
| | | if (visual.DbId != matching.MatchingDbId) |
| | | { |
| | | changeHelper?.Append(visual, eChangeType.Update); |
| | | propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.DbId), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改"); |
| | | } |
| | | visual.DbId = matching.MatchingDbId; |
| | | result = true; |
| | | } |
| | | if (!string.IsNullOrEmpty(matching.MatchingMaterial)) |
| | | { |
| | | if (visual.Material != matching.MatchingMaterial) |
| | | { |
| | | changeHelper?.Append(visual, eChangeType.Update); |
| | | propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.Material), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改"); |
| | | } |
| | | visual.Material = matching.MatchingMaterial; |
| | | result = true; |
| | | } |
| | | if (matching.MatchingDiameter.HasValue) |
| | | { |
| | | if (visual.Diameter != matching.MatchingDiameter.Value) |
| | | { |
| | | changeHelper?.Append(visual, eChangeType.Update); |
| | | propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.Diameter), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改"); |
| | | } |
| | | visual.Diameter = matching.MatchingDiameter.Value; |
| | | result = true; |
| | | } |
| | | if (matching.MatchingMinorLoss.HasValue) |
| | | { |
| | | if (visual.MinorLoss != matching.MatchingMinorLoss.Value) |
| | | { |
| | | changeHelper?.Append(visual, eChangeType.Update); |
| | | propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.MinorLoss), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改"); |
| | | } |
| | | visual.MinorLoss = matching.MatchingMinorLoss.Value; |
| | | result = true; |
| | | } |
| | |
| | | } |
| | | hydroInfo.Curves.Add(curvevql); |
| | | visual.CurveQL = curvevql.Code; |
| | | changeHelper?.Append(curvevql, eChangeType.Add); |
| | | changeHelper?.Append(visual, eChangeType.Update); |
| | | propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.CurveQL), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过产品配置匹配修改"); |
| | | result = true; |
| | | } |
| | | else |
| | |
| | | { |
| | | curvevql.DbId = matching.MatchingCurveDbId; |
| | | curvevql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); |
| | | changeHelper?.Append(curvevql, eChangeType.Update); |
| | | result = true; |
| | | } |
| | | } |