From bf66536228666d733475f4ccdb248e5cec74c0aa Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Tue, 5 Nov 2019 11:38:50 +0200 Subject: Done Related Work Items: #1277 --- .../Modules/Tango.MachineStudio.Developer/Views/MainView.xaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer') 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 08ba5b699..abea6aec9 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 @@ -555,15 +555,15 @@ - - - Job Aborted By User + + + Job Aborted By User -- cgit v1.3.1 From c698425b1ab832fe351aff257815709c01950fc3 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 6 Nov 2019 18:06:45 +0200 Subject: Implemented liquid quantity validation on PPC and MS. Improved PPC full control view. --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../ViewModels/MainViewVM.cs | 48 +++++---- .../Tango.MachineStudio.UI.csproj | 2 +- .../Dialogs/InsufficientLiquidQuantityView.xaml | 78 +++++++++++++++ .../Dialogs/InsufficientLiquidQuantityView.xaml.cs | 54 +++++++++++ .../Dialogs/InsufficientLiquidQuantityViewVM.cs | 20 ++++ .../Tango.PPC.Jobs/Images/cartridge_validation.png | Bin 0 -> 44260 bytes .../Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj | 13 ++- .../Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs | 22 ++++- .../Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 6 +- .../Controls/MachineStatusControl.xaml | 46 +++++++++ .../Controls/MachineStatusControl.xaml.cs | 28 ++++++ .../Dialogs/InsufficientLiquidQuantityView.xaml | 78 --------------- .../Dialogs/InsufficientLiquidQuantityView.xaml.cs | 54 ----------- .../Dialogs/InsufficientLiquidQuantityViewVM.cs | 20 ---- .../Tango.PPC.UI/Images/cartridge_validation.png | Bin 44260 -> 0 bytes .../Printing/DefaultPrintingManager.cs | 18 ++-- .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 18 ++-- .../PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml | 11 ++- .../PPC/Tango.PPC.UI/Views/LayoutView.xaml | 35 +------ .../Tango.Integration/Operation/MachineOperator.cs | 108 ++++++++++++++++++++- 24 files changed, 421 insertions(+), 238 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/InsufficientLiquidQuantityView.xaml create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/InsufficientLiquidQuantityView.xaml.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/InsufficientLiquidQuantityViewVM.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/cartridge_validation.png create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/MachineStatusControl.xaml create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/MachineStatusControl.xaml.cs delete mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml delete mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml.cs delete mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityViewVM.cs delete mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/cartridge_validation.png (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index 941c49094..bf543e37a 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index a600515de..700cc50d6 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index afccdfc0b..59730a18c 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 76704422a..9bdb66d41 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ 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 3a1f3fb11..c9483b9a2 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 @@ -1481,15 +1481,39 @@ namespace Tango.MachineStudio.Developer.ViewModels JobHandler.Failed += (x, ex) => { - LogManager.Log(ex, String.Format("Job {0} has failed.", RunningJob.Name)); - _eventLogger.Log(ex, String.Format("Job {0} has failed.", RunningJob.Name)); - SetJobFailed(); + if (ex is InsufficientLiquidQuantityException) + { + InvokeUI(() => + { + _notification.ShowModalDialog(new InsufficientLiquidQuantityViewVM(ex as InsufficientLiquidQuantityException), (_) => + { - InvokeUI(() => + MachineOperator.EnableJobLiquidQuantityValidation = false; + StartJob(); + + }, () => + { + SetJobFailed(); + + InvokeUI(() => + { + StopRecordingIfInProgress(); + }); + }); + }); + } + else { - _notification.ShowError("Job failed. " + ex.FlattenMessage()); - StopRecordingIfInProgress(); - }); + LogManager.Log(ex, String.Format("Job {0} has failed.", RunningJob.Name)); + _eventLogger.Log(ex, String.Format("Job {0} has failed.", RunningJob.Name)); + SetJobFailed(); + + InvokeUI(() => + { + _notification.ShowError("Job failed. " + ex.FlattenMessage()); + StopRecordingIfInProgress(); + }); + } }; JobHandler.Finalizing += (_, __) => @@ -1521,16 +1545,6 @@ namespace Tango.MachineStudio.Developer.ViewModels //Finally Canceled.. }; } - catch (InsufficientLiquidQuantityException ex) - { - _notification.ShowModalDialog(new InsufficientLiquidQuantityViewVM(ex), (x) => - { - - MachineOperator.EnableJobLiquidQuantityValidation = false; - StartJob(); - - }, () => { }); - } catch (Exception ex) { LogManager.Log(ex); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj index 3379ef4ae..914f7ac2d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -657,7 +657,7 @@ if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)ProtoCompilers\" - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/InsufficientLiquidQuantityView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/InsufficientLiquidQuantityView.xaml new file mode 100644 index 000000000..90492ce9f --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/InsufficientLiquidQuantityView.xaml @@ -0,0 +1,78 @@ + + + + + CLOSE + + + + Insufficient Ink Level + + There seems to be an insufficient ink levels in one or more of the following dispensers. + The job cannot be completed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/InsufficientLiquidQuantityView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/InsufficientLiquidQuantityView.xaml.cs new file mode 100644 index 000000000..eabff89b4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/InsufficientLiquidQuantityView.xaml.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.Integration.Operation; +using static Tango.Integration.Operation.InsufficientLiquidQuantityException; + +namespace Tango.PPC.Jobs.Dialogs +{ + /// + /// Interaction logic for InsufficientLiquidQuantityView.xaml + /// + public partial class InsufficientLiquidQuantityView : UserControl + { + public InsufficientLiquidQuantityView() + { + InitializeComponent(); + } + + private void IdsPackLoaded(object sender, RoutedEventArgs e) + { + Border border = sender as Border; + Grid parent = border.Parent as Grid; + IDSPackLevel packLevel = border.DataContext as IDSPackLevel; + + border.Height = ((double)packLevel.Current / (double)MachineOperator.MAX_DISPENSER_NANOLITER) * parent.ActualHeight; + } + + private void Limit_Loaded(object sender, RoutedEventArgs e) + { + Rectangle rect = sender as Rectangle; + 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); + + if (packLevel.IsValid) + { + rect.Visibility = Visibility.Hidden; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/InsufficientLiquidQuantityViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/InsufficientLiquidQuantityViewVM.cs new file mode 100644 index 000000000..e8cd8df85 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/InsufficientLiquidQuantityViewVM.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Integration.Operation; +using Tango.SharedUI; + +namespace Tango.PPC.Jobs.Dialogs +{ + public class InsufficientLiquidQuantityViewVM : DialogViewVM + { + public InsufficientLiquidQuantityException Exception { get; set; } + + public InsufficientLiquidQuantityViewVM(InsufficientLiquidQuantityException ex) + { + Exception = ex; + } + } +} 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 new file mode 100644 index 000000000..373cb78c1 Binary files /dev/null and b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/cartridge_validation.png 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 aedf09ce7..65d8ecba3 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 @@ -116,6 +116,10 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + Designer MSBuild:Compile @@ -211,6 +215,10 @@ CatalogSelectionView.xaml + + InsufficientLiquidQuantityView.xaml + + JobCreationView.xaml @@ -482,10 +490,13 @@ + + + - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs index 103a10b28..b98cde7dd 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs @@ -122,7 +122,10 @@ namespace Tango.PPC.Jobs.ViewModels NotificationProvider.CurrentAppBarItem.Close(); } - _stop_job_btn.Push(); + if (!_handler.Status.IsFailed) + { + _stop_job_btn.Push(); + } } #endregion @@ -141,10 +144,27 @@ namespace Tango.PPC.Jobs.ViewModels e.JobHandler.StatusChanged += JobHandler_StatusChanged; e.JobHandler.SpoolChangeRequired += JobHandler_SpoolChangeRequired; e.JobHandler.Stopped += JobHandler_Stopped; + e.JobHandler.Failed += JobHandler_Failed; _stop_job_btn.Push(); } + private void JobHandler_Failed(object sender, Exception ex) + { + if (ex is InsufficientLiquidQuantityException) + { + InvokeUI(async () => + { + await NotificationProvider.ShowDialog(new InsufficientLiquidQuantityViewVM(ex as InsufficientLiquidQuantityException)); + + if (IsVisible) + { + await NavigationManager.NavigateBack(); + } + }); + } + } + /// /// Handles the SpoolChangeRequired event of the JobHandler. /// diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index 3a3b820a5..ebdd18aeb 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -648,13 +648,9 @@ namespace Tango.PPC.Jobs.ViewModels try { LogManager.Log("Start job command pressed. Starting job and navigating to job progress view..."); - await PrintingManager.Print(Job, _db); + var handler = await PrintingManager.Print(Job, _db); await NavigationManager.NavigateTo(nameof(JobProgressView)); } - catch (InsufficientLiquidQuantityException) - { - //Ignore.. - } catch (Exception ex) { LogManager.Log(ex, "Could not start the current job."); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/MachineStatusControl.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/MachineStatusControl.xaml new file mode 100644 index 000000000..d6114576d --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/MachineStatusControl.xaml @@ -0,0 +1,46 @@ + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/MachineStatusControl.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/MachineStatusControl.xaml.cs new file mode 100644 index 000000000..61ecef0ad --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/MachineStatusControl.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.PPC.UI.Controls +{ + /// + /// Interaction logic for MachineStatusControl.xaml + /// + public partial class MachineStatusControl : UserControl + { + public MachineStatusControl() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml deleted file mode 100644 index f3c471954..000000000 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - CLOSE - - - - Insufficient Ink Level - - There seems to be an insufficient ink levels in one or more of the following dispensers. - 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 deleted file mode 100644 index 9ec1eec0e..000000000 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using Tango.Integration.Operation; -using static Tango.Integration.Operation.InsufficientLiquidQuantityException; - -namespace Tango.PPC.UI.Dialogs -{ - /// - /// Interaction logic for InsufficientLiquidQuantityView.xaml - /// - public partial class InsufficientLiquidQuantityView : UserControl - { - public InsufficientLiquidQuantityView() - { - InitializeComponent(); - } - - private void IdsPackLoaded(object sender, RoutedEventArgs e) - { - Border border = sender as Border; - Grid parent = border.Parent as Grid; - IDSPackLevel packLevel = border.DataContext as IDSPackLevel; - - border.Height = ((double)packLevel.Current / (double)MachineOperator.MAX_DISPENSER_NANOLITER) * parent.ActualHeight; - } - - private void Limit_Loaded(object sender, RoutedEventArgs e) - { - Rectangle rect = sender as Rectangle; - 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); - - if (packLevel.IsValid) - { - rect.Visibility = Visibility.Hidden; - } - } - } -} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityViewVM.cs deleted file mode 100644 index 8b15d2e00..000000000 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityViewVM.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.Integration.Operation; -using Tango.SharedUI; - -namespace Tango.PPC.UI.Dialogs -{ - public class InsufficientLiquidQuantityViewVM : DialogViewVM - { - public InsufficientLiquidQuantityException Exception { get; set; } - - public InsufficientLiquidQuantityViewVM(InsufficientLiquidQuantityException ex) - { - Exception = ex; - } - } -} 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 deleted file mode 100644 index 373cb78c1..000000000 Binary files a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/cartridge_validation.png and /dev/null differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs index 56ec2fa7e..21c68d3e6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs @@ -56,16 +56,8 @@ namespace Tango.PPC.UI.Printing #if STUBPRINT handler = await _machineProvider.MachineOperator.PrintStub(job); #else - try - { - handler = await _machineProvider.MachineOperator.Print(job); - } - catch (InsufficientLiquidQuantityException ex) - { - LogManager.Log(ex); - await _notificationProvider.ShowDialog(new InsufficientLiquidQuantityViewVM(ex)); - throw ex; - } + + handler = await _machineProvider.MachineOperator.Print(job); #endif handler.Completed += async (x, e) => @@ -113,9 +105,13 @@ namespace Tango.PPC.UI.Printing }; handler.Failed += async (x, e) => { - try + if (e is InsufficientLiquidQuantityException) { + return; + } + try + { job.JobStatus = JobStatuses.Disrupted; if (!context.IsDisposed) 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 c5045abf3..a0ad5b44d 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 @@ -120,15 +120,14 @@ WiFiAuthenticationView.xaml + + MachineStatusControl.xaml + CartridgeValidationView.xaml - - InsufficientLiquidQuantityView.xaml - - ScreenLockView.xaml @@ -202,13 +201,13 @@ Designer MSBuild:Compile - - MSBuild:Compile + Designer + MSBuild:Compile - - Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -327,7 +326,6 @@ - Tango.ColorLib_v1.dll @@ -577,7 +575,7 @@ if $(ConfigurationName) == Release del *.xml - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml index d83128007..4de00120f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml @@ -7,14 +7,19 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:vm="clr-namespace:Tango.PPC.UI.ViewModels" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:localControls="clr-namespace:Tango.PPC.UI.Controls" xmlns:local="clr-namespace:Tango.PPC.UI.Views" mc:Ignorable="d" d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:ExternalBridgeViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.ExternalBridgeViewVM}" Background="{StaticResource TangoPrimaryBackgroundBrush}"> - - - + + + + + + + - - + diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 3d3590746..6963b90d4 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -1485,6 +1485,90 @@ namespace Tango.Integration.Operation } } + private void ValidateJobLiquidQuantity(JobTicket ticket, ProcessParametersTable processParameters, Configuration configuration) + { + LogManager.Log("Validating job liquid quantity..."); + + Dictionary liquidQuantities = new Dictionary(); + + 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++) + { + 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; + + 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; + } + } + } + } + + if (MachineStatus != null) + { + var exception = new InsufficientLiquidQuantityException($"Insufficient liquids level."); + + bool shouldThrow = false; + + foreach (var liquidQuantity in liquidQuantities) + { + int index = liquidQuantity.Key; + var packLevel = MachineStatus.IDSPacksLevels.SingleOrDefault(x => x.Index == index); + var idsPack = configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.PackIndex == index); + + if (packLevel != null) + { + var idsLevel = new InsufficientLiquidQuantityException.IDSPackLevel() + { + IdsPack = idsPack, + Current = packLevel.DispenserLevel, + Required = (int)liquidQuantities[index] + }; + + if (liquidQuantities[index] > packLevel.DispenserLevel) + { + shouldThrow = true; + } + + exception.IdsPackLevels.Add(idsLevel); + } + else + { + LogManager.Log($"Could not validate required liquid quantity for job. Missing IDS Pack level at index {index}.", LogCategory.Warning); + } + } + + + if (shouldThrow) + { + throw LogManager.Log(exception, JsonConvert.SerializeObject(exception.IdsPackLevels.Select(x => new + { + Liquid = x.IdsPack.LiquidType.Name, + x.Required, + x.Current + }).ToList())); + } + } + else + { + LogManager.Log("Could not validate required liquid quantity for job. No machine status received", LogCategory.Warning); + } + } + #endregion #region Public Methods @@ -1658,10 +1742,10 @@ namespace Tango.Integration.Operation job.NumberOfUnits = 1; } - if (EnableJobLiquidQuantityValidation) - { - ValidateJobLiquidQuantity(job, processParameters, job.Machine.Configuration); - } + //if (EnableJobLiquidQuantityValidation) + //{ + // ValidateJobLiquidQuantity(job, processParameters, job.Machine.Configuration); + //} var originalJob = job; var clonedJob = job.Clone(); @@ -1807,6 +1891,22 @@ namespace Tango.Integration.Operation return; } + if (EnableJobLiquidQuantityValidation) + { + try + { + ValidateJobLiquidQuantity(ticket, 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 1c9bea6d04dcfbfd1fbf0e1c437c110bc7dafa3e Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 7 Nov 2019 17:39:00 +0200 Subject: Fixed issue with job completion on emulator. Added liquid volumes grid full step. Added full step to dispensing calculations. Fixed issue with gradient generation progress on MS. Worked on software items doc. --- .../ViewModels/MainViewVM.cs | 12 +++---- .../Views/JobView.xaml | 35 +++++++++++++++++++++ .../Twine Software Items (version 1).xlsb.xlsx | Bin 18776 -> 20410 bytes .../Tango.BL/Dispensing/DispensingCalcBase.cs | 10 ++++++ .../Tango.BL/Dispensing/DispensingCalcService.cs | 11 +++++++ .../Tango.BL/Dispensing/IDispensingCalc.cs | 7 +++++ .../Dispensing/TransparentLiquidDispensingCalc.cs | 6 ++-- Software/Visual_Studio/Tango.BL/LiquidVolume.cs | 12 ++++++- .../Tango.Emulations/Emulators/MachineEmulator.cs | 2 +- .../Tango.Integration/Operation/MachineOperator.cs | 9 +++++- 10 files changed, 91 insertions(+), 13 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer') 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 c9483b9a2..fec02529b 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 @@ -1034,6 +1034,11 @@ namespace Tango.MachineStudio.Developer.ViewModels { var percent = (e.Progress / e.Total * 100d); + if (_preparingTaskItem != null) + { + _preparingTaskItem.Message = $"Preparing job for printing {(e.Progress / e.Total * 100d).ToString("0.0")}%..."; + } + if (_preparingTaskItem == null && percent == 0) { _preparingTaskItem = _notification.PushTaskItem("Preparing job for printing..."); @@ -1043,13 +1048,6 @@ namespace Tango.MachineStudio.Developer.ViewModels _preparingTaskItem.Pop(); _preparingTaskItem = null; } - else - { - if (_preparingTaskItem != null) - { - _preparingTaskItem.Message = $"Preparing job for printing {(e.Progress / e.Total * 100d).ToString("0.0")}%..."; - } - } } private void MachineOperator_ResumingJob(object sender, ResumingJobEventArgs e) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml index 3bda86036..e1bbad6a7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -1179,6 +1179,41 @@ + + + + + + +