From 46978af63f2f683eefb0cadb87c1ce7540b0038d Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Mon, 4 Nov 2024 17:00:24 +0200 Subject: Store BrushStop Model. --- .../Tango.PPC.JobsV2/Models/BrushStopModel.cs | 60 +++++++++++++++++++++- 1 file changed, 58 insertions(+), 2 deletions(-) (limited to 'Software/Visual_Studio/PPC/Modules') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs index 62403e636..5c0d9145a 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs @@ -8,9 +8,11 @@ using Tango.BL.Dispensing; using Tango.BL.Entities; using Tango.BL.Enumerations; using Tango.ColorConversion; +using Tango.Core.DI; using Tango.Core.Threading; using Tango.PMR.ColorLab; using Tango.PPC.Common; +using Tango.PPC.Common.Connection; using Tango.Settings; using Tango.SharedUI; @@ -34,6 +36,9 @@ namespace Tango.PPC.Jobs.Models public event EventHandler LiquidVolumesOutOfRangeChanged; public event EventHandler ColorChanged; + [TangoInject] + public IMachineProvider MachineProvider { get; set; } + #region Property public String Guid { get; set; } @@ -135,6 +140,31 @@ namespace Tango.PPC.Jobs.Models } } + protected Double _violet; + + /// + /// Gets or sets the BrushStopModel violet. + /// + public Double Violet + { + get + { + return _violet; + } + + set + { + if (Violet != value) + { + _violet = value; + RaisePropertyChangedAuto(); + OnVolumeChanged(); + } + } + } + + + protected Int32 _red; /// @@ -630,7 +660,7 @@ namespace Tango.PPC.Jobs.Models { if (RequiredMaxLiquidTest && (ColorSpace == ColorSpaces.Volume || ColorSpace == ColorSpaces.CMYK)) { - var sum = GetColorNLPerCm(Cyan, LiquidTypes.Cyan) + GetColorNLPerCm(Magenta, LiquidTypes.Magenta) + GetColorNLPerCm(Yellow, LiquidTypes.Yellow) + GetColorNLPerCm(Black, LiquidTypes.Black); + var sum = GetColorNLPerCm(Cyan, LiquidTypes.Cyan) + GetColorNLPerCm(Magenta, LiquidTypes.Magenta) + GetColorNLPerCm(Yellow, LiquidTypes.Yellow) + GetColorNLPerCm(Black, LiquidTypes.Black) + GetColorNLPerCm(Violet, LiquidTypes.Violet); var maxLiq = GetTotalMaximumLiquidNlPerCMLimit(); LiquidVolumesOutOfRange = sum > GetTotalMaximumLiquidNlPerCMLimit(); @@ -690,6 +720,13 @@ namespace Tango.PPC.Jobs.Models LiquidVolumeBelowMinLimitmessage = $"{Black} Black should be > {minBlack.ToString("N3")}"; return LiquidVolumeBelowMinLimit; } + var minViolet = GetMinLimitLiquid(LiquidTypes.Violet); + if (Violet > 0 && Violet < minViolet) + { + LiquidVolumeBelowMinLimit = true; + LiquidVolumeBelowMinLimitmessage = $"{Violet} Violet should be > {minViolet.ToString("N3")}"; + return LiquidVolumeBelowMinLimit; + } LiquidVolumeBelowMinLimit = false; LiquidVolumeBelowMinLimitmessage = ""; return false; @@ -743,6 +780,8 @@ namespace Tango.PPC.Jobs.Models public Double YellowBeforeChange { get; set; } [JsonIgnore] public Double BlackBeforeChange { get; set; } + [JsonIgnore] + public Double VioletBeforeChange { get; set; } public bool FineTuningChanged { get; set; } @@ -753,6 +792,8 @@ namespace Tango.PPC.Jobs.Models public BrushStopModel() { Guid = System.Guid.NewGuid().ToString(); + + TangoIOC.Default.Inject(this); } public BrushStopModel(SegmentModel segmentModel) : this() @@ -796,6 +837,7 @@ namespace Tango.PPC.Jobs.Models Magenta = brushStop.Magenta * 100; Yellow = brushStop.Yellow * 100; Black = brushStop.Black * 100; + Violet = brushStop.Violet * 100; } else { @@ -803,6 +845,7 @@ namespace Tango.PPC.Jobs.Models Magenta = brushStop.GetVolume(LiquidTypes.Magenta); Yellow = brushStop.GetVolume(LiquidTypes.Yellow); Black = brushStop.GetVolume(LiquidTypes.Black); + Violet = brushStop.GetVolume(LiquidTypes.Violet); } } else @@ -811,6 +854,7 @@ namespace Tango.PPC.Jobs.Models Magenta = brushStop.Magenta; Yellow = brushStop.Yellow; Black = brushStop.Black; + Violet = brushStop.Violet; } Red = brushStop.Red; Green = brushStop.Green; @@ -836,7 +880,7 @@ namespace Tango.PPC.Jobs.Models _bestMatchL = 100; _bestMatchA = _bestMatchB = 0; _red = _green = _blue = 255; - _cyan = _magenta = _yellow = _black = 0; + _cyan = _magenta = _yellow = _black = _violet = 0; StopIndex = 1; Position = PositionStatus.FirstColor; IsOutOfGamut = false; @@ -885,6 +929,7 @@ namespace Tango.PPC.Jobs.Models Magenta = newBrushStop.Magenta; Yellow = newBrushStop.Yellow; Black = newBrushStop.Black; + Violet = newBrushStop.Violet; ColorCatalogsItem = newBrushStop.ColorCatalogsItem; PreventPropertyUpdate = false; @@ -913,6 +958,7 @@ namespace Tango.PPC.Jobs.Models s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Magenta.ToInt32()).PackIndex, Magenta); s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Yellow.ToInt32()).PackIndex, Yellow); s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Black.ToInt32()).PackIndex, Black); + s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Violet.ToInt32()).PackIndex, Violet); } else if (s.ColorSpace.Space == ColorSpaces.LAB) { @@ -981,6 +1027,7 @@ namespace Tango.PPC.Jobs.Models cloned.Magenta = Magenta; cloned.Yellow = Yellow; cloned.Black = Black; + cloned.Violet = Violet; cloned.Hue = Hue; cloned.Saturation = Saturation; cloned.Brightness = Brightness; @@ -1029,6 +1076,7 @@ namespace Tango.PPC.Jobs.Models Magenta = favoriteColor.Magenta; Yellow = favoriteColor.Yellow; Black = favoriteColor.Black; + Violet = favoriteColor.Violet; Red = favoriteColor.Red; Green = favoriteColor.Green; @@ -1072,6 +1120,7 @@ namespace Tango.PPC.Jobs.Models s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Magenta.ToInt32()).PackIndex, Magenta); s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Yellow.ToInt32()).PackIndex, Yellow); s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Black.ToInt32()).PackIndex, Black); + s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Violet.ToInt32()).PackIndex, Violet); s.L = this.L; s.A = this.A; @@ -1101,6 +1150,7 @@ namespace Tango.PPC.Jobs.Models Cyan = CyanBeforeChange; Magenta = MagentaBeforeChange; Yellow = YellowBeforeChange; + Violet = VioletBeforeChange; PreventPropertyUpdate = false; Black = BlackBeforeChange; } @@ -1121,6 +1171,7 @@ namespace Tango.PPC.Jobs.Models MagentaBeforeChange = Magenta; YellowBeforeChange = Yellow; BlackBeforeChange = Black; + VioletBeforeChange = Violet; } } @@ -1448,10 +1499,12 @@ namespace Tango.PPC.Jobs.Models _magenta = ColorCatalogsItem.Magenta; _yellow = ColorCatalogsItem.Yellow; _black = ColorCatalogsItem.Black; + _violet = 0; RaisePropertyChanged(nameof(Cyan)); RaisePropertyChanged(nameof(Yellow)); RaisePropertyChanged(nameof(Magenta)); RaisePropertyChanged(nameof(Black)); + RaisePropertyChanged(nameof(Violet)); IsOutOfGamut = false; // RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); // RaisePropertyChanged(nameof(IsLiquidVolumeBelowMinLimit)); @@ -1482,6 +1535,7 @@ namespace Tango.PPC.Jobs.Models _yellow = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Yellow).Volume); _magenta = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Magenta).Volume); _black = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Black).Volume); + _violet = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Violet).Volume); IsOutOfGamut = false; //if ( LastChangedColorSpace != ColorSpaces.RGB) //{ @@ -1495,6 +1549,7 @@ namespace Tango.PPC.Jobs.Models RaisePropertyChanged(nameof(Yellow)); RaisePropertyChanged(nameof(Magenta)); RaisePropertyChanged(nameof(Black)); + RaisePropertyChanged(nameof(Violet)); RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); RaisePropertyChanged(nameof(IsLiquidVolumeBelowMinLimit)); } @@ -1553,6 +1608,7 @@ namespace Tango.PPC.Jobs.Models _yellow = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Yellow).Volume); _magenta = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Magenta).Volume); _black = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Black).Volume); + _violet = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Violet).Volume); if (_black > 0 && _black < 0.5)//bug 7959 0.001 < K% < 0.5 ==> reset the K to 0. { _black = 0; -- cgit v1.3.1