From 1d0dc706bd76c7add0adf29acf73e5c502737bad Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 13 Apr 2021 16:31:05 +0300 Subject: Machine studio v4.4.7 --- .../MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Software/Visual_Studio/MachineStudio') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index 0436479bc..5f2a4798a 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("4.4.6.0")] +[assembly: AssemblyVersion("4.4.7.0")] [assembly: ComVisible(false)] \ No newline at end of file -- cgit v1.3.1 From 923ad7e2eb56061930d1490eaacb9bbd50cc57db Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Wed, 14 Apr 2021 15:01:44 +0300 Subject: Delete configuration and dispensers with machine. --- .../ViewModels/MainViewVM.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'Software/Visual_Studio/MachineStudio') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs index 069e33f7e..10141d28d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs @@ -838,7 +838,16 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels try { IsFree = false; - await SelectedMachine.DeleteCascadeAsync(MachinesAdapter.Context); + + var machineToDelete = await new MachineBuilder(MachinesAdapter.Context).Set(SelectedMachine).WithConfiguration().BuildAsync(); + + await machineToDelete.DeleteCascadeAsync(MachinesAdapter.Context); + await machineToDelete.Configuration.DeleteCascadeAsync(MachinesAdapter.Context); + foreach (var dispenser in machineToDelete.Configuration.IdsPacks.Select(x => x.Dispenser)) + { + await dispenser.DeleteCascadeAsync(MachinesAdapter.Context); + } + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.MachineDeleted, _authentication.CurrentUser, SelectedMachine.Name, SelectedMachine, "Machine deleted using Machine Studio."); MachinesAdapter.Context.Machines.Remove(SelectedMachine); MachinesAdapter.Machines.Remove(SelectedMachine); -- cgit v1.3.1 From 35a617cbde0f62ef3b5a69b0cbe2965bb134e5ec Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Mon, 19 Apr 2021 00:29:23 +0300 Subject: Validate liquid quantities fix when Mirta is generating gradients. --- .../ViewModels/MainViewVM.cs | 5 +- .../Visual_Studio/PPC/Tango.PPC.UI/app.manifest | 2 +- .../Tango.Integration/Operation/MachineOperator.cs | 175 +++++++++++++-------- 3 files changed, 113 insertions(+), 69 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 35e27c834..ba21e4875 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -895,7 +895,10 @@ namespace Tango.MachineStudio.Developer.ViewModels stop.Corrected = true; stop.IsOutOfGamut = false; } - catch { } + catch (Exception ex) + { + Debug.WriteLine(ex.ToString()); + } } else if (stop.ColorSpace.Code == BL.Enumerations.ColorSpaces.RGB.ToInt32() || stop.ColorSpace.Code == BL.Enumerations.ColorSpaces.LAB.ToInt32()) { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index d72e75011..efc5f8179 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - + diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 91a2a1b77..10c0420d4 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -2031,7 +2031,7 @@ namespace Tango.Integration.Operation private List ValidateJobLiquidQuantity(Job job, ProcessParametersTable processParameters, Configuration configuration) { - LogManager.Log("Validating job liquid quantities..."); + LogManager.Log("Validating job liquid quantities using integral..."); Dictionary liquidQuantities = new Dictionary(); List requiredLiquids = new List(); @@ -2166,84 +2166,42 @@ namespace Tango.Integration.Operation return requiredLiquids; } - /// - /// Assign the liquid quantities spent by the last job using the job and the handler last status. - /// - /// The job. - /// The configuration. - /// The handler. - private void SaveLastJobLiquidQuantities(Job job, Configuration configuration, ProcessParametersTable processParameters, JobHandler handler) + private List ValidateJobLiquidQuantity(JobTicket ticket, ProcessParametersTable processParameters, Configuration configuration) { - if (configuration == null) - { - configuration = _machineConfiguration; - } - - try - { - _lastJobLiquidQuantities = new List(); - - if (JobLiquidQuantityCalculationMode == JobLiquidQuantityCalculationMode.MachineStatus) - { - foreach (var pack in configuration.NoneEmptyIdsPacks.ToList()) - { - var packLevelAfter = MachineStatus.IDSPacksLevels.SingleOrDefault(x => x.Index == pack.PackIndex); - var packLevelBefore = _machineStatusBeforeJobStart.IDSPacksLevels.SingleOrDefault(x => x.Index == pack.PackIndex); - - if (packLevelAfter != null && packLevelBefore != null) - { - _lastJobLiquidQuantities.Add(new BL.ValueObjects.JobRunLiquidQuantity() - { - LiquidType = pack.LiquidType.Type, - Quantity = packLevelBefore.DispenserLevel - packLevelAfter.DispenserLevel, - }); - } - } - } - else - { - _lastJobLiquidQuantities = CreateJobRunLiquidQuantities(job, configuration, processParameters, handler.Status.Progress, handler.Status.TotalProgress); - } - } - catch (Exception ex) - { - LogManager.Log(ex, LogCategory.Critical, "Error saving last job liquid quantities."); - } - } - - private void ValidateJobLiquidQuantity(JobTicket ticket, ProcessParametersTable processParameters, Configuration configuration) - { - LogManager.Log("Validating job liquid quantity..."); + LogManager.Log("Validating job liquid quantity using job ticket..."); Dictionary liquidQuantities = new Dictionary(); + List requiredLiquids = new List(); foreach (var pack in configuration.NoneEmptyIdsPacks.OrderBy(x => x.PackIndex)) { liquidQuantities.Add(pack.PackIndex, 0); } - for (int i = 0; i < Math.Max(ticket.NumberOfUnits, 1); i++) + for (int segmentIndex = 0; segmentIndex < ticket.Segments.Count; segmentIndex++) { - for (int segmentIndex = 0; segmentIndex < ticket.Segments.Count; segmentIndex++) - { - var segment = ticket.Segments[segmentIndex]; - var segment_length_cm = segment.Length * 100d; + var segment = ticket.Segments[segmentIndex]; + var segment_length_cm = segment.Length * 100d; - var stop_count = segment.BrushStops.Count - (segment.BrushStops.Count == 1 ? 0 : 1); - var stop_length_centimeters = segment_length_cm / stop_count; + var stop_count = segment.BrushStops.Count - (segment.BrushStops.Count == 1 ? 0 : 1); + var stop_length_centimeters = segment_length_cm / stop_count; - for (int stopIndex = 0; stopIndex < stop_count; stopIndex++) - { - var stop = segment.BrushStops[stopIndex]; + for (int stopIndex = 0; stopIndex < stop_count; stopIndex++) + { + var stop = segment.BrushStops[stopIndex]; - foreach (var dispenser in stop.Dispensers) - { - liquidQuantities[dispenser.Index] += dispenser.NanoliterPerCentimeter * stop_length_centimeters; - } + foreach (var dispenser in stop.Dispensers) + { + liquidQuantities[dispenser.Index] += dispenser.NanoliterPerCentimeter * stop_length_centimeters; } } } + foreach (var key in liquidQuantities.Select(x => x.Key).ToList()) + { + liquidQuantities[key] *= Math.Max(ticket.NumberOfUnits, 1); + } + if (MachineStatus != null) { var exception = new InsufficientLiquidQuantityException($"Insufficient liquids level."); @@ -2266,9 +2224,26 @@ namespace Tango.Integration.Operation Maximum = MAX_DISPENSER_NANOLITER, }; - if (liquidQuantities[index] > packLevel.DispenserLevel) + requiredLiquids.Add(new RequiredLiquid() + { + IdsPack = idsPack, + Quantity = (int)liquidQuantities[index] + }); + + LogManager.Log($"Required {idsLevel.IdsPack.LiquidType.Type}: {idsLevel.Required}, Current: {idsLevel.Current}"); + + if (idsLevel.Required > idsLevel.Current) { shouldThrow = true; + + string display_value = (((double)(idsLevel.Required - idsLevel.Current) / 1000000)).ToString("N2", CultureInfo.InvariantCulture); + idsLevel.Message = $"Missing {display_value} CC to complete the job."; + + if (idsLevel.Required > idsLevel.Maximum) + { + display_value = (((double)(idsLevel.Required - idsLevel.Maximum)) / 1000000).ToString("N2", CultureInfo.InvariantCulture); + idsLevel.Message = $"Required ink exceeds the maximum capacity of the dispenser by {display_value} CC. Please reduce the segment length."; + } } exception.IdsPackLevels.Add(idsLevel); @@ -2282,6 +2257,10 @@ namespace Tango.Integration.Operation if (shouldThrow) { + LogManager.Log("Liquid quantity validation failed due to insufficient quantity. Throwing exception..."); + + exception.IdsPackLevels = exception.IdsPackLevels.OrderBy(x => x.IdsPack.PackIndex).ToList(); + throw LogManager.Log(exception, JsonConvert.SerializeObject(exception.IdsPackLevels.Select(x => new { Liquid = x.IdsPack.LiquidType.Name, @@ -2294,6 +2273,53 @@ namespace Tango.Integration.Operation { LogManager.Log("Could not validate required liquid quantity for job. No machine status received", LogCategory.Warning); } + + return requiredLiquids; + } + + /// + /// Assign the liquid quantities spent by the last job using the job and the handler last status. + /// + /// The job. + /// The configuration. + /// The handler. + private void SaveLastJobLiquidQuantities(Job job, Configuration configuration, ProcessParametersTable processParameters, JobHandler handler) + { + if (configuration == null) + { + configuration = _machineConfiguration; + } + + try + { + _lastJobLiquidQuantities = new List(); + + if (JobLiquidQuantityCalculationMode == JobLiquidQuantityCalculationMode.MachineStatus) + { + foreach (var pack in configuration.NoneEmptyIdsPacks.ToList()) + { + var packLevelAfter = MachineStatus.IDSPacksLevels.SingleOrDefault(x => x.Index == pack.PackIndex); + var packLevelBefore = _machineStatusBeforeJobStart.IDSPacksLevels.SingleOrDefault(x => x.Index == pack.PackIndex); + + if (packLevelAfter != null && packLevelBefore != null) + { + _lastJobLiquidQuantities.Add(new BL.ValueObjects.JobRunLiquidQuantity() + { + LiquidType = pack.LiquidType.Type, + Quantity = packLevelBefore.DispenserLevel - packLevelAfter.DispenserLevel, + }); + } + } + } + else + { + _lastJobLiquidQuantities = CreateJobRunLiquidQuantities(job, configuration, processParameters, handler.Status.Progress, handler.Status.TotalProgress); + } + } + catch (Exception ex) + { + LogManager.Log(ex, LogCategory.Critical, "Error saving last job liquid quantities."); + } } #endregion @@ -2616,12 +2642,29 @@ namespace Tango.Integration.Operation } } + var segments = job.OrderedSegments.ToList(); + List requiredLiquids = null; - //Validate liquid quantities.. + //Validate liquid quantities if (EnableJobLiquidQuantityValidation) { - requiredLiquids = ValidateJobLiquidQuantity(job, processParameters, job.Machine.Configuration); + if (!originalJob.Rml.UseColorLibGradients) //Validate liquid quantities when ColorLib generate gradient is disabled + { + requiredLiquids = ValidateJobLiquidQuantity(job, processParameters, job.Machine.Configuration); + } + else //Validate liquid quantities when ColorLib generate gradient is enabled + { + JobTicket t = new JobTicket(); + t.NumberOfUnits = (uint)originalJob.NumberOfUnits; + + foreach (var segment in segments) + { + t.Segments.Add(CreatePMRJobSegment(segment, originalJob, processParameters)); + } + + requiredLiquids = ValidateJobLiquidQuantity(t, processParameters, job.Machine.Configuration); + } } else { @@ -2634,8 +2677,6 @@ namespace Tango.Integration.Operation int max = job.OrderedSegments.Last().SegmentIndex + 1; - var segments = job.OrderedSegments.ToList(); - for (int i = 0; i < job.NumberOfUnits - 1; i++) { foreach (var s in segments) -- cgit v1.3.1 From 15067dcfb8ca4c74f75f7b54e3ff272e389e8d1a Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Mon, 19 Apr 2021 01:27:02 +0300 Subject: Fixed job length reloading after save on MS. --- .../Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Software/Visual_Studio/MachineStudio') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index ba21e4875..61791d4b4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -1998,6 +1998,9 @@ namespace Tango.MachineStudio.Developer.ViewModels SelectedMachineJob.Segments = SelectedMachineJob.Segments; }); + SelectedMachineJob.RaisePropertyChanged(x => x.Length); + SelectedMachineJob.RaisePropertyChanged(x => x.EstimatedDurationMili); + var settings = SettingsManager.Default.GetOrCreate(); settings.DefaultJobRmlGuid = ActiveJob.RmlGuid; settings.Save(); -- cgit v1.3.1 From b33e66dc7d2dc74231675c1414368bac815f4f4d Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Mon, 19 Apr 2021 12:38:16 +0300 Subject: machine delete fix. --- .../Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs index 10141d28d..4e3aa4c93 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs @@ -843,9 +843,12 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels await machineToDelete.DeleteCascadeAsync(MachinesAdapter.Context); await machineToDelete.Configuration.DeleteCascadeAsync(MachinesAdapter.Context); - foreach (var dispenser in machineToDelete.Configuration.IdsPacks.Select(x => x.Dispenser)) + foreach (var dispenser in machineToDelete.Configuration.NoneEmptyIdsPacks.Select(x => x.Dispenser)) { - await dispenser.DeleteCascadeAsync(MachinesAdapter.Context); + if (dispenser != null) + { + await dispenser.DeleteCascadeAsync(MachinesAdapter.Context); + } } _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.MachineDeleted, _authentication.CurrentUser, SelectedMachine.Name, SelectedMachine, "Machine deleted using Machine Studio."); -- cgit v1.3.1 From a3026447d47b8b2f40bc0f5adb848df285aeb33c Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 19 Apr 2021 12:32:54 +0300 Subject: Machine_Studio_v4.4.8 --- .../Advanced Installer Projects/Machine Studio Installer.aip | 6 +++--- .../MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio') diff --git a/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip b/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip index fd381af9f..ba5fb5501 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip +++ b/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip @@ -16,10 +16,10 @@ - + - + @@ -837,7 +837,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index 5f2a4798a..c143c7608 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("4.4.7.0")] +[assembly: AssemblyVersion("4.4.8.0")] [assembly: ComVisible(false)] \ No newline at end of file -- cgit v1.3.1