From 982cde7e9372dc218f23b204265d8e54f7e9ce4f Mon Sep 17 00:00:00 2001 From: ningshuxia <ningshuxia0927@outlook.com> Date: 星期四, 13 三月 2025 10:34:21 +0800 Subject: [PATCH] boxModel --- WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/00-core/HydroMatchingHelper.cs | 1348 ++++++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 1,022 insertions(+), 326 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 734815c..211d6f9 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 @@ -1,7 +1,4 @@ -锘縰sing DevExpress.XtraSpreadsheet.Model.CopyOperation; -using System.Windows.Media.Imaging; -using Yw.DAL.Basic; -using Yw.EPAnet; +锘縰sing Yw.Ahart; using Yw.Hydro; using Yw.Model; @@ -1030,9 +1027,15 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(HydroTankViewModel visualViewModel, HydroTankMatchingViewModel matching) + public static bool Apply + ( + HydroTankViewModel visualViewModel, + HydroTankMatchingViewModel 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; } @@ -1040,7 +1043,14 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroTankInfo visual, HydroTankMatchingViewModel matching) + public static bool Apply + ( + Yw.Model.HydroModelInfo hydroInfo, + Yw.Model.HydroTankInfo visual, + HydroTankMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1054,51 +1064,86 @@ { return false; } - visual.Name = matching.Name; - visual.DbLocked = matching.DbLocked; - visual.DbId = matching.DbId; - visual.ModelType = matching.ModelType; - visual.MinLevel = matching.MinLevel; - visual.MaxLevel = matching.MaxLevel; - visual.DN = matching.DN; - visual.MinVol = matching.MinVol; - visual.OverFlow = matching.OverFlow; + //visual.Name = matching.Name; + //visual.DbLocked = matching.DbLocked; + //visual.DbId = matching.DbId; + //visual.ModelType = matching.ModelType; + //visual.MinLevel = matching.MinLevel; + //visual.MaxLevel = matching.MaxLevel; + //visual.DN = matching.DN; + //visual.MinVol = matching.MinVol; + //visual.OverFlow = matching.OverFlow; 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 (matching.MatchingMinLevel.HasValue) { + if (visual.MinLevel != matching.MatchingMinLevel.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.MinLevel), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.MinLevel = matching.MatchingMinLevel.Value; result = true; } if (matching.MatchingMaxLevel.HasValue) { + if (visual.MaxLevel != matching.MatchingMaxLevel.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.MaxLevel), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.MaxLevel = matching.MatchingMaxLevel.Value; result = true; } if (matching.MatchingDN.HasValue) { + if (visual.DN != matching.MatchingDN.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.DN), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.DN = matching.MatchingDN.Value; result = true; } if (matching.MatchingMinVol.HasValue) { + if (visual.MinVol != matching.MatchingMinVol.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.MinVol), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.MinVol = matching.MatchingMinVol.Value; result = true; } if (matching.MatchingOverFlow.HasValue) { + if (visual.OverFlow != matching.MatchingOverFlow.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.OverFlow), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.OverFlow = matching.MatchingOverFlow.Value; result = true; } @@ -1122,6 +1167,7 @@ } hydroInfo.Curves.Add(curvevol); visual.VolCurve = curvevol.Code; + changeHelper?.Append(curvevol, eChangeType.Add); result = true; } else @@ -1130,14 +1176,24 @@ { curvevol.DbId = matching.MatchingCurveDbId; curvevol.CurveData = matching.MatchingVolCurve?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + changeHelper?.Append(curvevol, eChangeType.Update); result = true; } } + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.VolCurve), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇"); } else { - hydroInfo.Curves?.RemoveAll(x => x.Code == visual.VolCurve); - visual.VolCurve = string.Empty; + if (!string.IsNullOrEmpty(visual.VolCurve)) + { + var volCurve = hydroInfo?.Curves?.Find(x => x.Code == visual.VolCurve); + if (volCurve != null) + { + hydroInfo.Curves?.RemoveAll(x => x.Code == visual.VolCurve); + visual.VolCurve = string.Empty; + changeHelper?.Append(volCurve, eChangeType.Remove); + } + } } } return result; @@ -1150,9 +1206,15 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(HydroBluntheadViewModel visualViewModel, HydroBluntheadMatchingViewModel matching) + public static bool Apply + ( + HydroBluntheadViewModel visualViewModel, + HydroBluntheadMatchingViewModel 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; } @@ -1160,7 +1222,14 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroBluntheadInfo visual, HydroBluntheadMatchingViewModel matching) + public static bool Apply + ( + Yw.Model.HydroModelInfo hydroInfo, + Yw.Model.HydroBluntheadInfo visual, + HydroBluntheadMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1174,39 +1243,64 @@ { return false; } - visual.Name = matching.Name; - visual.DbLocked = matching.DbLocked; - visual.DbId = matching.DbId; - visual.ModelType = matching.ModelType; - visual.Caliber = matching.Caliber; - visual.Material = matching.Material; - visual.MinorLoss = matching.MinorLoss; + //visual.Name = matching.Name; + //visual.DbLocked = matching.DbLocked; + //visual.DbId = matching.DbId; + //visual.ModelType = matching.ModelType; + //visual.Caliber = matching.Caliber; + //visual.Material = matching.Material; + //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 (matching.MatchingCaliber.HasValue) { + if (visual.Caliber != matching.MatchingCaliber.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.Caliber), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.Caliber = matching.MatchingCaliber.Value; 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.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; } @@ -1221,9 +1315,15 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(HydroElbowViewModel visualViewModel, HydroElbowMatchingViewModel matching) + public static bool Apply + ( + HydroElbowViewModel visualViewModel, + HydroElbowMatchingViewModel 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; } @@ -1231,7 +1331,14 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroElbowInfo visual, HydroElbowMatchingViewModel matching) + public static bool Apply + ( + Yw.Model.HydroModelInfo hydroInfo, + Yw.Model.HydroElbowInfo visual, + HydroElbowMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1245,55 +1352,91 @@ { return false; } - visual.Name = matching.Name; - visual.DbLocked = matching.DbLocked; - visual.DbId = matching.DbId; - visual.ModelType = matching.ModelType; - visual.Caliber = matching.Caliber; - visual.Material = matching.Material; - visual.MinorLoss = matching.MinorLoss; - visual.BendingAngle = matching.BendingAngle; - if (matching.ElbowType.HasValue) - { - visual.ElbowType = HydroElbowTypeEnumHelper.GetElbowTypeName(matching.ElbowType.Value); - } + //visual.Name = matching.Name; + //visual.DbLocked = matching.DbLocked; + //visual.DbId = matching.DbId; + //visual.ModelType = matching.ModelType; + //visual.Caliber = matching.Caliber; + //visual.Material = matching.Material; + //visual.MinorLoss = matching.MinorLoss; + //visual.BendingAngle = matching.BendingAngle; + //if (matching.ElbowType.HasValue) + //{ + // visual.ElbowType = HydroElbowTypeEnumHelper.GetElbowTypeName(matching.ElbowType.Value); + //} 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 (matching.MatchingCaliber.HasValue) { + if (visual.Caliber != matching.MatchingCaliber.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.Caliber), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.Caliber = matching.MatchingCaliber.Value; 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.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; } if (matching.MatchingBendingAngle.HasValue) { + if (visual.BendingAngle != matching.MatchingBendingAngle.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.BendingAngle), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.BendingAngle = matching.MatchingBendingAngle.Value; result = true; } if (matching.MatchingElbowType.HasValue) { - visual.ElbowType = HydroElbowTypeEnumHelper.GetElbowTypeName(matching.MatchingElbowType.Value); + var elbowType = HydroElbowTypeEnumHelper.GetElbowTypeName(matching.MatchingElbowType.Value); + if (visual.ElbowType != elbowType) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.ElbowType), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } + visual.ElbowType = elbowType; result = true; } } @@ -1307,9 +1450,15 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(HydroThreelinkViewModel visualViewModel, HydroThreelinkMatchingViewModel matching) + public static bool Apply + ( + HydroThreelinkViewModel visualViewModel, + HydroThreelinkMatchingViewModel matching, + HydroChangeHelper changeHelper, + HydroPropStatusHelper propStatusHelper + ) { - var bol = Apply(visualViewModel.HydroInfo, visualViewModel.Vmo, matching); + var bol = Apply(visualViewModel.HydroInfo, visualViewModel.Vmo, matching, changeHelper, propStatusHelper); visualViewModel.UpdateProperty(); return bol; } @@ -1317,7 +1466,14 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroThreelinkInfo visual, HydroThreelinkMatchingViewModel matching) + public static bool Apply + ( + Yw.Model.HydroModelInfo hydroInfo, + Yw.Model.HydroThreelinkInfo visual, + HydroThreelinkMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1331,51 +1487,86 @@ { return false; } - visual.Name = matching.Name; - visual.DbLocked = matching.DbLocked; - visual.DbId = matching.DbId; - visual.ModelType = matching.ModelType; - visual.Caliber = matching.Caliber; - visual.Material = matching.Material; - visual.MinorLoss = matching.MinorLoss; - visual.RunningThroughLoss = matching.RunningThroughLoss; - visual.BranchThroughLoss = matching.BranchThroughLoss; + //visual.Name = matching.Name; + //visual.DbLocked = matching.DbLocked; + //visual.DbId = matching.DbId; + //visual.ModelType = matching.ModelType; + //visual.Caliber = matching.Caliber; + //visual.Material = matching.Material; + //visual.MinorLoss = matching.MinorLoss; + //visual.RunningThroughLoss = matching.RunningThroughLoss; + //visual.BranchThroughLoss = matching.BranchThroughLoss; 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 (matching.MatchingCaliber.HasValue) { + if (visual.Caliber != matching.MatchingCaliber.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.Caliber), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.Caliber = matching.MatchingCaliber.Value; 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.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; } if (matching.MatchingRunningThroughLoss.HasValue) { + if (visual.RunningThroughLoss != matching.MatchingRunningThroughLoss.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.RunningThroughLoss), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.RunningThroughLoss = matching.MatchingRunningThroughLoss.Value; result = true; } if (matching.MatchingBranchThroughLoss.HasValue) { + if (visual.BranchThroughLoss != matching.MatchingBranchThroughLoss.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.BranchThroughLoss), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.BranchThroughLoss = matching.MatchingBranchThroughLoss.Value; result = true; } @@ -1390,9 +1581,15 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(HydroFourlinkViewModel visualViewModel, HydroFourlinkMatchingViewModel matching) + public static bool Apply + ( + HydroFourlinkViewModel visualViewModel, + HydroFourlinkMatchingViewModel 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; } @@ -1400,7 +1597,14 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroFourlinkInfo visual, HydroFourlinkMatchingViewModel matching) + public static bool Apply + ( + Yw.Model.HydroModelInfo hydroInfo, + Yw.Model.HydroFourlinkInfo visual, + HydroFourlinkMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1414,39 +1618,64 @@ { return false; } - visual.Name = matching.Name; - visual.DbLocked = matching.DbLocked; - visual.DbId = matching.DbId; - visual.ModelType = matching.ModelType; - visual.Caliber = matching.Caliber; - visual.Material = matching.Material; - visual.MinorLoss = matching.MinorLoss; + //visual.Name = matching.Name; + //visual.DbLocked = matching.DbLocked; + //visual.DbId = matching.DbId; + //visual.ModelType = matching.ModelType; + //visual.Caliber = matching.Caliber; + //visual.Material = matching.Material; + //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 (matching.MatchingCaliber.HasValue) { + if (visual.Caliber != matching.MatchingCaliber.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.Caliber), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.Caliber = matching.MatchingCaliber.Value; 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.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; } @@ -1461,9 +1690,15 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(HydroNozzleViewModel visualViewModel, HydroNozzleMatchingViewModel matching) + public static bool Apply + ( + HydroNozzleViewModel visualViewModel, + HydroNozzleMatchingViewModel 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; } @@ -1471,7 +1706,14 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroNozzleInfo visual, HydroNozzleMatchingViewModel matching) + public static bool Apply + ( + Yw.Model.HydroModelInfo hydroInfo, + Yw.Model.HydroNozzleInfo visual, + HydroNozzleMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1485,45 +1727,75 @@ { 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.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; 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 (matching.MatchingCaliber.HasValue) { + if (visual.Caliber != matching.MatchingCaliber.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.Caliber), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.Caliber = matching.MatchingCaliber.Value; 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.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; } if (matching.MatchingCoefficient.HasValue) { + if (visual.Coefficient != matching.MatchingCoefficient.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.Coefficient), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.Coefficient = matching.MatchingCoefficient.Value; result = true; } @@ -1538,9 +1810,15 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(HydroHydrantViewModel visualViewModel, HydroHydrantMatchingViewModel matching) + public static bool Apply + ( + HydroHydrantViewModel visualViewModel, + HydroHydrantMatchingViewModel 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; } @@ -1548,7 +1826,14 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroHydrantInfo visual, HydroHydrantMatchingViewModel matching) + public static bool Apply + ( + Yw.Model.HydroModelInfo hydroInfo, + Yw.Model.HydroHydrantInfo visual, + HydroHydrantMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1562,45 +1847,75 @@ { 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.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; 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 (matching.MatchingCaliber.HasValue) { + if (visual.Caliber != matching.MatchingCaliber.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.Caliber), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.Caliber = matching.MatchingCaliber.Value; 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.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; } if (matching.MatchingCoefficient.HasValue) { + if (visual.Coefficient != matching.MatchingCoefficient.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.Coefficient), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.Coefficient = matching.MatchingCoefficient.Value; result = true; } @@ -1615,9 +1930,15 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(HydroCoolingViewModel visualViewModel, HydroCoolingMatchingViewModel matching) + public static bool Apply + ( + HydroCoolingViewModel visualViewModel, + HydroCoolingMatchingViewModel 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; } @@ -1625,7 +1946,14 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroCoolingInfo visual, HydroCoolingMatchingViewModel matching) + public static bool Apply + ( + Yw.Model.HydroModelInfo hydroInfo, + Yw.Model.HydroCoolingInfo visual, + HydroCoolingMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1639,51 +1967,86 @@ { 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; + //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)) { + 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 (matching.MatchingCaliber.HasValue) { + if (visual.Caliber != matching.MatchingCaliber.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.Caliber), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.Caliber = matching.MatchingCaliber.Value; 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.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; } if (matching.MatchingCoefficient.HasValue) { + if (visual.Coefficient != matching.MatchingCoefficient.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.Coefficient), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.Coefficient = matching.MatchingCoefficient.Value; result = true; } if (matching.MatchingLowerLimit.HasValue) { + if (visual.LowerLimit != matching.MatchingLowerLimit.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.LowerLimit), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.LowerLimit = matching.MatchingLowerLimit.Value; result = true; } @@ -1698,9 +2061,15 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(HydroMeterViewModel visualViewModel, HydroMeterMatchingViewModel matching) + public static bool Apply + ( + HydroMeterViewModel visualViewModel, + HydroMeterMatchingViewModel 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; } @@ -1708,7 +2077,14 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroMeterInfo visual, HydroMeterMatchingViewModel matching) + public static bool Apply + ( + Yw.Model.HydroModelInfo hydroInfo, + Yw.Model.HydroMeterInfo visual, + HydroMeterMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1722,27 +2098,42 @@ { return false; } - visual.Name = matching.Name; - visual.DbLocked = matching.DbLocked; - visual.DbId = matching.DbId; - visual.ModelType = matching.ModelType; - visual.MinorLoss = matching.MinorLoss; + //visual.Name = matching.Name; + //visual.DbLocked = matching.DbLocked; + //visual.DbId = matching.DbId; + //visual.ModelType = matching.ModelType; + //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 (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; } @@ -1757,9 +2148,15 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(HydroFlowmeterViewModel visualViewModel, HydroFlowmeterMatchingViewModel matching) + public static bool Apply + ( + HydroFlowmeterViewModel visualViewModel, + HydroFlowmeterMatchingViewModel 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; } @@ -1767,7 +2164,14 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroFlowmeterInfo visual, HydroFlowmeterMatchingViewModel matching) + public static bool Apply + ( + Yw.Model.HydroModelInfo hydroInfo, + Yw.Model.HydroFlowmeterInfo visual, + HydroFlowmeterMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1781,27 +2185,42 @@ { return false; } - visual.Name = matching.Name; - visual.DbLocked = matching.DbLocked; - visual.DbId = matching.DbId; - visual.ModelType = matching.ModelType; - visual.MinorLoss = matching.MinorLoss; + //visual.Name = matching.Name; + //visual.DbLocked = matching.DbLocked; + //visual.DbId = matching.DbId; + // visual.ModelType = matching.ModelType; + // 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 (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; } @@ -1816,9 +2235,15 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(HydroPressmeterViewModel visualViewModel, HydroPressmeterMatchingViewModel matching) + public static bool Apply + ( + HydroPressmeterViewModel visualViewModel, + HydroPressmeterMatchingViewModel 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; } @@ -1826,7 +2251,14 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroPressmeterInfo visual, HydroPressmeterMatchingViewModel matching) + public static bool Apply + ( + Yw.Model.HydroModelInfo hydroInfo, + Yw.Model.HydroPressmeterInfo visual, + HydroPressmeterMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1840,27 +2272,42 @@ { return false; } - visual.Name = matching.Name; - visual.DbLocked = matching.DbLocked; - visual.DbId = matching.DbId; - visual.ModelType = matching.ModelType; - visual.MinorLoss = matching.MinorLoss; + //visual.Name = matching.Name; + //visual.DbLocked = matching.DbLocked; + //visual.DbId = matching.DbId; + //visual.ModelType = matching.ModelType; + //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 (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; } @@ -1875,9 +2322,15 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(HydroPipeViewModel visualViewModel, HydroPipeMatchingViewModel matching) + public static bool Apply + ( + HydroPipeViewModel visualViewModel, + HydroPipeMatchingViewModel 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; } @@ -1885,7 +2338,14 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroPipeInfo visual, HydroPipeMatchingViewModel matching) + public static bool Apply + ( + Yw.Model.HydroModelInfo hydroInfo, + Yw.Model.HydroPipeInfo visual, + HydroPipeMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1900,14 +2360,14 @@ 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.Roughness = matching.Roughness; - 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.Roughness = matching.Roughness; + //visual.MinorLoss = matching.MinorLoss; bool result = false; @@ -1915,31 +2375,61 @@ { 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.MatchingRoughness.HasValue) { + if (visual.Roughness != matching.MatchingRoughness.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.Roughness), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.Roughness = matching.MatchingRoughness.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; } @@ -1954,9 +2444,15 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(HydroTranslationViewModel visualViewModel, HydroTranslationMatchingViewModel matching) + public static bool Apply + ( + HydroTranslationViewModel visualViewModel, + HydroTranslationMatchingViewModel 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; } @@ -1964,7 +2460,14 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroTranslationInfo visual, HydroTranslationMatchingViewModel matching) + public static bool Apply + ( + Yw.Model.HydroModelInfo hydroInfo, + Yw.Model.HydroTranslationInfo visual, + HydroTranslationMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1979,16 +2482,19 @@ 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.StartDiameter = matching.StartDiameter; - visual.EndDiameter = matching.EndDiameter; - visual.Roughness = matching.Roughness; - visual.MinorLoss = matching.MinorLoss; + //visual.Name = matching.Name; + //visual.DbLocked = matching.DbLocked; + //visual.DbId = matching.DbId; + //visual.ModelType = matching.ModelType; + //if (matching.TranslationType.HasValue) + //{ + // visual.TranslationType = HydroTranslationTypeEnumHelper.GetTranslationTypeName(matching.TranslationType.Value); + //} + //visual.Material = matching.Material; + //visual.StartDiameter = matching.StartDiameter; + //visual.EndDiameter = matching.EndDiameter; + //visual.Roughness = matching.Roughness; + //visual.MinorLoss = matching.MinorLoss; bool result = false; @@ -1996,42 +2502,83 @@ { 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 (matching.MatchingTranslationType.HasValue) + { + var translationType = HydroTranslationTypeEnumHelper.GetTranslationTypeName(matching.MatchingTranslationType.Value); + if (visual.TranslationType != translationType) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.TranslationType), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } + visual.TranslationType = translationType; 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) - { - visual.Diameter = matching.MatchingDiameter.Value; - result = true; - } - if (matching.MatchingStartDiameter.HasValue) - { - visual.StartDiameter = matching.MatchingStartDiameter.Value; - result = true; - } - if (matching.MatchingEndDiameter.HasValue) - { - visual.EndDiameter = matching.MatchingEndDiameter.Value; result = true; } if (matching.MatchingRoughness.HasValue) { + if (visual.Roughness != matching.MatchingRoughness.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.Roughness), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.Roughness = matching.MatchingRoughness.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; + } + if (matching.MatchingStartDiameter.HasValue) + { + if (visual.StartDiameter != matching.MatchingStartDiameter.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.StartDiameter), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } + visual.StartDiameter = matching.MatchingStartDiameter.Value; + result = true; + } + if (matching.MatchingEndDiameter.HasValue) + { + if (visual.EndDiameter != matching.MatchingEndDiameter.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.EndDiameter), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } + visual.EndDiameter = matching.MatchingEndDiameter.Value; result = true; } } @@ -2045,9 +2592,15 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(HydroPumpViewModel visualViewModel, HydroPumpMatchingViewModel matching) + public static bool Apply + ( + HydroPumpViewModel visualViewModel, + HydroPumpMatchingViewModel 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; } @@ -2055,7 +2608,14 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroPumpInfo visual, HydroPumpMatchingViewModel matching) + public static bool Apply + ( + Yw.Model.HydroModelInfo hydroInfo, + Yw.Model.HydroPumpInfo visual, + HydroPumpMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -2070,58 +2630,99 @@ return false; } - visual.Name = matching.Name; - visual.DbLocked = matching.DbLocked; - visual.DbId = matching.DbId; - visual.ModelType = matching.ModelType; - visual.RatedQ = matching.RatedQ; - visual.RatedH = matching.RatedH; - visual.RatedP = matching.RatedP; - visual.RatedN = matching.RatedN; - visual.RatedHz = matching.RatedHz; - visual.SpeedRatio = matching.CurrentHz / visual.RatedHz; + //visual.Name = matching.Name; + //visual.DbLocked = matching.DbLocked; + //visual.DbId = matching.DbId; + //visual.ModelType = matching.ModelType; + //visual.RatedQ = matching.RatedQ; + //visual.RatedH = matching.RatedH; + //visual.RatedP = matching.RatedP; + //visual.RatedN = matching.RatedN; + //visual.RatedHz = matching.RatedHz; + //visual.SpeedRatio = matching.CurrentHz / visual.RatedHz; 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 (matching.MatchingRatedQ.HasValue) { + if (visual.RatedQ != matching.MatchingRatedQ.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.RatedQ), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.RatedQ = matching.MatchingRatedQ.Value; result = true; } if (matching.MatchingRatedH.HasValue) { + if (visual.RatedH != matching.MatchingRatedH.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.RatedH), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.RatedH = matching.MatchingRatedH.Value; result = true; } if (matching.MatchingRatedP.HasValue) { + if (visual.RatedP != matching.MatchingRatedP.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.RatedP), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.RatedP = matching.MatchingRatedP.Value; result = true; } if (matching.MatchingRatedN.HasValue) { + if (visual.RatedN != matching.MatchingRatedN.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.RatedN), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.RatedN = matching.MatchingRatedN.Value; result = true; } if (matching.MatchingRatedHz.HasValue) { + if (visual.RatedHz != matching.MatchingRatedHz.Value) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.RatedHz), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.RatedHz = matching.MatchingRatedHz.Value; result = true; } if (matching.MatchingCurrentHz.HasValue) { - visual.SpeedRatio = matching.MatchingCurrentHz.Value / visual.RatedHz; + var speedRatio = matching.MatchingCurrentHz.Value / visual.RatedHz; + if (visual.SpeedRatio != speedRatio) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.SpeedRatio), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } + visual.SpeedRatio = speedRatio; result = true; } @@ -2146,6 +2747,9 @@ } hydroInfo.Curves.Add(curveqh); visual.CurveQH = curveqh.Code; + changeHelper?.Append(curveqh, eChangeType.Add); + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.CurveQH), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); result = true; } else @@ -2154,6 +2758,7 @@ { curveqh.DbId = matching.MatchingCurveDbId; curveqh.CurveData = matching.MatchingCurveQH?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + changeHelper?.Append(curveqh, eChangeType.Update); result = true; } } @@ -2177,6 +2782,9 @@ } hydroInfo.Curves.Add(curveqp); visual.CurveQP = curveqp.Code; + changeHelper?.Append(curveqp, eChangeType.Add); + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.CurveQP), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); result = true; } else @@ -2185,6 +2793,7 @@ { curveqp.DbId = matching.MatchingCurveDbId; curveqp.CurveData = matching.MatchingCurveQP?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + changeHelper?.Append(curveqp, eChangeType.Update); result = true; } } @@ -2208,6 +2817,9 @@ } hydroInfo.Curves.Add(curveqe); visual.CurveQE = curveqe.Code; + changeHelper?.Append(curveqe, eChangeType.Add); + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.CurveQE), ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); result = true; } else @@ -2216,6 +2828,7 @@ { curveqe.DbId = matching.MatchingCurveDbId; curveqe.CurveData = matching.MatchingCurveQE?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + changeHelper?.Append(curveqe, eChangeType.Update); result = true; } } @@ -2232,9 +2845,15 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(HydroValveViewModel visualViewModel, HydroValveMatchingViewModel matching) + public static bool Apply + ( + HydroValveViewModel visualViewModel, + HydroValveMatchingViewModel 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; } @@ -2242,7 +2861,14 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroValveInfo visual, HydroValveMatchingViewModel matching) + public static bool Apply + ( + Yw.Model.HydroModelInfo hydroInfo, + Yw.Model.HydroValveInfo visual, + HydroValveMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -2257,15 +2883,13 @@ 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.ValveType = HydroValveTypeEnumHelper.GetValveTypeCode(matching.ValveType); - visual.ValveSetting = matching.ValveSetting; + //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; @@ -2273,153 +2897,141 @@ { if (!string.IsNullOrEmpty(matching.MatchingModelType)) { + if (visual.ModelType != matching.MatchingModelType) + { + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.ModelType), ePropStatus.Matching, $"{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.Matching, $"{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.Matching, $"{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.Matching, $"{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.Matching, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } visual.MinorLoss = matching.MatchingMinorLoss.Value; result = true; } - if (matching.MatchingValveType.HasValue) + if (!string.IsNullOrEmpty(matching.MatchingCurveDbId)) { - visual.ValveType = HydroValveTypeEnumHelper.GetValveTypeCode(matching.MatchingValveType.Value); - result = true; - } - switch (visual.ValveType) - { - case Yw.Hydro.ValveType.PSV: + //寮�搴︽崯澶辨洸绾� + var curveol = hydroInfo.Curves?.Find(x => x.Code == visual.CurveOL); + if (curveol == null) + { + curveol = new Yw.Model.HydroCurveInfo(); + curveol.Catalog = Yw.Hydro.ParterCatalog.Curve; + curveol.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes()); + curveol.Name = "鍖归厤"; + curveol.ModelType = string.Empty; + curveol.DbLocked = false; + curveol.DbId = matching.MatchingCurveDbId; + curveol.CurveType = Yw.WinFrmUI.HydroCurveType.CurveOL; + curveol.CurveFactor = null; + curveol.CurveData = matching.MatchingCurveOL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + if (hydroInfo.Curves == null) { - if (!string.IsNullOrEmpty(matching.MatchingValveSetting)) - { - visual.ValveSetting = matching.MatchingValveSetting; - result = true; - } + hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>(); } - break; - case Yw.Hydro.ValveType.PBV: + hydroInfo.Curves.Add(curveol); + visual.CurveOL = curveol.Code; + changeHelper?.Append(curveol, eChangeType.Add); + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.CurveOL), ePropStatus.Matching, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + result = true; + } + else + { + if (!curveol.DbLocked) { - if (!string.IsNullOrEmpty(matching.MatchingValveSetting)) - { - visual.ValveSetting = matching.MatchingValveSetting; - result = true; - } + curveol.DbId = matching.MatchingCurveDbId; + curveol.CurveData = matching.MatchingCurveOL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + changeHelper?.Append(curveol, eChangeType.Update); + result = true; } - break; - case Yw.Hydro.ValveType.PRV: - { - if (!string.IsNullOrEmpty(matching.MatchingValveSetting)) - { - visual.ValveSetting = matching.MatchingValveSetting; - result = true; - } - } - break; - case Yw.Hydro.ValveType.FCV: - { - if (!string.IsNullOrEmpty(matching.MatchingValveSetting)) - { - visual.ValveSetting = matching.MatchingValveSetting; - result = true; - } - } - break; - case Yw.Hydro.ValveType.TCV: - { - if (!string.IsNullOrEmpty(matching.MatchingCurveDbId)) - { - //闃�闂ㄥ紑搴︽崯澶辩郴鏁版洸绾� - var curveol = hydroInfo.Curves?.Find(x => x.Code == visual.ValveSetting); - if (curveol == null) - { - curveol = new Yw.Model.HydroCurveInfo(); - curveol.Catalog = Yw.Hydro.ParterCatalog.Curve; - curveol.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes()); - curveol.Name = "鍖归厤"; - curveol.ModelType = visual.ModelType; - curveol.DbLocked = false; - 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(); - if (hydroInfo.Curves == null) - { - hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>(); - } - hydroInfo.Curves.Add(curveol); - visual.ValveSetting = curveol.Code; - result = true; - } - else - { - 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; - } - } - } - } - break; - case Yw.Hydro.ValveType.GPV: - { - if (!string.IsNullOrEmpty(matching.MatchingCurveDbId)) - { - //姘村ご鎹熷け鏇茬嚎 - var curveql = hydroInfo.Curves?.Find(x => x.Code == visual.ValveSetting); - if (curveql == null) - { - curveql = new Yw.Model.HydroCurveInfo(); - curveql.Catalog = Yw.Hydro.ParterCatalog.Curve; - curveql.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes()); - curveql.Name = "鍖归厤"; - curveql.ModelType = visual.ModelType; - curveql.DbLocked = false; - 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(); - if (hydroInfo.Curves == null) - { - hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>(); - } - hydroInfo.Curves.Add(curveql); - visual.ValveSetting = curveql.Code; - result = true; - } - else - { - 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; - } - } - } - } - break; - case Yw.Hydro.ValveType.CV: - { + } + //姘村ご鎹熷け鏇茬嚎 + if (matching.MatchingCurvesQL != null && matching.MatchingCurvesQL.Count > 0) + { + if (visual.CurvesQL == null) + { + visual.CurvesQL = new List<string>(); } - break; + var curvesql = new List<string>(); + var matchingCurvesQL = matching.MatchingCurvesQL.OrderBy(x => x.CurveFactor).ToList(); + foreach (var matchingCurveQL in matchingCurvesQL) + { + var curveql = hydroInfo.Curves?.Find(x => visual.CurvesQL.Contains(x.Code) && x.CurveFactor.HasValue && x.CurveFactor.Value == matchingCurveQL.CurveFactor); + if (curveql == null) + { + curveql = new Yw.Model.HydroCurveInfo(); + curveql.Catalog = Yw.Hydro.ParterCatalog.Curve; + curveql.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes()); + curveql.Name = "鍖归厤"; + curveql.ModelType = string.Empty; + curveql.DbLocked = false; + curveql.DbId = matching.MatchingCurveDbId; + curveql.CurveType = Yw.WinFrmUI.HydroCurveType.CurveQL; + curveql.CurveFactor = matchingCurveQL.CurveFactor; + curveql.CurveData = matchingCurveQL.CurveData?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + if (hydroInfo.Curves == null) + { + hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>(); + } + hydroInfo.Curves.Add(curveql); + changeHelper?.Append(curveql, eChangeType.Add); + result = true; + } + else + { + if (!curveql.DbLocked) + { + curveql.DbId = matching.MatchingCurveDbId; + curveql.CurveFactor = matchingCurveQL.CurveFactor; + curveql.CurveData = matchingCurveQL.CurveData?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + changeHelper?.Append(curveql, eChangeType.Update); + result = true; + } + } + curvesql.Add(curveql.Code); + } + visual.CurvesQL = curvesql; + changeHelper?.Append(visual, eChangeType.Update); + propStatusHelper?.UpdatePropStatus(visual.Code, nameof(visual.CurvesQL), ePropStatus.Matching, $"{DateTime.Now.ToStandardString()}閫氳繃浜у搧閰嶇疆鍖归厤淇敼"); + } } } return result; @@ -2432,9 +3044,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; } @@ -2442,7 +3060,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) { @@ -2456,39 +3081,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; } @@ -2513,6 +3163,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 @@ -2521,6 +3174,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; } } @@ -2536,9 +3190,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; } @@ -2546,7 +3206,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) { @@ -2560,39 +3227,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; } @@ -2617,6 +3309,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 @@ -2625,6 +3320,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