From adeeb0ee759b886f902ace9bb68998e1ecf320a7 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Thu, 12 Mar 2020 17:45:30 +0200 Subject: Implement statistic values in Job runs View. Related Work Items: #2509 --- .../Tango.MachineStudio.Statistics/App.config | 20 +- .../Converters/JobLengthConverter.cs | 35 +++ .../MidTankLevelToElementHeightConverter.cs | 2 +- .../Converters/NanoLiterToLiterFormatConverter.cs | 30 +++ .../Models/JobRunModel.cs | 2 + .../Models/StatisticsValueCollection.cs | 269 ++++++++++++++++++++ .../Tango.MachineStudio.Statistics.csproj | 10 + .../ViewModels/ChartsViewVM.cs | 101 ++++++-- .../ViewModels/JobRunsViewVM.cs | 103 +++++++- .../ViewModels/MainViewVM.cs | 1 - .../Views/ChartsView.xaml | 27 +- .../Views/JobRunsView.xaml | 281 +++++++++++++++++---- .../Views/JobRunsView.xaml.cs | 5 +- .../Tango.MachineStudio.Statistics/packages.config | 1 + 14 files changed, 792 insertions(+), 95 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/JobLengthConverter.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/NanoLiterToLiterFormatConverter.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/StatisticsValueCollection.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/App.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/App.config index ed4582d5b..75b63289d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/App.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/App.config @@ -22,7 +22,7 @@ - + @@ -30,27 +30,27 @@ - + - + - + - + - + - + @@ -74,7 +74,7 @@ - + @@ -92,6 +92,10 @@ + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/JobLengthConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/JobLengthConverter.cs new file mode 100644 index 000000000..b730d7881 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/JobLengthConverter.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.MachineStudio.Statistics.Converters +{ + public class JobLengthConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + if (values != null && values.Count() == 3) + { + double length = (double)values[0]; + double endPoint = (double)values[1]; + double width = (double)values[2]; + return Math.Round((endPoint / length) * width, MidpointRounding.AwayFromZero); + } + } + catch { } + + return 0d; + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/MidTankLevelToElementHeightConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/MidTankLevelToElementHeightConverter.cs index 4ea46336f..de002046e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/MidTankLevelToElementHeightConverter.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/MidTankLevelToElementHeightConverter.cs @@ -22,7 +22,7 @@ namespace Tango.MachineStudio.Statistics.Converters double midTankLevel = (double)Math.Min(quantity, MAX_QUANTITY); double delta = ((midTankLevel / MAX_QUANTITY) * parentActualHeight); - if (midTankLevel < (MAX_QUANTITY/10))// if quantity < 10|% set 2 pixel + if (quantity > 0 && midTankLevel < (MAX_QUANTITY/10))// if quantity < 10|% set 2 pixel delta = 2.0; var test = delta; return parentActualHeight - delta; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/NanoLiterToLiterFormatConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/NanoLiterToLiterFormatConverter.cs new file mode 100644 index 000000000..3c25bfe4f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/NanoLiterToLiterFormatConverter.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.MachineStudio.Statistics.Converters +{ + public class NanoLiterToLiterFormatConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + try + { + double val =(double) ((int)value) / 1000000; + return val.ToString("N2", CultureInfo.InvariantCulture); + } + catch{ } + + return ""; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} 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 28d51ab47..83897ca16 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 @@ -32,6 +32,8 @@ namespace Tango.MachineStudio.Statistics.Models { HeatingDuration = JobRun.ActualStartDate - JobRun.HeatingStartDate; } + + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/StatisticsValueCollection.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/StatisticsValueCollection.cs new file mode 100644 index 000000000..2a298777b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/StatisticsValueCollection.cs @@ -0,0 +1,269 @@ +using LiveCharts; +using LiveCharts.Wpf; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using System.Windows.Media; +using Tango.BL.Enumerations; +using Tango.BL.ValueObjects; +using Tango.Core; + +namespace Tango.MachineStudio.Statistics.Models +{ + public class StatisticsValue + { + public string Name { get; set; } + + public double Value { get; set; } + + public string Unit { get; set; } + } + public class MoreValue + { + public string Text { get; set; } + } + + public class StatisticsValueCollection: ExtendedObject + { + private List _pieColors; + + #region Properties + + private ObservableCollection _statisticsCollection; + + public ObservableCollection StatisticsCollection + { + get { return _statisticsCollection; } + set { _statisticsCollection = value; + RaisePropertyChangedAuto(); + } + } + + private List _threadConsumptionPerThread; + + public List ThreadConsumptionPerThread + { + get { return _threadConsumptionPerThread; } + set { _threadConsumptionPerThread = value; RaisePropertyChangedAuto(); } + } + + public CompositeCollection ThreadConsumptionPerThreadCollection { get; set; } + + private LabeledSeriesCollection _pieJobSource; + public LabeledSeriesCollection PieJobSource + { + get { return _pieJobSource; } + set { _pieJobSource = value; RaisePropertyChangedAuto(); } + } + + private LabeledSeriesCollection _pieJobRunStatus; + public LabeledSeriesCollection PieJobRunStatus + { + get { return _pieJobRunStatus; } + set { _pieJobRunStatus = value; RaisePropertyChangedAuto(); } + } + + private LabeledSeriesCollection _pieGradientSolid; + public LabeledSeriesCollection PieGradientSolid + { + get { return _pieGradientSolid; } + set { _pieGradientSolid = value; RaisePropertyChangedAuto(); } + } + + private List _liquidQuantities; + public List LiquidQuantities + { + get + { + if (_liquidQuantities == null) + { + _liquidQuantities = new List(); + } + return _liquidQuantities; + } + set + { _liquidQuantities = value; RaisePropertyChangedAuto(); } + } + + private int _totalLiquidQuantities; + + public int TotalLiquidQuantities + { + get { return _totalLiquidQuantities; } + set { _totalLiquidQuantities = value; RaisePropertyChangedAuto(); } + } + + #endregion + + public StatisticsValueCollection() + { + StatisticsCollection = new ObservableCollection(); + ThreadConsumptionPerThread = new List(); + ThreadConsumptionPerThreadCollection = new CompositeCollection(); + + _pieColors = new List(); + _pieColors.Add(Color.FromRgb(239, 131, 43));//green + _pieColors.Add(Color.FromRgb(144, 233, 144));//orange + _pieColors.Add(Color.FromRgb(100, 184, 236));//blue + + + PieJobSource = new LabeledSeriesCollection() + { + Title = "PPC/MS", + SeriesColors = _pieColors, + }; + PieJobRunStatus = new LabeledSeriesCollection() + { + Title = "Failed/Aborted/Completed", + SeriesColors = _pieColors, + }; + PieGradientSolid = new LabeledSeriesCollection() + { + Title = "Gradient/Solid", + SeriesColors = _pieColors, + }; + } + + public void Clean() + { + StatisticsCollection.Clear(); + ThreadConsumptionPerThreadCollection.Clear(); + ThreadConsumptionPerThread.Clear(); + PieJobSource.SeriesCollection.Clear(); + PieJobRunStatus.SeriesCollection.Clear(); + PieGradientSolid.SeriesCollection.Clear(); + } + + public void AddStatisticsValue( string name, double value, string unit) + { + StatisticsCollection.Add(new StatisticsValue() { Name = name, Value=value, Unit = unit }); + RaisePropertyChanged("StatisticsCollection"); + } + + public void CreateThreadConsumptionPerThread(List threads) + { + ThreadConsumptionPerThreadCollection.Add(new CollectionContainer() { Collection = threads.Take(threads.Count() > 2 ? 2 : threads.Count()) }); + if (threads.Count() > 2) + { + ThreadConsumptionPerThreadCollection.Add(new CollectionContainer() { Collection = new List() { new MoreValue(){ Text="More threads ..." } } }); + ThreadConsumptionPerThread = threads.Skip(2).ToList(); + } + + RaisePropertyChanged("ThreadConsumptionPerThreadCollection"); + } + + #region GeneratePieChart + Func labelPoint = chartPoint => + string.Format("{0} ({1:P})", chartPoint.Y, chartPoint.Participation); + + public void GeneratePieJobSource(int PPCCount, int MSCount) + { + var series = new PieSeries() + { + Title = "PPC", + Values = new ChartValues() { PPCCount }, + Fill = new SolidColorBrush(_pieColors[0]), + DataLabels = true, + ToolTip = "", + LabelPoint = labelPoint + + }; + + PieJobSource.SeriesCollection.Add(series); + + series = new PieSeries() + { + Title = "MS", + Values = new ChartValues() { MSCount }, + Fill = new SolidColorBrush(_pieColors[2]), + DataLabels = true, + ToolTip = "", + LabelPoint = labelPoint + }; + PieJobSource.SeriesCollection.Add(series); + RaisePropertyChanged("PieJobSource"); + } + + public void GeneratePieJobRunStatus(int failedCount, int abortedCount, int completedCount) + { + var series = new PieSeries() + { + Title = "Failed", + Values = new ChartValues() { failedCount }, + Fill = new SolidColorBrush(_pieColors[0]), + DataLabels = true, + ToolTip = "", + LabelPoint = labelPoint + }; + + PieJobRunStatus.SeriesCollection.Add(series); + + series = new PieSeries() + { + Title = "Aborted", + Values = new ChartValues() { abortedCount }, + Fill = new SolidColorBrush(_pieColors[2]), + DataLabels = true, + ToolTip = "", + LabelPoint = labelPoint, + + }; + PieJobRunStatus.SeriesCollection.Add(series); + + series = new PieSeries() + { + Title = "Completed", + Values = new ChartValues() { completedCount }, + Fill = new SolidColorBrush(_pieColors[1]), + DataLabels = true, + ToolTip = "", + LabelPoint = labelPoint + }; + PieJobRunStatus.SeriesCollection.Add(series); + + RaisePropertyChanged("PieJobRunStatus"); + } + + public void GeneratePieGradientSolid(int gradientCount, int solidCount) + { + var series = new PieSeries() + { + Title = "Solid", + Values = new ChartValues() { solidCount }, + Fill = new SolidColorBrush(_pieColors[0]), + DataLabels = true, + ToolTip = "", + LabelPoint = labelPoint + }; + PieGradientSolid.SeriesCollection.Add(series); + + series = new PieSeries() + { + Title = "Gradient", + Values = new ChartValues() { gradientCount }, + Fill = new SolidColorBrush(_pieColors[2]), + DataLabels = true, + ToolTip = "", + LabelPoint = labelPoint + + }; + + PieGradientSolid.SeriesCollection.Add(series); + + + RaisePropertyChanged("PieGradientSolid"); + } + #endregion + + public void GenerateStatisticsLiquidQuantity(List liquidQuantities) + { + LiquidQuantities = liquidQuantities; + TotalLiquidQuantities = liquidQuantities.Sum(x => x.Quantity); + } + + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj index 1300d7dba..adac4bb9f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj @@ -38,6 +38,9 @@ ..\..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll + + ..\..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll + ..\..\..\packages\LiveCharts.0.9.7\lib\net45\LiveCharts.dll @@ -75,14 +78,17 @@ + + + PieChartTooltipControl.xaml @@ -169,6 +175,10 @@ {bc932dbd-7cdb-488c-99e4-f02cf441f55e} Tango.Logging + + {e4927038-348d-4295-aaf4-861c58cb3943} + Tango.PMR + {22f87980-e990-4686-be81-be63d562c4d5} Tango.Serialization diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/ChartsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/ChartsViewVM.cs index b06261306..38c1cc24a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/ChartsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/ChartsViewVM.cs @@ -12,13 +12,14 @@ using Tango.SharedUI; using Tango.BL; using Tango.MachineStudio.Common.Notifications; using System.Threading.Tasks; +using Tango.Core.Commands; namespace Tango.MachineStudio.Statistics.ViewModels { public class ChartsViewVM : ViewModel { private INotificationProvider _notification; - private ObservablesContext _context; + //private ObservablesContext _context; private List _job_runs; private bool _loaded; @@ -48,14 +49,14 @@ namespace Tango.MachineStudio.Statistics.ViewModels public DateTime StartDate { get { return _startDate; } - set { _startDate = value; RaisePropertyChangedAuto(); OnDateRangeChanged(); } + set { _startDate = value; RaisePropertyChangedAuto();} } private DateTime _endDate; public DateTime EndDate { get { return _endDate; } - set { _endDate = value; RaisePropertyChangedAuto(); OnDateRangeChanged(); } + set { _endDate = value; RaisePropertyChangedAuto();} } private DateTime _minDate; @@ -71,6 +72,8 @@ namespace Tango.MachineStudio.Statistics.ViewModels get { return _maxDate; } set { _maxDate = value; RaisePropertyChangedAuto(); } } + + public RelayCommand LoadJobRunsCommand { get; set; } #endregion public ChartsViewVM(INotificationProvider notificationProvider) @@ -78,45 +81,93 @@ namespace Tango.MachineStudio.Statistics.ViewModels _notification = notificationProvider; StartDate = DateTime.Now.AddMonths(-1); EndDate = DateTime.Now; + LoadJobRunsCommand = new RelayCommand(async () => await LoadJobRuns(), () => IsFree); } #region Generate Charts - public async void Init() + //public async void Init() + //{ + //using (_notification.PushTaskItem("Loading statistics...")) + //{ + // IsFree = false; + + // await Task.Factory.StartNew(() => + // { + // _context = ObservablesContext.CreateDefault(); + // //_job_runs = _context.JobRuns.OrderBy(x => x.StartDate).ToList().Select(x => new JobRunStatisticsModel(x)).ToList(); + // //foreach (var run in _job_runs) + // //{ + // // run.LoadMachine(_context).GetAwaiter().GetResult(); + // //} + // }); + + // if (_job_runs.Count > 0) + // { + // MinDate = _job_runs.Min(x => x.StartDate); + // MaxDate = _job_runs.Max(x => x.StartDate); + // } + + // InvokeUIOnIdle(() => + // { + // if (_loaded) + // { + // OnDateRangeChanged(); + // } + // }); + + // _loaded = true; + // IsFree = true; + //} + //} + private async Task LoadJobRuns() { using (_notification.PushTaskItem("Loading statistics...")) { - IsFree = false; - - await Task.Factory.StartNew(() => + try { - _context = ObservablesContext.CreateDefault(); - _job_runs = _context.JobRuns.OrderBy(x => x.StartDate).ToList().Select(x => new JobRunStatisticsModel(x)).ToList(); - foreach (var run in _job_runs) + IsFree = false; + + await Task.Factory.StartNew(() => + { + using (var db = ObservablesContext.CreateDefault()) + { + _job_runs = db.JobRuns.OrderBy(x => x.StartDate).ToList().Select(x => new JobRunStatisticsModel(x)).ToList(); + foreach (var run in _job_runs) + { + run.LoadMachine(db).GetAwaiter().GetResult(); + } + + } + }); + if (_job_runs.Count > 0) { - run.LoadMachine(_context).GetAwaiter().GetResult(); + MinDate = _job_runs.Min(x => x.StartDate); + MaxDate = _job_runs.Max(x => x.StartDate); } - }); - if (_job_runs.Count > 0) + InvokeUIOnIdle(() => + { + if (_loaded) + { + OnDateRangeChanged(); + } + }); + + _loaded = true; + } + catch (Exception ex) { - MinDate = _job_runs.Min(x => x.StartDate); - MaxDate = _job_runs.Max(x => x.StartDate); + LogManager.Log(ex, "Error loading statistics."); } - - InvokeUIOnIdle(() => + finally { - if (_loaded) - { - OnDateRangeChanged(); - } - }); - - _loaded = true; - IsFree = true; + IsFree = true; + } } } + private List GetJobRunsByDateRange(DateTime startDate, DateTime endTime, JobRunStatus? status = null) { return _job_runs.Where(x => x.StartDate.ToLocalTime() >= startDate && x.StartDate.ToLocalTime() <= endTime && (status == null || x.JobRunStatus == status)).ToList(); 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 a51d18909..d57a1c96c 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 @@ -16,6 +16,10 @@ using Tango.MachineStudio.Statistics.Models; using Tango.SharedUI; using Tango.SharedUI.Components; using Tango.AutoComplete.Editors; +using System.Windows.Media; +using LiveCharts.Wpf; +using LiveCharts; +using Tango.BL.ValueObjects; namespace Tango.MachineStudio.Statistics.ViewModels { @@ -184,6 +188,8 @@ namespace Tango.MachineStudio.Statistics.ViewModels RaisePropertyChangedAuto(); } } + + public StatisticsValueCollection StatisticsValueCollection { get; set; } #endregion @@ -261,7 +267,8 @@ namespace Tango.MachineStudio.Statistics.ViewModels return null; } }); - + + StatisticsValueCollection = new StatisticsValueCollection(); } /// @@ -322,19 +329,21 @@ namespace Tango.MachineStudio.Statistics.ViewModels .Query(y => y.Where(x => ( String.IsNullOrEmpty(jobName) || x.JobName.ToLower().StartsWith(jobName.ToLower())) && (x.JobLength < LengthUpperValue && x.JobLength >= LengthLowerValue))) .BuildListAsync(); - var modelList = runs.Select(x => new JobRunModel() { JobRun = x, Machine = _allMachines.FirstOrDefault(y => y.Guid == x.MachineGuid), User = _allUsers.SingleOrDefault(y => y.Guid == x.UserGuid), - Rml = _rmlsModels.SingleOrDefault(y => y.Guid == x.RmlGuid) + Rml = _rmlsModels.SingleOrDefault(y => y.Guid == x.RmlGuid), }).OrderByDescending(x => x.JobRun.StartDate).ToList(); modelList.ForEach(x => x.Init()); JobRuns = modelList.ToObservableCollection(); + GenerateStatistics(); } + + } catch (Exception ex) { @@ -347,5 +356,93 @@ namespace Tango.MachineStudio.Statistics.ViewModels } } + protected void GenerateStatistics() + { + StatisticsValueCollection.Clean(); + GenerateTotalRunsLength(); + GenerateRunsDuration(); + GenerateUploadDuration(); + GenerateHeatingDuration(); + GenerateTotalThreadConsumption(); + + GeneratePieCharts(); + CreateThreadConsumptionPerThread(); + GenerateAllLiquidQuantities(); + } + + protected void GenerateTotalRunsLength() + { + double val = JobRuns.Where(z => z.JobRun.EndPosition > 0).Sum(x => x.JobRun.JobLength); + StatisticsValueCollection.AddStatisticsValue("Total Runs Length", val, " m"); + } + + protected void GenerateRunsDuration() + { + var selection = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.JobRun.EndDate != null && z.JobRun.ActualStartDate != null); + double val = selection.Sum(x => (x.JobRun.EndDate - x.JobRun.ActualStartDate).Value.TotalHours); + StatisticsValueCollection.AddStatisticsValue("Total Runs Duration", val, " hours"); + double average = selection.Average(x => (x.JobRun.EndDate - x.JobRun.ActualStartDate).Value.TotalHours); + StatisticsValueCollection.AddStatisticsValue("Average Runs Duration", average, " hours"); + } + + protected void GenerateUploadDuration() + { + var val = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.UploadDuration != null).Average(x => x.UploadDuration.Value.Ticks); + TimeSpan ts = new TimeSpan(Convert.ToInt64(val)); + StatisticsValueCollection.AddStatisticsValue("Average Upload Duration", Math.Max(ts.TotalMinutes, 0), " minutes"); + } + + protected void GenerateHeatingDuration() + { + var val = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.HeatingDuration != null).Average(x => x.HeatingDuration.Value.Ticks); + TimeSpan ts = new TimeSpan(Convert.ToInt64(val)); + StatisticsValueCollection.AddStatisticsValue("Average Heating Duration", Math.Max(ts.TotalMinutes, 0), " minutes"); + } + + protected void GenerateTotalThreadConsumption() + { + double val = JobRuns.Where(z => z.JobRun.EndPosition > 0).Sum(x => x.JobRun.EndPosition); + StatisticsValueCollection.AddStatisticsValue("Total Thread Consumption", val, " m"); + } + + protected void GeneratePieCharts() + { + int PPCCount = JobRuns.Count(x => x.JobRun.Source == JobSource.Local); + int MSCount = JobRuns.Count(x => x.JobRun.Source == JobSource.Remote); + StatisticsValueCollection.GeneratePieJobSource(PPCCount, MSCount); + + int failedCount = JobRuns.Count(x => x.JobRun.JobRunStatus == JobRunStatus.Failed); + int abortedCount = JobRuns.Count(x => x.JobRun.JobRunStatus == JobRunStatus.Aborted); + int completedCount = JobRuns.Count(x => x.JobRun.JobRunStatus == JobRunStatus.Completed); + StatisticsValueCollection.GeneratePieJobRunStatus(failedCount, abortedCount, completedCount); + + int gradientCount = JobRuns.Count(x => x.JobRun.IsGradient == true); + int solidCount = JobRuns.Count(x => x.JobRun.IsGradient == false); + StatisticsValueCollection.GeneratePieGradientSolid(gradientCount, solidCount); + + } + + protected void CreateThreadConsumptionPerThread() + { + var temp = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.Rml != null).GroupBy(x => x.Rml.Name); + List result = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.Rml != null && !String.IsNullOrEmpty(z.Rml.Name)).GroupBy(x => x.Rml.Name).Select(y => new StatisticsValue { Name = y.Key, Value = y.Sum(x => x.JobRun.EndPosition), Unit="m" }).ToList(); + StatisticsValueCollection.CreateThreadConsumptionPerThread(result); + } + + protected void GenerateAllLiquidQuantities() + { + var db_liquidQuantities = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.JobRun.LiquidQuantities.Count > 0).Select(y=> y.JobRun.LiquidQuantities).ToList(); + List allLiquidQuantities = new List(); + + foreach (LiquidTypes ltype in (LiquidTypes[])Enum.GetValues(typeof(LiquidTypes))) + { + var liquidQuantityByTypeList = db_liquidQuantities.Select(x => x.SingleOrDefault(y => y.LiquidType == ltype)).Where(x=>x!=null); + var count = liquidQuantityByTypeList != null ? liquidQuantityByTypeList.Sum(x => x.Quantity) : 0; + JobRunLiquidQuantity lq = new JobRunLiquidQuantity() { LiquidType = ltype, Quantity = count }; + allLiquidQuantities.Add(lq); + } + StatisticsValueCollection.GenerateStatisticsLiquidQuantity(allLiquidQuantities); + } + } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/MainViewVM.cs index 4a75a41c8..e7e2013c5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/MainViewVM.cs @@ -50,7 +50,6 @@ namespace Tango.MachineStudio.Statistics.ViewModels public override void OnNavigatedTo() { base.OnNavigatedTo(); - ChartsViewVM.Init(); } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/ChartsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/ChartsView.xaml index ecd7e01ed..ae4bf1d46 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/ChartsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/ChartsView.xaml @@ -17,23 +17,26 @@ - - - Start Date: - - + + + + Start Date: + + - - End Date: - - + + End Date: + + + + - + @@ -59,7 +62,7 @@ - + + + + @@ -68,34 +84,6 @@ - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -475,11 +537,142 @@ - - - TOTALS: - Cyan: - + + + + + + + + + + + + + + + + + + + + + + + + Total Thread Consumption per thread: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml.cs index c460e2a9b..2b3ed79ca 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml.cs @@ -1,4 +1,6 @@ -using System; +using LiveCharts; +using LiveCharts.Wpf; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -79,5 +81,6 @@ namespace Tango.MachineStudio.Statistics.Views } } } + } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/packages.config index 31c5f029f..6938c8a4b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/packages.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/packages.config @@ -1,6 +1,7 @@  + -- cgit v1.3.1 From b188d7bfd91062f65474bd139bb8a434694f117b Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sun, 15 Mar 2020 15:46:03 +0200 Subject: Fixed issue with job run start date. Fixed issue with ActionLogs busy indication. --- .../ViewModels/MainViewVM.cs | 71 ++++++++++++---------- .../Views/MainView.xaml | 2 +- .../ViewModels/JobRunsViewVM.cs | 23 ++++--- .../JobRuns/BasicJobRunsLogger.cs | 4 +- .../Tango.Integration/Operation/MachineOperator.cs | 9 +++ .../Operation/PrintingEventArgs.cs | 1 + 6 files changed, 63 insertions(+), 47 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs index 534bb364f..df2643d88 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs @@ -16,12 +16,15 @@ using Tango.BL.ValueObjects; using Tango.Core.Commands; using Tango.Core.ExtensionMethods; using Tango.MachineStudio.Common; +using Tango.MachineStudio.Common.Notifications; using Tango.SharedUI.Components; namespace Tango.MachineStudio.ActionLogs.ViewModels { public class MainViewVM : StudioViewModel { + private INotificationProvider _notification; + #region Properties private DateTime _startSelectedDate; @@ -83,30 +86,23 @@ namespace Tango.MachineStudio.ActionLogs.ViewModels set { _differenceObject = value; RaisePropertyChangedAuto(); } } - - private bool _isRunning; - public bool IsRunning - { - get { return _isRunning; } - set { _isRunning = value; } - } - #endregion public RelayCommand SearchCommand { get; set; } public RelayCommand CopyToClipBoardCommand { get; set; } public RelayCommand CopyRelateObjectIDCommand { get; set; } - public MainViewVM() + public MainViewVM(INotificationProvider notification) { + _notification = notification; + ActionLogs = new ObservableCollection(); - SearchCommand = new RelayCommand(GetActionLogs, () => !IsRunning); + SearchCommand = new RelayCommand(GetActionLogs, () => IsFree); CopyRelateObjectIDCommand = new RelayCommand(CopyRelateObjectID); CopyToClipBoardCommand = new RelayCommand(CopyToClipBoard, () => SelectedActionLog != null && SelectedActionLog.DifferenceObject != null); DateTime now = DateTime.Now; StartSelectedDate = now.AddMonths(-1); EndSelectedDate = now; - _isRunning = false; var source = Enum.GetValues(typeof(ActionLogType)).Cast().ToObservableCollection(); var syncedSource = Enum.GetValues(typeof(ActionLogType)).Cast().ToObservableCollection(); @@ -139,27 +135,40 @@ namespace Tango.MachineStudio.ActionLogs.ViewModels if (String.IsNullOrWhiteSpace(filter)) filter = null; - using (ObservablesContext db = ObservablesContext.CreateDefault()) + try + { + IsFree = false; + + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + + DateTime startUtc = new DateTime(StartSelectedDate.Date.Ticks, DateTimeKind.Utc); + TimeSpan offsetTime = (EndSelectedDate.Date == DateTime.Now.Date) ? DateTime.Now.TimeOfDay : new TimeSpan(24, 0, 0); + DateTime endUtc = new DateTime(EndSelectedDate.Date.Ticks + offsetTime.Ticks, DateTimeKind.Utc); + + Debug.Write($"TEST TIME {startUtc} from {endUtc} " + System.Environment.NewLine); + + ActionLogs = await new ActionLogsCollectionBuilder(db).Set(x => x.LastUpdated <= DbFunctions.TruncateTime(endUtc) && x.LastUpdated >= DbFunctions.TruncateTime(startUtc)) + .WithUsers() + .WithActionType(SelectedActionLogTypes.SynchedSource.ToArray()) + .Query(y => y.Where + (x => filter == null || + (x.ID.ToString().ToLower().StartsWith(filter) + || (x.RelatedObjectName != null && x.RelatedObjectName.ToLower().StartsWith(filter)) + || (x.RelatedObjectGuid != null && x.RelatedObjectGuid.ToLower().StartsWith(filter)) + || (x.User != null && x.User.Contact != null && x.User.Contact.FullName.ToLower().StartsWith(filter))))) + .BuildAsync(); + } + } + catch (Exception ex) + { + IsFree = true; + LogManager.Log(ex, "Error getting action logs."); + _notification.ShowError($"Error occurred while trying to retrieve the action logs.\n{ex.Message}"); + } + finally { - - DateTime startUtc = new DateTime(StartSelectedDate.Date.Ticks, DateTimeKind.Utc); - TimeSpan offsetTime = (EndSelectedDate.Date == DateTime.Now.Date) ? DateTime.Now.TimeOfDay : new TimeSpan(24, 0, 0); - DateTime endUtc = new DateTime(EndSelectedDate.Date.Ticks + offsetTime.Ticks, DateTimeKind.Utc); - - Debug.Write($"TEST TIME {startUtc} from {endUtc} " + System.Environment.NewLine); - - IsRunning = true; - ActionLogs = await new ActionLogsCollectionBuilder(db).Set(x => x.LastUpdated <= DbFunctions.TruncateTime(endUtc) && x.LastUpdated >= DbFunctions.TruncateTime(startUtc)) - .WithUsers() - .WithActionType(SelectedActionLogTypes.SynchedSource.ToArray()) - .Query(y => y.Where - (x => filter == null || - (x.ID.ToString().ToLower().StartsWith(filter) - || (x.RelatedObjectName != null && x.RelatedObjectName.ToLower().StartsWith(filter)) - || (x.RelatedObjectGuid != null && x.RelatedObjectGuid.ToLower().StartsWith(filter)) - || (x.User != null && x.User.Contact != null && x.User.Contact.FullName.ToLower().StartsWith(filter))))) - .BuildAsync(); - IsRunning = false; + IsFree = true; } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml index 3a7eaa802..fd640bae5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml @@ -207,7 +207,7 @@ - + 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 d57a1c96c..9bf69137d 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 @@ -188,7 +188,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels RaisePropertyChangedAuto(); } } - + public StatisticsValueCollection StatisticsValueCollection { get; set; } #endregion @@ -253,7 +253,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels { using (ObservablesContext db = ObservablesContext.CreateDefault()) { - return db.Jobs.Where(x => x.Name!= null && x.Name.ToLower().Contains(filter.ToLower())).ToList(); + return db.Jobs.Where(x => x.Name != null && x.Name.ToLower().Contains(filter.ToLower())).ToList(); } } else @@ -267,7 +267,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels return null; } }); - + StatisticsValueCollection = new StatisticsValueCollection(); } @@ -326,7 +326,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels .WithJobStatus(JobRunSelectedStatuses.SynchedSource) .WithGradient(IsGradientSelection.SynchedSource) .WithRmls(SelectedThreads.SynchedSource.Select(x => x.Guid).ToList()) - .Query(y => y.Where(x => ( String.IsNullOrEmpty(jobName) || x.JobName.ToLower().StartsWith(jobName.ToLower())) + .Query(y => y.Where(x => (String.IsNullOrEmpty(jobName) || x.JobName.ToLower().StartsWith(jobName.ToLower())) && (x.JobLength < LengthUpperValue && x.JobLength >= LengthLowerValue))) .BuildListAsync(); @@ -343,7 +343,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels GenerateStatistics(); } - + } catch (Exception ex) { @@ -387,9 +387,8 @@ namespace Tango.MachineStudio.Statistics.ViewModels protected void GenerateUploadDuration() { - var val = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.UploadDuration != null).Average(x => x.UploadDuration.Value.Ticks); - TimeSpan ts = new TimeSpan(Convert.ToInt64(val)); - StatisticsValueCollection.AddStatisticsValue("Average Upload Duration", Math.Max(ts.TotalMinutes, 0), " minutes"); + var val = (long)JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.UploadDuration != null).Average(x => x.UploadDuration.Value.TotalMilliseconds); + StatisticsValueCollection.AddStatisticsValue("Average Upload Duration", Math.Max(TimeSpan.FromMilliseconds(val).TotalMinutes, 0), " minutes"); } protected void GenerateHeatingDuration() @@ -425,18 +424,18 @@ namespace Tango.MachineStudio.Statistics.ViewModels protected void CreateThreadConsumptionPerThread() { var temp = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.Rml != null).GroupBy(x => x.Rml.Name); - List result = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.Rml != null && !String.IsNullOrEmpty(z.Rml.Name)).GroupBy(x => x.Rml.Name).Select(y => new StatisticsValue { Name = y.Key, Value = y.Sum(x => x.JobRun.EndPosition), Unit="m" }).ToList(); + List result = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.Rml != null && !String.IsNullOrEmpty(z.Rml.Name)).GroupBy(x => x.Rml.Name).Select(y => new StatisticsValue { Name = y.Key, Value = y.Sum(x => x.JobRun.EndPosition), Unit = "m" }).ToList(); StatisticsValueCollection.CreateThreadConsumptionPerThread(result); } protected void GenerateAllLiquidQuantities() { - var db_liquidQuantities = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.JobRun.LiquidQuantities.Count > 0).Select(y=> y.JobRun.LiquidQuantities).ToList(); + var db_liquidQuantities = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.JobRun.LiquidQuantities.Count > 0).Select(y => y.JobRun.LiquidQuantities).ToList(); List allLiquidQuantities = new List(); - + foreach (LiquidTypes ltype in (LiquidTypes[])Enum.GetValues(typeof(LiquidTypes))) { - var liquidQuantityByTypeList = db_liquidQuantities.Select(x => x.SingleOrDefault(y => y.LiquidType == ltype)).Where(x=>x!=null); + var liquidQuantityByTypeList = db_liquidQuantities.Select(x => x.SingleOrDefault(y => y.LiquidType == ltype)).Where(x => x != null); var count = liquidQuantityByTypeList != null ? liquidQuantityByTypeList.Sum(x => x.Quantity) : 0; JobRunLiquidQuantity lq = new JobRunLiquidQuantity() { LiquidType = ltype, Quantity = count }; allLiquidQuantities.Add(lq); diff --git a/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs b/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs index f2fb2f16e..0fadd1baa 100644 --- a/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs +++ b/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs @@ -17,7 +17,6 @@ namespace Tango.Integration.JobRuns /// public class BasicJobRunsLogger : ExtendedObject, IJobRunsLogger { - private DateTime _start_date; private Job _job; #region Properties @@ -96,7 +95,7 @@ namespace Tango.Integration.JobRuns JobRun run = new JobRun(); run.UserGuid = _job.UserGuid; - run.StartDate = _start_date; + run.StartDate = e.StartDate; run.UploadingStartDate = e.UploadingStartTime; run.HeatingStartDate = e.HeatingStartTime; run.ActualStartDate = e.ActualStartTime; @@ -187,7 +186,6 @@ namespace Tango.Integration.JobRuns private void Machine_PrintingStarted(object sender, PrintingEventArgs e) { _job = e.Job; - _start_date = DateTime.UtcNow; } #endregion diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 9768498c6..b17321942 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -75,6 +75,8 @@ namespace Tango.Integration.Operation private List _currentJobLiquidQuantities; private DateTime _diagnosticsTime; private MachineStatus _machineStatusBeforeJobStart; + + private DateTime _jobStartDate; private DateTime? _jobUploadingStartDate; private DateTime? _jobHeatingStartDate; private DateTime? _jobActualStartDate; @@ -1050,6 +1052,7 @@ namespace Tango.Integration.Operation PrintingStarted?.Invoke(this, new PrintingEventArgs(handler, job) { LiquidQuantities = _currentJobLiquidQuantities.ToList(), + StartDate = _jobStartDate, }); } @@ -1063,6 +1066,7 @@ namespace Tango.Integration.Operation PrintingCompleted?.Invoke(this, new PrintingEventArgs(handler, job) { LiquidQuantities = _currentJobLiquidQuantities.ToList(), + StartDate = _jobStartDate, UploadingStartTime = _jobUploadingStartDate, HeatingStartTime = _jobHeatingStartDate, ActualStartTime = _jobActualStartDate, @@ -1082,6 +1086,7 @@ namespace Tango.Integration.Operation PrintingFailed?.Invoke(this, new PrintingFailedEventArgs(handler, job, exception) { LiquidQuantities = _currentJobLiquidQuantities.ToList(), + StartDate = _jobStartDate, UploadingStartTime = _jobUploadingStartDate, HeatingStartTime = _jobHeatingStartDate, ActualStartTime = _jobActualStartDate, @@ -1099,6 +1104,7 @@ namespace Tango.Integration.Operation PrintingAborted?.Invoke(this, new PrintingEventArgs(handler, job) { LiquidQuantities = _currentJobLiquidQuantities.ToList(), + StartDate = _jobStartDate, UploadingStartTime = _jobUploadingStartDate, HeatingStartTime = _jobHeatingStartDate, ActualStartTime = _jobActualStartDate, @@ -1116,6 +1122,7 @@ namespace Tango.Integration.Operation PrintingEnded?.Invoke(this, new PrintingEventArgs(handler, job) { LiquidQuantities = _currentJobLiquidQuantities.ToList(), + StartDate = _jobStartDate, UploadingStartTime = _jobUploadingStartDate, HeatingStartTime = _jobHeatingStartDate, ActualStartTime = _jobActualStartDate, @@ -2159,6 +2166,8 @@ namespace Tango.Integration.Operation throw new InvalidOperationException("Could not print while status = " + Status); } + _jobStartDate = DateTime.UtcNow; + LogManager.Log($"Executing job '{job.Name}'..."); _currentJobLiquidQuantities = new List(); diff --git a/Software/Visual_Studio/Tango.Integration/Operation/PrintingEventArgs.cs b/Software/Visual_Studio/Tango.Integration/Operation/PrintingEventArgs.cs index f68204127..b088b9046 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/PrintingEventArgs.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/PrintingEventArgs.cs @@ -13,6 +13,7 @@ namespace Tango.Integration.Operation public JobHandler JobHandler { get; private set; } public Job Job { get; private set; } public List LiquidQuantities { get; set; } + public DateTime StartDate { get; set; } public DateTime? UploadingStartTime { get; set; } public DateTime? HeatingStartTime { get; set; } public DateTime? ActualStartTime { get; set; } -- cgit v1.3.1 From 56678ae530fe45b0880053793ab46f47051e4dc6 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Sun, 15 Mar 2020 16:12:26 +0200 Subject: MS Statistics Job Runs page. Added comments. --- .../Converters/NanoLiterToLiterFormatConverter.cs | 2 +- .../Models/StatisticsValueCollection.cs | 49 ++++++++++++++++-- .../ViewModels/JobRunsViewVM.cs | 59 +++++++++++++++++----- .../Views/JobRunsView.xaml | 25 ++++++++- 4 files changed, 113 insertions(+), 22 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/NanoLiterToLiterFormatConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/NanoLiterToLiterFormatConverter.cs index 3c25bfe4f..23d7564e8 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/NanoLiterToLiterFormatConverter.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/NanoLiterToLiterFormatConverter.cs @@ -14,7 +14,7 @@ namespace Tango.MachineStudio.Statistics.Converters { try { - double val =(double) ((int)value) / 1000000; + double val =(double) ((int)value) / 1000000000; return val.ToString("N2", CultureInfo.InvariantCulture); } catch{ } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/StatisticsValueCollection.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/StatisticsValueCollection.cs index 2a298777b..2ad165d79 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/StatisticsValueCollection.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/StatisticsValueCollection.cs @@ -35,6 +35,9 @@ namespace Tango.MachineStudio.Statistics.Models private ObservableCollection _statisticsCollection; + /// + /// Gets or sets the statistics collection of StatisticsValue object. + /// public ObservableCollection StatisticsCollection { get { return _statisticsCollection; } @@ -44,16 +47,25 @@ namespace Tango.MachineStudio.Statistics.Models } private List _threadConsumptionPerThread; - + /// + /// Gets or sets the thread consumption per thread list. + /// public List ThreadConsumptionPerThread { get { return _threadConsumptionPerThread; } set { _threadConsumptionPerThread = value; RaisePropertyChangedAuto(); } } + /// + /// Gets or sets the thread consumption per thread collection. + /// public CompositeCollection ThreadConsumptionPerThreadCollection { get; set; } private LabeledSeriesCollection _pieJobSource; + + /// + /// Gets or sets the pie job source. + /// public LabeledSeriesCollection PieJobSource { get { return _pieJobSource; } @@ -61,6 +73,10 @@ namespace Tango.MachineStudio.Statistics.Models } private LabeledSeriesCollection _pieJobRunStatus; + + /// + /// Gets or sets the pie job run status. + /// public LabeledSeriesCollection PieJobRunStatus { get { return _pieJobRunStatus; } @@ -68,6 +84,10 @@ namespace Tango.MachineStudio.Statistics.Models } private LabeledSeriesCollection _pieGradientSolid; + + /// + /// Gets or sets the pie gradient solid. + /// public LabeledSeriesCollection PieGradientSolid { get { return _pieGradientSolid; } @@ -75,6 +95,10 @@ namespace Tango.MachineStudio.Statistics.Models } private List _liquidQuantities; + + /// + /// Gets or sets the liquid quantities. + /// public List LiquidQuantities { get @@ -91,6 +115,9 @@ namespace Tango.MachineStudio.Statistics.Models private int _totalLiquidQuantities; + /// + /// Gets or sets the total liquid quantities. + /// public int TotalLiquidQuantities { get { return _totalLiquidQuantities; } @@ -128,6 +155,9 @@ namespace Tango.MachineStudio.Statistics.Models }; } + /// + /// Cleans all values. + /// public void Clean() { StatisticsCollection.Clear(); @@ -138,21 +168,27 @@ namespace Tango.MachineStudio.Statistics.Models PieGradientSolid.SeriesCollection.Clear(); } - public void AddStatisticsValue( string name, double value, string unit) + /// + /// Adds the statistics value. + /// + public void AddStatisticsValue(string name, double value, string unit) { - StatisticsCollection.Add(new StatisticsValue() { Name = name, Value=value, Unit = unit }); + StatisticsCollection.Add(new StatisticsValue() { Name = name, Value = value, Unit = unit }); RaisePropertyChanged("StatisticsCollection"); } + /// + /// Creates the thread consumption per thread. + /// public void CreateThreadConsumptionPerThread(List threads) { ThreadConsumptionPerThreadCollection.Add(new CollectionContainer() { Collection = threads.Take(threads.Count() > 2 ? 2 : threads.Count()) }); if (threads.Count() > 2) { - ThreadConsumptionPerThreadCollection.Add(new CollectionContainer() { Collection = new List() { new MoreValue(){ Text="More threads ..." } } }); + ThreadConsumptionPerThreadCollection.Add(new CollectionContainer() { Collection = new List() { new MoreValue() { Text = "More threads ..." } } }); ThreadConsumptionPerThread = threads.Skip(2).ToList(); } - + RaisePropertyChanged("ThreadConsumptionPerThreadCollection"); } @@ -259,6 +295,9 @@ namespace Tango.MachineStudio.Statistics.Models } #endregion + /// + /// Generates the statistics liquid quantity and TotalLiquidQuantities. + /// public void GenerateStatisticsLiquidQuantity(List liquidQuantities) { LiquidQuantities = liquidQuantities; 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 d57a1c96c..ed52c2352 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 @@ -177,7 +177,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels private Job _selectedJob; /// - /// Gets or sets the job. Used as Sele + /// Gets or sets the job. /// public Job SelectedJob { @@ -188,7 +188,10 @@ namespace Tango.MachineStudio.Statistics.ViewModels RaisePropertyChangedAuto(); } } - + + /// + /// Gets or sets the statistics value collection. Class - container included calculated statistic values. + /// public StatisticsValueCollection StatisticsValueCollection { get; set; } #endregion @@ -356,26 +359,37 @@ namespace Tango.MachineStudio.Statistics.ViewModels } } + #region GenerateS_StatisticsValueCollection + + /// + /// Generates the statistics. + /// protected void GenerateStatistics() { StatisticsValueCollection.Clean(); GenerateTotalRunsLength(); GenerateRunsDuration(); - GenerateUploadDuration(); - GenerateHeatingDuration(); + GenerateAverageUploadDuration(); + GenerateAverageHeatingDuration(); GenerateTotalThreadConsumption(); GeneratePieCharts(); CreateThreadConsumptionPerThread(); GenerateAllLiquidQuantities(); } - + + /// + /// Generates the total length of the job runs. + /// protected void GenerateTotalRunsLength() { double val = JobRuns.Where(z => z.JobRun.EndPosition > 0).Sum(x => x.JobRun.JobLength); StatisticsValueCollection.AddStatisticsValue("Total Runs Length", val, " m"); } + /// + /// Generates the duration and average of the job runs. + /// protected void GenerateRunsDuration() { var selection = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.JobRun.EndDate != null && z.JobRun.ActualStartDate != null); @@ -385,26 +399,36 @@ namespace Tango.MachineStudio.Statistics.ViewModels StatisticsValueCollection.AddStatisticsValue("Average Runs Duration", average, " hours"); } - protected void GenerateUploadDuration() + /// + /// Generates the average upload duration of the job runs. + /// + protected void GenerateAverageUploadDuration() { - var val = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.UploadDuration != null).Average(x => x.UploadDuration.Value.Ticks); - TimeSpan ts = new TimeSpan(Convert.ToInt64(val)); - StatisticsValueCollection.AddStatisticsValue("Average Upload Duration", Math.Max(ts.TotalMinutes, 0), " minutes"); + var average = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.UploadDuration != null && z.UploadDuration.Value.Ticks > 0).Average(x => x.UploadDuration.Value.TotalMinutes); + StatisticsValueCollection.AddStatisticsValue("Average Upload Duration", Math.Max(average, 0), " minutes"); } - protected void GenerateHeatingDuration() + /// + /// Generates the average duration heating of the job runs. + /// + protected void GenerateAverageHeatingDuration() { - var val = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.HeatingDuration != null).Average(x => x.HeatingDuration.Value.Ticks); - TimeSpan ts = new TimeSpan(Convert.ToInt64(val)); - StatisticsValueCollection.AddStatisticsValue("Average Heating Duration", Math.Max(ts.TotalMinutes, 0), " minutes"); + var average = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.HeatingDuration != null && z.HeatingDuration.Value.Ticks > 0).Average(x => x.HeatingDuration.Value.TotalMinutes); + StatisticsValueCollection.AddStatisticsValue("Average Heating Duration", Math.Max(average, 0), " minutes"); } + /// + /// Generates the total thread consumption by EndPosition. + /// protected void GenerateTotalThreadConsumption() { double val = JobRuns.Where(z => z.JobRun.EndPosition > 0).Sum(x => x.JobRun.EndPosition); StatisticsValueCollection.AddStatisticsValue("Total Thread Consumption", val, " m"); } + /// + /// Generates the pie charts in percentage: JobSource, JobRunStatus, Gradient. + /// protected void GeneratePieCharts() { int PPCCount = JobRuns.Count(x => x.JobRun.Source == JobSource.Local); @@ -422,6 +446,9 @@ namespace Tango.MachineStudio.Statistics.ViewModels } + /// + /// Creates the thread consumption per thread. + /// protected void CreateThreadConsumptionPerThread() { var temp = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.Rml != null).GroupBy(x => x.Rml.Name); @@ -429,6 +456,9 @@ namespace Tango.MachineStudio.Statistics.ViewModels StatisticsValueCollection.CreateThreadConsumptionPerThread(result); } + /// + /// Generates all liquid quantities. + /// protected void GenerateAllLiquidQuantities() { var db_liquidQuantities = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.JobRun.LiquidQuantities.Count > 0).Select(y=> y.JobRun.LiquidQuantities).ToList(); @@ -436,13 +466,14 @@ namespace Tango.MachineStudio.Statistics.ViewModels foreach (LiquidTypes ltype in (LiquidTypes[])Enum.GetValues(typeof(LiquidTypes))) { - var liquidQuantityByTypeList = db_liquidQuantities.Select(x => x.SingleOrDefault(y => y.LiquidType == ltype)).Where(x=>x!=null); + var liquidQuantityByTypeList = db_liquidQuantities.Select(x => x.FirstOrDefault(y => y.LiquidType == ltype)).Where(x=>x!=null); var count = liquidQuantityByTypeList != null ? liquidQuantityByTypeList.Sum(x => x.Quantity) : 0; JobRunLiquidQuantity lq = new JobRunLiquidQuantity() { LiquidType = ltype, Quantity = count }; allLiquidQuantities.Add(lq); } StatisticsValueCollection.GenerateStatisticsLiquidQuantity(allLiquidQuantities); } + #endregion } } 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 4790402d5..58d94aca1 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 @@ -554,13 +554,24 @@ - + - Total Thread Consumption per thread: + + + + + @@ -669,6 +680,16 @@ + + + -- cgit v1.3.1 From 1e563685f9c74fc7cfc204b714a1401002eba5fd Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Sun, 15 Mar 2020 17:11:16 +0200 Subject: Machine Studio. Statistics Job Runs page, change colors of pies, a little changes in GUI. --- .../Models/StatisticsValueCollection.cs | 20 ++++++++++++-------- .../ViewModels/JobRunsViewVM.cs | 18 +++++++++--------- .../Views/JobRunsView.xaml | 12 ++++++------ 3 files changed, 27 insertions(+), 23 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/StatisticsValueCollection.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/StatisticsValueCollection.cs index 2ad165d79..287e09009 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/StatisticsValueCollection.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/StatisticsValueCollection.cs @@ -11,6 +11,8 @@ using System.Windows.Media; using Tango.BL.Enumerations; using Tango.BL.ValueObjects; using Tango.Core; +using System.Windows.Media; +using System.Windows; namespace Tango.MachineStudio.Statistics.Models { @@ -133,8 +135,10 @@ namespace Tango.MachineStudio.Statistics.Models ThreadConsumptionPerThreadCollection = new CompositeCollection(); _pieColors = new List(); - _pieColors.Add(Color.FromRgb(239, 131, 43));//green - _pieColors.Add(Color.FromRgb(144, 233, 144));//orange + _pieColors.Add(((SolidColorBrush)Application.Current.Resources["RedBrush100"]).Color); + _pieColors.Add(((SolidColorBrush)Application.Current.Resources["OrangeBrush300"]).Color); + _pieColors.Add(((SolidColorBrush)Application.Current.Resources["GreenBrush300"]).Color); + _pieColors.Add(((SolidColorBrush)Application.Current.Resources["BlueBrush100"]).Color); _pieColors.Add(Color.FromRgb(100, 184, 236));//blue @@ -202,7 +206,7 @@ namespace Tango.MachineStudio.Statistics.Models { Title = "PPC", Values = new ChartValues() { PPCCount }, - Fill = new SolidColorBrush(_pieColors[0]), + Fill = new SolidColorBrush(_pieColors[2]), DataLabels = true, ToolTip = "", LabelPoint = labelPoint @@ -215,7 +219,7 @@ namespace Tango.MachineStudio.Statistics.Models { Title = "MS", Values = new ChartValues() { MSCount }, - Fill = new SolidColorBrush(_pieColors[2]), + Fill = new SolidColorBrush(_pieColors[3]), DataLabels = true, ToolTip = "", LabelPoint = labelPoint @@ -242,7 +246,7 @@ namespace Tango.MachineStudio.Statistics.Models { Title = "Aborted", Values = new ChartValues() { abortedCount }, - Fill = new SolidColorBrush(_pieColors[2]), + Fill = new SolidColorBrush(_pieColors[1]), DataLabels = true, ToolTip = "", LabelPoint = labelPoint, @@ -254,7 +258,7 @@ namespace Tango.MachineStudio.Statistics.Models { Title = "Completed", Values = new ChartValues() { completedCount }, - Fill = new SolidColorBrush(_pieColors[1]), + Fill = new SolidColorBrush(_pieColors[2]), DataLabels = true, ToolTip = "", LabelPoint = labelPoint @@ -270,7 +274,7 @@ namespace Tango.MachineStudio.Statistics.Models { Title = "Solid", Values = new ChartValues() { solidCount }, - Fill = new SolidColorBrush(_pieColors[0]), + Fill = new SolidColorBrush(_pieColors[2]), DataLabels = true, ToolTip = "", LabelPoint = labelPoint @@ -281,7 +285,7 @@ namespace Tango.MachineStudio.Statistics.Models { Title = "Gradient", Values = new ChartValues() { gradientCount }, - Fill = new SolidColorBrush(_pieColors[2]), + Fill = new SolidColorBrush(_pieColors[3]), DataLabels = true, ToolTip = "", LabelPoint = labelPoint 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 ed7bbec56..ca40273f9 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 @@ -368,10 +368,10 @@ namespace Tango.MachineStudio.Statistics.ViewModels { StatisticsValueCollection.Clean(); GenerateTotalRunsLength(); + GenerateTotalThreadConsumption(); GenerateRunsDuration(); GenerateAverageUploadDuration(); GenerateAverageHeatingDuration(); - GenerateTotalThreadConsumption(); GeneratePieCharts(); CreateThreadConsumptionPerThread(); @@ -395,8 +395,8 @@ namespace Tango.MachineStudio.Statistics.ViewModels var selection = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.JobRun.EndDate != null && z.JobRun.ActualStartDate != null); double val = selection.Sum(x => (x.JobRun.EndDate - x.JobRun.ActualStartDate).Value.TotalHours); StatisticsValueCollection.AddStatisticsValue("Total Runs Duration", val, " hours"); - double average = selection.Average(x => (x.JobRun.EndDate - x.JobRun.ActualStartDate).Value.TotalHours); - StatisticsValueCollection.AddStatisticsValue("Average Runs Duration", average, " hours"); + double average = selection.Average(x => (x.JobRun.EndDate - x.JobRun.ActualStartDate).Value.TotalMilliseconds); + StatisticsValueCollection.AddStatisticsValue("Average Runs Duration", Math.Max(TimeSpan.FromMilliseconds(average).TotalHours, 0), " hours"); } /// @@ -404,8 +404,8 @@ namespace Tango.MachineStudio.Statistics.ViewModels /// protected void GenerateAverageUploadDuration() { - var val = (long)JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.UploadDuration != null).Average(x => x.UploadDuration.Value.TotalMilliseconds); - StatisticsValueCollection.AddStatisticsValue("Average Upload Duration", Math.Max(TimeSpan.FromMilliseconds(val).TotalMinutes, 0), " minutes"); + var average = (long)JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.UploadDuration != null).Average(x => x.UploadDuration.Value.TotalMilliseconds); + StatisticsValueCollection.AddStatisticsValue("Average Upload Duration", Math.Max(TimeSpan.FromMilliseconds(average).TotalMinutes, 0), " minutes"); } /// @@ -413,8 +413,8 @@ namespace Tango.MachineStudio.Statistics.ViewModels /// protected void GenerateAverageHeatingDuration() { - var average = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.HeatingDuration != null && z.HeatingDuration.Value.Ticks > 0).Average(x => x.HeatingDuration.Value.TotalMinutes); - StatisticsValueCollection.AddStatisticsValue("Average Heating Duration", Math.Max(average, 0), " minutes"); + var average = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.HeatingDuration != null && z.HeatingDuration.Value.Ticks > 0).Average(x => x.HeatingDuration.Value.TotalMilliseconds); + StatisticsValueCollection.AddStatisticsValue("Average Heating Duration", Math.Max(TimeSpan.FromMilliseconds(average).TotalMinutes, 0), " minutes"); } /// @@ -423,7 +423,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels protected void GenerateTotalThreadConsumption() { double val = JobRuns.Where(z => z.JobRun.EndPosition > 0).Sum(x => x.JobRun.EndPosition); - StatisticsValueCollection.AddStatisticsValue("Total Thread Consumption", val, " m"); + StatisticsValueCollection.AddStatisticsValue("Actual Total Runs Length", val, " m"); } /// @@ -466,7 +466,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels foreach (LiquidTypes ltype in (LiquidTypes[])Enum.GetValues(typeof(LiquidTypes))) { - var liquidQuantityByTypeList = db_liquidQuantities.Select(x => x.SingleOrDefault(y => y.LiquidType == ltype)).Where(x => x != null); + var liquidQuantityByTypeList = db_liquidQuantities.Select(x => x.FirstOrDefault(y => y.LiquidType == ltype)).Where(x => x != null); var count = liquidQuantityByTypeList != null ? liquidQuantityByTypeList.Sum(x => x.Quantity) : 0; JobRunLiquidQuantity lq = new JobRunLiquidQuantity() { LiquidType = ltype, Quantity = count }; allLiquidQuantities.Add(lq); 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 58d94aca1..057647858 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 @@ -552,7 +552,7 @@ - + @@ -560,7 +560,7 @@ - + - + -- cgit v1.3.1 From ab31d366a5d9e5c6f8e9ce1bcb4e76e9ab46d526 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Mon, 16 Mar 2020 16:12:49 +0200 Subject: MS. Statistic Job Runs page. Add "Total Runs: Integer". --- .../Models/StatisticsValueCollection.cs | 10 +++++----- .../Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs | 9 ++++++++- .../Tango.MachineStudio.Statistics/Views/JobRunsView.xaml | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/StatisticsValueCollection.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/StatisticsValueCollection.cs index eab4eecde..ef5527406 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/StatisticsValueCollection.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/StatisticsValueCollection.cs @@ -20,7 +20,7 @@ namespace Tango.MachineStudio.Statistics.Models { public string Name { get; set; } - public double Value { get; set; } + public object Value { get; set; } public string Unit { get; set; } } @@ -139,7 +139,7 @@ namespace Tango.MachineStudio.Statistics.Models _pieColors.Add(((SolidColorBrush)Application.Current.Resources["OrangeBrush"]).Color); _pieColors.Add(((SolidColorBrush)Application.Current.Resources["GreenBrush"]).Color); _pieColors.Add(((SolidColorBrush)Application.Current.Resources["BlueBrush100"]).Color); - _pieColors.Add(Color.FromRgb(100, 184, 236));//blue + _pieColors.Add(Colors.Yellow); PieJobSource = new LabeledSeriesCollection() @@ -175,7 +175,7 @@ namespace Tango.MachineStudio.Statistics.Models /// /// Adds the statistics value. /// - public void AddStatisticsValue(string name, double value, string unit) + public void AddStatisticsValue(string name, object value, string unit) { StatisticsCollection.Add(new StatisticsValue() { Name = name, Value = value, Unit = unit }); RaisePropertyChanged("StatisticsCollection"); @@ -206,7 +206,7 @@ namespace Tango.MachineStudio.Statistics.Models { Title = "PPC", Values = new ChartValues() { PPCCount }, - Fill = new SolidColorBrush(_pieColors[2]), + Fill = new SolidColorBrush(_pieColors[4]), DataLabels = true, ToolTip = "", LabelPoint = labelPoint @@ -274,7 +274,7 @@ namespace Tango.MachineStudio.Statistics.Models { Title = "Solid", Values = new ChartValues() { solidCount }, - Fill = new SolidColorBrush(_pieColors[2]), + Fill = new SolidColorBrush(_pieColors[4]), DataLabels = true, ToolTip = "", LabelPoint = labelPoint 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 ca40273f9..94d06a178 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 @@ -367,6 +367,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels protected void GenerateStatistics() { StatisticsValueCollection.Clean(); + GenerateTotalRunsCount(); GenerateTotalRunsLength(); GenerateTotalThreadConsumption(); GenerateRunsDuration(); @@ -377,7 +378,13 @@ namespace Tango.MachineStudio.Statistics.ViewModels CreateThreadConsumptionPerThread(); GenerateAllLiquidQuantities(); } - + + protected void GenerateTotalRunsCount() + {//Total Runs: + int val =JobRuns.Where(z => z.JobRun.EndPosition > 0).Count(); + StatisticsValueCollection.AddStatisticsValue("Total Runs ", val, " "); + } + /// /// Generates the total length of the job runs. /// 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 ecc846903..af363b32a 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 @@ -554,7 +554,7 @@ - + -- cgit v1.3.1 From 23e661dfbb74dc67ea097ae331cadd2446997b31 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Wed, 18 Mar 2020 11:19:40 +0200 Subject: Machine Studio. Changes in Statistics Job Runs and Action log. Improving data creation performance. --- 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 .../Tango.MachineStudio.ActionLogs.csproj | 3 + .../ViewModels/MainViewVM.cs | 123 ++++++++++++++++-- .../Views/MainView.xaml | 9 +- .../Converters/NanoLiterToLiterFormatConverter.cs | 15 +-- .../Models/StatisticsValueCollection.cs | 19 +-- .../Models/TotalLiquidQuantityModel.cs | 15 +++ .../Tango.MachineStudio.Statistics.csproj | 1 + .../ViewModels/JobRunsViewVM.cs | 138 ++++++++++++++++++--- .../Visual_Studio/Tango.BL/Entities/ActionLog.cs | 22 ++-- 13 files changed, 289 insertions(+), 56 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/TotalLiquidQuantityModel.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index fc06677b0..2324ac49b 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 0eedec06a..7f09eb239 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 332a33b03..0e9e45341 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 ab1f7fc1b..99b7995e4 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Tango.MachineStudio.ActionLogs.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Tango.MachineStudio.ActionLogs.csproj index 280356aa8..de4783237 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Tango.MachineStudio.ActionLogs.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Tango.MachineStudio.ActionLogs.csproj @@ -156,5 +156,8 @@ + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs index df2643d88..c1bf63ce4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs @@ -24,6 +24,7 @@ namespace Tango.MachineStudio.ActionLogs.ViewModels public class MainViewVM : StudioViewModel { private INotificationProvider _notification; + private List _allUsers; #region Properties @@ -86,6 +87,17 @@ namespace Tango.MachineStudio.ActionLogs.ViewModels set { _differenceObject = value; RaisePropertyChangedAuto(); } } + private bool _isLoading; + + public bool IsLoading + { + get { return _isLoading; } + set { _isLoading = value; RaisePropertyChangedAuto(); } + } + + + + #endregion public RelayCommand SearchCommand { get; set; } @@ -96,6 +108,7 @@ namespace Tango.MachineStudio.ActionLogs.ViewModels { _notification = notification; + IsLoading = false; ActionLogs = new ObservableCollection(); SearchCommand = new RelayCommand(GetActionLogs, () => IsFree); CopyRelateObjectIDCommand = new RelayCommand(CopyRelateObjectID); @@ -111,7 +124,28 @@ namespace Tango.MachineStudio.ActionLogs.ViewModels public override void OnApplicationReady() { + InitUsers(); + } + public async void InitUsers() + { + try + { + IsFree = false; + + using (var db = ObservablesContext.CreateDefault()) + { + _allUsers = await db.Users.Include(x => x.Contact).ToListAsync(); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error loading users."); + } + finally + { + IsFree = true; + } } private void CopyToClipBoard() @@ -129,8 +163,9 @@ namespace Tango.MachineStudio.ActionLogs.ViewModels /// /// New Database Query with search parameters. Initialization ActionLogs property. /// - private async void GetActionLogs() + private void GetActionLogs() { + IsLoading = true; string filter = SearchFilter?.ToLower(); if (String.IsNullOrWhiteSpace(filter)) filter = null; @@ -147,17 +182,48 @@ namespace Tango.MachineStudio.ActionLogs.ViewModels DateTime endUtc = new DateTime(EndSelectedDate.Date.Ticks + offsetTime.Ticks, DateTimeKind.Utc); Debug.Write($"TEST TIME {startUtc} from {endUtc} " + System.Environment.NewLine); + + var db_ActionLogs = db.ActionLogs.Where(x => x.LastUpdated <= DbFunctions.TruncateTime(endUtc) && x.LastUpdated >= DbFunctions.TruncateTime(startUtc)) + .Select(x => new + { + x.ID,x.Guid,x.UserGuid, x.LastUpdated,x.Type,x.RelatedObjectName, x.RelatedObjectGuid,x.Message + }); + int[] actionTypes = SelectedActionLogTypes.SynchedSource.ToArray().Select(x => (int)x).ToArray(); + if(actionTypes.Length > 0) + { + db_ActionLogs = db_ActionLogs.Where(x => actionTypes.Contains(x.Type)); + } - ActionLogs = await new ActionLogsCollectionBuilder(db).Set(x => x.LastUpdated <= DbFunctions.TruncateTime(endUtc) && x.LastUpdated >= DbFunctions.TruncateTime(startUtc)) - .WithUsers() - .WithActionType(SelectedActionLogTypes.SynchedSource.ToArray()) - .Query(y => y.Where - (x => filter == null || - (x.ID.ToString().ToLower().StartsWith(filter) - || (x.RelatedObjectName != null && x.RelatedObjectName.ToLower().StartsWith(filter)) + var runs = db_ActionLogs.ToList() + .Select(x => new ActionLog() + { + ID = x.ID,Guid = x.Guid, + UserGuid = x.UserGuid, + LastUpdated = x.LastUpdated, + Type = x.Type, + RelatedObjectName = x.RelatedObjectName, + RelatedObjectGuid = x.RelatedObjectGuid, + Message = x.Message, + User = _allUsers.SingleOrDefault(y => y.Guid == x.UserGuid) + }); + if (!String.IsNullOrEmpty(filter)) + { + runs = runs.Where(x => x.ID.ToString().ToLower().StartsWith(filter) || (x.RelatedObjectName != null && x.RelatedObjectName.ToLower().StartsWith(filter)) || (x.RelatedObjectGuid != null && x.RelatedObjectGuid.ToLower().StartsWith(filter)) - || (x.User != null && x.User.Contact != null && x.User.Contact.FullName.ToLower().StartsWith(filter))))) - .BuildAsync(); + || (x.User != null && x.User.Contact != null && x.User.Contact.FullName.ToLower().StartsWith(filter))); + } + ActionLogs = runs.ToObservableCollection(); + + //ActionLogs = await new ActionLogsCollectionBuilder(db).Set(x => x.LastUpdated <= DbFunctions.TruncateTime(endUtc) && x.LastUpdated >= DbFunctions.TruncateTime(startUtc)) + // .WithUsers() + // .WithActionType(SelectedActionLogTypes.SynchedSource.ToArray()) + // .Query(y => y.Where + // (x => filter == null || + // (x.ID.ToString().ToLower().StartsWith(filter) + // || (x.RelatedObjectName != null && x.RelatedObjectName.ToLower().StartsWith(filter)) + // || (x.RelatedObjectGuid != null && x.RelatedObjectGuid.ToLower().StartsWith(filter)) + // || (x.User != null && x.User.Contact != null && x.User.Contact.FullName.ToLower().StartsWith(filter))))) + // .BuildAsync(); } } catch (Exception ex) @@ -169,14 +235,49 @@ namespace Tango.MachineStudio.ActionLogs.ViewModels finally { IsFree = true; + IsLoading = false; } } + /// + /// Update DifferenceObject on Selected item changed + /// private void SelectedItemChanged() { - if (SelectedActionLog == null || SelectedActionLog.DifferenceObject == null) + if (SelectedActionLog == null) return; + if(SelectedActionLog.Difference==null) + { + InitSelectedActionLogDifference(); + } DifferenceObject = SelectedActionLog.DifferenceObject; } + + /// + /// Initializes the selected action log difference. + /// + public void InitSelectedActionLogDifference() + { + IsLoading = true; + try + { + using (var db = ObservablesContext.CreateDefault()) + { + var difference = db.ActionLogs.SingleOrDefault(x => x.Guid.Equals(SelectedActionLog.Guid)); + if (difference != null) + { + SelectedActionLog.DifferenceObject = difference.DifferenceObject; + } + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error loading difference of the selected action log."); + } + finally + { + IsLoading = false; + } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml index fd640bae5..05aad0574 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml @@ -149,13 +149,13 @@ - + - - - + + + -- cgit v1.3.1 From 46fac8b6ce7c0223f005c79281a8d7a65f560a4e Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Sun, 22 Mar 2020 16:33:28 +0200 Subject: JobRuns and Action Log - correct date selections. --- .../ViewModels/MainViewVM.cs | 9 ++++----- .../ViewModels/JobRunsViewVM.cs | 16 ++++++++-------- 2 files changed, 12 insertions(+), 13 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs index c091f1221..069435307 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs @@ -185,14 +185,13 @@ namespace Tango.MachineStudio.ActionLogs.ViewModels using (ObservablesContext db = ObservablesContext.CreateDefault()) { - - DateTime startUtc = new DateTime(StartSelectedDate.Date.Ticks, DateTimeKind.Utc); - TimeSpan offsetTime = (EndSelectedDate.Date == DateTime.Now.Date) ? DateTime.Now.TimeOfDay : new TimeSpan(24, 0, 0); - DateTime endUtc = new DateTime(EndSelectedDate.Date.Ticks + offsetTime.Ticks, DateTimeKind.Utc); + DateTime startUtc = StartSelectedDate.ToUniversalTime(); + TimeSpan offsetTime = (EndSelectedDate.Date == DateTime.Now.Date) ? DateTime.Now.TimeOfDay : new TimeSpan(23, 59, 59); + DateTime endUtc = EndSelectedDate.ToUniversalTime() + offsetTime; Debug.Write($"TEST TIME {startUtc} from {endUtc} " + System.Environment.NewLine); - var db_ActionLogs = db.ActionLogs.Where(x => x.LastUpdated <= DbFunctions.TruncateTime(endUtc) && x.LastUpdated >= DbFunctions.TruncateTime(startUtc)) + var db_ActionLogs = db.ActionLogs.Where(x => x.LastUpdated <= endUtc && x.LastUpdated >= startUtc.Date) .Select(x => new { x.ID, 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 6be0948a9..254dcd6e1 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 @@ -82,7 +82,8 @@ namespace Tango.MachineStudio.Statistics.ViewModels public DateTime StartSelectedDate { get { return _startSelectedDate; } - set { _startSelectedDate = value; RaisePropertyChangedAuto(); } + set { _startSelectedDate = value; + RaisePropertyChangedAuto(); } } private DateTime _endSelectedDate; @@ -322,11 +323,10 @@ namespace Tango.MachineStudio.Statistics.ViewModels DateTime startUtc = StartSelectedDate.ToUniversalTime(); TimeSpan offsetTime = (EndSelectedDate.Date == DateTime.Now.Date) ? DateTime.Now.TimeOfDay : new TimeSpan(23, 59, 59); DateTime endUtc = EndSelectedDate.ToUniversalTime() + offsetTime; - string jobName = SelectedJob == null ? "" : SelectedJob.Name; - - - var db_JobRuns = db.JobRuns.Where(x => x.StartDate <= DbFunctions.TruncateTime(endUtc) && x.StartDate >= DbFunctions.TruncateTime(startUtc.Date)) + string jobName = SelectedJob == null ? "" : SelectedJob.Name; + + var db_JobRuns = db.JobRuns.Where(x => (x.StartDate <= endUtc && x.StartDate >= startUtc.Date)) .Select(x => new { x.ID, @@ -355,8 +355,6 @@ namespace Tango.MachineStudio.Statistics.ViewModels x.LubricantQuantity, x.CleanerQuantity }); - - var machineIDs = new HashSet(SelectedMachines.SynchedSource.ToList().Select(p => p.Guid)); if (machineIDs.Count > 0) { @@ -419,7 +417,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels LubricantQuantity = x.LubricantQuantity, CleanerQuantity = x.CleanerQuantity }).ToList(); - + var modelList = runs.Select(x => new JobRunModel() { JobRun = x, @@ -454,6 +452,8 @@ namespace Tango.MachineStudio.Statistics.ViewModels protected void GenerateStatistics() { StatisticsValueCollection.Clean(); + if (JobRuns.Count() == 0) + return; GenerateTotalRunsCount(); GenerateTotalRunsLength(); GenerateTotalThreadConsumption(); -- cgit v1.3.1 From 2ebbed964bdc4aa1c2889d6c4c0521b3ba1562aa Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sun, 22 Mar 2020 16:50:25 +0200 Subject: Dropped logging categories from settings on MS and PPC. Debug Logs Processing is done in real time from UI. --- .../ViewModels/ApplicationLogsViewVM.cs | 22 ++++++++++++++++------ .../Views/ApplicationLogsView.xaml | 2 +- .../MachineStudioSettings.cs | 6 ------ .../Tango.MachineStudio.UI/App.xaml.cs | 13 ------------- .../ViewModels/LoggingViewVM.cs | 19 +++++++++++++++++++ .../Tango.PPC.Technician/Views/LoggingView.xaml | 13 +++++++++++++ .../PPC/Tango.PPC.Common/PPCSettings.cs | 6 ------ .../Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs | 18 ------------------ 8 files changed, 49 insertions(+), 50 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs index 91cc677e0..a384c133d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs @@ -59,14 +59,14 @@ namespace Tango.MachineStudio.Logging.ViewModels } } - private bool _displayDebug; + private bool _processDebugLogs; /// /// Gets or sets a value indicating whether display debug logs. /// - public bool DisplayDebug + public bool ProcessDebugLogs { - get { return _displayDebug; } - set { _displayDebug = value; RaisePropertyChangedAuto(); } + get { return _processDebugLogs; } + set { _processDebugLogs = value; RaisePropertyChangedAuto(); OnProcessDebugLogsChanged(); } } private LogItemBase _selectedLog; @@ -184,6 +184,18 @@ namespace Tango.MachineStudio.Logging.ViewModels _is_debug = LogManager.Categories.Contains(LogCategory.Debug); } + private void OnProcessDebugLogsChanged() + { + if (ProcessDebugLogs) + { + LogManager.Categories.Add(LogCategory.Debug); + } + else + { + LogManager.Categories.RemoveAll(x => x == LogCategory.Debug); + } + } + private void ApplyLogsFilter() { if ((_realTimePaused && _isRealTime) || !_isRealTime) @@ -204,8 +216,6 @@ namespace Tango.MachineStudio.Logging.ViewModels private void LogManager_NewLog(object sender, LogItemBase log) { - if (log.Category == LogCategory.Debug && !DisplayDebug) return; - if (!RealTimePaused) { InvokeUI(() => diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogsView.xaml index 4c291d0df..486c0751d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogsView.xaml @@ -114,7 +114,7 @@ - Process Debug Logs + Enable Debug Logs diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs index 7a016b376..25dfc2dc8 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs @@ -56,11 +56,6 @@ namespace Tango.MachineStudio.Common /// public String LastVirtualMachineSerialNumber { get; set; } - /// - /// Gets or sets the logging categories. - /// - public List LoggingCategories { get; set; } - /// /// Gets or sets the last bounds. /// @@ -189,7 +184,6 @@ namespace Tango.MachineStudio.Common public MachineStudioSettings() { LastBounds = new Rect(); - LoggingCategories = new List(); DefaultIssueReportTags = new List(); StudioModulesBounds = new List(); Environment = WorkingEnvironment.Remote; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs index cb17a5a83..2ea0ebd38 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs @@ -81,19 +81,6 @@ namespace Tango.MachineStudio.UI base.OnStartup(e); - LogManager.Categories.Clear(); - - - if (settings.LoggingCategories.Count == 0) - { - settings.LoggingCategories.Add(LogCategory.Critical); - settings.LoggingCategories.Add(LogCategory.Error); - settings.LoggingCategories.Add(LogCategory.Info); - settings.LoggingCategories.Add(LogCategory.Warning); - } - - LogManager.Categories.AddRange(settings.LoggingCategories); - exceptionTrapper = new WpfGlobalExceptionTrapper(); exceptionTrapper.Initialize(this); exceptionTrapper.ApplicationCrashed += ExceptionTrapper_ApplicationCrashed; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs index 89ac7e87b..a0110b18a 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs @@ -68,6 +68,13 @@ namespace Tango.PPC.Technician.ViewModels set { _isPaused = value; RaisePropertyChangedAuto(); OnIsPausedChanged(); } } + private bool _processDebugLogs; + public bool ProcessDebugLogs + { + get { return _processDebugLogs; } + set { _processDebugLogs = value; RaisePropertyChangedAuto(); OnProcessDebugLogsChanged(); } + } + public RelayCommand ClearCommand { get; set; } public LoggingViewVM() @@ -112,6 +119,18 @@ namespace Tango.PPC.Technician.ViewModels }; } + private void OnProcessDebugLogsChanged() + { + if (ProcessDebugLogs) + { + LogManager.Categories.Add(LogCategory.Debug); + } + else + { + LogManager.Categories.RemoveAll(x => x == LogCategory.Debug); + } + } + private void OnIsPausedChanged() { foreach (var log in paused_logs) diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/LoggingView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/LoggingView.xaml index 07db49909..8393349ea 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/LoggingView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/LoggingView.xaml @@ -47,6 +47,19 @@ + + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index 71a417190..2c605ec36 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -20,11 +20,6 @@ namespace Tango.PPC.Common /// public class PPCSettings : SettingsBase { - /// - /// Gets or sets the logging categories. - /// - public List LoggingCategories { get; set; } - /// /// Gets or sets the state of the application. /// @@ -278,7 +273,6 @@ namespace Tango.PPC.Common EnableGradientGeneration = true; GradientGenerationResolution = 20; MachineScanningTimeoutSeconds = 20; - LoggingCategories = new List(); EmbeddedComPort = "COM10"; EmbeddedDeviceHint = "Tango USB Serial Port"; ExternalBridgePassword = "Aa123456"; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs index 8ee8f6a1a..ff0b1018b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs @@ -69,8 +69,6 @@ namespace Tango.PPC.UI exceptionTrapper.Initialize(this); exceptionTrapper.ApplicationCrashed += ExceptionTrapper_ApplicationCrashed; - LogManager.Categories.Clear(); - CoreSettings.DefaultDataSource = new DataSource() { Address = "localhost\\SQLEXPRESS", @@ -78,22 +76,6 @@ namespace Tango.PPC.UI IntegratedSecurity = true, }; - SettingsManager.Default.GetOrCreate(); - - var settings = SettingsManager.Default.GetOrCreate(); - - if (settings.LoggingCategories.Count == 0) - { - settings.LoggingCategories.Add(LogCategory.Critical); - settings.LoggingCategories.Add(LogCategory.Error); - settings.LoggingCategories.Add(LogCategory.Info); - settings.LoggingCategories.Add(LogCategory.Warning); - } - - settings.Save(); - - LogManager.Categories.AddRange(settings.LoggingCategories); - WebRequest.DefaultWebProxy = null; } -- cgit v1.3.1 From 37d47dd053e02118c5b314a3ec5e8f1f2b0fc8e6 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sun, 22 Mar 2020 18:34:00 +0200 Subject: Added new head cleaning parameters support. Added build up pressure to process parameters. --- 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 .../Messages/Printing/HeadCleaningParameters.proto | 9 ++ Software/PMR/Messages/Printing/JobTicket.proto | 2 + .../PMR/Messages/Printing/ProcessParameters.proto | 2 + .../Controls/JobOutlineControl.cs | 14 ++ .../Views/JobView.xaml | 2 +- .../Tango.MachineStudio.RML.csproj | 7 + .../Views/HeadCleaningParametersView.xaml | 56 ++++++++ .../Views/HeadCleaningParametersView.xaml.cs | 28 ++++ .../Tango.MachineStudio.RML/Views/RmlView.xaml | 19 ++- .../Views/ThreadParametersView.xaml | 31 +++- .../Tango.PPC.Jobs/Controls/JobOutlineControl.cs | 14 ++ .../Tango.BL/DTO/ProcessParametersTableDTOBase.cs | 8 ++ Software/Visual_Studio/Tango.BL/DTO/RmlDTOBase.cs | 8 ++ .../Entities/ProcessParametersTableBase.cs | 42 ++++++ .../Visual_Studio/Tango.BL/Entities/RmlBase.cs | 38 +++++ .../DB/PROCESS_PARAMETERS_TABLES.cs | 1 + Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs | 1 + .../Tango.DAL.Remote/DB/RemoteADO.Designer.cs | 2 +- .../Tango.DAL.Remote/DB/RemoteADO.edmx | 6 + .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 158 ++++++++++---------- .../Tango.Integration/Operation/MachineOperator.cs | 6 +- .../Tango.PMR/Printing/HeadCleaningParameters.cs | 160 +++++++++++++++++++++ .../Visual_Studio/Tango.PMR/Printing/JobTicket.cs | 70 ++++++--- .../Tango.PMR/Printing/ProcessParameters.cs | 36 ++++- Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj | 3 +- 29 files changed, 610 insertions(+), 113 deletions(-) create mode 100644 Software/PMR/Messages/Printing/HeadCleaningParameters.proto create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/HeadCleaningParametersView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/HeadCleaningParametersView.xaml.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Printing/HeadCleaningParameters.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index aebfaccbe..b785ddea1 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 6eca6b42c..3f2b8561e 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 e92ecfa41..e2f940f6a 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 2e727d616..677ff5b5f 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/PMR/Messages/Printing/HeadCleaningParameters.proto b/Software/PMR/Messages/Printing/HeadCleaningParameters.proto new file mode 100644 index 000000000..ca5a20d74 --- /dev/null +++ b/Software/PMR/Messages/Printing/HeadCleaningParameters.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Printing; +option java_package = "com.twine.tango.pmr.printing"; + +message HeadCleaningParameters +{ + double CleanerFlow = 1; +} diff --git a/Software/PMR/Messages/Printing/JobTicket.proto b/Software/PMR/Messages/Printing/JobTicket.proto index b442893cd..141adff01 100644 --- a/Software/PMR/Messages/Printing/JobTicket.proto +++ b/Software/PMR/Messages/Printing/JobTicket.proto @@ -6,6 +6,7 @@ import "JobWindingMethod.proto"; import "JobSpool.proto"; import "JobUploadStrategy.proto"; import "ThreadParameters.proto"; +import "HeadCleaningParameters.proto"; package Tango.PMR.Printing; option java_package = "com.twine.tango.pmr.printing"; @@ -38,4 +39,5 @@ message JobTicket bool SampleWinding = 14; ThreadParameters ThreadParameters = 15; + HeadCleaningParameters HeadCleaningParameters = 16; } \ No newline at end of file diff --git a/Software/PMR/Messages/Printing/ProcessParameters.proto b/Software/PMR/Messages/Printing/ProcessParameters.proto index 9dbc0e78b..0a483d9bb 100644 --- a/Software/PMR/Messages/Printing/ProcessParameters.proto +++ b/Software/PMR/Messages/Printing/ProcessParameters.proto @@ -76,4 +76,6 @@ message ProcessParameters double LBlowerTemp = 30; + double PressureBuildUp = 31; + } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/JobOutlineControl.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/JobOutlineControl.cs index 5a3f5d337..68dc7e3bf 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/JobOutlineControl.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/JobOutlineControl.cs @@ -150,6 +150,20 @@ namespace Tango.MachineStudio.Developer.Controls _sizeControl.Height += NORMAL_FONT_HEIGHT; } } + //JobTicket.HeadCleaningParameters + if (job.HeadCleaningParameters != null) + { + _sizeControl.Height += 20; + DrawHeaderText(drawingContext, "HEAD CLEANING PARAMETERS", 17, LevelOffset.level_0); + _sizeControl.Height += TITLE_FONT_HEIGHT; + _sizeControl.Height += 5.0; + basicProps = GetNameValueList(job.HeadCleaningParameters); + foreach (var prop in basicProps) + { + DrawNameValueText(drawingContext, prop, LevelOffset.level_1, PackIconKind.Settings); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + } + } //JobTicket.Segments if (job.Segments != null) { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml index ed8fc57fe..ed832f468 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -1553,7 +1553,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj index f448932a0..a413223c3 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj @@ -118,6 +118,9 @@ RmlView.xaml + + HeadCleaningParametersView.xaml + ThreadParametersView.xaml @@ -229,6 +232,10 @@ Designer MSBuild:Compile + + MSBuild:Compile + Designer + MSBuild:Compile Designer diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/HeadCleaningParametersView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/HeadCleaningParametersView.xaml new file mode 100644 index 000000000..72e377c34 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/HeadCleaningParametersView.xaml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + HEAD CLEANING PARAMETERS + + + + + + + + + + CLEANER + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/HeadCleaningParametersView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/HeadCleaningParametersView.xaml.cs new file mode 100644 index 000000000..8d036efa5 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/HeadCleaningParametersView.xaml.cs @@ -0,0 +1,28 @@ +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.MachineStudio.RML.Views +{ + /// + /// Interaction logic for SpoolsView.xaml + /// + public partial class HeadCleaningParametersView : UserControl + { + public HeadCleaningParametersView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml index e967c7d83..f425f2003 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml @@ -56,7 +56,13 @@ PROPERTIES - + + + + @@ -149,13 +155,16 @@ - + - + - + + + + @@ -214,7 +223,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ThreadParametersView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ThreadParametersView.xaml index 7f1ca2262..c083e9b02 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ThreadParametersView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ThreadParametersView.xaml @@ -35,7 +35,13 @@ FEEDER - + + + + @@ -49,7 +55,13 @@ PULLER - + + + + @@ -63,7 +75,13 @@ WINDER - + + + + @@ -83,7 +101,12 @@ ROCKERS - + + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobOutlineControl.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobOutlineControl.cs index 0d6a2f6be..78f8c90a1 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobOutlineControl.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobOutlineControl.cs @@ -157,6 +157,20 @@ namespace Tango.PPC.Jobs _sizeControl.Height += NORMAL_FONT_HEIGHT; } } + //JobTicket.HeadCleaningParameters + if (job.HeadCleaningParameters != null) + { + _sizeControl.Height += 20; + DrawHeaderText(drawingContext, "HEAD CLEANING PARAMETERS", 17, LevelOffset.level_0); + _sizeControl.Height += TITLE_FONT_HEIGHT; + _sizeControl.Height += 5.0; + basicProps = GetNameValueList(job.HeadCleaningParameters); + foreach (var prop in basicProps) + { + DrawNameValueText(drawingContext, prop, LevelOffset.level_1, TouchIconKind.Settings); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + } + } //JobTicket.Segments if (job.Segments != null) { diff --git a/Software/Visual_Studio/Tango.BL/DTO/ProcessParametersTableDTOBase.cs b/Software/Visual_Studio/Tango.BL/DTO/ProcessParametersTableDTOBase.cs index 2d431b9df..f0699bc72 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/ProcessParametersTableDTOBase.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/ProcessParametersTableDTOBase.cs @@ -277,5 +277,13 @@ namespace Tango.BL.DTO get; set; } + /// + /// pressure build up + /// + public Double PressureBuildUp + { + get; set; + } + } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/RmlDTOBase.cs b/Software/Visual_Studio/Tango.BL/DTO/RmlDTOBase.cs index c30f9c42b..dff2eec8b 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/RmlDTOBase.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/RmlDTOBase.cs @@ -349,5 +349,13 @@ namespace Tango.BL.DTO get; set; } + /// + /// cleaner flow + /// + public Int32 CleanerFlow + { + get; set; + } + } } diff --git a/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTableBase.cs b/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTableBase.cs index 2d9f1e4fb..16acc7398 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTableBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTableBase.cs @@ -89,6 +89,8 @@ namespace Tango.BL.Entities public event EventHandler LBlowerTempChanged; + public event EventHandler PressureBuildUpChanged; + public event EventHandler ProcessParametersTablesGroupChanged; protected String _name; @@ -1074,6 +1076,37 @@ namespace Tango.BL.Entities } } + protected Double _pressurebuildup; + + /// + /// Gets or sets the processparameterstablebase pressure build up. + /// + + [Column("PRESSURE_BUILD_UP")] + + [StringFormat("0")] + + [PropertyIndex(29)] + + public Double PressureBuildUp + { + get + { + return _pressurebuildup; + } + + set + { + if (_pressurebuildup != value) + { + _pressurebuildup = value; + + OnPressureBuildUpChanged(value); + + } + } + } + protected ProcessParametersTablesGroup _processparameterstablesgroup; /// @@ -1385,6 +1418,15 @@ namespace Tango.BL.Entities RaisePropertyChanged(nameof(LBlowerTemp)); } + /// + /// Called when the PressureBuildUp has changed. + /// + protected virtual void OnPressureBuildUpChanged(Double pressurebuildup) + { + PressureBuildUpChanged?.Invoke(this, pressurebuildup); + RaisePropertyChanged(nameof(PressureBuildUp)); + } + /// /// Called when the ProcessParametersTablesGroup has changed. /// diff --git a/Software/Visual_Studio/Tango.BL/Entities/RmlBase.cs b/Software/Visual_Studio/Tango.BL/Entities/RmlBase.cs index f56de3208..dc22ac33c 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/RmlBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/RmlBase.cs @@ -95,6 +95,8 @@ namespace Tango.BL.Entities public event EventHandler BypassRockersChanged; + public event EventHandler CleanerFlowChanged; + public event EventHandler> CatsChanged; public event EventHandler CctChanged; @@ -1223,6 +1225,33 @@ namespace Tango.BL.Entities } } + protected Int32 _cleanerflow; + + /// + /// Gets or sets the rmlbase cleaner flow. + /// + + [Column("CLEANER_FLOW")] + + public Int32 CleanerFlow + { + get + { + return _cleanerflow; + } + + set + { + if (_cleanerflow != value) + { + _cleanerflow = value; + + OnCleanerFlowChanged(value); + + } + } + } + protected SynchronizedObservableCollection _cats; /// @@ -1928,6 +1957,15 @@ namespace Tango.BL.Entities RaisePropertyChanged(nameof(BypassRockers)); } + /// + /// Called when the CleanerFlow has changed. + /// + protected virtual void OnCleanerFlowChanged(Int32 cleanerflow) + { + CleanerFlowChanged?.Invoke(this, cleanerflow); + RaisePropertyChanged(nameof(CleanerFlow)); + } + /// /// Called when the Cats has changed. /// diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/PROCESS_PARAMETERS_TABLES.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/PROCESS_PARAMETERS_TABLES.cs index 2a04633bf..5896f742e 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/PROCESS_PARAMETERS_TABLES.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/PROCESS_PARAMETERS_TABLES.cs @@ -49,6 +49,7 @@ namespace Tango.DAL.Remote.DB public double R_BLOWER_TEMP { get; set; } public double L_BLOWER_FLOW { get; set; } public double L_BLOWER_TEMP { get; set; } + public double PRESSURE_BUILD_UP { get; set; } public virtual PROCESS_PARAMETERS_TABLES_GROUPS PROCESS_PARAMETERS_TABLES_GROUPS { get; set; } } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs index 17eb2ec66..fc7354e0e 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs @@ -70,6 +70,7 @@ namespace Tango.DAL.Remote.DB public int WINDER_I { get; set; } public int WINDER_D { get; set; } public bool BYPASS_ROCKERS { get; set; } + public int CLEANER_FLOW { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection CATS { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Designer.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Designer.cs index 17bc2683d..d26e67908 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Designer.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Designer.cs @@ -1,4 +1,4 @@ -// T4 code generation is enabled for model 'D:\Development\Tango\Software\Visual_Studio\Tango.DAL.Remote\DB\RemoteADO.edmx'. +// T4 code generation is enabled for model 'C:\DATA\Development\Tango\Software\Visual_Studio\Tango.DAL.Remote\DB\RemoteADO.edmx'. // To enable legacy code generation, change the value of the 'Code Generation Strategy' designer // property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model // is open in the designer. diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx index 3cf2baaba..0a4a052a6 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -889,6 +889,7 @@ + @@ -950,6 +951,7 @@ + @@ -4227,6 +4229,7 @@ + @@ -4291,6 +4294,7 @@ + @@ -6657,6 +6661,7 @@ + @@ -6711,6 +6716,7 @@ + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram index a69b91e87..93f29852f 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,85 +5,85 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index b17321942..f432c2e69 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -2288,7 +2288,7 @@ namespace Tango.Integration.Operation ticket.Spool.LimitSwitchStartPointOffset = machineSpool.LimitSwitchStartPointOffset != null ? machineSpool.LimitSwitchStartPointOffset.Value : ticket.Spool.LimitSwitchStartPointOffset; } - //Thread parameters + //Thread Parameters ticket.ThreadParameters = new ThreadParameters(); job.Rml.MapPrimitivesTo(ticket.ThreadParameters); @@ -2296,6 +2296,10 @@ namespace Tango.Integration.Operation processParameters.MapPrimitivesTo(process); ticket.ProcessParameters = process; + //Head Cleaning Parameters + ticket.HeadCleaningParameters = new HeadCleaningParameters(); + ticket.HeadCleaningParameters.CleanerFlow = job.Rml.CleanerFlow; + JobHandler handler = null; StorageFileHandler fileUploadHandler = null; diff --git a/Software/Visual_Studio/Tango.PMR/Printing/HeadCleaningParameters.cs b/Software/Visual_Studio/Tango.PMR/Printing/HeadCleaningParameters.cs new file mode 100644 index 000000000..e086fdddf --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Printing/HeadCleaningParameters.cs @@ -0,0 +1,160 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: HeadCleaningParameters.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Printing { + + /// Holder for reflection information generated from HeadCleaningParameters.proto + public static partial class HeadCleaningParametersReflection { + + #region Descriptor + /// File descriptor for HeadCleaningParameters.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static HeadCleaningParametersReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChxIZWFkQ2xlYW5pbmdQYXJhbWV0ZXJzLnByb3RvEhJUYW5nby5QTVIuUHJp", + "bnRpbmciLQoWSGVhZENsZWFuaW5nUGFyYW1ldGVycxITCgtDbGVhbmVyRmxv", + "dxgBIAEoAUIeChxjb20udHdpbmUudGFuZ28ucG1yLnByaW50aW5nYgZwcm90", + "bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Printing.HeadCleaningParameters), global::Tango.PMR.Printing.HeadCleaningParameters.Parser, new[]{ "CleanerFlow" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class HeadCleaningParameters : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HeadCleaningParameters()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Printing.HeadCleaningParametersReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public HeadCleaningParameters() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public HeadCleaningParameters(HeadCleaningParameters other) : this() { + cleanerFlow_ = other.cleanerFlow_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public HeadCleaningParameters Clone() { + return new HeadCleaningParameters(this); + } + + /// Field number for the "CleanerFlow" field. + public const int CleanerFlowFieldNumber = 1; + private double cleanerFlow_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double CleanerFlow { + get { return cleanerFlow_; } + set { + cleanerFlow_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as HeadCleaningParameters); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(HeadCleaningParameters other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (CleanerFlow != other.CleanerFlow) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (CleanerFlow != 0D) hash ^= CleanerFlow.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (CleanerFlow != 0D) { + output.WriteRawTag(9); + output.WriteDouble(CleanerFlow); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (CleanerFlow != 0D) { + size += 1 + 8; + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(HeadCleaningParameters other) { + if (other == null) { + return; + } + if (other.CleanerFlow != 0D) { + CleanerFlow = other.CleanerFlow; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 9: { + CleanerFlow = input.ReadDouble(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Printing/JobTicket.cs b/Software/Visual_Studio/Tango.PMR/Printing/JobTicket.cs index 0431913a4..8e314704d 100644 --- a/Software/Visual_Studio/Tango.PMR/Printing/JobTicket.cs +++ b/Software/Visual_Studio/Tango.PMR/Printing/JobTicket.cs @@ -25,25 +25,27 @@ namespace Tango.PMR.Printing { "Cg9Kb2JUaWNrZXQucHJvdG8SElRhbmdvLlBNUi5QcmludGluZxoQSm9iU2Vn", "bWVudC5wcm90bxoXUHJvY2Vzc1BhcmFtZXRlcnMucHJvdG8aFkpvYldpbmRp", "bmdNZXRob2QucHJvdG8aDkpvYlNwb29sLnByb3RvGhdKb2JVcGxvYWRTdHJh", - "dGVneS5wcm90bxoWVGhyZWFkUGFyYW1ldGVycy5wcm90byKxBAoJSm9iVGlj", - "a2V0EgwKBEd1aWQYASABKAkSDAoETmFtZRgCIAEoCRIaChJFbmFibGVJbnRl", - "clNlZ21lbnQYAyABKAgSGgoSSW50ZXJTZWdtZW50TGVuZ3RoGAQgASgBEg4K", - "Bkxlbmd0aBgFIAEoARJAChFQcm9jZXNzUGFyYW1ldGVycxgGIAEoCzIlLlRh", - "bmdvLlBNUi5QcmludGluZy5Qcm9jZXNzUGFyYW1ldGVycxI7Cg1XaW5kaW5n", - "TWV0aG9kGAcgASgOMiQuVGFuZ28uUE1SLlByaW50aW5nLkpvYldpbmRpbmdN", - "ZXRob2QSKwoFU3Bvb2wYCCABKAsyHC5UYW5nby5QTVIuUHJpbnRpbmcuSm9i", - "U3Bvb2wSMAoIU2VnbWVudHMYCSADKAsyHi5UYW5nby5QTVIuUHJpbnRpbmcu", - "Sm9iU2VnbWVudBI9Cg5VcGxvYWRTdHJhdGVneRgKIAEoDjIlLlRhbmdvLlBN", - "Ui5QcmludGluZy5Kb2JVcGxvYWRTdHJhdGVneRIaChJKb2JEZXNjcmlwdGlv", - "bkZpbGUYCyABKAkSGQoRRW5hYmxlTHVicmljYXRpb24YDCABKAgSFQoNTnVt", - "YmVyT2ZVbml0cxgNIAEoDRIVCg1TYW1wbGVXaW5kaW5nGA4gASgIEj4KEFRo", - "cmVhZFBhcmFtZXRlcnMYDyABKAsyJC5UYW5nby5QTVIuUHJpbnRpbmcuVGhy", - "ZWFkUGFyYW1ldGVyc0IeChxjb20udHdpbmUudGFuZ28ucG1yLnByaW50aW5n", - "YgZwcm90bzM=")); + "dGVneS5wcm90bxoWVGhyZWFkUGFyYW1ldGVycy5wcm90bxocSGVhZENsZWFu", + "aW5nUGFyYW1ldGVycy5wcm90byL9BAoJSm9iVGlja2V0EgwKBEd1aWQYASAB", + "KAkSDAoETmFtZRgCIAEoCRIaChJFbmFibGVJbnRlclNlZ21lbnQYAyABKAgS", + "GgoSSW50ZXJTZWdtZW50TGVuZ3RoGAQgASgBEg4KBkxlbmd0aBgFIAEoARJA", + "ChFQcm9jZXNzUGFyYW1ldGVycxgGIAEoCzIlLlRhbmdvLlBNUi5QcmludGlu", + "Zy5Qcm9jZXNzUGFyYW1ldGVycxI7Cg1XaW5kaW5nTWV0aG9kGAcgASgOMiQu", + "VGFuZ28uUE1SLlByaW50aW5nLkpvYldpbmRpbmdNZXRob2QSKwoFU3Bvb2wY", + "CCABKAsyHC5UYW5nby5QTVIuUHJpbnRpbmcuSm9iU3Bvb2wSMAoIU2VnbWVu", + "dHMYCSADKAsyHi5UYW5nby5QTVIuUHJpbnRpbmcuSm9iU2VnbWVudBI9Cg5V", + "cGxvYWRTdHJhdGVneRgKIAEoDjIlLlRhbmdvLlBNUi5QcmludGluZy5Kb2JV", + "cGxvYWRTdHJhdGVneRIaChJKb2JEZXNjcmlwdGlvbkZpbGUYCyABKAkSGQoR", + "RW5hYmxlTHVicmljYXRpb24YDCABKAgSFQoNTnVtYmVyT2ZVbml0cxgNIAEo", + "DRIVCg1TYW1wbGVXaW5kaW5nGA4gASgIEj4KEFRocmVhZFBhcmFtZXRlcnMY", + "DyABKAsyJC5UYW5nby5QTVIuUHJpbnRpbmcuVGhyZWFkUGFyYW1ldGVycxJK", + "ChZIZWFkQ2xlYW5pbmdQYXJhbWV0ZXJzGBAgASgLMiouVGFuZ28uUE1SLlBy", + "aW50aW5nLkhlYWRDbGVhbmluZ1BhcmFtZXRlcnNCHgocY29tLnR3aW5lLnRh", + "bmdvLnBtci5wcmludGluZ2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Tango.PMR.Printing.JobSegmentReflection.Descriptor, global::Tango.PMR.Printing.ProcessParametersReflection.Descriptor, global::Tango.PMR.Printing.JobWindingMethodReflection.Descriptor, global::Tango.PMR.Printing.JobSpoolReflection.Descriptor, global::Tango.PMR.Printing.JobUploadStrategyReflection.Descriptor, global::Tango.PMR.Printing.ThreadParametersReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::Tango.PMR.Printing.JobSegmentReflection.Descriptor, global::Tango.PMR.Printing.ProcessParametersReflection.Descriptor, global::Tango.PMR.Printing.JobWindingMethodReflection.Descriptor, global::Tango.PMR.Printing.JobSpoolReflection.Descriptor, global::Tango.PMR.Printing.JobUploadStrategyReflection.Descriptor, global::Tango.PMR.Printing.ThreadParametersReflection.Descriptor, global::Tango.PMR.Printing.HeadCleaningParametersReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Printing.JobTicket), global::Tango.PMR.Printing.JobTicket.Parser, new[]{ "Guid", "Name", "EnableInterSegment", "InterSegmentLength", "Length", "ProcessParameters", "WindingMethod", "Spool", "Segments", "UploadStrategy", "JobDescriptionFile", "EnableLubrication", "NumberOfUnits", "SampleWinding", "ThreadParameters" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Printing.JobTicket), global::Tango.PMR.Printing.JobTicket.Parser, new[]{ "Guid", "Name", "EnableInterSegment", "InterSegmentLength", "Length", "ProcessParameters", "WindingMethod", "Spool", "Segments", "UploadStrategy", "JobDescriptionFile", "EnableLubrication", "NumberOfUnits", "SampleWinding", "ThreadParameters", "HeadCleaningParameters" }, null, null, null) })); } #endregion @@ -89,6 +91,7 @@ namespace Tango.PMR.Printing { numberOfUnits_ = other.numberOfUnits_; sampleWinding_ = other.sampleWinding_; ThreadParameters = other.threadParameters_ != null ? other.ThreadParameters.Clone() : null; + HeadCleaningParameters = other.headCleaningParameters_ != null ? other.HeadCleaningParameters.Clone() : null; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -263,6 +266,17 @@ namespace Tango.PMR.Printing { } } + /// Field number for the "HeadCleaningParameters" field. + public const int HeadCleaningParametersFieldNumber = 16; + private global::Tango.PMR.Printing.HeadCleaningParameters headCleaningParameters_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Tango.PMR.Printing.HeadCleaningParameters HeadCleaningParameters { + get { return headCleaningParameters_; } + set { + headCleaningParameters_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as JobTicket); @@ -291,6 +305,7 @@ namespace Tango.PMR.Printing { if (NumberOfUnits != other.NumberOfUnits) return false; if (SampleWinding != other.SampleWinding) return false; if (!object.Equals(ThreadParameters, other.ThreadParameters)) return false; + if (!object.Equals(HeadCleaningParameters, other.HeadCleaningParameters)) return false; return true; } @@ -312,6 +327,7 @@ namespace Tango.PMR.Printing { if (NumberOfUnits != 0) hash ^= NumberOfUnits.GetHashCode(); if (SampleWinding != false) hash ^= SampleWinding.GetHashCode(); if (threadParameters_ != null) hash ^= ThreadParameters.GetHashCode(); + if (headCleaningParameters_ != null) hash ^= HeadCleaningParameters.GetHashCode(); return hash; } @@ -379,6 +395,10 @@ namespace Tango.PMR.Printing { output.WriteRawTag(122); output.WriteMessage(ThreadParameters); } + if (headCleaningParameters_ != null) { + output.WriteRawTag(130, 1); + output.WriteMessage(HeadCleaningParameters); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -427,6 +447,9 @@ namespace Tango.PMR.Printing { if (threadParameters_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(ThreadParameters); } + if (headCleaningParameters_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(HeadCleaningParameters); + } return size; } @@ -487,6 +510,12 @@ namespace Tango.PMR.Printing { } ThreadParameters.MergeFrom(other.ThreadParameters); } + if (other.headCleaningParameters_ != null) { + if (headCleaningParameters_ == null) { + headCleaningParameters_ = new global::Tango.PMR.Printing.HeadCleaningParameters(); + } + HeadCleaningParameters.MergeFrom(other.HeadCleaningParameters); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -566,6 +595,13 @@ namespace Tango.PMR.Printing { input.ReadMessage(threadParameters_); break; } + case 130: { + if (headCleaningParameters_ == null) { + headCleaningParameters_ = new global::Tango.PMR.Printing.HeadCleaningParameters(); + } + input.ReadMessage(headCleaningParameters_); + break; + } } } } diff --git a/Software/Visual_Studio/Tango.PMR/Printing/ProcessParameters.cs b/Software/Visual_Studio/Tango.PMR/Printing/ProcessParameters.cs index ef290e431..b0c29288f 100644 --- a/Software/Visual_Studio/Tango.PMR/Printing/ProcessParameters.cs +++ b/Software/Visual_Studio/Tango.PMR/Printing/ProcessParameters.cs @@ -23,7 +23,7 @@ namespace Tango.PMR.Printing { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "ChdQcm9jZXNzUGFyYW1ldGVycy5wcm90bxISVGFuZ28uUE1SLlByaW50aW5n", - "IrkFChFQcm9jZXNzUGFyYW1ldGVycxITCgtEeWVpbmdTcGVlZBgBIAEoARIU", + "ItIFChFQcm9jZXNzUGFyYW1ldGVycxITCgtEeWVpbmdTcGVlZBgBIAEoARIU", "CgxNaW5JbmtVcHRha2UYAiABKAESFAoMTWF4SW5rVXB0YWtlGAMgASgBEhUK", "DUZlZWRlclRlbnNpb24YBCABKAESFQoNUHVsbGVyVGVuc2lvbhgFIAEoARIV", "Cg1XaW5kZXJUZW5zaW9uGAYgASgBEhEKCU1peGVyVGVtcBgHIAEoARIVCg1I", @@ -38,12 +38,12 @@ namespace Tango.PMR.Printing { "IAEoARIWCg5IZWFkWm9uZTEwVGVtcBgYIAEoARIWCg5IZWFkWm9uZTExVGVt", "cBgZIAEoARIWCg5IZWFkWm9uZTEyVGVtcBgaIAEoARITCgtSQmxvd2VyRmxv", "dxgbIAEoARITCgtSQmxvd2VyVGVtcBgcIAEoARITCgtMQmxvd2VyRmxvdxgd", - "IAEoARITCgtMQmxvd2VyVGVtcBgeIAEoAUIeChxjb20udHdpbmUudGFuZ28u", - "cG1yLnByaW50aW5nYgZwcm90bzM=")); + "IAEoARITCgtMQmxvd2VyVGVtcBgeIAEoARIXCg9QcmVzc3VyZUJ1aWxkVXAY", + "HyABKAFCHgocY29tLnR3aW5lLnRhbmdvLnBtci5wcmludGluZ2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Printing.ProcessParameters), global::Tango.PMR.Printing.ProcessParameters.Parser, new[]{ "DyeingSpeed", "MinInkUptake", "MaxInkUptake", "FeederTension", "PullerTension", "WinderTension", "MixerTemp", "HeadZone1Temp", "HeadZone2Temp", "HeadZone3Temp", "HeadZone4Temp", "HeadZone5Temp", "HeadZone6Temp", "DryerAirFlow", "DryerZone1Temp", "DryerZone2Temp", "DryerZone3Temp", "DryerBufferLength", "HeadAirFlow", "TableIndex", "HeadZone7Temp", "HeadZone8Temp", "HeadZone9Temp", "HeadZone10Temp", "HeadZone11Temp", "HeadZone12Temp", "RBlowerFlow", "RBlowerTemp", "LBlowerFlow", "LBlowerTemp" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Printing.ProcessParameters), global::Tango.PMR.Printing.ProcessParameters.Parser, new[]{ "DyeingSpeed", "MinInkUptake", "MaxInkUptake", "FeederTension", "PullerTension", "WinderTension", "MixerTemp", "HeadZone1Temp", "HeadZone2Temp", "HeadZone3Temp", "HeadZone4Temp", "HeadZone5Temp", "HeadZone6Temp", "DryerAirFlow", "DryerZone1Temp", "DryerZone2Temp", "DryerZone3Temp", "DryerBufferLength", "HeadAirFlow", "TableIndex", "HeadZone7Temp", "HeadZone8Temp", "HeadZone9Temp", "HeadZone10Temp", "HeadZone11Temp", "HeadZone12Temp", "RBlowerFlow", "RBlowerTemp", "LBlowerFlow", "LBlowerTemp", "PressureBuildUp" }, null, null, null) })); } #endregion @@ -104,6 +104,7 @@ namespace Tango.PMR.Printing { rBlowerTemp_ = other.rBlowerTemp_; lBlowerFlow_ = other.lBlowerFlow_; lBlowerTemp_ = other.lBlowerTemp_; + pressureBuildUp_ = other.pressureBuildUp_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -441,6 +442,17 @@ namespace Tango.PMR.Printing { } } + /// Field number for the "PressureBuildUp" field. + public const int PressureBuildUpFieldNumber = 31; + private double pressureBuildUp_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double PressureBuildUp { + get { return pressureBuildUp_; } + set { + pressureBuildUp_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ProcessParameters); @@ -484,6 +496,7 @@ namespace Tango.PMR.Printing { if (RBlowerTemp != other.RBlowerTemp) return false; if (LBlowerFlow != other.LBlowerFlow) return false; if (LBlowerTemp != other.LBlowerTemp) return false; + if (PressureBuildUp != other.PressureBuildUp) return false; return true; } @@ -520,6 +533,7 @@ namespace Tango.PMR.Printing { if (RBlowerTemp != 0D) hash ^= RBlowerTemp.GetHashCode(); if (LBlowerFlow != 0D) hash ^= LBlowerFlow.GetHashCode(); if (LBlowerTemp != 0D) hash ^= LBlowerTemp.GetHashCode(); + if (PressureBuildUp != 0D) hash ^= PressureBuildUp.GetHashCode(); return hash; } @@ -650,6 +664,10 @@ namespace Tango.PMR.Printing { output.WriteRawTag(241, 1); output.WriteDouble(LBlowerTemp); } + if (PressureBuildUp != 0D) { + output.WriteRawTag(249, 1); + output.WriteDouble(PressureBuildUp); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -745,6 +763,9 @@ namespace Tango.PMR.Printing { if (LBlowerTemp != 0D) { size += 2 + 8; } + if (PressureBuildUp != 0D) { + size += 2 + 8; + } return size; } @@ -843,6 +864,9 @@ namespace Tango.PMR.Printing { if (other.LBlowerTemp != 0D) { LBlowerTemp = other.LBlowerTemp; } + if (other.PressureBuildUp != 0D) { + PressureBuildUp = other.PressureBuildUp; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -973,6 +997,10 @@ namespace Tango.PMR.Printing { LBlowerTemp = input.ReadDouble(); break; } + case 249: { + PressureBuildUp = input.ReadDouble(); + break; + } } } } diff --git a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj index d7b2203dd..277687384 100644 --- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj +++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj @@ -269,6 +269,7 @@ + @@ -325,7 +326,7 @@ - + \ No newline at end of file -- cgit v1.3.1 From ff15e093dd28bd1c02e00c14853aa8c24153995c Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Mon, 23 Mar 2020 12:54:59 +0200 Subject: Job Runs and Action logs. Changed start time. Related Work Items: #2574 --- .../Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs | 6 +++--- .../Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs index 069435307..3e5c59fee 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs @@ -185,13 +185,13 @@ namespace Tango.MachineStudio.ActionLogs.ViewModels using (ObservablesContext db = ObservablesContext.CreateDefault()) { - DateTime startUtc = StartSelectedDate.ToUniversalTime(); + DateTime startUtc = new DateTime(StartSelectedDate.Year, StartSelectedDate.Month, StartSelectedDate.Day, 0, 0, 0).ToUniversalTime(); TimeSpan offsetTime = (EndSelectedDate.Date == DateTime.Now.Date) ? DateTime.Now.TimeOfDay : new TimeSpan(23, 59, 59); DateTime endUtc = EndSelectedDate.ToUniversalTime() + offsetTime; - Debug.Write($"TEST TIME {startUtc} from {endUtc} " + System.Environment.NewLine); + Debug.Write($"TEST TIME {startUtc} to {endUtc} "+ System.Environment.NewLine); - var db_ActionLogs = db.ActionLogs.Where(x => x.LastUpdated <= endUtc && x.LastUpdated >= startUtc.Date) + var db_ActionLogs = db.ActionLogs.Where(x => x.LastUpdated <= endUtc && x.LastUpdated >= startUtc) .Select(x => new { x.ID, 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 254dcd6e1..800346ff9 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 @@ -320,13 +320,13 @@ namespace Tango.MachineStudio.Statistics.ViewModels using (var db = ObservablesContext.CreateDefault()) { - DateTime startUtc = StartSelectedDate.ToUniversalTime(); + DateTime startUtc = new DateTime(StartSelectedDate.Year, StartSelectedDate.Month, StartSelectedDate.Day, 0, 0, 0).ToUniversalTime(); TimeSpan offsetTime = (EndSelectedDate.Date == DateTime.Now.Date) ? DateTime.Now.TimeOfDay : new TimeSpan(23, 59, 59); DateTime endUtc = EndSelectedDate.ToUniversalTime() + offsetTime; string jobName = SelectedJob == null ? "" : SelectedJob.Name; - var db_JobRuns = db.JobRuns.Where(x => (x.StartDate <= endUtc && x.StartDate >= startUtc.Date)) + var db_JobRuns = db.JobRuns.Where(x => (x.StartDate <= endUtc && x.StartDate >= startUtc)) .Select(x => new { x.ID, -- cgit v1.3.1 From 8f57d4962fa84499c8a153ebfff6e7766434ee1c Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Wed, 25 Mar 2020 14:57:56 +0200 Subject: Machine Studio. Added bottom margin to the job outline to show the "BACK TO JOBS" button. Related Work Items: #2607 --- .../Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml | 2 +- .../Tango.Integration/ExternalBridge/ExternalBridgeScanner.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml index e7f16146b..0400ee7e6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml @@ -208,7 +208,7 @@ - +