From ba6abe56c52a9ba0e73c30062ed2e73dee883fa6 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 4 Feb 2018 16:44:48 +0200 Subject: Added basic skeleton for job printing communication. Added Job Handling for Machine Operator & Machine Emulator. --- .../Tango.Integration/Operators/MachineOperator.cs | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs') diff --git a/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs index 17884b677..fd20f9f5d 100644 --- a/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs @@ -11,6 +11,10 @@ using System.Reactive.Linq; using System.Reactive.Concurrency; using System.Reactive.Threading; using Tango.PMR.Common; +using Tango.PMR.Printing; +using Tango.Integration.Observables; +using System.Reactive.Subjects; +using Tango.Integration.Printing; namespace Tango.Integration.Operators { @@ -87,5 +91,64 @@ namespace Tango.Integration.Operators OnEnableSensorsUpdateChanged(EnableSensorsUpdate); } + + /// + /// Prints the specified job. + /// + /// The job. + /// Process parameters table + /// + public JobHandler Print(Job job, ProcessParametersTable processParameters) + { + JobRequest request = new JobRequest(); + + JobTicket ticket = new JobTicket(); + ticket.EnableInterSegment = job.EnableInterSegment; + ticket.InterSegmentLength = job.InterSegmentLength; + ticket.Length = job.Length; + ticket.WindingMethod = (JobWindingMethod)job.WindingMethod.Code; + + ProcessParameters process = new ProcessParameters(); + process.DyeingSpeed = processParameters.DyeingSpeed; + process.MinInkUptake = processParameters.MinInkUptake; + process.MixerTemp = processParameters.MixerTemp; + process.HeadZone1Temp = processParameters.HeadZone1Temp; + process.HeadZone2Temp = processParameters.HeadZone2Temp; + process.HeadZone3Temp = processParameters.HeadZone3Temp; + process.HeadAirFlow = processParameters.HeadAirFlow; + process.FeederTension = processParameters.FeederTension; + process.PullerTension = processParameters.PullerTension; + process.DryerBufferLength = processParameters.DryerBufferLength; + process.DryerZone1Temp = processParameters.DryerZone1Temp; + process.DryerZone2Temp = processParameters.DryerZone2Temp; + process.DryerZone3Temp = processParameters.DryerZone3Temp; + process.DryerAirFlow = processParameters.DryerAirFlow; + process.WinderTension = processParameters.WinderTension; + + ticket.ProcessParameters = process; + + request.JobTicket = ticket; + + JobHandler handler = null; + + handler = new JobHandler(async () => + { + var result = await SendRequest(new AbortJobRequest(), TimeSpan.FromSeconds(10)); + handler.RaiseCanceled(); + }); + + SendContinuousRequest(request).Subscribe((response) => + { + handler.RaiseStatusReceived(response.Message.Status); + },(ex) => + { + handler.RaiseFailed(ex); + },() => + { + handler.RaiseCompleted(); + }); + + return handler; + } } } -- cgit v1.3.1