From 6dbef47fe2ca696fcf11ce4c2d0662c28b36bf35 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sun, 10 Mar 2024 16:26:32 +0200 Subject: FSE Remote Job Parameters. --- .../Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs | 2 + .../RemoteJob/DefaultRemoteJobService.cs | 109 ++++++++++++++++++++- .../RemoteJob/IRemoteJobInputOutputProvider.cs | 22 +++++ .../PPC/Tango.PPC.Common/Tango.PPC.Common.csproj | 3 +- .../Tango.PPC.Shared/Jobs/RemoteJobInputOutput.cs | 22 +++++ .../PPC/Tango.PPC.Shared/Jobs/RemoteJobProgress.cs | 2 + .../Jobs/RemoteJobUpdateResponse.cs | 1 + .../PPC/Tango.PPC.Shared/Tango.PPC.Shared.csproj | 1 + .../PPC/Tango.PPC.UI/MainWindow.xaml.cs | 2 +- .../Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs | 3 +- .../Visual_Studio/PPC/Tango.PPC.UI/app.manifest | 2 +- 11 files changed, 161 insertions(+), 8 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/IRemoteJobInputOutputProvider.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobInputOutput.cs (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs index 5f005385e..c3d6136af 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs @@ -474,6 +474,8 @@ namespace Tango.PPC.Jobs.ViewModels job.Name = "Unnamed"; job.EnableInterSegment = false; job.InterSegmentLength = 0; + job.NumberOfSpools = 4; + job.NumberOfUnits = 1; } else { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/DefaultRemoteJobService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/DefaultRemoteJobService.cs index 8826a8be3..00b4f5ad1 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/DefaultRemoteJobService.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/DefaultRemoteJobService.cs @@ -8,6 +8,7 @@ using Tango.Core; using Tango.Core.DI; using Tango.Integration.ExternalBridge; using Tango.Integration.Operation; +using Tango.PPC.Common.Build; using Tango.PPC.Common.Connection; using Tango.PPC.Common.ExternalBridge; using Tango.PPC.Shared.Jobs; @@ -27,18 +28,23 @@ namespace Tango.PPC.Common.RemoteJob private List _clients; private JobHandler _handler; private JobDTO _currentJobDTO; + private String _rmlName; private ProcessParametersTableDTO _currentJobProcessParameters; + private IRemoteJobInputOutputProvider _inputOutputProvider; + private IBuildProvider _buildProvider; public bool Enabled { get; set; } = true; private IMachineProvider MachineProvider { get; set; } - public DefaultRemoteJobService(IPPCExternalBridgeService externalBridge, IMachineProvider machineProvider) + public DefaultRemoteJobService(IPPCExternalBridgeService externalBridge, IMachineProvider machineProvider, IBuildProvider buildProvider) { externalBridge.RegisterRequestHandler(this); MachineProvider = machineProvider; + _buildProvider = buildProvider; + _clients = new List(); MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted; } @@ -52,6 +58,14 @@ namespace Tango.PPC.Common.RemoteJob _currentJobDTO = JobDTO.FromObservable(e.Job); _currentJobProcessParameters = ProcessParametersTableDTO.FromObservable(_handler.ProcessParameters); + _rmlName = e.Job.Rml.FinalName; + + RemoteJobInputOutput inputOutput = new RemoteJobInputOutput(); + + if (_clients.Count > 0 && _buildProvider.IsEureka) + { + inputOutput = GetCurrentJobInputOutput(); + } foreach (var client in _clients.ToList()) { @@ -60,12 +74,15 @@ namespace Tango.PPC.Common.RemoteJob RemoteJobProgress progress = new RemoteJobProgress(); progress.Stage = RemoteJobStage.Started; progress.JobStatus = _handler.JobStatus; + progress.InputOutput = inputOutput; + await client.Receiver.SendGenericResponse(new RemoteJobUpdateResponse() { Job = _currentJobDTO, ProcessParameters = _currentJobProcessParameters, - Progress = progress + Progress = progress, + RmlName = _rmlName }, client.Token); client.JobSent = true; @@ -76,6 +93,16 @@ namespace Tango.PPC.Common.RemoteJob private async void JobHandler_StatusChanged(object sender, RunningJobStatus e) { + var currentProgress = GetJobProgress(_handler); + RemoteJobInputOutput inputOutput = new RemoteJobInputOutput(); + + if (_clients.Count > 0 && _buildProvider.IsEureka) + { + inputOutput = GetCurrentJobInputOutput(); + } + + currentProgress.InputOutput = inputOutput; + foreach (var client in _clients.ToList()) { if (client.JobSent) @@ -84,7 +111,8 @@ namespace Tango.PPC.Common.RemoteJob { await client.Receiver.SendGenericResponse(new RemoteJobUpdateResponse() { - Progress = GetJobProgress(_handler) + Progress = currentProgress, + RmlName = _rmlName, }, client.Token); } catch { } @@ -96,12 +124,14 @@ namespace Tango.PPC.Common.RemoteJob RemoteJobProgress progress = new RemoteJobProgress(); progress.Stage = RemoteJobStage.Started; progress.JobStatus = _handler.JobStatus; + progress.InputOutput = inputOutput; await client.Receiver.SendGenericResponse(new RemoteJobUpdateResponse() { Job = _currentJobDTO, ProcessParameters = _currentJobProcessParameters, - Progress = progress + Progress = progress, + RmlName = _rmlName }, client.Token); client.JobSent = true; @@ -128,6 +158,77 @@ namespace Tango.PPC.Common.RemoteJob } } + private RemoteJobInputOutput GetCurrentJobInputOutput() + { + var inputOutput = new RemoteJobInputOutput(); + + if (_inputOutputProvider == null && _buildProvider.IsEureka) + { + _inputOutputProvider = TangoIOC.Default.GetInstance(); + } + + if (_inputOutputProvider != null) + { + var i = _inputOutputProvider; + + if (i.CurrentBrushStop != null) + { + var colorSpace = i.CurrentBrushStop.BrushColorSpace; + + inputOutput.ColorSpace = colorSpace; + + switch (colorSpace) + { + case BL.Enumerations.ColorSpaces.Volume: + inputOutput.Input.Add(new Tuple("C", i.CurrentBrushStop.Cyan.ToString("0.00"))); + inputOutput.Input.Add(new Tuple("M", i.CurrentBrushStop.Magenta.ToString("0.00"))); + inputOutput.Input.Add(new Tuple("Y", i.CurrentBrushStop.Yellow.ToString("0.00"))); + inputOutput.Input.Add(new Tuple("K", i.CurrentBrushStop.Black.ToString("0.00"))); + break; + case BL.Enumerations.ColorSpaces.RGB: + inputOutput.Input.Add(new Tuple("R", i.CurrentBrushStop.Red.ToString())); + inputOutput.Input.Add(new Tuple("G", i.CurrentBrushStop.Green.ToString())); + inputOutput.Input.Add(new Tuple("B", i.CurrentBrushStop.Blue.ToString())); + break; + case BL.Enumerations.ColorSpaces.LAB: + inputOutput.Input.Add(new Tuple("L", i.CurrentBrushStop.L.ToString("0.00"))); + inputOutput.Input.Add(new Tuple("A", i.CurrentBrushStop.A.ToString("0.00"))); + inputOutput.Input.Add(new Tuple("B", i.CurrentBrushStop.B.ToString("0.00"))); + break; + case BL.Enumerations.ColorSpaces.Catalog: + inputOutput.Input.Add(new Tuple("Catalog", i.CurrentBrushStop.ColorCatalog.Name)); + inputOutput.Input.Add(new Tuple("Color", i.CurrentBrushStop.ColorCatalogsItem.Name)); + break; + default: + break; + } + + try + { + inputOutput.Output.Add(new Tuple("C", i.CyanOutput.ToString())); + inputOutput.Output.Add(new Tuple("LC", i.LightCyanOutput.ToString())); + inputOutput.Output.Add(new Tuple("M", i.MagentaOutput.ToString())); + inputOutput.Output.Add(new Tuple("LM", i.LightMagentaOutput.ToString())); + inputOutput.Output.Add(new Tuple("Y", i.YellowOutput.ToString())); + inputOutput.Output.Add(new Tuple("LY", i.LightYellowOutput.ToString())); + inputOutput.Output.Add(new Tuple("K", i.BlackOutput.ToString())); + } + catch + { + inputOutput.Output.Add(new Tuple("C", "N/A")); + inputOutput.Output.Add(new Tuple("LC", "N/A")); + inputOutput.Output.Add(new Tuple("M", "N/A")); + inputOutput.Output.Add(new Tuple("LM", "N/A")); + inputOutput.Output.Add(new Tuple("Y", "N/A")); + inputOutput.Output.Add(new Tuple("LY", "N/A")); + inputOutput.Output.Add(new Tuple("K", "N/A")); + } + } + } + + return inputOutput; + } + private RemoteJobProgress GetJobProgress(JobHandler handler) { RemoteJobStage stage = RemoteJobStage.Running; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/IRemoteJobInputOutputProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/IRemoteJobInputOutputProvider.cs new file mode 100644 index 000000000..cc98bd419 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/IRemoteJobInputOutputProvider.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; + +namespace Tango.PPC.Common.RemoteJob +{ + public interface IRemoteJobInputOutputProvider + { + BrushStop CurrentBrushStop { get; } + + double CyanOutput { get; } + double MagentaOutput { get; } + double YellowOutput { get; } + double BlackOutput { get; } + double LightCyanOutput { get; } + double LightMagentaOutput { get; } + double LightYellowOutput { get; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj index 28cbfa6bc..08ad6ec1c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -221,6 +221,7 @@ + @@ -642,7 +643,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobInputOutput.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobInputOutput.cs new file mode 100644 index 000000000..e6c39a024 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobInputOutput.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Enumerations; + +namespace Tango.PPC.Shared.Jobs +{ + public class RemoteJobInputOutput + { + public ColorSpaces ColorSpace { get; set; } + public List> Input { get; set; } + public List> Output { get; set; } + + public RemoteJobInputOutput() + { + Input = new List>(); + Output = new List>(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobProgress.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobProgress.cs index d91d612d1..d3adc7ecb 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobProgress.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobProgress.cs @@ -12,10 +12,12 @@ namespace Tango.PPC.Shared.Jobs { public RemoteJobStage Stage { get; set; } public JobStatus JobStatus { get; set; } + public RemoteJobInputOutput InputOutput { get; set; } public RemoteJobProgress() { JobStatus = new JobStatus(); + InputOutput = new RemoteJobInputOutput(); } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobUpdateResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobUpdateResponse.cs index 0bb32d266..28ff50622 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobUpdateResponse.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobUpdateResponse.cs @@ -11,6 +11,7 @@ namespace Tango.PPC.Shared.Jobs public class RemoteJobUpdateResponse { public JobDTO Job { get; set; } + public String RmlName { get; set; } public ProcessParametersTableDTO ProcessParameters { get; set; } public RemoteJobProgress Progress { get; set; } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Tango.PPC.Shared.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Tango.PPC.Shared.csproj index 3f7bc0cbe..6b4e448f7 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Tango.PPC.Shared.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Tango.PPC.Shared.csproj @@ -75,6 +75,7 @@ + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs index 92c527134..4a67f204c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs @@ -73,7 +73,7 @@ namespace Tango.PPC.UI viewBox.Child = new Views.MainEurekaView(); var screens = System.Windows.Forms.Screen.AllScreens; - var touch_screen = screens.Last(); + var touch_screen = screens.OrderBy(x => x.Bounds.X).Last(); bool hasTouch = TouchHelper.IsTouchEnabled() || settings.ForceTouchMode; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs index 937a76f94..8507d1e39 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs @@ -30,10 +30,11 @@ using System.Windows.Media; using Tango.PPC.Common.Resume; using Tango.Core.ExtensionMethods; using Tango.PPC.Common.Printing; +using Tango.PPC.Common.RemoteJob; namespace Tango.PPC.UI.ViewModels { - public class MachineStatusViewVM : PPCViewModel + public class MachineStatusViewVM : PPCViewModel, IRemoteJobInputOutputProvider { public enum StatisticTab { 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. --> - + -- cgit v1.3.1