From db81ac5eb4b912bc23b45e33c7d3d909b5c0636e Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Wed, 26 Mar 2025 06:45:03 +0200 Subject: Final touches on X1. --- .../Tango.FSE.Statistics/ViewModels/MainViewVM.cs | 13 +- .../Modules/Tango.PPC.JobsV2/ViewModelLocator.cs | 14 +- .../Tango.PPC.JobsV2/ViewModels/MainViewVM.cs | 8 + .../Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs | 203 ++++++++++++++++++--- .../PPC/Tango.PPC.UI/Views/MachineStatusView.xaml | 12 +- .../Visual_Studio/PPC/Tango.PPC.UI/app.manifest | 2 +- .../Tango.Integration/Operation/MachineOperator.cs | 2 +- ...larm events handling chart_TS_and_X4_Rev20.xlsx | Bin 0 -> 108135 bytes ...larm events handling chart_TS_and_X4_Rev23.xlsx | Bin 0 -> 108255 bytes ...larm events handling chart_TS_and_X4_Rev24.xlsx | Bin 0 -> 106314 bytes .../Tango.EventsTypesGenerator/Program.cs | 2 +- .../Tango.EventsTypesGenerator.csproj | 9 + 12 files changed, 221 insertions(+), 44 deletions(-) create mode 100644 Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Eureka BB alarm events handling chart_TS_and_X4_Rev20.xlsx create mode 100644 Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Eureka BB alarm events handling chart_TS_and_X4_Rev23.xlsx create mode 100644 Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Eureka BB alarm events handling chart_TS_and_X4_Rev24.xlsx (limited to 'Software/Visual_Studio') diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs index a45f65a54..85b7002a5 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs @@ -8,6 +8,7 @@ using System.Data.Entity; using System.Diagnostics; using System.IO; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Windows; @@ -507,6 +508,7 @@ namespace Tango.FSE.Statistics.ViewModels SeriesCollection seriesCollection = new SeriesCollection(); List liquidQuantities = new List(); + Dictionary jobRunProperties = new Dictionary(); foreach (var liquidType in _liquidTypes.ToList()) { @@ -515,13 +517,22 @@ namespace Tango.FSE.Statistics.ViewModels LiquidType = liquidType, Quantity = 0 }); + + jobRunProperties.Add(liquidType.Type, typeof(JobRunDTO).GetProperty(liquidType.Type.ToString() + "Quantity")); } foreach (var stop in Stops) { foreach (var quantity in liquidQuantities) { - quantity.Quantity += (double)typeof(JobRun).GetProperty(quantity.LiquidType.Type.ToString() + "Quantity").GetValue(stop.JobRun); + try + { + quantity.Quantity += (double)jobRunProperties[quantity.LiquidType.Type].GetValue(stop.JobRun); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error on summaries for liquid type {quantity.LiquidType.Type}."); + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModelLocator.cs index 2004d60b7..d3aa7d485 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModelLocator.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModelLocator.cs @@ -22,10 +22,7 @@ namespace Tango.PPC.Jobs TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); - if (TangoIOC.Default.GetInstance().BuildType == BuildType.TS1800) - { - TangoIOC.Default.Register(); - } + TangoIOC.Default.Register(); TangoIOC.Default.Register(); } @@ -91,7 +88,14 @@ namespace Tango.PPC.Jobs { get { - return TangoIOC.Default.GetInstance(); + if (TangoIOC.Default.GetInstance().BuildType == BuildType.TS1800) + { + return TangoIOC.Default.GetInstance(); + } + else + { + return null; + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/MainViewVM.cs index 1ceb47ebd..5e0d36da5 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/MainViewVM.cs @@ -151,6 +151,14 @@ namespace Tango.PPC.Jobs.ViewModels } else { + if (BuildProvider.MachineType.IsXMachine()) + { + foreach (var item in NotificationProvider.NotificationItems.Where(x => x.CanClose).ToList()) + { + NotificationProvider.PopNotification(item); + } + } + NotificationProvider.PushNotification(new MessageNotificationItem(String.Format("'{0}' completed successfully", e.Job.Name), "Tap to view this job details.", MessageNotificationItem.MessageNotificationItemTypes.Success, () => { NavigationManager.NavigateWithObject(new JobNavigationObject() { Job = e.Job }); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs index 07c5f77ed..2faee12ac 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs @@ -32,6 +32,7 @@ using Tango.Core.ExtensionMethods; using Tango.PPC.Common.Printing; using Tango.PPC.Common.RemoteJob; using Tango.PPC.UI.Dialogs; +using Tango.ColorConversion; namespace Tango.PPC.UI.ViewModels { @@ -76,6 +77,9 @@ namespace Tango.PPC.UI.ViewModels private DispatcherTimer _productiondata_timer; private bool startingJob = false; private bool _jerricanDialogShowing; + private List _colorSpaces; + private bool _conversion_Busy; + private bool _printingEnded; #region Properties @@ -180,14 +184,28 @@ namespace Tango.PPC.UI.ViewModels if (_currentBrushStop != value) { _currentBrushStop = value; - - OnUpdateCurrentBrush(); } } } - public JobBrushStop JobBrushStop { get; set; } + private JobBrushStop _jobBrushStop; + public JobBrushStop JobBrushStop + { + get { return _jobBrushStop; } + set + { + if (_jobBrushStop != value) + { + _jobBrushStop = value; + if (_jobBrushStop != null) + { + UpdateOutputLiquids(); + } + } + } + } + //public double TransparentInkOutput //{ @@ -392,7 +410,7 @@ namespace Tango.PPC.UI.ViewModels AbortCommand = new RelayCommand(AbortJob, () => CanStopped()); ResumeCommand = new RelayCommand(ResumeJob, () => MachineProvider.MachineOperator.CanPrint); - CaancelJobCommand = new RelayCommand(CaancelJob); + CaancelJobCommand = new RelayCommand(CancelJob); RestartJobCommand = new RelayCommand(RestartJob, () => MachineProvider.MachineOperator.CanPrint); ClearJobCommand = new RelayCommand(ClearJob); @@ -585,7 +603,7 @@ namespace Tango.PPC.UI.ViewModels #region printing - public override void OnApplicationStarted() + public override async void OnApplicationStarted() { MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted; MachineProvider.MachineOperator.PrintingEnded += MachineOperator_PrintingEnded; @@ -595,6 +613,18 @@ namespace Tango.PPC.UI.ViewModels JobResumeManager.JobResumeUpdated += JobResumeManager_JobResumeUpdated; JobResumeManager.JobResumeDropped += JobResumeManager_JobResumeDropped; + + try + { + using (var db = ObservablesContext.CreateDefault()) + { + _colorSpaces = await db.ColorSpaces.ToListAsync(); + } + } + catch (Exception ex) + { + LogManager.Log(ex); + } } @@ -605,8 +635,11 @@ namespace Tango.PPC.UI.ViewModels private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e) { + _printingEnded = false; _handler = e.JobHandler; Job = e.Job; + CurrentBrushStop = null; + JobBrushStop = null; List outputs = new List(); @@ -647,8 +680,6 @@ namespace Tango.PPC.UI.ViewModels StopCommand.RaiseCanExecuteChanged(); AbortCommand.RaiseCanExecuteChanged(); }); - - } private void JobHandler_Stopped(object sender, EventArgs e) @@ -665,6 +696,14 @@ namespace Tango.PPC.UI.ViewModels private void MachineOperator_PrintingEnded(object sender, PrintingEventArgs e) { + _printingEnded = true; + + try + { + CurrentBrushStop = RunningJobStatus.CurrentSegment.BrushStops.OrderBy(x => x.StopIndex).Last(); + } + catch { } + LogManager.Log("Printing ended"); InvokeUI(() => { @@ -674,7 +713,7 @@ namespace Tango.PPC.UI.ViewModels }); } - private void JobHandler_StatusChanged(object sender, RunningJobStatus e) + private async void JobHandler_StatusChanged(object sender, RunningJobStatus e) { RunningJobStatus = e; if (RunningJobStatus != null && RunningJobStatus.IsFailed) @@ -689,41 +728,142 @@ namespace Tango.PPC.UI.ViewModels IsDyeingProcess = (RunningJobStatus != null && RunningJobStatus.CurrentSegment != null); if (RunningJobStatus != null && RunningJobStatus.CurrentSegment != null) { - if (_runningJobStatus.CurrentSegment.IsInterSegment) - { - CurrentBrushStop = _runningJobStatus.CurrentSegment.BrushStops.FirstOrDefault(); - JobBrushStop = null; - } - else + try { - var realsegmIndex = 1; - if (Job.EnableInterSegment && Job.InterSegmentLength > 0) + if (_runningJobStatus.CurrentSegment.IsInterSegment) { - int segmentIndex = _runningJobStatus.CurrentSegment.SegmentIndex - (Job.EffectiveSegments.Count * RunningJobStatus.CurrentUnit); - if (RunningJobStatus.CurrentUnit > 0) + var stop = _runningJobStatus.CurrentSegment.BrushStops.FirstOrDefault(); + stop.ColorSpace = CurrentBrushStop.ColorSpace; + CurrentBrushStop = stop; + JobBrushStop = null; + } + else + { + var realsegmIndex = 1; + if (Job.EnableInterSegment && Job.InterSegmentLength > 0) + { + int segmentIndex = _runningJobStatus.CurrentSegment.SegmentIndex - (Job.EffectiveSegments.Count * RunningJobStatus.CurrentUnit); + if (RunningJobStatus.CurrentUnit > 0) + { + segmentIndex -= RunningJobStatus.CurrentUnit;// inter segment between units + } + realsegmIndex = (int)(segmentIndex / 2) + 1; + } + else + { + realsegmIndex = Math.Max(_runningJobStatus.CurrentSegment.SegmentIndex - (Job.Segments.Count * RunningJobStatus.CurrentUnit), 0); + } + + var segment = Job.Segments.FirstOrDefault(x => x.SegmentIndex == realsegmIndex); + JobSegment jobSegment = null; + + if (segment != null) { - segmentIndex -= RunningJobStatus.CurrentUnit;// inter segment between units + if (_handler.JobTicket.Segments.Count > 0) + { + jobSegment = _handler.JobTicket.Segments[Job.OrderedSegments.IndexOf(segment)]; + if (jobSegment.BrushStops.Count == 1) + { + JobBrushStop = jobSegment.BrushStops.First(); + } + else if (jobSegment.BrushStops.Count > 1) + { + JobBrushStop = jobSegment.BrushStops.Last(x => x.OffsetMeters <= e.CurrentSegment.Progress); + } + else + { + JobBrushStop = null; + } + } + } + + + if (segment != null && jobSegment != null && jobSegment.BrushStops.Count > 1) + { + if (!_conversion_Busy) + { + var brushStop = RunningJobStatus.CurrentSegment.FirstBrushStop; + await ApplyJobBrushStopToBrushStop(JobBrushStop, brushStop); + + if (!_printingEnded) + { + _currentBrushStop = brushStop; + RaisePropertyChanged(nameof(CurrentBrushStop)); + } + } + } + else + { + CurrentBrushStop = RunningJobStatus.CurrentSegment.FirstBrushStop; } - realsegmIndex = (int)(segmentIndex / 2) + 1; } - else + } + catch (Exception ex) + { + LogManager.Log(ex, "Error displaying job progress input output."); + } + } + } + + private async Task ApplyJobBrushStopToBrushStop(JobBrushStop stop, BrushStop s) + { + _conversion_Busy = true; + + try + { + foreach (var dispenser in stop.Dispensers) + { + s.SetVolume(dispenser.Index, dispenser.Volume); + } + + s.SetLiquidVolumes(MachineProvider.Machine.Configuration, Job.Rml, MachineProvider.MachineOperator.CurrentProcessParameters); + + foreach (var liquidVolume in s.LiquidVolumes.Where(x => x.IdsPack.LiquidType.IsLightInk && x.Volume > 0).ToList()) + { + var darkInk = s.LiquidVolumes.FirstOrDefault(x => x.IdsPack.LiquidType.Code == liquidVolume.IdsPack.LiquidType.DarkInkCode); + if (darkInk != null) { - realsegmIndex = Math.Max(_runningJobStatus.CurrentSegment.SegmentIndex - (Job.Segments.Count * RunningJobStatus.CurrentUnit), 0); + darkInk.Volume = liquidVolume.Volume / 10d; + liquidVolume.Volume = 0; } + } - var segment = Job.Segments.FirstOrDefault(x => x.SegmentIndex == realsegmIndex); - if (segment != null) + if (_colorSpaces != null) + { + if ((s.BrushColorSpace == ColorSpaces.RGB || s.BrushColorSpace == ColorSpaces.LAB) && (!s.IsLast && !s.IsFirst)) { - if (_handler.JobTicket.Segments.Count > 0) + var converter = new DefaultColorConverter(); + + var previousSpace = s.ColorSpace; + s.SetColorSpaceSilent(_colorSpaces.First(x => x.Space == ColorSpaces.Volume)); + + try { - JobBrushStop = _handler.JobTicket.Segments[Job.OrderedSegments.IndexOf(segment)].BrushStops.First(); + var output = await converter.ConvertAsync(s, false, false); + s.SetColorSpaceSilent(previousSpace); + if (!_printingEnded) + { + output.ApplyOnBrushStop(s, MachineProvider.MachineOperator.CurrentProcessParameters); + } + } + catch (Exception ex) + { + s.SetColorSpaceSilent(previousSpace); + throw ex; } } - CurrentBrushStop = RunningJobStatus.CurrentSegment.FirstBrushStop; } + + _conversion_Busy = false; + } + catch (Exception ex) + { + _conversion_Busy = false; + throw ex; } } + private void JobHandler_CanCancelChanged(object sender, EventArgs e) { InvokeUI(() => @@ -874,7 +1014,7 @@ namespace Tango.PPC.UI.ViewModels } } - private void CaancelJob() + private void CancelJob() { ClearJob(); } @@ -908,10 +1048,15 @@ namespace Tango.PPC.UI.ViewModels protected void OnUpdateCurrentBrush() { - CurrentBrushStop.SetLiquidVolumes(MachineProvider.Machine.Configuration, Job.Rml, MachineProvider.MachineOperator.CurrentProcessParameters); + CurrentBrushStop?.SetLiquidVolumes(MachineProvider.Machine.Configuration, Job.Rml, MachineProvider.MachineOperator.CurrentProcessParameters); RaisePropertyChanged(nameof(CurrentBrushStop)); + UpdateOutputLiquids(); + } + + private void UpdateOutputLiquids() + { foreach (var output in LiquidOutputs) { output.Volume = GetVolumeLiquidType(output.LiquidType.Type); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml index 39adb7bdd..a269c590d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml @@ -68,19 +68,19 @@ - + - + - + @@ -90,18 +90,18 @@ - + - + - + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index d72e75011..efc5f8179 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - + diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index e8ef93edd..5bece20cd 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -3280,7 +3280,7 @@ namespace Tango.Integration.Operation resumePreProgress = config.ResumeConfig.GlobalStartPosition - config.ResumeConfig.FirstUnitStartPosition;//- processParameters.DryerBufferLengthMeters; - request.FirstUnitStartPosition = config.ResumeConfig.FirstUnitStartPosition; + request.FirstUnitStartPosition = config.ResumeConfig.FirstUnitStartPosition + processParameters.DryerBufferLengthMeters; //LogManager.Log($" resumePreProgress = {resumePreProgress}, GlobalStartPosition {config.ResumeConfig.GlobalStartPosition} FirstUnitStartPosition {request.FirstUnitStartPosition}"); request.JobTicket.Length = (request.JobTicket.Length / Math.Max(request.JobTicket.NumberOfUnits, 1)) * (int)Math.Max(config.ResumeConfig.RemainingUnits, 1); diff --git a/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Eureka BB alarm events handling chart_TS_and_X4_Rev20.xlsx b/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Eureka BB alarm events handling chart_TS_and_X4_Rev20.xlsx new file mode 100644 index 000000000..4a31bb708 Binary files /dev/null and b/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Eureka BB alarm events handling chart_TS_and_X4_Rev20.xlsx differ diff --git a/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Eureka BB alarm events handling chart_TS_and_X4_Rev23.xlsx b/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Eureka BB alarm events handling chart_TS_and_X4_Rev23.xlsx new file mode 100644 index 000000000..330ab3dbb Binary files /dev/null and b/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Eureka BB alarm events handling chart_TS_and_X4_Rev23.xlsx differ diff --git a/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Eureka BB alarm events handling chart_TS_and_X4_Rev24.xlsx b/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Eureka BB alarm events handling chart_TS_and_X4_Rev24.xlsx new file mode 100644 index 000000000..ea1b1b5b4 Binary files /dev/null and b/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Eureka BB alarm events handling chart_TS_and_X4_Rev24.xlsx differ diff --git a/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Program.cs b/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Program.cs index 44605d492..3eeb5613f 100644 --- a/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Program.cs +++ b/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Program.cs @@ -16,7 +16,7 @@ namespace Tango.EventsTypesGenerator { class Program { - private static string EVENTS_FILE = "Eureka BB alarm events handling chart_TS_and_X4_Rev18.xlsx"; + private static string EVENTS_FILE = "Eureka BB alarm events handling chart_TS_and_X4_Rev24.xlsx"; private class ExcelEventType { diff --git a/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Tango.EventsTypesGenerator.csproj b/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Tango.EventsTypesGenerator.csproj index 57036f670..e2959a6f9 100644 --- a/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Tango.EventsTypesGenerator.csproj +++ b/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Tango.EventsTypesGenerator.csproj @@ -82,6 +82,15 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + PreserveNewest -- cgit v1.3.1