From 1c3e5bc50d3045d51cb9a9f747d53442b82d9e2c Mon Sep 17 00:00:00 2001 From: duheng <2784771470@qq.com> Date: 星期五, 27 十二月 2024 17:50:22 +0800 Subject: [PATCH] 资产修改 --- WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/00-core/HydroMatchingHelper.cs | 222 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 208 insertions(+), 14 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 d9cedf2..ca67a33 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 @@ -70,6 +70,12 @@ #endregion + #region 鍐峰嵈濉� + + vm.Coolings = hydroInfo.Coolings?.Select(x => Create(x, hydroInfo)).ToList(); + + #endregion + #region 姘磋〃 vm.Meters = hydroInfo.Meters?.Select(x => Create(x, hydroInfo)).ToList(); @@ -347,6 +353,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 @@ -794,6 +832,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) @@ -879,6 +936,25 @@ hydroInfo.Translations.ForEach(x => { var matching = matchingInfo.Translations.Find(t => t.Code == x.Code); + if (Apply(hydroInfo, x, matching)) + { + result = true; + } + }); + } + } + + #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; @@ -993,36 +1069,43 @@ { if (!string.IsNullOrEmpty(matching.MatchingModelType)) { + visual.UpdatePropStatus(nameof(visual.ModelType), ePropStatus.Matching, "閫氳繃鍩虹鏁版嵁鍖归厤淇"); visual.ModelType = matching.MatchingModelType; result = true; } if (!string.IsNullOrEmpty(matching.MatchingDbId)) { + visual.UpdatePropStatus(nameof(visual.DbId), ePropStatus.Matching, "閫氳繃鍩虹鏁版嵁鍖归厤淇"); visual.DbId = matching.MatchingDbId; result = true; } if (matching.MatchingMinLevel.HasValue) { + visual.UpdatePropStatus(nameof(visual.MinLevel), ePropStatus.Matching, "閫氳繃鍩虹鏁版嵁鍖归厤淇"); visual.MinLevel = matching.MatchingMinLevel.Value; result = true; } if (matching.MatchingMaxLevel.HasValue) { + visual.UpdatePropStatus(nameof(visual.MaxLevel), ePropStatus.Matching, "閫氳繃鍩虹鏁版嵁鍖归厤淇"); visual.MaxLevel = matching.MatchingMaxLevel.Value; result = true; } if (matching.MatchingDN.HasValue) { + visual.UpdatePropStatus(nameof(visual.DN), ePropStatus.Matching, "閫氳繃鍩虹鏁版嵁鍖归厤淇"); visual.DN = matching.MatchingDN.Value; result = true; } if (matching.MatchingMinVol.HasValue) { + visual.UpdatePropStatus(nameof(visual.MinVol), ePropStatus.Matching, "閫氳繃鍩虹鏁版嵁鍖归厤淇"); visual.MinVol = matching.MatchingMinVol.Value; result = true; } if (matching.MatchingOverFlow.HasValue) { + visual.UpdatePropStatus(nameof(visual.OverFlow), ePropStatus.Matching, "閫氳繃鍩虹鏁版嵁鍖归厤淇"); visual.OverFlow = matching.MatchingOverFlow.Value; result = true; } @@ -1038,7 +1121,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) { @@ -1529,6 +1612,96 @@ #endregion + #region 鍐峰嵈濉� + + /// <summary> + /// 搴旂敤 + /// </summary> + public static bool Apply(HydroCoolingViewModel visualViewModel, HydroCoolingMatchingViewModel matching) + { + var bol = Apply(visualViewModel.HydroInfo, visualViewModel.Vmo, matching); + visualViewModel.UpdateProperty(); + return bol; + } + + /// <summary> + /// 搴旂敤 + /// </summary> + public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroCoolingInfo visual, HydroCoolingMatchingViewModel matching) + { + if (hydroInfo == null) + { + return false; + } + if (visual == null) + { + return false; + } + if (matching == null) + { + return false; + } + visual.Name = matching.Name; + visual.DbLocked = matching.DbLocked; + visual.DbId = matching.DbId; + visual.ModelType = matching.ModelType; + visual.Material = matching.Material; + visual.Caliber = matching.Caliber; + visual.MinorLoss = matching.MinorLoss; + visual.Coefficient = matching.Coefficient; + visual.LowerLimit = matching.LowerLimit; + + bool result = false; + if (!visual.DbLocked) + { + if (!string.IsNullOrEmpty(matching.MatchingModelType)) + { + visual.UpdatePropStatus(nameof(visual.ModelType), ePropStatus.Matching, $"閫氳繃鍩虹鏁版嵁鍖归厤淇锛屽師鏁版嵁:{visual.ModelType}"); + visual.ModelType = matching.MatchingModelType; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingDbId)) + { + visual.UpdatePropStatus(nameof(visual.DbId), ePropStatus.Matching, $"閫氳繃鍩虹鏁版嵁鍖归厤淇锛屽師鏁版嵁:{visual.DbId}"); + visual.DbId = matching.MatchingDbId; + result = true; + } + if (matching.MatchingCaliber.HasValue) + { + visual.UpdatePropStatus(nameof(visual.Caliber), ePropStatus.Matching, $"閫氳繃鍩虹鏁版嵁鍖归厤淇锛屽師鏁版嵁:{visual.Caliber}"); + visual.Caliber = matching.MatchingCaliber.Value; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingMaterial)) + { + visual.UpdatePropStatus(nameof(visual.Material), ePropStatus.Matching, $"閫氳繃鍩虹鏁版嵁鍖归厤淇锛屽師鏁版嵁:{visual.Material}"); + visual.Material = matching.MatchingMaterial; + result = true; + } + if (matching.MatchingMinorLoss.HasValue) + { + visual.UpdatePropStatus(nameof(visual.MinorLoss), ePropStatus.Matching, $"閫氳繃鍩虹鏁版嵁鍖归厤淇锛屽師鏁版嵁:{visual.MinorLoss}"); + visual.MinorLoss = matching.MatchingMinorLoss.Value; + result = true; + } + if (matching.MatchingCoefficient.HasValue) + { + visual.UpdatePropStatus(nameof(visual.Coefficient), ePropStatus.Matching, $"閫氳繃鍩虹鏁版嵁鍖归厤淇锛屽師鏁版嵁:{visual.Coefficient}"); + visual.Coefficient = matching.MatchingCoefficient.Value; + result = true; + } + if (matching.MatchingLowerLimit.HasValue) + { + visual.UpdatePropStatus(nameof(visual.LowerLimit), ePropStatus.Matching, $"閫氳繃鍩虹鏁版嵁鍖归厤淇锛屽師鏁版嵁:{visual.LowerLimit}"); + visual.LowerLimit = matching.MatchingLowerLimit.Value; + result = true; + } + } + return result; + } + + #endregion + #region 姘磋〃 /// <summary> @@ -1922,41 +2095,49 @@ { if (!string.IsNullOrEmpty(matching.MatchingModelType)) { + visual.UpdatePropStatus(nameof(visual.ModelType), ePropStatus.Matching, $"閫氳繃鍩虹鏁版嵁鍖归厤淇锛屽師濮嬫暟鎹�:{visual.ModelType}"); visual.ModelType = matching.MatchingModelType; result = true; } if (!string.IsNullOrEmpty(matching.MatchingDbId)) { + visual.UpdatePropStatus(nameof(visual.DbId), ePropStatus.Matching, $"閫氳繃鍩虹鏁版嵁鍖归厤淇锛屽師濮嬫暟鎹�:{visual.DbId}"); visual.DbId = matching.MatchingDbId; result = true; } if (matching.MatchingRatedQ.HasValue) { + visual.UpdatePropStatus(nameof(visual.RatedQ), ePropStatus.Matching, $"閫氳繃鍩虹鏁版嵁鍖归厤淇锛屽師濮嬫暟鎹�:{visual.RatedQ}"); visual.RatedQ = matching.MatchingRatedQ.Value; result = true; } if (matching.MatchingRatedH.HasValue) { + visual.UpdatePropStatus(nameof(visual.RatedH), ePropStatus.Matching, $"閫氳繃鍩虹鏁版嵁鍖归厤淇锛屽師濮嬫暟鎹�:{visual.RatedH}"); visual.RatedH = matching.MatchingRatedH.Value; result = true; } if (matching.MatchingRatedP.HasValue) { + visual.UpdatePropStatus(nameof(visual.RatedP), ePropStatus.Matching, $"閫氳繃鍩虹鏁版嵁鍖归厤淇锛屽師濮嬫暟鎹�:{visual.RatedP}"); visual.RatedP = matching.MatchingRatedP.Value; result = true; } if (matching.MatchingRatedN.HasValue) { + visual.UpdatePropStatus(nameof(visual.RatedN), ePropStatus.Matching, $"閫氳繃鍩虹鏁版嵁鍖归厤淇锛屽師濮嬫暟鎹�:{visual.RatedN}"); visual.RatedN = matching.MatchingRatedN.Value; result = true; } if (matching.MatchingRatedHz.HasValue) { + visual.UpdatePropStatus(nameof(visual.RatedHz), ePropStatus.Matching, $"閫氳繃鍩虹鏁版嵁鍖归厤淇锛屽師濮嬫暟鎹�:{visual.RatedHz}"); visual.RatedHz = matching.MatchingRatedHz.Value; result = true; } if (matching.MatchingCurrentHz.HasValue) { + visual.UpdatePropStatus(nameof(visual.SpeedRatio), ePropStatus.Matching, $"閫氳繃鍩虹鏁版嵁鍖归厤淇锛屽師濮嬫暟鎹�:{visual.SpeedRatio}"); visual.SpeedRatio = matching.MatchingCurrentHz.Value / visual.RatedHz; result = true; } @@ -1974,13 +2155,14 @@ 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) { hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>(); } hydroInfo.Curves.Add(curveqh); + visual.UpdatePropStatus(nameof(visual.CurveQH), ePropStatus.Matching, $"閫氳繃鍩虹鏁版嵁鍖归厤淇"); visual.CurveQH = curveqh.Code; result = true; } @@ -2005,13 +2187,14 @@ 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) { hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>(); } hydroInfo.Curves.Add(curveqp); + visual.UpdatePropStatus(nameof(visual.CurveQP), ePropStatus.Matching, $"閫氳繃鍩虹鏁版嵁鍖归厤淇"); visual.CurveQP = curveqp.Code; result = true; } @@ -2036,13 +2219,14 @@ 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) { hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>(); } hydroInfo.Curves.Add(curveqe); + visual.UpdatePropStatus(nameof(visual.CurveQE), ePropStatus.Matching, $"閫氳繃鍩虹鏁版嵁鍖归厤淇"); visual.CurveQE = curveqe.Code; result = true; } @@ -2109,31 +2293,37 @@ { if (!string.IsNullOrEmpty(matching.MatchingModelType)) { + visual.UpdatePropStatus(nameof(visual.ModelType), ePropStatus.Matching, "閫氳繃鍩虹鏁版嵁鍖归厤淇"); visual.ModelType = matching.MatchingModelType; result = true; } if (!string.IsNullOrEmpty(matching.MatchingDbId)) { + visual.UpdatePropStatus(nameof(visual.DbId), ePropStatus.Matching, "閫氳繃鍩虹鏁版嵁鍖归厤淇"); visual.DbId = matching.MatchingDbId; result = true; } if (!string.IsNullOrEmpty(matching.MatchingMaterial)) { + visual.UpdatePropStatus(nameof(visual.Material), ePropStatus.Matching, "閫氳繃鍩虹鏁版嵁鍖归厤淇"); visual.Material = matching.MatchingMaterial; result = true; } if (matching.MatchingDiameter.HasValue) { + visual.UpdatePropStatus(nameof(visual.Diameter), ePropStatus.Matching, "閫氳繃鍩虹鏁版嵁鍖归厤淇"); visual.Diameter = matching.MatchingDiameter.Value; result = true; } if (matching.MatchingMinorLoss.HasValue) { + visual.UpdatePropStatus(nameof(visual.MinorLoss), ePropStatus.Matching, "閫氳繃鍩虹鏁版嵁鍖归厤淇"); visual.MinorLoss = matching.MatchingMinorLoss.Value; result = true; } if (matching.MatchingValveType.HasValue) { + visual.UpdatePropStatus(nameof(visual.ValveType), ePropStatus.Matching, "閫氳繃鍩虹鏁版嵁鍖归厤淇"); visual.ValveType = HydroValveTypeEnumHelper.GetValveTypeCode(matching.MatchingValveType.Value); result = true; } @@ -2143,6 +2333,7 @@ { if (!string.IsNullOrEmpty(matching.MatchingValveSetting)) { + visual.UpdatePropStatus(nameof(visual.ValveSetting), ePropStatus.Matching, "閫氳繃鍩虹鏁版嵁鍖归厤淇"); visual.ValveSetting = matching.MatchingValveSetting; result = true; } @@ -2152,6 +2343,7 @@ { if (!string.IsNullOrEmpty(matching.MatchingValveSetting)) { + visual.UpdatePropStatus(nameof(visual.ValveSetting), ePropStatus.Matching, "閫氳繃鍩虹鏁版嵁鍖归厤淇"); visual.ValveSetting = matching.MatchingValveSetting; result = true; } @@ -2161,6 +2353,7 @@ { if (!string.IsNullOrEmpty(matching.MatchingValveSetting)) { + visual.UpdatePropStatus(nameof(visual.ValveSetting), ePropStatus.Matching, "閫氳繃鍩虹鏁版嵁鍖归厤淇"); visual.ValveSetting = matching.MatchingValveSetting; result = true; } @@ -2170,6 +2363,7 @@ { if (!string.IsNullOrEmpty(matching.MatchingValveSetting)) { + visual.UpdatePropStatus(nameof(visual.ValveSetting), ePropStatus.Matching, "閫氳繃鍩虹鏁版嵁鍖归厤淇"); visual.ValveSetting = matching.MatchingValveSetting; result = true; } @@ -2190,7 +2384,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) { @@ -2216,7 +2410,7 @@ { if (!string.IsNullOrEmpty(matching.MatchingCurveDbId)) { - //闃�闂ㄥ紑搴︽崯澶辩郴鏁版洸绾� + //姘村ご鎹熷け鏇茬嚎 var curveql = hydroInfo.Curves?.Find(x => x.Code == visual.ValveSetting); if (curveql == null) { @@ -2227,7 +2421,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) { @@ -2339,7 +2533,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) { @@ -2408,31 +2602,31 @@ if (!string.IsNullOrEmpty(matching.MatchingModelType)) { visual.ModelType = matching.MatchingModelType; - visual.UpdatePropStatus(nameof(visual.ModelType), ePropStatus.Normal, "鍖归厤淇"); + visual.UpdatePropStatus(nameof(visual.ModelType), ePropStatus.Matching, "閫氳繃鍩虹鏁版嵁鍖归厤淇"); result = true; } if (!string.IsNullOrEmpty(matching.MatchingDbId)) { visual.DbId = matching.MatchingDbId; - visual.UpdatePropStatus(nameof(visual.DbId), ePropStatus.Normal, "鍖归厤淇"); + visual.UpdatePropStatus(nameof(visual.DbId), ePropStatus.Matching, "閫氳繃鍩虹鏁版嵁鍖归厤淇"); result = true; } if (!string.IsNullOrEmpty(matching.MatchingMaterial)) { visual.Material = matching.MatchingMaterial; - visual.UpdatePropStatus(nameof(visual.Material), ePropStatus.Normal, "鍖归厤淇"); + visual.UpdatePropStatus(nameof(visual.Material), ePropStatus.Matching, "閫氳繃鍩虹鏁版嵁鍖归厤淇"); result = true; } if (matching.MatchingDiameter.HasValue) { visual.Diameter = matching.MatchingDiameter.Value; - visual.UpdatePropStatus(nameof(visual.Diameter), ePropStatus.Normal, "鍖归厤淇"); + visual.UpdatePropStatus(nameof(visual.Diameter), ePropStatus.Matching, "閫氳繃鍩虹鏁版嵁鍖归厤淇"); result = true; } if (matching.MatchingMinorLoss.HasValue) { visual.MinorLoss = matching.MatchingMinorLoss.Value; - visual.UpdatePropStatus(nameof(visual.MinorLoss), ePropStatus.Normal, "鍖归厤淇"); + visual.UpdatePropStatus(nameof(visual.MinorLoss), ePropStatus.Matching, "閫氳繃鍩虹鏁版嵁鍖归厤淇"); result = true; } @@ -2448,7 +2642,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