From 02c14c9c57dbde72d9c771bd8b0fab1cd023047d Mon Sep 17 00:00:00 2001 From: cloudflight <cloudflight@126.com> Date: 星期一, 13 一月 2025 09:09:22 +0800 Subject: [PATCH] 上下游纵断面分析 --- WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/00-core/HydroMatchingHelper.cs | 1199 ++++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 1,058 insertions(+), 141 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 b83614e..4a86348 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.Hydro; using Yw.Model; namespace Yw.WinFrmUI @@ -66,6 +63,12 @@ #region 娑堢伀鏍� vm.Hydrants = hydroInfo.Hydrants?.Select(x => Create(x, hydroInfo)).ToList(); + + #endregion + + #region 鍐峰嵈濉� + + vm.Coolings = hydroInfo.Coolings?.Select(x => Create(x, hydroInfo)).ToList(); #endregion @@ -346,6 +349,38 @@ return default; } return new HydroHydrantMatchingViewModel(visualViewModel); + } + + #endregion + + #region 鍐峰嵈濉� + + /// <summary> + /// 鍒涘缓鍐峰嵈濉旇嚜鍔ㄥ尮閰峍iewModel + /// </summary> + public static HydroCoolingMatchingViewModel Create(HydroCoolingInfo visualInfo, HydroModelInfo hydroInfo) + { + if (visualInfo == null) + { + return default; + } + if (hydroInfo == null) + { + return default; + } + return new HydroCoolingMatchingViewModel(visualInfo, hydroInfo); + } + + /// <summary> + /// 鍒涘缓鍐峰嵈濉旇嚜鍔ㄥ尮閰峍iewModel + /// </summary> + public static HydroCoolingMatchingViewModel Create(HydroCoolingViewModel visualViewModel) + { + if (visualViewModel == null) + { + return default; + } + return new HydroCoolingMatchingViewModel(visualViewModel); } #endregion @@ -793,6 +828,25 @@ #endregion + #region 娑堢伀鏍� + + if (hydroInfo.Coolings != null && hydroInfo.Coolings.Count > 0) + { + if (matchingInfo.Coolings != null && matchingInfo.Coolings.Count > 0) + { + hydroInfo.Coolings.ForEach(x => + { + var matching = matchingInfo.Coolings.Find(t => t.Code == x.Code); + if (Apply(hydroInfo, x, matching)) + { + result = true; + } + }); + } + } + + #endregion + #region 姘磋〃 if (hydroInfo.Meters != null && hydroInfo.Meters.Count > 0) @@ -888,6 +942,25 @@ #endregion + #region 姘存车 + + if (hydroInfo.Pumps != null && hydroInfo.Pumps.Count > 0) + { + if (matchingInfo.Pumps != null && matchingInfo.Pumps.Count > 0) + { + hydroInfo.Pumps.ForEach(x => + { + var matching = matchingInfo.Pumps.Find(t => t.Code == x.Code); + if (Apply(hydroInfo, x, matching)) + { + result = true; + } + }); + } + } + + #endregion + #region 闃�闂� if (hydroInfo.Valves != null && hydroInfo.Valves.Count > 0) @@ -953,7 +1026,30 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroTankInfo visual, HydroTankMatchingViewModel matching) + public static bool Apply + ( + HydroTankViewModel visualViewModel, + HydroTankMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) + { + 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.HydroTankInfo visual, + HydroTankMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -967,51 +1063,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; } @@ -1027,7 +1158,7 @@ curvevol.ModelType = string.Empty; curvevol.DbLocked = false; curvevol.DbId = matching.MatchingCurveDbId; - curvevol.CurveType = Yw.WinFrmUI.HydroCurve.TankVol; + curvevol.CurveType = Yw.WinFrmUI.HydroCurveType.CurveVol; curvevol.CurveData = matching.MatchingVolCurve?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); if (hydroInfo.Curves == null) { @@ -1035,6 +1166,7 @@ } hydroInfo.Curves.Add(curvevol); visual.VolCurve = curvevol.Code; + changeHelper?.Append(curvevol, eChangeType.Add); result = true; } else @@ -1043,7 +1175,22 @@ { 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 + { + 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); } } } @@ -1058,7 +1205,30 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroBluntheadInfo visual, HydroBluntheadMatchingViewModel matching) + public static bool Apply + ( + HydroBluntheadViewModel visualViewModel, + HydroBluntheadMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) + { + 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.HydroBluntheadInfo visual, + HydroBluntheadMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1072,39 +1242,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; } @@ -1119,7 +1314,30 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroElbowInfo visual, HydroElbowMatchingViewModel matching) + public static bool Apply + ( + HydroElbowViewModel visualViewModel, + HydroElbowMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) + { + 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.HydroElbowInfo visual, + HydroElbowMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1133,55 +1351,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; } } @@ -1195,7 +1449,30 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroThreelinkInfo visual, HydroThreelinkMatchingViewModel matching) + public static bool Apply + ( + HydroThreelinkViewModel visualViewModel, + HydroThreelinkMatchingViewModel matching, + HydroChangeHelper changeHelper, + HydroPropStatusHelper propStatusHelper + ) + { + 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.HydroThreelinkInfo visual, + HydroThreelinkMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1209,51 +1486,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; } @@ -1268,7 +1580,30 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroFourlinkInfo visual, HydroFourlinkMatchingViewModel matching) + public static bool Apply + ( + HydroFourlinkViewModel visualViewModel, + HydroFourlinkMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) + { + 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.HydroFourlinkInfo visual, + HydroFourlinkMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1282,39 +1617,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; } @@ -1329,7 +1689,30 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroNozzleInfo visual, HydroNozzleMatchingViewModel matching) + public static bool Apply + ( + HydroNozzleViewModel visualViewModel, + HydroNozzleMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) + { + 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.HydroNozzleInfo visual, + HydroNozzleMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1343,45 +1726,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; } @@ -1396,7 +1809,30 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroHydrantInfo visual, HydroHydrantMatchingViewModel matching) + public static bool Apply + ( + HydroHydrantViewModel visualViewModel, + HydroHydrantMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) + { + 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.HydroHydrantInfo visual, + HydroHydrantMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1410,46 +1846,207 @@ { 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; + } + } + return result; + } + + #endregion + + #region 鍐峰嵈濉� + + /// <summary> + /// 搴旂敤 + /// </summary> + public static bool Apply + ( + HydroCoolingViewModel visualViewModel, + HydroCoolingMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) + { + 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.HydroCoolingInfo visual, + HydroCoolingMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) + { + if (hydroInfo == null) + { + return false; + } + if (visual == null) + { + return false; + } + if (matching == null) + { + return false; + } + //visual.Name = matching.Name; + //visual.DbLocked = matching.DbLocked; + //visual.DbId = matching.DbId; + //visual.ModelType = matching.ModelType; + //visual.Material = matching.Material; + //visual.Caliber = matching.Caliber; + //visual.MinorLoss = matching.MinorLoss; + //visual.Coefficient = matching.Coefficient; + //visual.LowerLimit = matching.LowerLimit; + + bool result = false; + if (!visual.DbLocked) + { + if (!string.IsNullOrEmpty(matching.MatchingModelType)) + { + 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; } } @@ -1463,7 +2060,30 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroMeterInfo visual, HydroMeterMatchingViewModel matching) + public static bool Apply + ( + HydroMeterViewModel visualViewModel, + HydroMeterMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) + { + 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.HydroMeterInfo visual, + HydroMeterMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1477,27 +2097,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; } @@ -1512,7 +2147,30 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroFlowmeterInfo visual, HydroFlowmeterMatchingViewModel matching) + public static bool Apply + ( + HydroFlowmeterViewModel visualViewModel, + HydroFlowmeterMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) + { + 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.HydroFlowmeterInfo visual, + HydroFlowmeterMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1526,27 +2184,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; } @@ -1561,7 +2234,30 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroPressmeterInfo visual, HydroPressmeterMatchingViewModel matching) + public static bool Apply + ( + HydroPressmeterViewModel visualViewModel, + HydroPressmeterMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) + { + 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.HydroPressmeterInfo visual, + HydroPressmeterMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1575,27 +2271,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; } @@ -1610,7 +2321,30 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroPipeInfo visual, HydroPipeMatchingViewModel matching) + public static bool Apply + ( + HydroPipeViewModel visualViewModel, + HydroPipeMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) + { + 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.HydroPipeInfo visual, + HydroPipeMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1625,14 +2359,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; @@ -1640,31 +2374,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; } @@ -1679,7 +2443,30 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroTranslationInfo visual, HydroTranslationMatchingViewModel matching) + public static bool Apply + ( + HydroTranslationViewModel visualViewModel, + HydroTranslationMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) + { + 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.HydroTranslationInfo visual, + HydroTranslationMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1694,16 +2481,16 @@ 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; + //visual.Material = matching.Material; + //visual.Diameter = matching.Diameter; + //visual.StartDiameter = matching.StartDiameter; + //visual.EndDiameter = matching.EndDiameter; + //visual.Roughness = matching.Roughness; + //visual.MinorLoss = matching.MinorLoss; bool result = false; @@ -1711,42 +2498,82 @@ { 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.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; } } @@ -1760,7 +2587,24 @@ /// <summary> /// 搴旂敤 /// </summary> - public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroPumpInfo visual, HydroPumpMatchingViewModel matching) + public static bool Apply(HydroPumpViewModel visualViewModel, HydroPumpMatchingViewModel matching) + { + var bol = Apply(visualViewModel.HydroInfo, visualViewModel.Vmo, matching); + visualViewModel.UpdateProperty(); + return bol; + } + + /// <summary> + /// 搴旂敤 + /// </summary> + public static bool Apply + ( + Yw.Model.HydroModelInfo hydroInfo, + Yw.Model.HydroPumpInfo visual, + HydroPumpMatchingViewModel matching, + HydroChangeHelper changeHelper = null, + HydroPropStatusHelper propStatusHelper = null + ) { if (hydroInfo == null) { @@ -1775,58 +2619,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; } @@ -1843,7 +2728,7 @@ curveqh.ModelType = string.Empty; curveqh.DbLocked = false; curveqh.DbId = matching.MatchingCurveDbId; - curveqh.CurveType = Yw.WinFrmUI.HydroCurve.PumpQH; + curveqh.CurveType = Yw.WinFrmUI.HydroCurveType.CurveQH; curveqh.CurveData = matching.MatchingCurveQH?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); if (hydroInfo.Curves == null) { @@ -1874,7 +2759,7 @@ curveqp.ModelType = string.Empty; curveqp.DbLocked = false; curveqp.DbId = matching.MatchingCurveDbId; - curveqp.CurveType = Yw.WinFrmUI.HydroCurve.PumpQP; + curveqp.CurveType = Yw.WinFrmUI.HydroCurveType.CurveQP; curveqp.CurveData = matching.MatchingCurveQP?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); if (hydroInfo.Curves == null) { @@ -1905,7 +2790,7 @@ curveqe.ModelType = string.Empty; curveqe.DbLocked = false; curveqe.DbId = matching.MatchingCurveDbId; - curveqe.CurveType = Yw.WinFrmUI.HydroCurve.PumpQE; + curveqe.CurveType = Yw.WinFrmUI.HydroCurveType.CurveQE; curveqe.CurveData = matching.MatchingCurveQE?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); if (hydroInfo.Curves == null) { @@ -1933,6 +2818,16 @@ #endregion #region 闃�闂� + + /// <summary> + /// 搴旂敤 + /// </summary> + public static bool Apply(HydroValveViewModel visualViewModel, HydroValveMatchingViewModel matching) + { + var bol = Apply(visualViewModel.HydroInfo, visualViewModel.Vmo, matching); + visualViewModel.UpdateProperty(); + return bol; + } /// <summary> /// 搴旂敤 @@ -2049,7 +2944,7 @@ curveol.ModelType = visual.ModelType; curveol.DbLocked = false; curveol.DbId = matching.MatchingCurveDbId; - curveol.CurveType = Yw.WinFrmUI.HydroCurve.ValveOL; + curveol.CurveType = Yw.WinFrmUI.HydroCurveType.CurveOL; curveol.CurveData = matching.MatchingCurveOL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); if (hydroInfo.Curves == null) { @@ -2064,6 +2959,7 @@ 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; } @@ -2075,7 +2971,7 @@ { if (!string.IsNullOrEmpty(matching.MatchingCurveDbId)) { - //闃�闂ㄥ紑搴︽崯澶辩郴鏁版洸绾� + //姘村ご鎹熷け鏇茬嚎 var curveql = hydroInfo.Curves?.Find(x => x.Code == visual.ValveSetting); if (curveql == null) { @@ -2086,7 +2982,7 @@ curveql.ModelType = visual.ModelType; curveql.DbLocked = false; curveql.DbId = matching.MatchingCurveDbId; - curveql.CurveType = Yw.WinFrmUI.HydroCurve.ValveOL; + curveql.CurveType = Yw.WinFrmUI.HydroCurveType.CurveQL; curveql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); if (hydroInfo.Curves == null) { @@ -2101,6 +2997,7 @@ 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; } @@ -2121,6 +3018,16 @@ #endregion #region 鎹㈢儹鍣� + + /// <summary> + /// 搴旂敤 + /// </summary> + public static bool Apply(HydroExchangerViewModel visualViewModel, HydroExchangerMatchingViewModel matching) + { + var bol = Apply(visualViewModel.HydroInfo, visualViewModel.Vmo, matching); + visualViewModel.UpdateProperty(); + return bol; + } /// <summary> /// 搴旂敤 @@ -2188,7 +3095,7 @@ curvevql.ModelType = string.Empty; curvevql.DbLocked = false; curvevql.DbId = matching.MatchingCurveDbId; - curvevql.CurveType = Yw.WinFrmUI.HydroCurve.ExchangerQL; + curvevql.CurveType = Yw.WinFrmUI.HydroCurveType.CurveQL; curvevql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); if (hydroInfo.Curves == null) { @@ -2215,6 +3122,16 @@ #endregion #region 绌哄帇鏈� + + /// <summary> + /// 搴旂敤 + /// </summary> + public static bool Apply(HydroCompressorViewModel visualViewModel, HydroCompressorMatchingViewModel matching) + { + var bol = Apply(visualViewModel.HydroInfo, visualViewModel.Vmo, matching); + visualViewModel.UpdateProperty(); + return bol; + } /// <summary> /// 搴旂敤 @@ -2282,7 +3199,7 @@ curvevql.ModelType = string.Empty; curvevql.DbLocked = false; curvevql.DbId = matching.MatchingCurveDbId; - curvevql.CurveType = Yw.WinFrmUI.HydroCurve.CompressorQL; + curvevql.CurveType = Yw.WinFrmUI.HydroCurveType.CurveQL; curvevql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); if (hydroInfo.Curves == null) { -- Gitblit v1.9.3