From b5c5758e431077d84fb53a3ff62f8e751fca2731 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 23 Sep 2019 18:22:32 +0300 Subject: Implemented Insufficient liquid levels !!! --- .../Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs | 5 ++ .../Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 5 ++ .../Connection/DefaultMachineProvider.cs | 11 ++- .../PPC/Tango.PPC.Common/PPCSettings.cs | 8 ++- .../Dialogs/InsufficientLiquidQuantityView.xaml | 78 ++++++++++++++++++++++ .../Dialogs/InsufficientLiquidQuantityView.xaml.cs | 54 +++++++++++++++ .../Dialogs/InsufficientLiquidQuantityViewVM.cs | 20 ++++++ .../Printing/DefaultPrintingManager.cs | 17 ++++- .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 10 ++- 9 files changed, 198 insertions(+), 10 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityViewVM.cs (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs index 14065ccba..49d11a8fd 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs @@ -8,6 +8,7 @@ using Tango.BL.Builders; using Tango.BL.Entities; using Tango.ColorConversion; using Tango.Core.Commands; +using Tango.Integration.Operation; using Tango.PPC.Common; using Tango.PPC.Common.Messages; using Tango.PPC.Common.Navigation; @@ -91,6 +92,10 @@ namespace Tango.PPC.Jobs.ViewModels await PrintingManager.Print(Job, _context); await NavigationManager.NavigateTo(false, nameof(JobProgressView)); } + catch (InsufficientLiquidQuantityException) + { + //Ignore.. + } catch (Exception ex) { LogManager.Log(ex, "Could not start the current job."); 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 85eb87824..a99e45eb3 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 @@ -36,6 +36,7 @@ using Tango.Explorer; using Tango.PPC.Storage; using System.IO; using Tango.ColorConversion; +using Tango.Integration.Operation; namespace Tango.PPC.Jobs.ViewModels { @@ -644,6 +645,10 @@ namespace Tango.PPC.Jobs.ViewModels 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.Common/Connection/DefaultMachineProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs index cd432538c..a16e2f649 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs @@ -89,6 +89,11 @@ namespace Tango.PPC.Common.Connection MachineOperator.GradientGenerationConfiguration.IsEnabled = settings.EnableGradientGeneration; MachineOperator.GradientGenerationConfiguration.ResolutionCM = settings.GradientGenerationResolution; + + MachineOperator.EmergencyNotificationProvider.Address = settings.EmergencyComPort; + MachineOperator.EmergencyNotificationProvider.IsEnabled = settings.EnableEmergencyNotifications; + + MachineOperator.EnableJobLiquidQuantityValidation = settings.EnableJobLiquidQuantityValidation; } private async void ConnectionThreadMethod() @@ -159,9 +164,6 @@ namespace Tango.PPC.Common.Connection await Task.Delay(1000); await MachineOperator.UploadHardwareConfiguration(Machine.Configuration.HardwareVersion, Machine.Configuration); MachineOperator.UseKeepAlive = true; - - MachineOperator.EmergencyNotificationProvider.Address = settings.EmergencyComPort; - MachineOperator.EmergencyNotificationProvider.IsEnabled = settings.EnableEmergencyNotifications; } } else @@ -184,9 +186,6 @@ namespace Tango.PPC.Common.Connection await Task.Delay(1000); await MachineOperator.UploadHardwareConfiguration(Machine.Configuration.HardwareVersion, Machine.Configuration); - - MachineOperator.EmergencyNotificationProvider.Address = settings.EmergencyComPort; - MachineOperator.EmergencyNotificationProvider.IsEnabled = settings.EnableEmergencyNotifications; } } catch (Exception ex) diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index b495ec54d..b1bc3faad 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -132,6 +132,11 @@ namespace Tango.PPC.Common /// public String EmergencyComPort { get; set; } + /// + /// Gets or sets a value indicating whether to enable the job liquid quantity validation. + /// + public bool EnableJobLiquidQuantityValidation { get; set; } + /// /// Gets the machine service address. /// @@ -160,7 +165,8 @@ namespace Tango.PPC.Common DeploymentSlot = DeploymentSlot.TEST; EnableWatchDog = true; EnableEmergencyNotifications = true; - EmergencyComPort = "COM1"; + EmergencyComPort = "COM2"; + EnableJobLiquidQuantityValidation = true; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml new file mode 100644 index 000000000..f3c471954 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/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/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml.cs new file mode 100644 index 000000000..9ec1eec0e --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/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.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 new file mode 100644 index 000000000..8b15d2e00 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/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.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/Printing/DefaultPrintingManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs index 41a231932..56ec2fa7e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs @@ -13,8 +13,10 @@ using Tango.PPC.Common.Connection; using Tango.PPC.Common.Messages; using Tango.PPC.Common.Models; using Tango.PPC.Common.Navigation; +using Tango.PPC.Common.Notifications; using Tango.PPC.Common.Printing; using Tango.PPC.Jobs.Messages; +using Tango.PPC.UI.Dialogs; namespace Tango.PPC.UI.Printing { @@ -26,14 +28,16 @@ namespace Tango.PPC.UI.Printing public class DefaultPrintingManager : ExtendedObject, IPrintingManager { private IMachineProvider _machineProvider; + private INotificationProvider _notificationProvider; /// /// Initializes a new instance of the class. /// /// The machine provider. - public DefaultPrintingManager(IMachineProvider machineProvider) + public DefaultPrintingManager(IMachineProvider machineProvider, INotificationProvider notificationProvider) { _machineProvider = machineProvider; + _notificationProvider = notificationProvider; } /// @@ -52,7 +56,16 @@ namespace Tango.PPC.UI.Printing #if STUBPRINT handler = await _machineProvider.MachineOperator.PrintStub(job); #else - handler = await _machineProvider.MachineOperator.Print(job); + try + { + handler = await _machineProvider.MachineOperator.Print(job); + } + catch (InsufficientLiquidQuantityException ex) + { + LogManager.Log(ex); + await _notificationProvider.ShowDialog(new InsufficientLiquidQuantityViewVM(ex)); + throw ex; + } #endif handler.Completed += async (x, e) => 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 b32ee0339..40afab3de 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 @@ -125,6 +125,10 @@ CartridgeValidationView.xaml + + InsufficientLiquidQuantityView.xaml + + ScreenLockView.xaml @@ -202,6 +206,10 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -569,7 +577,7 @@ if $(ConfigurationName) == Release del *.xml - + \ No newline at end of file -- cgit v1.3.1