From e89f04cbdda4e34baef11d43c9f812773911a33c Mon Sep 17 00:00:00 2001 From: Roy Date: Mon, 26 Dec 2022 21:33:29 +0200 Subject: Implemented Waste Replace Handling. Implemented Job Stop on Out Of Range on MachineOperator. Implemented job upload error on Volumes out of range. --- .../Operation/IMachineOperator.cs | 11 +++++++ .../Tango.Integration/Operation/MachineOperator.cs | 34 ++++++++++++++++++++++ 2 files changed, 45 insertions(+) (limited to 'Software/Visual_Studio/Tango.Integration') diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs index 873e024fd..ca00f2891 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs @@ -261,6 +261,11 @@ namespace Tango.Integration.Operation /// event EventHandler InkFillingStatusChanged; + /// + /// Occurs when waste replacement is required. + /// + event EventHandler WasteReplacementRequired; + /// /// Gets or sets a value indicating whether direct the embedded device to send diagnostics messages. /// @@ -576,5 +581,11 @@ namespace Tango.Integration.Operation /// /// Type of the spool. Task SetSpoolType(JobSpoolType spoolType); + + /// + /// Completes the waste replacement sequence. + /// + /// Approve or decline the sequence. + Task CompleteWasteReplacement(bool approved); } } diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 6b79fa5bc..005121b88 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -89,6 +89,7 @@ namespace Tango.Integration.Operation private List _emulatedEvents; private List _bitResults; private JobSpoolType _currentSpoolType; + private String _lastWasteReplaceRequestToken; public static String EmbeddedLogsFolder { get; private set; } public static String EmbeddedLogsTag { get; private set; } @@ -303,6 +304,11 @@ namespace Tango.Integration.Operation /// public event EventHandler InkFillingStatusChanged; + /// + /// Occurs when waste replacement is required. + /// + public event EventHandler WasteReplacementRequired; + #endregion #region Properties @@ -1207,6 +1213,11 @@ namespace Tango.Integration.Operation e.Handled = true; OnUpdateStatusRequestReceived(container.Token, MessageFactory.ExtractMessageFromContainer(container)); } + else if (container.Type == MessageType.WasteReplaceRequest) + { + e.Handled = true; + OnWasteReplacementRequired(container.Token, MessageFactory.ExtractMessageFromContainer(container)); + } } /// @@ -1388,6 +1399,12 @@ namespace Tango.Integration.Operation }); } + protected virtual void OnWasteReplacementRequired(string token, WasteReplaceRequest wasteReplaceRequest) + { + _lastWasteReplaceRequestToken = token; + WasteReplacementRequired?.Invoke(this, new EventArgs()); + } + #endregion #region Override Methods @@ -2638,6 +2655,11 @@ namespace Tango.Integration.Operation { throw new InvalidOperationException($"Error processing the coordinates of stop '{stop.StopIndex}' of segment '{stop.Segment.SegmentIndex}'.", ex); } + + if (stop.IsLiquidVolumesOutOfRange) + { + throw new InvalidOperationException($"The specified ink volumes at segment {segment.SegmentIndex} exceeds the maximum allowed total volume for the current thread."); + } } } } @@ -4473,6 +4495,18 @@ namespace Tango.Integration.Operation } } + /// + /// Completes the waste replacement sequence. + /// + /// Approve or decline the sequence. + public async Task CompleteWasteReplacement(bool approved) + { + if (_lastWasteReplaceRequestToken != null) + { + await SendResponse(new WasteReplaceResponse() { Approved = approved }, _lastWasteReplaceRequestToken); + } + } + #endregion } } -- cgit v1.3.1