From c03fb4a1b2aadd8952b321d08ca840e55fcee72d Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sun, 14 Jul 2024 23:06:47 +0300 Subject: Revision of statistics and resumed jobs. --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../Controls/RangeProgressBar.cs | 81 +++++++++ .../Tango.FSE.Statistics/Models/StopModel.cs | 33 ++++ .../Tango.FSE.Statistics.csproj | 1 + .../Tango.FSE.Statistics/Themes/Generic.xaml | 17 ++ .../Tango.FSE.Statistics/ViewModels/MainViewVM.cs | 4 +- .../Tango.FSE.Statistics/Views/MainView.xaml | 17 +- .../Models/JobRunModel.cs | 36 ++++ .../ViewModels/JobRunsViewVM.cs | 12 +- .../Views/JobRunsView.xaml | 35 ++-- .../Tango.PPC.JobsV2/ViewModels/JobViewVM.cs | 1 + .../Printing/PrintingConfiguration.cs | 1 + .../Resume/DefaultJobResumeManager.cs | 1 + .../PPC/Tango.PPC.Common/Resume/JobResumeModel.cs | 2 + .../Statistics/JobRunComposition.cs | 24 +++ .../Printing/DefaultPrintingManager.cs | 1 + .../Visual_Studio/Tango.BL/DTO/JobRunDTOBase.cs | 16 ++ Software/Visual_Studio/Tango.BL/Entities/Job.cs | 4 + Software/Visual_Studio/Tango.BL/Entities/JobRun.cs | 13 ++ .../Visual_Studio/Tango.BL/Entities/JobRunBase.cs | 76 +++++++++ .../Visual_Studio/Tango.DAL.Remote/DB/JOB_RUNS.cs | 2 + .../Tango.DAL.Remote/DB/RemoteADO.edmx | 6 + .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 184 ++++++++++----------- .../JobRuns/BasicJobRunsLogger.cs | 2 + .../Operation/AdditionalJobConfiguration.cs | 1 + .../Tango.Integration/Operation/MachineOperator.cs | 5 + .../Tango.SharedUI/Controls/RangeProgressBar.cs | 92 +++++++++++ .../Tango.SharedUI/Tango.SharedUI.csproj | 3 +- .../Tango.SharedUI/Themes/Generic.xaml | 16 ++ .../Properties/AssemblyInfo.cs | 2 +- 33 files changed, 573 insertions(+), 115 deletions(-) create mode 100644 Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Controls/RangeProgressBar.cs create mode 100644 Software/Visual_Studio/Tango.SharedUI/Controls/RangeProgressBar.cs diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index 01314a149..c8371da66 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 b9f28e433..c909e3819 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index cb79ef227..53ba1c060 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 8d2f6a746..b3173ce13 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Controls/RangeProgressBar.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Controls/RangeProgressBar.cs new file mode 100644 index 000000000..0d18bb4ca --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Controls/RangeProgressBar.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +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.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.FSE.Diagnostics.Controls +{ + public class RangeProgressBar : Control + { + private Border _innerBorder; + private Border _outerBorder; + + static RangeProgressBar() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(RangeProgressBar), new FrameworkPropertyMetadata(typeof(RangeProgressBar))); + } + + public Brush FillBrush + { + get { return (Brush)GetValue(FillBrushProperty); } + set { SetValue(FillBrushProperty, value); } + } + public static readonly DependencyProperty FillBrushProperty = + DependencyProperty.Register("FillBrush", typeof(Brush), typeof(RangeProgressBar), new PropertyMetadata(Brushes.Red)); + + public double Maximum + { + get { return (double)GetValue(MaximumProperty); } + set { SetValue(MaximumProperty, value); } + } + public static readonly DependencyProperty MaximumProperty = + DependencyProperty.Register("Maximum", typeof(double), typeof(RangeProgressBar), new PropertyMetadata(100.0)); + + public double LowerValue + { + get { return (double)GetValue(LowerValueProperty); } + set { SetValue(LowerValueProperty, value); } + } + public static readonly DependencyProperty LowerValueProperty = + DependencyProperty.Register("LowerValue", typeof(double), typeof(RangeProgressBar), new PropertyMetadata(20.0)); + + public double UpperValue + { + get { return (double)GetValue(UpperValueProperty); } + set { SetValue(UpperValueProperty, value); } + } + public static readonly DependencyProperty UpperValueProperty = + DependencyProperty.Register("UpperValue", typeof(double), typeof(RangeProgressBar), new PropertyMetadata(80.0)); + + public override void OnApplyTemplate() + { + base.OnApplyTemplate(); + _innerBorder = GetTemplateChild("PART_InnerBorder") as Border; + _outerBorder = GetTemplateChild("PART_OuterBorder") as Border; + + PlaceInnerBorder(); + SizeChanged -= RangeProgressBar_SizeChanged; + SizeChanged += RangeProgressBar_SizeChanged; + } + + private void RangeProgressBar_SizeChanged(object sender, SizeChangedEventArgs e) + { + PlaceInnerBorder(); + } + + private void PlaceInnerBorder() + { + _innerBorder.Margin = new Thickness(LowerValue / Maximum * _outerBorder.ActualWidth, 0, _outerBorder.ActualWidth - (UpperValue / Maximum * _outerBorder.ActualWidth), 0); + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Models/StopModel.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Models/StopModel.cs index 3d616f957..d979fe55b 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Models/StopModel.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Models/StopModel.cs @@ -178,6 +178,31 @@ namespace Tango.FSE.Statistics.Models get { return IsEureka ? JobRun.EndPosition * 4 : JobRun.EndPosition; } } + public double ActualStartPosition + { + get { return IsEureka ? JobRun.ActualStartPosition * 4 : JobRun.ActualStartPosition; } + } + + public double ActualEndPosition + { + get + { + if (JobRun.ActualEndPosition > 0) + { + return IsEureka ? JobRun.ActualEndPosition * 4 : JobRun.ActualEndPosition; + } + else + { + return IsEureka ? JobRun.EndPosition * 4 : JobRun.EndPosition; + } + } + } + + public double ActualLength + { + get { return IsEureka ? JobRun.JobLogicalLength * 4 : JobRun.JobLogicalLength; } + } + public String FineTuningMeasured { get @@ -244,5 +269,13 @@ namespace Tango.FSE.Statistics.Models } private set { _fineTuningDeltaE = value; } } + + public double Distance + { + get + { + return ActualEndPosition - ActualStartPosition; + } + } } } diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Tango.FSE.Statistics.csproj b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Tango.FSE.Statistics.csproj index 3ca736b8a..fcfb157e6 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Tango.FSE.Statistics.csproj +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Tango.FSE.Statistics.csproj @@ -105,6 +105,7 @@ Controls\JobOutlineControl.cs + JobRunExtendedInfoView.xaml diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Themes/Generic.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Themes/Generic.xaml index 2c6475626..313a46355 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Themes/Generic.xaml +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Themes/Generic.xaml @@ -1,9 +1,26 @@  + + \ No newline at end of file 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 538e8a795..a21619aac 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 @@ -487,8 +487,8 @@ namespace Tango.FSE.Statistics.ViewModels stats.CompletedRuns = _model.StatisticsResult.JobRuns.Count(x => x.JobRun.Status == (int)JobRunStatus.Completed); stats.FailedRuns = _model.StatisticsResult.JobRuns.Count(x => x.JobRun.Status == (int)JobRunStatus.Failed); stats.AbortedRuns = _model.StatisticsResult.JobRuns.Count(x => x.JobRun.Status == (int)JobRunStatus.Aborted); - stats.TotalDyeingLength = (int)_model.StatisticsResult.JobRuns.Where(x => x.JobRun.EndPosition > 0).Select(x => x.JobRun.EndPosition).Sum(); - stats.AverageDyeingLength = (int)_model.StatisticsResult.JobRuns.Where(x => x.JobRun.EndPosition > 0).Select(x => x.JobRun.EndPosition).Average(); + stats.TotalDyeingLength = (int)_model.StatisticsResult.JobRuns.Where(x => x.JobRun.EndPosition > 0).Select(x => x.Distance).Sum(); + stats.AverageDyeingLength = (int)_model.StatisticsResult.JobRuns.Where(x => x.JobRun.EndPosition > 0).Select(x => x.Distance).Average(); var timeRuns = _model.StatisticsResult.JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.JobRun.EndDate != null && z.JobRun.ActualStartDate != null).ToList(); diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Views/MainView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Views/MainView.xaml index 590192e28..0e1d8cb60 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Views/MainView.xaml +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Views/MainView.xaml @@ -10,6 +10,7 @@ xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete" xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" + xmlns:localControls="clr-namespace:Tango.FSE.Statistics.Controls" xmlns:local="clr-namespace:Tango.FSE.Statistics.Views" mc:Ignorable="d" d:DesignHeight="720" d:DesignWidth="1280" Background="{StaticResource FSE_PrimaryBackgroundBrush}" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> @@ -144,7 +145,19 @@ - + + + + + + + + + + + + + @@ -258,7 +271,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/JobRunModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/JobRunModel.cs index 7646e91c0..184135c40 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/JobRunModel.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/JobRunModel.cs @@ -22,6 +22,8 @@ namespace Tango.MachineStudio.Statistics.Models public RmlModel Rml { get; set; } + public bool IsEureka { get; set; } + public String Gen { get @@ -30,6 +32,39 @@ namespace Tango.MachineStudio.Statistics.Models } } + public double ActualStartPosition + { + get { return IsEureka ? JobRun.ActualStartPosition * 4 : JobRun.ActualStartPosition; } + } + + public double ActualEndPosition + { + get + { + if (JobRun.ActualEndPosition > 0) + { + return IsEureka ? JobRun.ActualEndPosition * 4 : JobRun.ActualEndPosition; + } + else + { + return IsEureka ? JobRun.EndPosition * 4 : JobRun.EndPosition; + } + } + } + + public double Distance + { + get + { + return ActualEndPosition - ActualStartPosition; + } + } + + public double ActualLength + { + get { return JobRun.JobLogicalLength; } + } + public void Init() { if (JobRun.HeatingStartDate != null) @@ -47,6 +82,7 @@ namespace Tango.MachineStudio.Statistics.Models JobRun.JobLogicalLength *= 4; JobRun.JobLength *= 4; JobRun.EndPosition *= 4; + IsEureka = true; } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs index 5f38ae147..84b7ca76b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs @@ -517,7 +517,10 @@ namespace Tango.MachineStudio.Statistics.ViewModels x.LightCyanQuantity, x.LightMagentaQuantity, x.LightYellowQuantity, - x.IsHeadCleaning + x.IsHeadCleaning, + x.ActualStartPosition, + x.ActualEndPosition, + x.JobLogicalLength, }); var machineIDs = new HashSet(SelectedMachines.SynchedSource.ToList().Select(p => p.Guid)); if (machineIDs.Count > 0) @@ -591,7 +594,10 @@ namespace Tango.MachineStudio.Statistics.ViewModels LightCyanQuantity = x.LightCyanQuantity, LightMagentaQuantity = x.LightMagentaQuantity, LightYellowQuantity = x.LightYellowQuantity, - IsHeadCleaning = x.IsHeadCleaning + IsHeadCleaning = x.IsHeadCleaning, + ActualStartPosition = x.ActualStartPosition, + ActualEndPosition = x.ActualEndPosition, + JobLogicalLength = x.JobLogicalLength, }).ToList(); var modelList = runs.Select(x => new JobRunModel() @@ -739,7 +745,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels /// protected void GenerateTotalRunsLength() { - double val = JobRuns.Where(z => z.JobRun.EndPosition > 0).Sum(x => x.JobRun.JobLength); + double val = JobRuns.Where(z => z.JobRun.EndPosition > 0).Sum(x => x.Distance); StatisticsValueCollection.AddStatisticsValue("Total Runs Length", val, " m"); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml index b067d83fb..467ce5be6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml @@ -591,7 +591,7 @@ - + @@ -601,7 +601,25 @@ - + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs index 22709dcd5..131483550 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs @@ -24,4 +24,4 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("3.0.21.0")] +[assembly: AssemblyVersion("3.0.22.0")] -- cgit v1.3.1