From b294fd44000766de11ce6c0e2d82d2fae81c82b9 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Wed, 13 Nov 2019 11:59:51 +0200 Subject: Restored job liquid quantity validation to start of procedure. --- .../Tango.Integration/Operation/MachineOperator.cs | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs') diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index d6d926800..451ed8219 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -1916,25 +1916,6 @@ namespace Tango.Integration.Operation return; } - if (EnableJobLiquidQuantityValidation) - { - try - { - //ValidateJobLiquidQuantity(originalJob, processParameters, job.Machine.Configuration); - var ticketForValidation = ticket.Clone(); - ticketForValidation.NumberOfUnits = (uint)originalJob.NumberOfUnits; - ValidateJobLiquidQuantity(ticketForValidation, processParameters, job.Machine.Configuration); - } - catch (Exception ex) - { - Status = MachineStatuses.ReadyToDye; - PrintingFailed?.Invoke(this, new PrintingFailedEventArgs(handler, clonedJob, ex)); - PrintingEnded?.Invoke(this, new PrintingEventArgs(handler, clonedJob)); - handler.RaiseFailed(ex); - return; - } - } - var segs = new List(); if (JobUnitsMethod == JobUnitsMethods.Operator) -- cgit v1.3.1 From 2c9f65d23e63e71c20e4321244bace59fdfbf791 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Wed, 13 Nov 2019 17:55:22 +0200 Subject: Improve insufficient liquid quantity view. Fixed MS finalizing text. --- .../Views/InsufficientLiquidQuantityView.xaml | 58 +++++++++++++++++----- .../Views/InsufficientLiquidQuantityView.xaml.cs | 6 +-- .../Views/MainView.xaml | 58 ++++++++++++---------- .../InsufficientLiquidQuantityException.cs | 8 +++ .../Tango.Integration/Operation/MachineOperator.cs | 20 +++++--- 5 files changed, 102 insertions(+), 48 deletions(-) (limited to 'Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/InsufficientLiquidQuantityView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/InsufficientLiquidQuantityView.xaml index 9bf76c026..fa85ea598 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/InsufficientLiquidQuantityView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/InsufficientLiquidQuantityView.xaml @@ -5,8 +5,10 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:vm="clr-namespace:Tango.MachineStudio.Developer.ViewModels" xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views" + xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes" mc:Ignorable="d" - Height="450" Width="800" d:DataContext="{d:DesignInstance Type=vm:InsufficientLiquidQuantityViewVM, IsDesignTimeCreatable=False}"> + Height="590" Width="800" d:DataContext="{d:DesignInstance Type=vm:InsufficientLiquidQuantityViewVM, IsDesignTimeCreatable=False}" Foreground="{StaticResource Dialog.Foreground}" + Background="{StaticResource Dialog.Background}"> @@ -23,28 +25,53 @@ - - + + - + - - - + + + + + + + + + + + + + + + - + - - + + - + + + + + + + - + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/InsufficientLiquidQuantityView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/InsufficientLiquidQuantityView.xaml.cs index 171cb754e..51cfb1e73 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/InsufficientLiquidQuantityView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/InsufficientLiquidQuantityView.xaml.cs @@ -33,7 +33,7 @@ namespace Tango.MachineStudio.Developer.Views Grid parent = border.Parent as Grid; IDSPackLevel packLevel = border.DataContext as IDSPackLevel; - border.Height = ((double)packLevel.Current / (double)MachineOperator.MAX_DISPENSER_NANOLITER) * parent.ActualHeight; + border.Width = ((double)packLevel.Current / (double)MachineOperator.MAX_DISPENSER_NANOLITER) * parent.ActualWidth; } private void Limit_Loaded(object sender, RoutedEventArgs e) @@ -42,8 +42,8 @@ namespace Tango.MachineStudio.Developer.Views Grid parent = rect.Parent as Grid; IDSPackLevel packLevel = rect.DataContext as IDSPackLevel; - var top = ((double)packLevel.Required / (double)MachineOperator.MAX_DISPENSER_NANOLITER) * parent.ActualHeight; - rect.Margin = new Thickness(0, 0, 0, top); + var left = ((double)packLevel.Required / (double)MachineOperator.MAX_DISPENSER_NANOLITER) * parent.ActualWidth; + rect.Margin = new Thickness(left, 0, 0, 0); if (packLevel.IsValid) { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml index abea6aec9..d0caa2447 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml @@ -330,31 +330,36 @@ - - - + + + Finalizing... + + + + + @@ -408,8 +413,7 @@ - Finalizing... - + diff --git a/Software/Visual_Studio/Tango.Integration/Operation/InsufficientLiquidQuantityException.cs b/Software/Visual_Studio/Tango.Integration/Operation/InsufficientLiquidQuantityException.cs index a1c18370b..3e4758c58 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/InsufficientLiquidQuantityException.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/InsufficientLiquidQuantityException.cs @@ -14,11 +14,19 @@ namespace Tango.Integration.Operation public IdsPack IdsPack { get; set; } public int Current { get; set; } public int Required { get; set; } + public int Maximum { get; set; } public bool IsValid { get { return Current >= Required; } } + + public bool IsOverMax + { + get { return Required > Maximum; } + } + + public String Message { get; set; } } public InsufficientLiquidQuantityException(String message) : base(message) diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 451ed8219..ebbf520c3 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -1425,9 +1425,9 @@ namespace Tango.Integration.Operation { var segment = job.Segments[segmentIndex]; var segment_length_cm = segment.Length * 100d; - + List orderedBrushCollection = segment.BrushStops.OrderBy(x => x.OffsetMeters).ToList(); - + int solid_gradient_oeff = orderedBrushCollection.Count == 1 ? 1 : 2; double prev_offset_cm = 0; for (int brushIndex = 0; brushIndex < orderedBrushCollection.Count; brushIndex++) @@ -1450,7 +1450,7 @@ namespace Tango.Integration.Operation brush_length_centimeters -= resolution; } prev_offset_cm = brush_offset_cm; - + foreach (var liquidVolumes in brush.LiquidVolumes) { liquidQuantities[liquidVolumes.IdsPack.PackIndex] += liquidVolumes.NanoliterPerCentimeter * (brush_length_centimeters / solid_gradient_oeff); @@ -1477,12 +1477,20 @@ namespace Tango.Integration.Operation { IdsPack = idsPack, Current = packLevel.DispenserLevel, - Required = (int)liquidQuantities[index] + Required = (int)liquidQuantities[index], + Maximum = MAX_DISPENSER_NANOLITER, }; - if (liquidQuantities[index] > packLevel.DispenserLevel) + if (idsLevel.Required > idsLevel.Current) { shouldThrow = true; + + idsLevel.Message = $"Missing {idsLevel.Required - idsLevel.Current} nanoliters to complete the job."; + + if (idsLevel.Required > idsLevel.Maximum) + { + idsLevel.Message = $"Required ink exceeds the maximum capacity of the dispenser by {idsLevel.Required - idsLevel.Maximum} nanoliters. Please reduce the segment length."; + } } exception.IdsPackLevels.Add(idsLevel); @@ -1769,7 +1777,7 @@ namespace Tango.Integration.Operation if (EnableJobLiquidQuantityValidation) { - ValidateJobLiquidQuantity(job, processParameters, job.Machine.Configuration); + ValidateJobLiquidQuantity(job, processParameters, job.Machine.Configuration); } var originalJob = job; -- cgit v1.3.1 From ebcd646d565cc251d808048fc7ffa2bacbeaeca2 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Thu, 14 Nov 2019 11:38:18 +0200 Subject: Changed color of text and format in InsufficientLiquidQuantityException dialog --- .../Views/InsufficientLiquidQuantityView.xaml | 33 ++++++++++++++-------- .../InsufficientLiquidQuantityException.cs | 8 ++++++ .../Tango.Integration/Operation/MachineOperator.cs | 11 +++++--- 3 files changed, 36 insertions(+), 16 deletions(-) (limited to 'Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/InsufficientLiquidQuantityView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/InsufficientLiquidQuantityView.xaml index fa85ea598..c0cb963e7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/InsufficientLiquidQuantityView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/InsufficientLiquidQuantityView.xaml @@ -25,7 +25,7 @@ - + @@ -34,7 +34,7 @@ - + @@ -43,7 +43,7 @@ + - - + @@ -97,14 +104,16 @@ - - - - - + + + + + + + - + diff --git a/Software/Visual_Studio/Tango.Integration/Operation/InsufficientLiquidQuantityException.cs b/Software/Visual_Studio/Tango.Integration/Operation/InsufficientLiquidQuantityException.cs index 3e4758c58..797d4f498 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/InsufficientLiquidQuantityException.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/InsufficientLiquidQuantityException.cs @@ -27,6 +27,12 @@ namespace Tango.Integration.Operation } public String Message { get; set; } + public IDSPackLevel() + { + Maximum = 130000000; + Required = 0; + Current = 0; + } } public InsufficientLiquidQuantityException(String message) : base(message) @@ -35,5 +41,7 @@ namespace Tango.Integration.Operation } public List IdsPackLevels { get; internal set; } + + } } diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index ebbf520c3..9a5c7ff9b 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -40,6 +40,7 @@ using Tango.Integration.Emergency; using Tango.PMR.MachineStatus; using Newtonsoft.Json; using Tango.PMR.Integration; +using System.Globalization; namespace Tango.Integration.Operation { @@ -1484,12 +1485,13 @@ namespace Tango.Integration.Operation if (idsLevel.Required > idsLevel.Current) { shouldThrow = true; - - idsLevel.Message = $"Missing {idsLevel.Required - idsLevel.Current} nanoliters to complete the job."; + string display_value = (((double)(idsLevel.Required - idsLevel.Current)/ 1000000000)).ToString("N2", CultureInfo.InvariantCulture); + idsLevel.Message = $"Missing {display_value} liters to complete the job."; if (idsLevel.Required > idsLevel.Maximum) { - idsLevel.Message = $"Required ink exceeds the maximum capacity of the dispenser by {idsLevel.Required - idsLevel.Maximum} nanoliters. Please reduce the segment length."; + display_value = (((double)(idsLevel.Required - idsLevel.Maximum))/ 1000000000).ToString("N2", CultureInfo.InvariantCulture); + idsLevel.Message = $"Required ink exceeds the maximum capacity of the dispenser by {display_value} liters. Please reduce the segment length."; } } @@ -1569,7 +1571,8 @@ namespace Tango.Integration.Operation { IdsPack = idsPack, Current = packLevel.DispenserLevel, - Required = (int)liquidQuantities[index] + Required = (int)liquidQuantities[index], + Maximum = MAX_DISPENSER_NANOLITER, }; if (liquidQuantities[index] > packLevel.DispenserLevel) -- cgit v1.3.1 From 5727b7e6d821f3ba965ceea382da2d839257bb47 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Thu, 14 Nov 2019 16:07:42 +0200 Subject: Refactored InsufficientLiquidQuantityView on PPC. --- .../Tango.PPC.Jobs/Images/cartridge_validation.png | Bin 44260 -> 0 bytes .../Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj | 5 +- .../Dialogs/InsufficientLiquidQuantityView.xaml | 60 +++++++++++++++++---- .../Dialogs/InsufficientLiquidQuantityView.xaml.cs | 6 +-- .../Tango.PPC.UI/Images/cartridge_validation.png | Bin 0 -> 44260 bytes .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 3 +- .../Tango.Integration/Operation/MachineOperator.cs | 15 ++++-- 7 files changed, 68 insertions(+), 21 deletions(-) delete mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/cartridge_validation.png create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/cartridge_validation.png (limited to 'Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/cartridge_validation.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/cartridge_validation.png deleted file mode 100644 index 373cb78c1..000000000 Binary files a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/cartridge_validation.png and /dev/null differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj index 3092b60c1..fb27ff031 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj @@ -482,13 +482,10 @@ - - - - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml index 8b8983fa5..ad1c2ece3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml @@ -20,28 +20,59 @@ The job cannot be completed. - + - + - - - + + + + + + + + + + + + + - + - - + + - + + + + + + + + + - + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml.cs index 9ec1eec0e..9a17f4f22 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml.cs @@ -33,7 +33,7 @@ namespace Tango.PPC.UI.Dialogs Grid parent = border.Parent as Grid; IDSPackLevel packLevel = border.DataContext as IDSPackLevel; - border.Height = ((double)packLevel.Current / (double)MachineOperator.MAX_DISPENSER_NANOLITER) * parent.ActualHeight; + border.Width = ((double)packLevel.Current / (double)MachineOperator.MAX_DISPENSER_NANOLITER) * parent.ActualWidth; } private void Limit_Loaded(object sender, RoutedEventArgs e) @@ -42,8 +42,8 @@ namespace Tango.PPC.UI.Dialogs Grid parent = rect.Parent as Grid; IDSPackLevel packLevel = rect.DataContext as IDSPackLevel; - var top = ((double)packLevel.Required / (double)MachineOperator.MAX_DISPENSER_NANOLITER) * parent.ActualHeight; - rect.Margin = new Thickness(0, 0, 0, top); + var left = ((double)packLevel.Required / (double)MachineOperator.MAX_DISPENSER_NANOLITER) * parent.ActualWidth; + rect.Margin = new Thickness(left, 0, 0, 0); if (packLevel.IsValid) { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/cartridge_validation.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/cartridge_validation.png new file mode 100644 index 000000000..373cb78c1 Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/cartridge_validation.png differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index 1cabc959d..b8bbc781c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -347,6 +347,7 @@ Tango.ColorLib_v3.dll PreserveNewest + @@ -587,7 +588,7 @@ if $(ConfigurationName) == Release del *.xml - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 9a5c7ff9b..6b90ef393 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -1485,12 +1485,12 @@ namespace Tango.Integration.Operation if (idsLevel.Required > idsLevel.Current) { shouldThrow = true; - string display_value = (((double)(idsLevel.Required - idsLevel.Current)/ 1000000000)).ToString("N2", CultureInfo.InvariantCulture); + string display_value = (((double)(idsLevel.Required - idsLevel.Current) / 1000000000)).ToString("N2", CultureInfo.InvariantCulture); idsLevel.Message = $"Missing {display_value} liters to complete the job."; if (idsLevel.Required > idsLevel.Maximum) { - display_value = (((double)(idsLevel.Required - idsLevel.Maximum))/ 1000000000).ToString("N2", CultureInfo.InvariantCulture); + display_value = (((double)(idsLevel.Required - idsLevel.Maximum)) / 1000000000).ToString("N2", CultureInfo.InvariantCulture); idsLevel.Message = $"Required ink exceeds the maximum capacity of the dispenser by {display_value} liters. Please reduce the segment length."; } } @@ -1634,7 +1634,16 @@ namespace Tango.Integration.Operation throw new NullReferenceException("Could not locate an active process parameters tables group for RML " + job.Rml.Name); } - var processParameters = converter.GetRecommendedProcessParameters(job); + ProcessParametersTable processParameters = null; + + try + { + processParameters = converter.GetRecommendedProcessParameters(job); + } + catch (Exception ex) + { + throw LogManager.Log(new InvalidOperationException($"An error occurred while trying to resolve the recommended process parameters.\n{ex.Message}")); + } if (processParameters == null) { -- cgit v1.3.1