diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2021-04-25 14:14:20 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2021-04-25 14:14:20 +0300 |
| commit | 6432cd503b7bf334a004b079ff8de6d289b5f0af (patch) | |
| tree | 72e6f77fd111a6e691692ab395d59b647bc7ad6b /Software/Visual_Studio | |
| parent | 840c6db5bf9be7b255c66c76fe0241245f4cdfb6 (diff) | |
| parent | ccaec5a493d2880c1d82b64bcad804fa51db6c57 (diff) | |
| download | Tango-6432cd503b7bf334a004b079ff8de6d289b5f0af.tar.gz Tango-6432cd503b7bf334a004b079ff8de6d289b5f0af.zip | |
MERGED org_site branch.
Diffstat (limited to 'Software/Visual_Studio')
6 files changed, 309 insertions, 22 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/OrganisationToSiteModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/OrganisationToSiteModel.cs new file mode 100644 index 000000000..e24c7ba55 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/OrganisationToSiteModel.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Statistics.Models +{ + public class MachineModel + { + public string Guid { get; set; } + + public string Name { get; set; } + + public string SerialNumber { get; set; } + }; + + public class SiteModel + { + public string Guid { get; set; } + + public string Name { get; set; } + + public List<MachineModel> Machines { get; set; } + + public SiteModel() + { + Machines = new List<MachineModel>(); + } + }; + + public class OrganisationToSiteModel + { + public string Guid { get; set; } + + public string Name { get; set; } + + public List<SiteModel> Sites { get; set; } + + public List<MachineModel> Machines { get; set; } + + + public OrganisationToSiteModel() + { + Sites = new List<SiteModel>(); + Machines = new List<MachineModel>(); + } + + public override string ToString() + { + return Name; + } + }; +} 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 4ce0ea87d..5896b2c47 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 @@ -87,6 +87,7 @@ <Compile Include="Converters\StringToFirstLetterConverter.cs" /> <Compile Include="Converters\TooltipLiquidQuantityFormatConverter.cs" /> <Compile Include="Models\ExcelModel.cs" /> + <Compile Include="Models\OrganisationToSiteModel.cs" /> <Compile Include="Models\TotalLiquidQuantityModel.cs" /> <Compile Include="Models\JobRunModel.cs" /> <Compile Include="Models\JobRunStatisticsModel.cs" /> 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 e1876e87e..9494de3f9 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 @@ -41,6 +41,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels public class JobRunsViewVM : ViewModel { private INotificationProvider _notification; + private List<OrganisationToSiteModel> _organizations; private List<Machine> _allMachines; private List<User> _allUsers; private List<RmlModel> _rmlsModels; @@ -77,11 +78,72 @@ namespace Tango.MachineStudio.Statistics.ViewModels } } - private SelectedObjectCollection<Machine> _selectedMachines; + private SelectedObjectCollection<OrganisationToSiteModel> _selectedOrganizations; /// <summary> /// Gets or sets the selected machines. Contains all available machines and selected machines. Binding to ComboBox Machines. /// </summary> - public SelectedObjectCollection<Machine> SelectedMachines + public SelectedObjectCollection<OrganisationToSiteModel> SelectedOrganizations + { + get { return _selectedOrganizations; } + set + { + _selectedOrganizations = value; + RaisePropertyChangedAuto(); + } + } + + private bool _IsEnabledSelectionSites; + + public bool IsEnabledSelectionSites + { + get { return _IsEnabledSelectionSites; } + set { _IsEnabledSelectionSites = value; + RaisePropertyChangedAuto(); + } + } + + private bool _allSelectedSites; + + public bool AllSelectedSites + { + get { return _allSelectedSites; } + set { _allSelectedSites = value; + RaisePropertyChangedAuto(); + } + } + + + private SelectedObjectCollection<SiteModel> _selectedSites; + /// <summary> + /// Gets or sets the selected machines. Contains all available machines and selected machines. Binding to ComboBox Machines. + /// </summary> + public SelectedObjectCollection<SiteModel> SelectedSites + { + get { return _selectedSites; } + set + { + _selectedSites = value; + RaisePropertyChangedAuto(); + } + } + + private bool _allSelectedMachines; + + public bool AllSelectedMachines + { + get { return _allSelectedMachines; } + set + { + _allSelectedMachines = value; + RaisePropertyChangedAuto(); + } + } + + private SelectedObjectCollection<MachineModel> _selectedMachines; + /// <summary> + /// Gets or sets the selected machines. Contains all available machines and selected machines. Binding to ComboBox Machines. + /// </summary> + public SelectedObjectCollection<MachineModel> SelectedMachines { get { return _selectedMachines; } set @@ -236,7 +298,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels { _notification = notificationProvider; JobRuns = new ObservableCollection<JobRunModel>(); - LoadJobRunsCommand = new RelayCommand(async () => await LoadJobRuns(), () => IsFree); + LoadJobRunsCommand = new RelayCommand(async () => await LoadJobRuns(), () => IsFree && SelectedMachines.Source.Count >0); ExportToExcelCommand = new RelayCommand(ExportToExcel, () => IsFree); LengthUpperValue = 10000.0; LengthLowerValue = 0.0; @@ -325,12 +387,32 @@ namespace Tango.MachineStudio.Statistics.ViewModels using (var db = ObservablesContext.CreateDefault()) { + + _organizations = await db.Organizations.Select(x => new OrganisationToSiteModel(){ Name = x.Name, Guid = x.Guid}).ToListAsync(); + foreach(var org in _organizations) + { + org.Sites = await db.Sites.Where(y => y.OrganizationGuid == org.Guid).Select(y => new SiteModel(){ Guid = y.Guid,Name = y.Name,}).ToListAsync(); + foreach(var site in org.Sites) + { + site.Machines = await db.Machines.Where(x => x.SiteGuid == site.Guid).Select(y => new MachineModel(){Guid = y.Guid,Name = y.Name,SerialNumber = y.SerialNumber}).ToListAsync(); + } + org.Machines = await db.Machines.Where(y=> y.OrganizationGuid == org.Guid).Select(y => new MachineModel() {Guid = y.Guid, Name = y.Name, SerialNumber = y.SerialNumber }).ToListAsync(); + } _allMachines = await db.Machines.ToListAsync(); _allUsers = await db.Users.Include(x => x.Contact).ToListAsync(); _rmlsModels = await db.Rmls.Select(x => new RmlModel() { Name = x.Name, Guid = x.Guid }).ToListAsync(); - SelectedMachines = new SelectedObjectCollection<Machine>(_allMachines.ToObservableCollection(), new ObservableCollection<Machine>()); - SelectedThreads = new SelectedObjectCollection<RmlModel>(_rmlsModels.ToObservableCollection(), new ObservableCollection<RmlModel>()); } + IsEnabledSelectionSites = false; + SelectedMachines = new SelectedObjectCollection<MachineModel>(new ObservableCollection<MachineModel>(), new ObservableCollection<MachineModel>()); + SelectedThreads = new SelectedObjectCollection<RmlModel>(_rmlsModels.ToObservableCollection(), new ObservableCollection<RmlModel>()); + SelectedSites = new SelectedObjectCollection<SiteModel>(new ObservableCollection<SiteModel>(), new ObservableCollection<SiteModel>()); + SelectedOrganizations = new SelectedObjectCollection<OrganisationToSiteModel>(_organizations.ToObservableCollection(), _organizations.ToObservableCollection()); + SelectedOrganizations.SelectionChanged -= OnSelectedOrganizationsChanged; + SelectedOrganizations.SelectionChanged += OnSelectedOrganizationsChanged; + SelectedSites.SelectionChanged -= OnSelectedSitesChanged; + SelectedSites.SelectionChanged += OnSelectedSitesChanged; + AllSelectedSites = true; + AllSelectedMachines = true; } catch (Exception ex) { @@ -343,6 +425,46 @@ namespace Tango.MachineStudio.Statistics.ViewModels } } + + private void OnSelectedSitesChanged(object sender, EventArgs e) + { + if (SelectedSites.SynchedSource.Count > 0) + { + SelectedMachines = new SelectedObjectCollection<MachineModel>(SelectedSites.SynchedSource.SelectMany(x => x.Machines).ToObservableCollection(), SelectedSites.SynchedSource.SelectMany(x => x.Machines).ToObservableCollection()); + } + else + { + SelectedMachines = new SelectedObjectCollection<MachineModel>(SelectedOrganizations.SynchedSource.SelectMany(x => x.Machines).ToObservableCollection(), SelectedOrganizations.SynchedSource.SelectMany(x => x.Machines).ToObservableCollection()); + } + AllSelectedMachines = false; + AllSelectedMachines = true; + InvalidateRelayCommands(); + } + + private void OnSelectedOrganizationsChanged(object sender, EventArgs e) + { + if (SelectedOrganizations.SynchedSource.Count != SelectedOrganizations.Source.Count) + { + IsEnabledSelectionSites = true; + var selectedOrg = SelectedOrganizations.SynchedSource.ToList(); + SelectedSites = new SelectedObjectCollection<SiteModel>(selectedOrg.SelectMany(x => x.Sites).ToObservableCollection(), selectedOrg.SelectMany(x => x.Sites).ToObservableCollection()); + SelectedSites.SelectionChanged -= OnSelectedSitesChanged; + SelectedSites.SelectionChanged += OnSelectedSitesChanged; + SelectedMachines = new SelectedObjectCollection<MachineModel>(selectedOrg.SelectMany(x => x.Machines).ToObservableCollection(), selectedOrg.SelectMany(x => x.Machines).ToObservableCollection()); + AllSelectedSites = false; + AllSelectedSites = true; + } + else + { + SelectedSites = new SelectedObjectCollection<SiteModel>(SelectedOrganizations.SynchedSource.SelectMany(x => x.Sites).ToObservableCollection(), SelectedOrganizations.SynchedSource.SelectMany(x => x.Sites).ToObservableCollection()); + AllSelectedSites = false; + IsEnabledSelectionSites = false; + SelectedMachines = new SelectedObjectCollection<MachineModel>(SelectedOrganizations.SynchedSource.SelectMany(x => x.Machines).ToObservableCollection(), SelectedOrganizations.SynchedSource.SelectMany(x => x.Machines).ToObservableCollection()); + } + AllSelectedMachines = false; + AllSelectedMachines = true; + InvalidateRelayCommands(); + } /// <summary> /// Loads the job runs by filters. @@ -354,7 +476,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels try { IsFree = false; - + using (var db = ObservablesContext.CreateDefault()) { DateTime startUtc = new DateTime(StartSelectedDate.Year, StartSelectedDate.Month, StartSelectedDate.Day, 0, 0, 0).ToUniversalTime(); @@ -482,8 +604,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels JobRuns = modelList.ToObservableCollection(); GenerateStatistics(); } - - + } catch (Exception ex) { @@ -712,7 +833,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels { if (lq.Quantity < 0) { - Debug.WriteLine($"Warning: JobRun '{run.JobRun.ID}' contains an invalid value '{lq.Quantity}' for {lq.LiquidType} quantity."); + Debug.WriteLine($"Warning: JobRun '{run.JobRun.ID}' of machine '{run.Machine?.SerialNumber}' with user '{run.User?.Email}' started on '{run.JobRun.StartDate.ToLocalTime()}' ended on '{run.JobRun.EndDate.ToLocalTime()}' contains an invalid value '{lq.Quantity}' for {lq.LiquidType} quantity."); } total_quantities[lq.LiquidType] += Convert.ToUInt64(Math.Max(lq.Quantity, 0)); 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 bc99c1bfa..1184622f6 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 @@ -115,8 +115,102 @@ </Grid.RowDefinitions> <StackPanel Orientation="Horizontal" Grid.Row="0"> <StackPanel Margin="10 5 0 0" Orientation="Vertical" HorizontalAlignment="Center"> + <TextBlock Text="Organization:" VerticalAlignment="Center" FontSize="11"></TextBlock> + <ToggleButton Width="160" Margin="0 10 0 0" x:Name="selectOrgButton" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center"> + <ToggleButton.Template> + <ControlTemplate> + <Grid> + <Border CornerRadius="3" BorderBrush="{StaticResource borderBrush}" BorderThickness="1" TextElement.Foreground="Black" Height="24"> + <DockPanel> + <Button x:Name="selectOrgButton" Width="18" Padding="0" Height="16" DockPanel.Dock="Right" BorderBrush="{x:Null}" HorizontalAlignment="Left" Click="SelectOrganizationButton_Click" Style="{StaticResource MaterialDesignFlatButton}" Foreground="{StaticResource MainWindow.Foreground}"> + <materialDesign:PackIcon Width="16" Height="16" Kind="ChevronDown" VerticalAlignment="Center" Foreground="{StaticResource MainWindow.Foreground}" HorizontalAlignment="Right"/> + </Button> + <TextBlock VerticalAlignment="Center" Foreground="{StaticResource MainWindow.Foreground}" FontSize="11" Margin="5"> + <TextBlock.Style> + <Style TargetType="{x:Type TextBlock}"> + <Setter Property="Text" Value="{Binding SelectedOrganizations.SynchedSource.Count, StringFormat={}Selected Organizations({0})}"> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding SelectedOrganizations.SynchedSource.Count}" Value="0"> + <Setter Property="Text" Value="All organizations"/> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </DockPanel> + </Border> + <Popup AllowsTransparency="True" StaysOpen="False" IsOpen="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=IsChecked }"> + <Border Padding="3" CornerRadius="0 0 3 3" MinWidth="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=Width}" Margin="5" BorderBrush="{StaticResource AutoCompleteTextBox.Popup.BorderBrush}" > + <Border.Effect> + <DropShadowEffect Opacity="0.2" /> + </Border.Effect> + <controls:AllSelectedCheckboxList Style="{StaticResource AllSelectedCheckBoxListStyle}" MaxHeight="600" ItemsSource="{Binding SelectedOrganizations, Mode=TwoWay}" Background="{StaticResource ComboBox.Floating.Background}" Foreground="{StaticResource MainWindow.Foreground}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SelectionMode="Single" AllSelected="True" FontSize="11" FontFamily="{StaticResource FontName}"> + <controls:AllSelectedCheckboxList.ItemTemplate> + <DataTemplate > + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data.Name}" ToolTip="{Binding Data.Name}" FontFamily="{StaticResource FontName}" Background="{DynamicResource TransparentBackgroundBrush}" FontSize="11"></TextBlock> + + </DataTemplate> + </controls:AllSelectedCheckboxList.ItemTemplate> + </controls:AllSelectedCheckboxList> + </Border> + </Popup> + </Grid> + </ControlTemplate> + </ToggleButton.Template> + </ToggleButton> + </StackPanel> + + <StackPanel Margin="10 5 0 0" Orientation="Vertical" HorizontalAlignment="Center"> + <TextBlock Text="Sites:" VerticalAlignment="Center" FontSize="11"></TextBlock> + <ToggleButton Width="130" Margin="0 10 0 0" x:Name="selectSiteButton" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center" IsEnabled="{Binding IsEnabledSelectionSites}"> + <ToggleButton.Template> + <ControlTemplate> + <Grid> + <Border CornerRadius="3" BorderBrush="{StaticResource borderBrush}" BorderThickness="1" TextElement.Foreground="Black" Height="24"> + <DockPanel> + <Button x:Name="selectSiteButton" Width="18" Padding="0" Height="16" DockPanel.Dock="Right" BorderBrush="{x:Null}" HorizontalAlignment="Left" Click="SelectSiteButton_Click" Style="{StaticResource MaterialDesignFlatButton}" Foreground="{StaticResource MainWindow.Foreground}"> + <materialDesign:PackIcon Width="16" Height="16" Kind="ChevronDown" VerticalAlignment="Center" Foreground="{StaticResource MainWindow.Foreground}" HorizontalAlignment="Right"/> + </Button> + <TextBlock VerticalAlignment="Center" Foreground="{StaticResource MainWindow.Foreground}" FontSize="11" Margin="5"> + <TextBlock.Style> + <Style TargetType="{x:Type TextBlock}"> + <Setter Property="Text" Value="{Binding SelectedSites.SynchedSource.Count, StringFormat={}Selected Sites({0})}"> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding SelectedSites.SynchedSource.Count}" Value="0"> + <Setter Property="Text" Value="All sites"/> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </DockPanel> + </Border> + <Popup AllowsTransparency="True" StaysOpen="False" IsOpen="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=IsChecked }"> + <Border Padding="3" CornerRadius="0 0 3 3" MinWidth="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=Width}" Margin="5" BorderBrush="{StaticResource AutoCompleteTextBox.Popup.BorderBrush}" > + <Border.Effect> + <DropShadowEffect Opacity="0.2" /> + </Border.Effect> + <controls:AllSelectedCheckboxList Style="{StaticResource AllSelectedCheckBoxListStyle}" MaxHeight="600" ItemsSource="{Binding SelectedSites, Mode=TwoWay}" Background="{StaticResource ComboBox.Floating.Background}" Foreground="{StaticResource MainWindow.Foreground}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SelectionMode="Single" AllSelected="{Binding AllSelectedSites}" FontSize="11" FontFamily="{StaticResource FontName}"> + <controls:AllSelectedCheckboxList.ItemTemplate> + <DataTemplate > + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data.Name}" ToolTip="{Binding Data.Name}" FontFamily="{StaticResource FontName}" Background="{DynamicResource TransparentBackgroundBrush}" FontSize="11"></TextBlock> + + </DataTemplate> + </controls:AllSelectedCheckboxList.ItemTemplate> + </controls:AllSelectedCheckboxList> + </Border> + </Popup> + </Grid> + </ControlTemplate> + </ToggleButton.Template> + </ToggleButton> + </StackPanel> + + <StackPanel Margin="20 5 0 0" Orientation="Vertical" HorizontalAlignment="Center"> <TextBlock Text="Machine:" VerticalAlignment="Center" FontSize="11"></TextBlock> - <ToggleButton Width="140" Margin="0 10 0 0" x:Name="selectMachineButton" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center"> + <ToggleButton Width="150" Margin="0 10 0 0" x:Name="selectMachineButton" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center"> <ToggleButton.Template> <ControlTemplate> <Grid> @@ -145,7 +239,7 @@ <Border.Effect> <DropShadowEffect Opacity="0.2" /> </Border.Effect> - <controls:AllSelectedCheckboxList Style="{StaticResource AllSelectedCheckBoxListStyle}" MaxHeight="600" ItemsSource="{Binding SelectedMachines}" Background="{StaticResource ComboBox.Floating.Background}" Foreground="{StaticResource MainWindow.Foreground}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SelectionMode="Multiple" AllSelected="True" FontSize="11" FontFamily="{StaticResource FontName}"> + <controls:AllSelectedCheckboxList Style="{StaticResource AllSelectedCheckBoxListStyle}" MaxHeight="600" ItemsSource="{Binding SelectedMachines}" Background="{StaticResource ComboBox.Floating.Background}" Foreground="{StaticResource MainWindow.Foreground}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SelectionMode="Multiple" FontSize="11" FontFamily="{StaticResource FontName}" AllSelected="{Binding AllSelectedMachines}"> <controls:AllSelectedCheckboxList.ItemTemplate> <DataTemplate > <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data.SerialNumber}" ToolTip="{Binding Data.SerialNumber}" FontFamily="{StaticResource FontName}" Background="{DynamicResource TransparentBackgroundBrush}" FontSize="11"></TextBlock> @@ -161,7 +255,7 @@ </ToggleButton> </StackPanel> - <StackPanel Margin="30 10 0 0" HorizontalAlignment="Center"> + <StackPanel Margin="20 10 0 0" HorizontalAlignment="Center"> <TextBlock FontSize="11">Start Date:</TextBlock> <DatePicker x:Name="startdatePicker" SelectedDateChanged="StartDatePicker_SelectedDateChanged" Margin="0 5 0 0" materialDesign:HintAssist.Hint="Pick start date" Width="130" VerticalAlignment="Center" FontSize="11" > <DatePicker.SelectedDate> @@ -191,7 +285,7 @@ <StackPanel Orientation="Horizontal" Grid.Row="1"> <StackPanel Margin="10 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> <TextBlock Text="Job Name:" VerticalAlignment="Center" FontSize="11"></TextBlock> - <autoComplete:AutoCompleteTextBox Margin="0 10 0 0" Provider="{Binding JobsProvider}" Width="140" FontSize="11" LoadingContent="Loading..." SelectedItem="{Binding SelectedJob,Mode=TwoWay}" materialDesign:HintAssist.Hint="All" DisplayMember="Name" materialDesign:HintAssist.IsFloating="False"> + <autoComplete:AutoCompleteTextBox Margin="0 10 0 0" Provider="{Binding JobsProvider}" Width="150" FontSize="11" LoadingContent="Loading..." SelectedItem="{Binding SelectedJob,Mode=TwoWay}" materialDesign:HintAssist.Hint="All" DisplayMember="Name" materialDesign:HintAssist.IsFloating="False"> <autoComplete:AutoCompleteTextBox.ItemTemplate> <DataTemplate> <StackPanel> @@ -201,7 +295,7 @@ </autoComplete:AutoCompleteTextBox.ItemTemplate> </autoComplete:AutoCompleteTextBox> </StackPanel> - <StackPanel Margin="30 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> + <StackPanel Margin="20 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> <TextBlock Text="Source:" VerticalAlignment="Center" FontSize="11"></TextBlock> <ToggleButton Width="130" Height="24" Margin="0 10 0 0" x:Name="selectJobRunSources" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center"> <ToggleButton.Template> @@ -229,9 +323,9 @@ </ToggleButton.Template> </ToggleButton> </StackPanel> - <StackPanel Margin="30 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> + <StackPanel Margin="20 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> <TextBlock Text="Gradient:" VerticalAlignment="Center" FontSize="11"></TextBlock> - <ToggleButton Height="24" Width="130" Margin="0 10 0 0" x:Name="selectIsGradient" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center"> + <ToggleButton Height="24" Width="150" Margin="0 10 0 0" x:Name="selectIsGradient" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center"> <ToggleButton.Template> <ControlTemplate> <Grid> @@ -259,20 +353,20 @@ </ToggleButton.Template> </ToggleButton> </StackPanel> - <StackPanel Margin="30 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> + <StackPanel Margin="20 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> <TextBlock Text="Length:" VerticalAlignment="Center" FontSize="11"></TextBlock> <Border BorderThickness="1" CornerRadius="3" BorderBrush="{StaticResource borderBrush}" Margin="0 10 0 0" Height="24" Padding="10 0"> <StackPanel Orientation="Horizontal"> - <TextBlock Text="{Binding LengthLowerValue, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" FontSize="11" Width="30"></TextBlock> + <TextBlock Text="{Binding LengthLowerValue, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" FontSize="11" Width="40"></TextBlock> <mahapps:RangeSlider Focusable="True" Height="40" Margin="5 5 5 5" Minimum="0" Maximum="10000" Width="140" ExtendedMode="True" LowerValue="{Binding LengthLowerValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" UpperValue="{Binding LengthUpperValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" IsSnapToTickEnabled="True" FontSize="8"/> - <TextBlock Text="{Binding LengthUpperValue}" VerticalAlignment="Center" FontSize="11" Width="30"></TextBlock> + <TextBlock Text="{Binding LengthUpperValue}" VerticalAlignment="Center" FontSize="11" Width="40"></TextBlock> </StackPanel> </Border> </StackPanel> - <StackPanel Margin="30 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> + <StackPanel Margin="20 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> <TextBlock Text="Status:" VerticalAlignment="Center" FontSize="11"></TextBlock> <ToggleButton Height="24" Width="170" Margin="0 10 0 0" x:Name="selectJobRunStatus" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center"> <ToggleButton.Template> @@ -299,7 +393,7 @@ </ToggleButton.Template> </ToggleButton> </StackPanel> - <StackPanel Margin="30 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> + <StackPanel Margin="20 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> <TextBlock Text="Threads:" VerticalAlignment="Center" FontSize="11"></TextBlock> <ToggleButton Width="100" Margin="0 10 0 0" x:Name="selectThreadsButton" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center"> <ToggleButton.Template> @@ -344,7 +438,7 @@ </ToggleButton.Template> </ToggleButton> </StackPanel> - <StackPanel Margin="30 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> + <StackPanel Margin="20 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> <TextBlock Text="HeadCleaning:" VerticalAlignment="Center" FontSize="11"></TextBlock> <ToggleButton Height="24" Width="120" Margin="0 10 0 0" x:Name="isHeadCleaningToggleButton" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center"> <ToggleButton.Template> 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 961d7f691..a2d129920 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 @@ -67,6 +67,18 @@ namespace Tango.MachineStudio.Statistics.Views e.Handled = true; } + private void SelectOrganizationButton_Click(object sender, RoutedEventArgs e) + { + selectOrgButton.IsChecked = true; + e.Handled = true; + } + + private void SelectSiteButton_Click(object sender, RoutedEventArgs e) + { + selectSiteButton.IsChecked = true; + e.Handled = true; + } + private void SelectMachineButton_Click(object sender, RoutedEventArgs e) { selectThreadsButton.IsChecked = true; diff --git a/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs b/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs index 7ba38c9ca..2b7c931f0 100644 --- a/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs +++ b/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs @@ -8,6 +8,7 @@ using Tango.BL.Builders; using Tango.BL.Entities; using Tango.BL.Enumerations; using Tango.Core; +using Tango.Core.ExtensionMethods; using Tango.Integration.Operation; namespace Tango.Integration.JobRuns @@ -177,6 +178,8 @@ namespace Tango.Integration.JobRuns job.LastRun = DateTime.UtcNow; } + LogManager.Log($"Inserting job run for '{run.JobName}'...\n{run.ToJsonString(nameof(JobRun.JobString), nameof(JobRun.LiquidQuantityString))}"); + db.SaveChanges(); } } @@ -264,6 +267,8 @@ namespace Tango.Integration.JobRuns db.JobRuns.Add(run); + LogManager.Log($"Inserting head cleaning job run...\n{run.ToJsonString(nameof(JobRun.JobString), nameof(JobRun.LiquidQuantityString))}"); + db.SaveChanges(); } } |
