From 60988675685060adfc98b2d071c3e1df1e10fd87 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 5 Mar 2020 16:42:24 +0200 Subject: Added new maintenance commands to PPC. --- .../Commands/HomingMotorCommand.cs | 80 +++++++++++ .../Commands/OpenCloseDyeingHeadCommand.cs | 31 ++++ .../Commands/OpenCloseLeftLeadingWheelsCommand.cs | 30 ++++ .../Commands/OpenCloseMotorCommand.cs | 158 +++++++++++++++++++++ .../Commands/OpenCloseRightLeadingWheelsCommand.cs | 30 ++++ .../Commands/ResetThreadLoadingCommand.cs | 24 ++++ .../Controls/StateTouchButton.cs | 109 ++++++++++++++ .../Tango.PPC.Maintenance/MaintenanceCommand.cs | 81 +++++++++++ .../Tango.PPC.Maintenance.csproj | 13 ++ .../Tango.PPC.Maintenance/Themes/Generic.xaml | 9 ++ .../ViewModels/MaintenanceViewVM.cs | 99 ++----------- .../Views/MaintenanceView.xaml | 22 ++- 12 files changed, 597 insertions(+), 89 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/HomingMotorCommand.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseDyeingHeadCommand.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseLeftLeadingWheelsCommand.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseMotorCommand.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseRightLeadingWheelsCommand.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/ResetThreadLoadingCommand.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Controls/StateTouchButton.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaintenanceCommand.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Themes/Generic.xaml (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/HomingMotorCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/HomingMotorCommand.cs new file mode 100644 index 000000000..d3f44fe7e --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/HomingMotorCommand.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.Diagnostics; +using Tango.PMR.Hardware; + +namespace Tango.PPC.Maintenance.Commands +{ + public abstract class HomingMotorCommand : MaintenanceCommand + { + public HardwareMotorType Motor { get; set; } + + public MotorDirection Direction { get; set; } + + public double Speed { get; set; } + + public String HomingMessage { get; set; } + + public String ErrorMessage { get; set; } + + public String SuccessMessage { get; set; } + + public HomingMotorCommand(HardwareMotorType motor, + MotorDirection direction, + double speed, + string homingMessage, + string errorMessage, + string successMessage) + { + Motor = motor; + Direction = direction; + Speed = speed; + HomingMessage = homingMessage; + ErrorMessage = errorMessage; + SuccessMessage = successMessage; + } + + protected override void OnExecute() + { + IsEnabled = false; + + try + { + NotificationProvider.SetGlobalBusyMessage(HomingMessage); + + MachineProvider.MachineOperator.StartMotorHoming(new PMR.Diagnostics.MotorHomingRequest() + { + Direction = Direction, + MotorType = Motor, + Speed = Speed, + }).Subscribe((response) => + { + //Next + }, (ex) => + { + //Error + IsEnabled = true; + NotificationProvider.ReleaseGlobalBusyMessage(); + LogManager.Log(ex, ErrorMessage); + NotificationProvider.ShowError(ex.FlattenMessage()); + }, () => + { + //Complete + IsEnabled = true; + NotificationProvider.ReleaseGlobalBusyMessage(); + NotificationProvider.ShowSuccess(SuccessMessage); + }); + } + catch (Exception ex) + { + LogManager.Log(ex, ErrorMessage); + NotificationProvider.ReleaseGlobalBusyMessage(); + NotificationProvider.ShowError(ex.FlattenMessage()); + IsEnabled = true; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseDyeingHeadCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseDyeingHeadCommand.cs new file mode 100644 index 000000000..794274e21 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseDyeingHeadCommand.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Integration.Operation; +using Tango.PMR.Diagnostics; +using Tango.PMR.Hardware; + +namespace Tango.PPC.Maintenance.Commands +{ + public class OpenCloseDyeingHeadCommand : OpenCloseMotorCommand + { + public OpenCloseDyeingHeadCommand() : base( + HardwareMotorType.MotoDhLid, + MotorDirection.Backward, + 400, + 400, + MotorState.Closed, + "Opening dyeing head lead...", + "Closing dyeing head lead...", + "Error opening dyeing head lead.", + "Error closing dyeing head lead.", + "The dyeing head lead is now opened.", + "The dyeing head lead is now closed." + ) + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseLeftLeadingWheelsCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseLeftLeadingWheelsCommand.cs new file mode 100644 index 000000000..b0d8c1dc5 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseLeftLeadingWheelsCommand.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.Diagnostics; +using Tango.PMR.Hardware; + +namespace Tango.PPC.Maintenance.Commands +{ + public class OpenCloseLeftLeadingWheelsCommand : OpenCloseMotorCommand + { + public OpenCloseLeftLeadingWheelsCommand() : base( + HardwareMotorType.MotoLloading, + MotorDirection.Backward, + 250, + 250, + MotorState.Closed, + "Opening left leading wheels...", + "Closing left leading wheels...", + "Error opening left leading wheels.", + "Error closing left leading wheels.", + "The left leading wheels are now opened.", + "The left leading wheels are now closed." + ) + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseMotorCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseMotorCommand.cs new file mode 100644 index 000000000..149c3675d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseMotorCommand.cs @@ -0,0 +1,158 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.Diagnostics; +using Tango.PMR.Hardware; + +namespace Tango.PPC.Maintenance.Commands +{ + public abstract class OpenCloseMotorCommand : MaintenanceCommand + { + public enum MotorState + { + Closed, + Opened, + } + + public HardwareMotorType Motor { get; set; } + + public MotorDirection OpenDirection { get; set; } + + public MotorDirection CloseDirection + { + get + { + return OpenDirection == MotorDirection.Forward ? MotorDirection.Backward : MotorDirection.Forward; + } + } + + public double OpeningSpeed { get; set; } + + public double ClosingSpeed { get; set; } + + public String OpeningMessage { get; set; } + + public String ClosingMessage { get; set; } + + public String OpeningErrorMessage { get; set; } + + public String ClosingErrorMessage { get; set; } + + public String OpeningSuccessMessage { get; set; } + + public String ClosingSuccessMessage { get; set; } + + public OpenCloseMotorCommand( + HardwareMotorType motor, + MotorDirection openDirection, + double openingSpeed, + double closingSpeed, + MotorState defaultState, + String openingMessage, + String closingMessage, + String openingErrorMessage, + String closingErrorMessage, + String openingSuccessMessage, + String closingSuccessMessage) + { + + Motor = motor; + OpenDirection = openDirection; + OpeningSpeed = openingSpeed; + ClosingSpeed = closingSpeed; + State = defaultState; + OpeningMessage = openingMessage; + ClosingMessage = closingMessage; + OpeningErrorMessage = openingErrorMessage; + ClosingErrorMessage = closingErrorMessage; + OpeningSuccessMessage = openingSuccessMessage; + ClosingSuccessMessage = closingSuccessMessage; + } + + protected override void OnExecute() + { + if (State == MotorState.Closed) + { + IsEnabled = false; + + try + { + NotificationProvider.SetGlobalBusyMessage(OpeningMessage); + + MachineProvider.MachineOperator.StartMotorHoming(new PMR.Diagnostics.MotorHomingRequest() + { + Direction = OpenDirection, + MotorType = Motor, + Speed = OpeningSpeed, + }).Subscribe((response) => + { + //Next + }, (ex) => + { + //Error + IsEnabled = true; + NotificationProvider.ReleaseGlobalBusyMessage(); + LogManager.Log(ex, OpeningErrorMessage); + NotificationProvider.ShowError(ex.FlattenMessage()); + }, () => + { + //Complete + IsEnabled = true; + State = MotorState.Opened; + NotificationProvider.ReleaseGlobalBusyMessage(); + NotificationProvider.ShowSuccess(OpeningSuccessMessage); + }); + } + catch (Exception ex) + { + LogManager.Log(ex, OpeningErrorMessage); + NotificationProvider.ReleaseGlobalBusyMessage(); + NotificationProvider.ShowError(ex.FlattenMessage()); + IsEnabled = true; + } + } + else + { + IsEnabled = false; + + try + { + NotificationProvider.SetGlobalBusyMessage(ClosingMessage); + + MachineProvider.MachineOperator.StartMotorHoming(new PMR.Diagnostics.MotorHomingRequest() + { + Direction = CloseDirection, + MotorType = Motor, + Speed = ClosingSpeed, + }).Subscribe((response) => + { + //Next + }, (ex) => + { + //Error + IsEnabled = true; + NotificationProvider.ReleaseGlobalBusyMessage(); + LogManager.Log(ex, ClosingErrorMessage); + NotificationProvider.ShowError(ex.FlattenMessage()); + }, () => + { + //Complete + IsEnabled = true; + State = MotorState.Closed; + NotificationProvider.ReleaseGlobalBusyMessage(); + NotificationProvider.ShowSuccess(ClosingSuccessMessage); + }); + } + catch (Exception ex) + { + LogManager.Log(ex, ClosingErrorMessage); + NotificationProvider.ReleaseGlobalBusyMessage(); + NotificationProvider.ShowError(ex.FlattenMessage()); + IsEnabled = true; + } + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseRightLeadingWheelsCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseRightLeadingWheelsCommand.cs new file mode 100644 index 000000000..ced9eea60 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseRightLeadingWheelsCommand.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.Diagnostics; +using Tango.PMR.Hardware; + +namespace Tango.PPC.Maintenance.Commands +{ + public class OpenCloseRightLeadingWheelsCommand : OpenCloseMotorCommand + { + public OpenCloseRightLeadingWheelsCommand() : base( + HardwareMotorType.MotoRloading, + MotorDirection.Backward, + 250, + 250, + MotorState.Closed, + "Opening right leading wheels...", + "Closing right leading wheels...", + "Error opening right leading wheels.", + "Error closing right leading wheels.", + "The right leading wheels are now opened.", + "The right leading wheels are now closed." + ) + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/ResetThreadLoadingCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/ResetThreadLoadingCommand.cs new file mode 100644 index 000000000..0078cd546 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/ResetThreadLoadingCommand.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.Diagnostics; +using Tango.PMR.Hardware; + +namespace Tango.PPC.Maintenance.Commands +{ + public class ResetThreadLoadingCommand : HomingMotorCommand + { + public ResetThreadLoadingCommand() : base( + HardwareMotorType.MotoDryerLoadarm, + MotorDirection.Backward, + 200, + "Resetting thread loading arm...", + "Error resetting thread loading arm.", + "Thread loading arm in now in place.") + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Controls/StateTouchButton.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Controls/StateTouchButton.cs new file mode 100644 index 000000000..9a259482b --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Controls/StateTouchButton.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.ComponentModel; +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.Markup; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.Touch.Controls; + +namespace Tango.PPC.Maintenance.Controls +{ + public class ButtonState : DependencyObject + { + public Object Value + { + get { return (Object)GetValue(ValueProperty); } + set { SetValue(ValueProperty, value); } + } + public static readonly DependencyProperty ValueProperty = + DependencyProperty.Register("Value", typeof(Object), typeof(ButtonState), new PropertyMetadata(null)); + + public Object Content + { + get { return (Object)GetValue(ContentProperty); } + set { SetValue(ContentProperty, value); } + } + public static readonly DependencyProperty ContentProperty = + DependencyProperty.Register("Content", typeof(Object), typeof(ButtonState), new PropertyMetadata(null)); + } + + [ContentProperty(nameof(States))] + public class StateTouchButton : TouchButton + { + public ObservableCollection States + { + get { return (ObservableCollection)GetValue(StatesProperty); } + set { SetValue(StatesProperty, value); } + } + public static readonly DependencyProperty StatesProperty = + DependencyProperty.Register("States", typeof(ObservableCollection), typeof(StateTouchButton), new PropertyMetadata(null, (d, e) => (d as StateTouchButton).OnStatesChanged())); + + public Object SelectedState + { + get { return (Object)GetValue(SelectedStateProperty); } + set { SetValue(SelectedStateProperty, value); } + } + public static readonly DependencyProperty SelectedStateProperty = + DependencyProperty.Register("SelectedState", typeof(Object), typeof(StateTouchButton), new PropertyMetadata(null, (d, e) => (d as StateTouchButton).OnSelectedStateChanged())); + + public StateTouchButton() + { + States = new ObservableCollection(); + } + + private void OnStatesChanged() + { + if (States != null) + { + States.CollectionChanged -= States_CollectionChanged; + States.CollectionChanged += States_CollectionChanged; + OnSelectedStateChanged(); + } + } + + private void OnSelectedStateChanged() + { + if (SelectedState == null) + { + Content = null; + return; + } + + if (States != null) + { + var converter = TypeDescriptor.GetConverter(SelectedState.GetType()); + var matchingState = States.OfType().ToList().FirstOrDefault(x => x.Value != null && converter.ConvertFrom(x.Value).Equals(SelectedState)); + if (matchingState != null) + { + Content = matchingState.Content; + } + else + { + Content = null; + } + } + else + { + Content = null; + } + } + + private void States_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + { + OnSelectedStateChanged(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaintenanceCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaintenanceCommand.cs new file mode 100644 index 000000000..5c74d92cd --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaintenanceCommand.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.Core.Commands; +using Tango.Core.DI; +using Tango.Integration.Operation; +using Tango.PPC.Common.Connection; +using Tango.PPC.Common.Notifications; + +namespace Tango.PPC.Maintenance +{ + public abstract class MaintenanceCommand : ExtendedObject + { + private IMachineProvider _machineProvider; + [TangoInject(Mode = TangoInjectMode.WhenAvailable)] + protected IMachineProvider MachineProvider + { + get { return _machineProvider; } + set + { + _machineProvider = value; RaisePropertyChangedAuto(); + _machineProvider.MachineOperator.StatusChanged += MachineOperator_StatusChanged; + } + } + + [TangoInject(Mode = TangoInjectMode.WhenAvailable)] + protected INotificationProvider NotificationProvider { get; set; } + + private RelayCommand _command; + public RelayCommand Command + { + get { return _command; } + set { _command = value; RaisePropertyChangedAuto(); } + } + + private bool _isEnabled; + public bool IsEnabled + { + get { return _isEnabled; } + set { _isEnabled = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + private T _state; + public T State + { + get { return _state; } + set { _state = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + private void MachineOperator_StatusChanged(object sender, MachineStatuses e) + { + InvalidateRelayCommands(); + } + + public MaintenanceCommand() + { + TangoIOC.Default.Inject(this); + IsEnabled = true; + Command = new RelayCommand(Execute, CanExecute); + } + + protected virtual bool CanExecute() + { + if (!IsEnabled) return false; + if (MachineProvider == null) return false; + if (!MachineProvider.MachineOperator.CanPrint) return false; + + return true; + } + + private void Execute() + { + OnExecute(); + } + + protected abstract void OnExecute(); + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj index 3f9f7c7b9..42d4a396e 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj @@ -85,6 +85,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -102,6 +106,13 @@ GlobalVersionInfo.cs + + + + + + + @@ -113,6 +124,7 @@ + @@ -265,6 +277,7 @@ + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Themes/Generic.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Themes/Generic.xaml new file mode 100644 index 000000000..a77cc2281 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Themes/Generic.xaml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs index aeb349bdc..8d221c3f3 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs @@ -11,6 +11,7 @@ using Tango.Integration.Operation; using Tango.Logging; using Tango.PMR.MachineStatus; using Tango.PPC.Common; +using Tango.PPC.Maintenance.Commands; using Tango.PPC.Maintenance.Helpers; using Tango.PPC.Maintenance.Models; using Tango.PPC.Maintenance.Views; @@ -38,11 +39,15 @@ namespace Tango.PPC.Maintenance.ViewModels set { _overallTemperature = value; RaisePropertyChangedAuto(); } } - public RelayCommand OpenDyeingHeadCommand { get; set; } + public RelayCommand ExportLogsCommand { get; set; } - public RelayCommand CloseDyeingHeadCommand { get; set; } + public OpenCloseDyeingHeadCommand OpenCloseDyeingHeadCommand { get; set; } - public RelayCommand ExportLogsCommand { get; set; } + public OpenCloseLeftLeadingWheelsCommand OpenCloseLeftLeadingWheelsCommand { get; set; } + + public OpenCloseRightLeadingWheelsCommand OpenCloseRightLeadingWheelsCommand { get; set; } + + public ResetThreadLoadingCommand ResetThreadLoadingCommand { get; set; } public MaintenanceViewVM() { @@ -50,10 +55,12 @@ namespace Tango.PPC.Maintenance.ViewModels OverallTemperature = new OverallTemperatureModel(); OpenGuideCommand = new RelayCommand(OpenGuide); - - OpenDyeingHeadCommand = new RelayCommand(OpenDyeingHead); - CloseDyeingHeadCommand = new RelayCommand(CloseDyeingHead); ExportLogsCommand = new RelayCommand(ExportLogsToStorage); + + OpenCloseDyeingHeadCommand = new OpenCloseDyeingHeadCommand(); + OpenCloseLeftLeadingWheelsCommand = new OpenCloseLeftLeadingWheelsCommand(); + OpenCloseRightLeadingWheelsCommand = new OpenCloseRightLeadingWheelsCommand(); + ResetThreadLoadingCommand = new ResetThreadLoadingCommand(); } public override void OnApplicationStarted() @@ -101,86 +108,6 @@ namespace Tango.PPC.Maintenance.ViewModels } } - private void OpenDyeingHead() - { - IsFree = false; - - try - { - NotificationProvider.SetGlobalBusyMessage("Opening dyeing head lead..."); - - MachineProvider.MachineOperator.StartMotorHoming(new PMR.Diagnostics.MotorHomingRequest() - { - Direction = PMR.Diagnostics.MotorDirection.Backward, - MotorType = PMR.Hardware.HardwareMotorType.MotoDhLid, - Speed = 400, - }).Subscribe((response) => - { - //Next - }, (ex) => - { - //Error - IsFree = true; - NotificationProvider.ReleaseGlobalBusyMessage(); - LogManager.Log(ex, "Error opening dyeing head lead."); - NotificationProvider.ShowError(ex.FlattenMessage()); - }, () => - { - //Complete - IsFree = true; - NotificationProvider.ReleaseGlobalBusyMessage(); - NotificationProvider.ShowSuccess("The dyeing head lead is now opened."); - }); - } - catch (Exception ex) - { - LogManager.Log(ex, "Error opening dyeing head lead."); - NotificationProvider.ReleaseGlobalBusyMessage(); - NotificationProvider.ShowError(ex.FlattenMessage()); - IsFree = true; - } - } - - private void CloseDyeingHead() - { - IsFree = false; - - try - { - NotificationProvider.SetGlobalBusyMessage("Closing dyeing head lead..."); - - MachineProvider.MachineOperator.StartMotorHoming(new PMR.Diagnostics.MotorHomingRequest() - { - Direction = PMR.Diagnostics.MotorDirection.Forward, - MotorType = PMR.Hardware.HardwareMotorType.MotoDhLid, - Speed = 400, - }).Subscribe((response) => - { - //Next - }, (ex) => - { - //Error - IsFree = true; - NotificationProvider.ReleaseGlobalBusyMessage(); - LogManager.Log(ex, "Error closing dyeing head lead."); - NotificationProvider.ShowError(ex.FlattenMessage()); - }, () => - { - //Complete - IsFree = true; - NotificationProvider.ReleaseGlobalBusyMessage(); - NotificationProvider.ShowSuccess("The dyeing head lead is now closed."); - }); - } - catch (Exception ex) - { - LogManager.Log(ex, "Error closing dyeing head lead."); - NotificationProvider.ReleaseGlobalBusyMessage(); - NotificationProvider.ShowError(ex.FlattenMessage()); - IsFree = true; - } - } - private async void ExportLogsToStorage() { var result = await NavigationManager. diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml index dbe09ca19..538d4e96d 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml @@ -5,8 +5,10 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:vm="clr-namespace:Tango.PPC.Maintenance.ViewModels" xmlns:global="clr-namespace:Tango.PPC.Maintenance" + xmlns:arr="clr-namespace:System.Collections;assembly=mscorlib" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:localConverters="clr-namespace:Tango.PPC.Maintenance.Converters" + xmlns:localControls="clr-namespace:Tango.PPC.Maintenance.Controls" xmlns:local="clr-namespace:Tango.PPC.Maintenance.Views" mc:Ignorable="d" d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MaintenanceViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MaintenanceViewVM}"> @@ -171,10 +173,24 @@ - - OPEN DYEING HEAD LEAD + - CLOSE DYEING HEAD LEAD + + + + + + + + + + + + + + + + RESET THREAD LOADING EXPORT SYSTEM LOGS -- cgit v1.3.1 From 2009e374e82aa54c122d10f3c00a7defddab3a4c Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 5 Mar 2020 18:31:05 +0200 Subject: Fixed issue with job mixing. Fixed issue with LogViewer scroll and session logs. --- Software/DB/Scripts/Select With Local Datetime.sql | 2 + .../Machine Studio Installer.aip | 9 ++-- .../PPC Installer-cache/cacheIndex.txt | Bin 52 -> 52 bytes .../Advanced Installer Projects/PPC Installer.aip | 46 +++++++++++++++++++-- .../Properties/AssemblyInfo.cs | 2 +- .../PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs | 2 +- .../Tango.Integration/Operation/MachineOperator.cs | 24 +++++++++++ .../Tango.RemoteDesktop/Tango.RemoteDesktop.csproj | 1 + .../Tango.LogViewer.UI/LogViewerManager.cs | 2 +- .../Utilities/Tango.LogViewer.UI/MainWindow.xaml | 4 +- 10 files changed, 81 insertions(+), 11 deletions(-) create mode 100644 Software/DB/Scripts/Select With Local Datetime.sql (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/DB/Scripts/Select With Local Datetime.sql b/Software/DB/Scripts/Select With Local Datetime.sql new file mode 100644 index 000000000..f0c22ea91 --- /dev/null +++ b/Software/DB/Scripts/Select With Local Datetime.sql @@ -0,0 +1,2 @@ +SELECT CONVERT(datetime, SWITCHOFFSET(START_DATE, DATEPART(TZOFFSET, +START_DATE AT TIME ZONE 'Israel Standard Time'))) as LOCAL_TIME, * FROM JOB_RUNS ORDER BY START_DATE DESC \ No newline at end of file diff --git a/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip b/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip index a1d8353fe..29f744ef6 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip +++ b/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip @@ -16,10 +16,10 @@ - + - + @@ -360,6 +360,7 @@ + @@ -799,6 +800,7 @@ + @@ -810,7 +812,7 @@ - + @@ -1272,6 +1274,7 @@ + diff --git a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt index 993ced97e..a603ff06b 100644 Binary files a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt and b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt differ diff --git a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip index e3bea2a1b..4abc93ae4 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip +++ b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip @@ -18,10 +18,10 @@ - + - + @@ -45,6 +45,8 @@ + + @@ -106,6 +108,7 @@ + @@ -118,6 +121,10 @@ + + + + @@ -172,6 +179,7 @@ + @@ -182,8 +190,14 @@ + + + + + + @@ -409,6 +423,20 @@ + + + + + + + + + + + + + + @@ -418,7 +446,7 @@ - + @@ -660,6 +688,18 @@ + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index 9f7d786bc..edf619f2f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("4.1.2.0")] +[assembly: AssemblyVersion("4.1.4.0")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index 01ccc7654..11a400fd3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango PPC Application")] -[assembly: AssemblyVersion("1.1.5.0")] +[assembly: AssemblyVersion("1.1.6.0")] diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 96c8e5ccf..9768498c6 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -2354,6 +2354,12 @@ namespace Tango.Integration.Operation ThreadFactory.StartNew(async () => { + if (handler.IsCanceled) + { + Status = MachineStatuses.ReadyToDye; + return; + } + Status = MachineStatuses.GettingReady; RunningJob = clonedJob; OnPrintingStarted(handler, clonedJob); @@ -2429,6 +2435,12 @@ namespace Tango.Integration.Operation LogManager.Log($"Job upload method is set to {JobUploadStrategy}..."); + if (handler.IsCanceled) + { + Status = MachineStatuses.ReadyToDye; + return; + } + var oldKeepAlive = UseKeepAlive; if (JobUploadStrategy == JobUploadStrategy.JobDescriptionFile) @@ -2449,9 +2461,21 @@ namespace Tango.Integration.Operation Message = "Uploading job description file...", }); + if (handler.IsCanceled) + { + Status = MachineStatuses.ReadyToDye; + return; + } + LogManager.Log("Creating storage API manager..."); var storage = CreateStorageManager(); + if (handler.IsCanceled) + { + Status = MachineStatuses.ReadyToDye; + return; + } + //Suppress keep alive while job uploads. //storage.SuppressKeepAliveWhileFileUploads = true; UseKeepAlive = false; //This is a work around for Shlomo not managing to keep alive while parsing the file. diff --git a/Software/Visual_Studio/Tango.RemoteDesktop/Tango.RemoteDesktop.csproj b/Software/Visual_Studio/Tango.RemoteDesktop/Tango.RemoteDesktop.csproj index dfffe90ec..2aad073cb 100644 --- a/Software/Visual_Studio/Tango.RemoteDesktop/Tango.RemoteDesktop.csproj +++ b/Software/Visual_Studio/Tango.RemoteDesktop/Tango.RemoteDesktop.csproj @@ -30,6 +30,7 @@ TRACE prompt 4 + true diff --git a/Software/Visual_Studio/Utilities/Tango.LogViewer.UI/LogViewerManager.cs b/Software/Visual_Studio/Utilities/Tango.LogViewer.UI/LogViewerManager.cs index 9c385b387..3615eb50a 100644 --- a/Software/Visual_Studio/Utilities/Tango.LogViewer.UI/LogViewerManager.cs +++ b/Software/Visual_Studio/Utilities/Tango.LogViewer.UI/LogViewerManager.cs @@ -64,7 +64,7 @@ namespace Tango.LogViewer.UI logfileName = logfileName.Substring(0, indexPos); } - String dateString = System.IO.Path.GetFileNameWithoutExtension(filePath).Replace($"{fileName}-", ""); + String dateString = System.IO.Path.GetFileNameWithoutExtension(filePath).Replace($"{fileName}-", "").Replace("_session", ""); indexPos = dateString.IndexOf(FileLogger.FILE_SET_EXTENSION); int indexOfFile = 0; CountOfSet = 0; diff --git a/Software/Visual_Studio/Utilities/Tango.LogViewer.UI/MainWindow.xaml b/Software/Visual_Studio/Utilities/Tango.LogViewer.UI/MainWindow.xaml index 952fb853b..f1c947402 100644 --- a/Software/Visual_Studio/Utilities/Tango.LogViewer.UI/MainWindow.xaml +++ b/Software/Visual_Studio/Utilities/Tango.LogViewer.UI/MainWindow.xaml @@ -219,7 +219,7 @@ -