From d208f2029740f203ce79c6452432fa083a4c5c07 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Mon, 4 Jul 2022 20:08:15 +0300 Subject: RML Extension. New filter to show machines where test were added. Related Work Items: #6803 --- .../Models/MachineModel.cs | 11 +++ .../ViewModels/MainViewVM.cs | 86 +++++++++++++++++++--- .../Views/MachineTestResultsView.xaml | 8 +- 3 files changed, 92 insertions(+), 13 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/MachineModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/MachineModel.cs index c2b00fe92..bac5f62b8 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/MachineModel.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/MachineModel.cs @@ -26,6 +26,17 @@ namespace Tango.MachineStudio.ThreadExtensions.Models } } + private DateTime _lastUpdated; + /// + /// Gets or sets the entity last updated data and time. + /// + public DateTime LastUpdated + { + get { return _lastUpdated; } + set { _lastUpdated = value; + RaisePropertyChanged(nameof(LastUpdated)); } + } + private bool _hasRMLTest; public bool HasRMLTest diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs index 164d37b74..820a55558 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs @@ -303,11 +303,66 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels set { - _machines = value; RaisePropertyChanged(nameof(Machines)); + _machines = value; + LoadFilteredMachines(); + RaisePropertyChanged(nameof(Machines)); } } + private ObservableCollection _filteremachines; + /// + /// Gets or sets the Machines. + /// + public ObservableCollection FilteredMachines + { + get + { + return _filteremachines; + } + + set + { + _filteremachines = value; RaisePropertyChanged(nameof(FilteredMachines)); + } + + } + + private bool _showWithData; + /// + /// Gets or sets the bool show with data only. + /// + public bool ShowWithData + { + get { return _showWithData; } + set { + if(_showWithData != value) + { + _showWithData = value; + RaisePropertyChangedAuto(); + LoadFilteredMachines(); + } + } + } + + private void LoadFilteredMachines() + { + if(_showWithData) + FilteredMachines = Machines.Where(x => x.HasRMLTest).OrderBy(x => x.LastUpdated).ToObservableCollection(); + else + { + FilteredMachines = Machines.OrderBy(x=>x.Name).ToObservableCollection(); + } + + } + + private bool _canEdit; + public bool CanEdit + { + get { return _canEdit; } + set { _canEdit = value; + RaisePropertyChangedAuto(); } + } //private MachineTestResultsTabs PreviosSelectedTab { get; set; } //private MachineTestResultsTabs _selectedTab; @@ -792,19 +847,14 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels #endregion - private bool _canEdit; - public bool CanEdit - { - get { return _canEdit; } - set { _canEdit = value; - RaisePropertyChangedAuto(); } - } + public MainViewVM(INotificationProvider notificationProvider, IAuthenticationProvider authentication, IActionLogManager actionLogManager) { _notification = notificationProvider; _authentication = authentication; _actionLogManager = actionLogManager; + _showWithData = false; BackToThreadExtensionViewsCommand = new RelayCommand(BackToThreadExtensionViews, () => IsFree); SaveCommand = new RelayCommand(Save, () => IsFree); @@ -853,7 +903,6 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels AddGlossLevelItemCommand = new RelayCommand(AddGlossLevelItem); EditGlossLevelItemCommand = new RelayCommand(EditGlossLevelItem); - } @@ -947,7 +996,9 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels Guid = x.Guid, Name = x.Name, SerialNumber = x.SerialNumber, - IdsPacks = x.Configuration.IdsPacks.Where(z => !z.IsEmpty) + IdsPacks = x.Configuration.IdsPacks.Where(z => !z.IsEmpty), + LastUpdated = x.LastUpdated, + HasRMLTest = false }).ToObservableCollection(); } @@ -1028,6 +1079,17 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels Manufacturers.Add(ActiveRML.Manufacturer); } + //var colorProcessParameters = _active_context.ColorProcessParameters.Where(x => x.RmlsExtensionsGuid == guid).Select(x=>x.MachineGuid).ToList(); + //var TestResultsCollection = await new RMLExtensionTestResultsCollectionBuilder(_active_context).SetAll().ForRMLExtension(guid).BuildAsync(); + //var test1 = TestResultsCollection.Select(x => x.MachineGuid).ToList(); + //var ColorCalibration = await new RMLExtensionColorCalibrationBuilder(_active_context).SetAll().ForRMLExtension(guid).WithTests().BuildAsync(); + //var test12 = ColorCalibration.Where(x=>x.RmlExtensionColorCalibrationsTests!= null && x.RmlExtensionColorCalibrationsTests.Count() > 0).Select(x => x.MachineGuid).ToList(); + //var testResults = await new RMLExtensionColorShadeBuilder(_active_context).SetAll().ForRMLExtension(guid).WithTests().BuildAsync(); + //var test13 = testResults.Where(x => x.RmlExtensionColorShadesTests != null && x.RmlExtensionColorShadesTests.Count() > 0).Select(x => x.MachineGuid).ToList(); + + //var ulist = colorProcessParameters.Union(test1).Union(test12).Union(test13).ToList(); + + var machineIdsHasTest = (from c in _active_context.ColorProcessParameters.Where(x => x.RmlsExtensionsGuid == guid) select new { MichineGUID = c.MachineGuid }). Union(from p in _active_context.RmlExtensionTestResults.Where(x => x.RmlsExtensionsGuid == guid) @@ -1035,9 +1097,11 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels if (machineIdsHasTest.Count > 0) { + ShowWithData = true; var MachineGuid = machineIdsHasTest.First().MichineGUID; Machines.Where(x => machineIdsHasTest.Any(y => y.MichineGUID == x.Guid)).ToList().ForEach(x => x.HasRMLTest = true); - SelectedMachine = Machines.First(x => x.Guid == MachineGuid); + LoadFilteredMachines(); + SelectedMachine = FilteredMachines.First(); } else { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MachineTestResultsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MachineTestResultsView.xaml index 820c68715..4a0839164 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MachineTestResultsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MachineTestResultsView.xaml @@ -24,9 +24,13 @@ - TARGET MACHINE + + TARGET MACHINE + Show machines with data only + - + + -- cgit v1.3.1