aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-02-04 16:44:48 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-02-04 16:44:48 +0200
commitba6abe56c52a9ba0e73c30062ed2e73dee883fa6 (patch)
tree3348b09b1e8188244bad289903edcb2e8a519f1c /Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs
parent2885eca102b05b2a853f3b1f082f39d48b0132a2 (diff)
downloadTango-ba6abe56c52a9ba0e73c30062ed2e73dee883fa6.tar.gz
Tango-ba6abe56c52a9ba0e73c30062ed2e73dee883fa6.zip
Added basic skeleton for job printing communication.
Added Job Handling for Machine Operator & Machine Emulator.
Diffstat (limited to 'Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs')
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs63
1 files changed, 63 insertions, 0 deletions
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);
}
+
+ /// <summary>
+ /// Prints the specified job.
+ /// </summary>
+ /// <param name="job">The job.</param>
+ /// <param name="processParameters">Process parameters table</param>
+ /// <returns></returns>
+ 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<AbortJobRequest, AbortJobResponse>(new AbortJobRequest(), TimeSpan.FromSeconds(10));
+ handler.RaiseCanceled();
+ });
+
+ SendContinuousRequest<JobRequest, JobResponse>(request).Subscribe((response) =>
+ {
+ handler.RaiseStatusReceived(response.Message.Status);
+ },(ex) =>
+ {
+ handler.RaiseFailed(ex);
+ },() =>
+ {
+ handler.RaiseCompleted();
+ });
+
+ return handler;
+ }
}
}