From 7867b3ac045364fc2aa11a860871bee2bfeb072d Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sun, 15 Aug 2021 10:27:35 +0300 Subject: Multiple Jobs on one spool. --- .../Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs | 4 + .../Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 4 + ...ango.PPC.MachineSettings_0fik0rdm_wpftmp.csproj | 227 +++++++++++++++++++++ .../PPC/Tango.PPC.UI/Dialogs/SpoolReplaceView.xaml | 31 +++ .../Tango.PPC.UI/Dialogs/SpoolReplaceView.xaml.cs | 28 +++ .../PPC/Tango.PPC.UI/Dialogs/SpoolReplaceViewVM.cs | 13 ++ .../Printing/DefaultPrintingManager.cs | 8 + .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 10 +- .../Visual_Studio/PPC/Tango.PPC.UI/app.manifest | 2 +- .../Tango.Emulations/Emulators/MachineEmulator.cs | 19 ++ .../Operation/IMachineOperator.cs | 5 + .../Tango.Integration/Operation/MachineOperator.cs | 13 ++ 12 files changed, 362 insertions(+), 2 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings_0fik0rdm_wpftmp.csproj create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/SpoolReplaceView.xaml create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/SpoolReplaceView.xaml.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/SpoolReplaceViewVM.cs (limited to 'Software/Visual_Studio') 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 3dcca8821..d6f5261f8 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 @@ -121,6 +121,10 @@ namespace Tango.PPC.Jobs.ViewModels { //Ignore.. } + catch (OperationCanceledException) + { + //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 25136e5b9..94c504908 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 @@ -674,6 +674,10 @@ namespace Tango.PPC.Jobs.ViewModels { //Ignore.. } + catch (OperationCanceledException) + { + //Ignore.. + } catch (Exception ex) { LogManager.Log(ex, "Could not start the current job."); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings_0fik0rdm_wpftmp.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings_0fik0rdm_wpftmp.csproj new file mode 100644 index 000000000..c79aef3f6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings_0fik0rdm_wpftmp.csproj @@ -0,0 +1,227 @@ + + + + + Debug + AnyCPU + {91B70E9B-66A7-4873-AE10-400E71CF404F} + library + Tango.PPC.MachineSettings + Tango.PPC.MachineSettings + v4.6.1 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + true + full + false + ..\..\..\Build\PPC\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\..\Build\PPC\Release\ + TRACE + prompt + 4 + + + + + + + + GlobalVersionInfo.cs + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + MainView.xaml + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + {f441feee-322a-4943-b566-110e12fd3b72} + Tango.BL + + + {b4fe6485-4161-4b36-bc08-67e0b53d01b7} + Tango.ColorConversion + + + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} + Tango.Core + + + {b112d89a-a106-41ae-a0c1-4abc84c477f5} + Tango.DragAndDrop + + + {4206ac58-3b57-4699-8835-90bf6db01a61} + Tango.Integration + + + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} + Tango.Logging + + + {e4927038-348d-4295-aaf4-861c58cb3943} + Tango.PMR + + + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} + Tango.Settings + + + {8491d07b-c1f6-4b62-a412-41b9fd2d6538} + Tango.SharedUI + + + {fd86424c-6e84-491b-8df9-3d0f5c236a2a} + Tango.Touch + + + {74e700b0-1156-4126-be40-ee450d3c3026} + Tango.Transport + + + {6aa425c9-ea6a-4b01-aaed-5ff122e8b663} + Tango.WiFi + + + {0be74eee-22cb-4dba-b896-793b9e1a3ac0} + Tango.PPC.Common + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/SpoolReplaceView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/SpoolReplaceView.xaml new file mode 100644 index 000000000..764435de3 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/SpoolReplaceView.xaml @@ -0,0 +1,31 @@ + + + + + CANCEL + CONTINUE + + + + Replace Spool + + The system has detected that a previous job has ended but the spool was not replaced. + + + Would you like to continue dyeing this job on the same spool? + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/SpoolReplaceView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/SpoolReplaceView.xaml.cs new file mode 100644 index 000000000..7c9d7813d --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/SpoolReplaceView.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.Dialogs +{ + /// + /// Interaction logic for SpoolReplaceView.xaml + /// + public partial class SpoolReplaceView : UserControl + { + public SpoolReplaceView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/SpoolReplaceViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/SpoolReplaceViewVM.cs new file mode 100644 index 000000000..71c6e4ae7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/SpoolReplaceViewVM.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.SharedUI; + +namespace Tango.PPC.UI.Dialogs +{ + public class SpoolReplaceViewVM : DialogViewVM + { + } +} 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 ed1a0253d..9f31305f7 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs @@ -61,6 +61,14 @@ namespace Tango.PPC.UI.Printing #else try { + if (!_machineProvider.MachineOperator.IsSpoolReplaced) + { + if (!(await _notificationProvider.ShowDialog(new SpoolReplaceViewVM())).DialogResult) + { + throw new OperationCanceledException(); + } + } + _notificationProvider.SetGlobalBusyMessage("Processing job..."); //Apply additional job configuration... 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 738d94c3e..e812b4a7f 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 @@ -152,6 +152,10 @@ SafetyLevelOperationsConfirmationView.xaml + + SpoolReplaceView.xaml + + ThreadBreakView.xaml @@ -288,6 +292,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -787,7 +795,7 @@ if $(ConfigurationName) == Debug copy /Y "$(TargetDir)Packages" "$(TargetDir)" - + \ No newline at end of file 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.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index 22fa062a7..451ef4868 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -86,6 +86,7 @@ namespace Tango.Emulations.Emulators private DateTime _connectionTime; private int _jobAbortCounter; private bool _abortHeadCleaning; + private String _machineStatusRequestToken; #region Properties @@ -156,6 +157,7 @@ namespace Tango.Emulations.Emulators { _isAfterReset = true; MachineStatus = new MachineStatus(); + MachineStatus.SpoolState = SpoolState.Present; MachineStatus.State = MachineState.Ready; for (int i = 0; i < 10; i++) @@ -672,6 +674,8 @@ namespace Tango.Emulations.Emulators var cancelToken = CreateCancelToken(); + _machineStatusRequestToken = request.Container.Token; + Task.Factory.StartNew(() => { while (_machine_updates_enabled && Transporter.State == TransportComponentState.Connected && !cancelToken.Canceled) @@ -922,6 +926,21 @@ namespace Tango.Emulations.Emulators } }, request.Container.Token, new TransportResponseConfig() { Completed = !_cancelJob }); + + if (_rnd.Next(0, 100) > 50) + { + Task.Factory.StartNew(() => + { + Thread.Sleep(5000); + MachineStatus.SpoolState = SpoolState.Absent; + Transporter.SendResponse(new StartMachineStatusUpdateResponse() { Status = MachineStatus }, _machineStatusRequestToken); + + Thread.Sleep(2000); + + MachineStatus.SpoolState = SpoolState.Present; + Transporter.SendResponse(new StartMachineStatusUpdateResponse() { Status = MachineStatus }, _machineStatusRequestToken); + }); + } } else { diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs index ac7bc75c5..23cc4aa48 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs @@ -126,6 +126,11 @@ namespace Tango.Integration.Operation /// TimeSpan ContinuousRequestTimeout { get; set; } + /// + /// Gets a value indicating whether the spool was replaced after the last job. + /// + bool IsSpoolReplaced { get; } + /// /// Occurs when the machine has changed. /// diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index e15a5a0bd..fb43b55b3 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -154,6 +154,7 @@ namespace Tango.Integration.Operation EmergencyNotificationProvider = new UsbEmergencyNotificationProvider("COM1"); EnableJobLiquidQuantityValidation = true; FailsWithAdapter = true; + IsSpoolReplaced = true; ContinuousRequestTimeout = TimeSpan.FromSeconds(2); ResetInkFllingStatus(); } @@ -651,6 +652,11 @@ namespace Tango.Integration.Operation /// public TimeSpan ContinuousRequestTimeout { get; set; } + /// + /// Gets a value indicating whether the spool was replaced after the last job. + /// + public bool IsSpoolReplaced { get; private set; } + #endregion #region Virtual Methods @@ -1018,6 +1024,11 @@ namespace Tango.Integration.Operation { OnMachineStateChanged(MachineStatus.State); } + + if (MachineStatus.SpoolState == SpoolState.Absent) + { + IsSpoolReplaced = true; + } } /// @@ -1348,6 +1359,8 @@ namespace Tango.Integration.Operation /// The job. protected virtual void OnPrintingEnded(JobHandler handler, Job job) { + IsSpoolReplaced = false; + LogManager.Log("Raising printing ended event..."); PrintingEnded?.Invoke(this, new PrintingEventArgs(handler, job) -- cgit v1.3.1