diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2022-07-04 20:08:15 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2022-07-04 20:08:15 +0300 |
| commit | d208f2029740f203ce79c6452432fa083a4c5c07 (patch) | |
| tree | cfa81cdb6307f885e83be4285a13d3c55ee7e2b7 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions | |
| parent | c2c59833f0f946418b69b935c62867ca5fcccd49 (diff) | |
| download | Tango-d208f2029740f203ce79c6452432fa083a4c5c07.tar.gz Tango-d208f2029740f203ce79c6452432fa083a4c5c07.zip | |
RML Extension. New filter to show machines where test were added.
Related Work Items: #6803
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions')
3 files changed, 92 insertions, 13 deletions
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; + /// <summary> + /// Gets or sets the entity last updated data and time. + /// </summary> + 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<MachineModel> _filteremachines; + /// <summary> + /// Gets or sets the Machines. + /// </summary> + public ObservableCollection<MachineModel> FilteredMachines + { + get + { + return _filteremachines; + } + + set + { + _filteremachines = value; RaisePropertyChanged(nameof(FilteredMachines)); + } + + } + + private bool _showWithData; + /// <summary> + /// Gets or sets the bool show with data only. + /// </summary> + 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 @@ <Grid> <DockPanel> <StackPanel Orientation="Horizontal" DockPanel.Dock="Top"> - <TextBlock Margin="40 10" FontSize="20" FontWeight="SemiBold" FontStyle="Italic">TARGET MACHINE</TextBlock> + <StackPanel Margin="40 10"> + <TextBlock FontSize="20" FontWeight="SemiBold" FontStyle="Italic">TARGET MACHINE</TextBlock> + <CheckBox Margin="0 10" IsChecked="{Binding ShowWithData}" >Show machines with data only</CheckBox> + </StackPanel> - <controls:SearchComboBox FontSize="20" SelectedItem="{Binding SelectedMachine,Mode=TwoWay}" materialDesign:HintAssist.Hint="Serial Number" Width="280" HorizontalContentAlignment="Stretch" SearchProperty="Name" ItemsSource="{Binding Machines}"> + + <controls:SearchComboBox FontSize="20" SelectedItem="{Binding SelectedMachine,Mode=TwoWay}" materialDesign:HintAssist.Hint="Serial Number" Width="280" HorizontalContentAlignment="Stretch" SearchProperty="Name" ItemsSource="{Binding FilteredMachines}" > <controls:SearchComboBox.ItemTemplate> <DataTemplate> <StackPanel> |
