From a4d52e6779fc90934c22b94e53d41d42bef3626e Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 5 Mar 2019 16:58:38 +0200 Subject: Some improvements to PPC. Fixed issue with database constraint of dispensers <=> IDS_PACKS. --- .../PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs index 5b4a3e403..7026a6ebc 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs @@ -9,6 +9,7 @@ using Tango.Integration.Operation; using Tango.PPC.Common; using Tango.PPC.Common.Notifications; using Tango.PPC.Common.Notifications.NotificationItems; +using Tango.PPC.Jobs.Messages; using Tango.PPC.Jobs.NavigationObjects; using Tango.PPC.Jobs.Views; @@ -79,5 +80,11 @@ namespace Tango.PPC.Jobs.ViewModels })); } } + + public override void OnNavigatedTo() + { + base.OnNavigatedTo(); + RaiseMessage(); + } } } -- cgit v1.3.1 From 09eabd45ecf65d6f900b9d53428e7576bdc4d825 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Thu, 18 Apr 2019 22:19:59 +0300 Subject: Implemented resume job on PPC. Fixed resume job on emulator. Fixed an issue with PPC event logger. Added getting ready status to machine operator. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../Build/Shortcuts/Machine Emulator.lnk | Bin 1445 -> 1530 bytes .../Tango.PPC.Jobs/ViewModels/MainViewVM.cs | 34 +++++++++++++++++++++ .../EventLogging/DefaultEventLogger.cs | 25 ++++++++++++++- .../Tango.Emulations/Emulators/MachineEmulator.cs | 4 +-- .../Tango.Integration/Operation/MachineOperator.cs | 19 ++++++++++-- 7 files changed, 77 insertions(+), 5 deletions(-) (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 84eb6afc9..724b8c150 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index f3b9858f1..a2be2cb15 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk index 7417e4f31..697cc906e 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs index 7026a6ebc..d72f4544a 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Builders; using Tango.BL.Entities; using Tango.BL.Enumerations; using Tango.Integration.Operation; @@ -28,6 +30,38 @@ namespace Tango.PPC.Jobs.ViewModels { MachineProvider.MachineOperator.PrintingCompleted += MachineOperator_PrintingCompleted; MachineProvider.MachineOperator.PrintingFailed += MachineOperator_PrintingFailed; + MachineProvider.MachineOperator.ResumingJob += MachineOperator_ResumingJob; + } + + private async void MachineOperator_ResumingJob(object sender, ResumingJobEventArgs e) + { + LogManager.Log($"Trying to resume job '{e.JobGuid}'..."); + + try + { + var job = await new JobBuilder(ObservablesContext.CreateDefault()).Set(e.JobGuid) + .WithConfiguration() + .WithRML() + .WithUser() + .WithSegments() + .WithBrushStops() + .BuildAsync(); + + e.Approve(job); + + InvokeUI(() => + { + NavigationManager.NavigateTo(nameof(JobProgressView)); + }); + } + catch (Exception ex) + { + LogManager.Log(ex, "An error occurred while trying to resume the job."); + InvokeUI(() => + { + NotificationProvider.ShowError("An error occurred while trying to resume a job in progress."); + }); + } } /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs index d540e3fd3..25eb2df04 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs @@ -79,6 +79,7 @@ namespace Tango.PPC.Common.EventLogging _machineProvider.MachineOperator.RequestSent += Machine_RequestSent; _machineProvider.MachineOperator.RequestFailed += Machine_RequestFailed; _machineProvider.MachineOperator.ResponseReceived += Machine_ResponseReceived; + _machineProvider.MachineOperator.StateChanged += MachineOperator_StateChanged; } #endregion @@ -113,6 +114,20 @@ namespace Tango.PPC.Common.EventLogging #region Event Handlers + /// + /// Handles the machine operator state changed event. + /// + /// The sender. + /// The e. + private void MachineOperator_StateChanged(object sender, Transport.TransportComponentState e) + { + if (e == Transport.TransportComponentState.Connected) + { + _events = new ConcurrentQueue(); + _currentEvents.Clear(); + } + } + /// /// Handles the RequestSent event of the connected machine. /// @@ -212,7 +227,15 @@ namespace Tango.PPC.Common.EventLogging machineEvent.UserGuid = _authentication.CurrentUser.Guid; machineEvent.User = _authentication.CurrentUser; _events.Enqueue(machineEvent); - _currentEvents.Add(machineEvent); + + if (!_currentEvents.Exists(x => x.Type == machineEvent.Type)) + { + if (machineEvent.Group != EventTypeGroups.Application && machineEvent.Group != EventTypeGroups.Transport) + { + _currentEvents.Add(machineEvent); + } + } + EventReceived?.Invoke(this, machineEvent); } } diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index f1d9487ff..8b83f1f73 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -606,7 +606,7 @@ namespace Tango.Emulations.Emulators Transporter.SendResponse(new ResumeCurrentJobResponse() { - }, request.Container.Token, false, ErrorCode.ContinuousResponseAborted); + }, _current_job_resume_token, false, ErrorCode.ContinuousResponseAborted); } } else @@ -631,7 +631,7 @@ namespace Tango.Emulations.Emulators Progress = job.Length + job.ProcessParameters.DryerBufferLength, } - }, request.Container.Token, !_cancelJob); + }, _current_job_resume_token, !_cancelJob); } } }); diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 2672b2d0f..dd0872898 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -226,7 +226,7 @@ namespace Tango.Integration.Operation { get { - return Status == MachineStatuses.Printing; + return Status == MachineStatuses.Printing || Status == MachineStatuses.GettingReady; } } @@ -862,12 +862,27 @@ namespace Tango.Integration.Operation if (!responseLogged) { + Status = MachineStatuses.GettingReady; responseLogged = true; - Status = MachineStatuses.Printing; RunningJob = originalJob; PrintingStarted?.Invoke(this, new PrintingEventArgs(handler, originalJob)); LogResponseReceived(response.Message); } + + if (JobHandlingMode == JobHandlerModes.SettingUp) + { + if (response.Message.Status.Progress > jobTicket.ProcessParameters.DryerBufferLength) + { + Status = MachineStatuses.Printing; + } + } + else + { + if (response.Message.Status.Progress > 0) + { + Status = MachineStatuses.Printing; + } + } }, (ex) => { if (!(ex is ContinuousResponseAbortedException)) -- cgit v1.3.1 From f95997c235bab4106f4bdfa33b4b8adb9921bb48 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 23 Apr 2019 12:21:12 +0300 Subject: Added guidance to event types. Implemented general event view on PPC. Improved job resume tracking. Improved job resume on PPC. Added corruption emulation to machine emulator. --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes Software/DB/TCC/TCC.mdf | Bin 8388608 -> 8388608 bytes Software/DB/TCC/TCC_log.ldf | Bin 8388608 -> 8388608 bytes .../Build/Shortcuts/Machine Emulator.lnk | Bin 1530 -> 1445 bytes .../Tango.PPC.Events/EventsViews/GeneralView.xaml | 25 +++- .../Tango.PPC.Events/Images/machine_small.png | Bin 0 -> 37734 bytes .../Tango.PPC.Events/Tango.PPC.Events.csproj | 5 +- .../Tango.PPC.Events/ViewModels/MainViewVM.cs | 2 +- .../Modules/Tango.PPC.Events/Views/MainView.xaml | 4 +- .../Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs | 2 + .../Tango.PPC.Jobs/ViewModels/MainViewVM.cs | 10 +- .../Connection/DefaultMachineProvider.cs | 10 +- .../PPC/Tango.PPC.Common/Resources/Merged.xaml | 1 + .../Visual_Studio/Tango.BL/DTO/EventTypeDTOBase.cs | 8 ++ .../Tango.BL/Entities/EventTypeBase.cs | 38 ++++++ .../Tango.DAL.Remote/DB/EVENT_TYPES.cs | 1 + .../Tango.DAL.Remote/DB/RemoteADO.edmx | 3 + .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 140 ++++++++++----------- .../Tango.Emulations/Emulators/MachineEmulator.cs | 72 +++++++---- .../Tango.Integration/Operation/JobHandler.cs | 2 +- .../Tango.Integration/Operation/MachineOperator.cs | 12 +- .../Converters/StringToLinesConverter.cs | 32 +++++ .../Tango.SharedUI/Tango.SharedUI.csproj | 3 +- .../Visual_Studio/Tango.Transport/ITransporter.cs | 5 + .../Tango.Transport/TransporterBase.cs | 8 +- Software/Visual_Studio/Tango.sln | 12 +- .../Tango.EventsTypesGenerator/Program.cs | 1 + .../Tango.MachineEM.UI/Views/MainView.xaml | 1 + 29 files changed, 282 insertions(+), 115 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Images/machine_small.png create mode 100644 Software/Visual_Studio/Tango.SharedUI/Converters/StringToLinesConverter.cs (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index 87b59afc3..385ec2708 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index 79746966d..c94ea41e5 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/TCC/TCC.mdf b/Software/DB/TCC/TCC.mdf index 7670a3170..488624b20 100644 Binary files a/Software/DB/TCC/TCC.mdf and b/Software/DB/TCC/TCC.mdf differ diff --git a/Software/DB/TCC/TCC_log.ldf b/Software/DB/TCC/TCC_log.ldf index 1cf272342..6e8a53f2e 100644 Binary files a/Software/DB/TCC/TCC_log.ldf and b/Software/DB/TCC/TCC_log.ldf differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk index 697cc906e..10e5b56da 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/EventsViews/GeneralView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/EventsViews/GeneralView.xaml index edec8cb55..8ba021afb 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/EventsViews/GeneralView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/EventsViews/GeneralView.xaml @@ -3,10 +3,29 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" xmlns:local="clr-namespace:Tango.PPC.Events.EventsViews" mc:Ignorable="d" - d:DesignHeight="450" d:DesignWidth="800"> - - + d:DesignHeight="220" d:DesignWidth="750" d:DataContext="{d:DesignInstance Type=entities:MachinesEvent, IsDesignTimeCreatable=False}"> + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Images/machine_small.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Images/machine_small.png new file mode 100644 index 000000000..8b86bfe25 Binary files /dev/null and b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Images/machine_small.png differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj index 815223834..e446e3812 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj @@ -167,10 +167,13 @@ + + + - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs index 9ee24ad38..49e0763d9 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs @@ -132,7 +132,7 @@ namespace Tango.PPC.Events.ViewModels var notificationItem = new MessageNotificationItem(); notificationItem.CanClose = false; notificationItem.Message = ev.EventType.Title; - notificationItem.ExpandedMessage = ev.Description; + notificationItem.ExpandedMessage = ev.EventType.Description; notificationItem.Pressed += async (_, __) => { SelectedEventsSource = EventsSource.CURRENT; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml index 3477a5349..af42a5576 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml @@ -83,7 +83,7 @@ - + @@ -168,7 +168,7 @@ - + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs index d37ce7583..103a10b28 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs @@ -141,6 +141,8 @@ namespace Tango.PPC.Jobs.ViewModels e.JobHandler.StatusChanged += JobHandler_StatusChanged; e.JobHandler.SpoolChangeRequired += JobHandler_SpoolChangeRequired; e.JobHandler.Stopped += JobHandler_Stopped; + + _stop_job_btn.Push(); } /// diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs index d72f4544a..ed1e28f55 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs @@ -23,6 +23,8 @@ namespace Tango.PPC.Jobs.ViewModels /// public class MainViewVM : PPCViewModel { + private NotificationItem _last_failed_job_notification; + /// /// Called when the application has been started. /// @@ -52,6 +54,12 @@ namespace Tango.PPC.Jobs.ViewModels InvokeUI(() => { NavigationManager.NavigateTo(nameof(JobProgressView)); + + if (_last_failed_job_notification != null) + { + _last_failed_job_notification.Close(); + _last_failed_job_notification = null; + } }); } catch (Exception ex) @@ -71,7 +79,7 @@ namespace Tango.PPC.Jobs.ViewModels /// The instance containing the event data. private void MachineOperator_PrintingFailed(object sender, PrintingFailedEventArgs e) { - NotificationProvider.PushNotification(new MessageNotificationItem( + _last_failed_job_notification = NotificationProvider.PushNotification(new MessageNotificationItem( String.Format("'{0}' failed.", e.Job.Name), String.Format("The job '{1}' has failed due to unexpected error.{0}{2}{0}{0}Tap to view this job details.", Environment.NewLine, e.Job.Name, e.Exception), MessageNotificationItem.MessageNotificationItemTypes.Error, () => { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs index 3ffb6f634..61ddfdb2b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs @@ -119,7 +119,15 @@ namespace Tango.PPC.Common.Connection MachineOperator.Adapter = response.Adapter; MachineOperator.JobHandlingMode = JobHandlerModes.SettingUp; LogManager.Log("Connecting machine operator...", LogCategory.Debug); - await MachineOperator.Connect(); + try + { + await MachineOperator.Connect(); + } + catch (Exception) + { + await response.Adapter.Disconnect(); + throw; + } await Task.Delay(1000); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml index 62f248a8c..b5b9f9b23 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml @@ -48,6 +48,7 @@ +