From 63854f704730af6f1f9a3cc08bc9276ac9350edc Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期四, 16 一月 2025 12:01:45 +0800 Subject: [PATCH] 基准标高判断验证 --- WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/00-core/HydroMatchingHelper.cs | 124 ++++++++++++++++++++++++++++++++++------ 1 files changed, 104 insertions(+), 20 deletions(-) diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/00-core/HydroMatchingHelper.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/00-core/HydroMatchingHelper.cs index 4158f0a..3f953ac 100644 --- a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/00-core/HydroMatchingHelper.cs +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/00-core/HydroMatchingHelper.cs @@ -3040,9 +3040,15 @@ /// <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; } @@ -3050,7 +3056,14 @@ /// <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) { @@ -3064,39 +3077,64 @@ { 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; } @@ -3121,6 +3159,9 @@ } 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 @@ -3129,6 +3170,7 @@ { 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; } } @@ -3144,9 +3186,15 @@ /// <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; } @@ -3154,7 +3202,14 @@ /// <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) { @@ -3168,39 +3223,64 @@ { 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; } @@ -3225,6 +3305,9 @@ } 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 @@ -3233,6 +3316,7 @@ { 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; } } -- Gitblit v1.9.3