diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-02-27 00:34:46 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-02-27 00:34:46 +0200 |
| commit | 882a6d54d60f05f3bf542ab43c3681f64152df41 (patch) | |
| tree | 3d62d27ad3517f93fffd5d8e690f7551a15a4b5a /Software/Visual_Studio/MachineStudio/Modules | |
| parent | 8e5ab17ced647a8c9fbba764c6fa0c06d56269c9 (diff) | |
| download | Tango-882a6d54d60f05f3bf542ab43c3681f64152df41.tar.gz Tango-882a6d54d60f05f3bf542ab43c3681f64152df41.zip | |
Added thread parameters DB, PMR, MachineOperator merging, Machine Studio.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
7 files changed, 219 insertions, 73 deletions
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 ee570ac34..5a3f5d337 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 @@ -136,6 +136,20 @@ namespace Tango.MachineStudio.Developer.Controls _sizeControl.Height += NORMAL_FONT_HEIGHT; } } + //JobTicket.ThreadParameters + if (job.ThreadParameters != null) + { + _sizeControl.Height += 20; + DrawHeaderText(drawingContext, "THREAD PARAMETERS", 17, LevelOffset.level_0); + _sizeControl.Height += TITLE_FONT_HEIGHT; + _sizeControl.Height += 5.0; + basicProps = GetNameValueList(job.ThreadParameters); + 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.RML/Tango.MachineStudio.RML.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj index 9f3a95e0b..f448932a0 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 @@ <Compile Include="Views\RmlView.xaml.cs"> <DependentUpon>RmlView.xaml</DependentUpon> </Compile> + <Compile Include="Views\ThreadParametersView.xaml.cs"> + <DependentUpon>ThreadParametersView.xaml</DependentUpon> + </Compile> <Compile Include="Views\SpoolsView.xaml.cs"> <DependentUpon>SpoolsView.xaml</DependentUpon> </Compile> @@ -226,6 +229,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Views\ThreadParametersView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="Views\SpoolsView.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs index b75d65fe0..1ceaf07df 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs @@ -283,102 +283,114 @@ namespace Tango.MachineStudio.RML.ViewModels { using (_notification.PushTaskItem("Loading RML...")) { - IsFree = false; - - if (_active_context != null) + try { - _active_context.Dispose(); - } - - _active_context = ObservablesContext.CreateDefault(); + IsFree = false; - CCTS = _active_context.Ccts - .Select(x => new CctModel() + if (_active_context != null) { - Guid = x.Guid, - FileName = x.FileName, + _active_context.Dispose(); + } - }).ToObservableCollection(); + _active_context = ObservablesContext.CreateDefault(); - CCTS.Where(x => String.IsNullOrWhiteSpace(x.FileName)).ToList().ForEach(x => x.FileName = x.Guid); + CCTS = _active_context.Ccts + .Select(x => new CctModel() + { + Guid = x.Guid, + FileName = x.FileName, - LoadRmlProperties(); + }).ToObservableCollection(); - ActiveRML = await new RmlBuilder(_active_context) - .Set(guid) - .WithActiveParametersGroup() - .WithLiquidFactors() - .WithCCT() - .WithSpools() - .BuildAsync(); + CCTS.Where(x => String.IsNullOrWhiteSpace(x.FileName)).ToList().ForEach(x => x.FileName = x.Guid); - if (ActiveRML.Cct != null) - { - SelectedCCT = CCTS.SingleOrDefault(x => x.Guid == ActiveRML.Cct.Guid); - } + LoadRmlProperties(); - if (ActiveRML.ProcessParametersTablesGroups.ToList().Count == 0) - { - if (!_notification.ShowQuestion("Could not find any process group for the selected RML. Would you like to create one?")) + ActiveRML = await new RmlBuilder(_active_context) + .Set(guid) + .WithActiveParametersGroup() + .WithLiquidFactors() + .WithCCT() + .WithSpools() + .BuildAsync(); + + if (ActiveRML.Cct != null) { - _notification.ShowError("Cannot load an RML with no process group."); - IsFree = true; - return; + SelectedCCT = CCTS.SingleOrDefault(x => x.Guid == ActiveRML.Cct.Guid); } - else + + if (ActiveRML.ProcessParametersTablesGroups.ToList().Count == 0) { - ProcessParametersTablesGroup group = new ProcessParametersTablesGroup(); - group.Name = "Active Group"; - group.Active = true; - group.ProcessParametersTables.Add(new ProcessParametersTable() + if (!_notification.ShowQuestion("Could not find any process group for the selected RML. Would you like to create one?")) + { + _notification.ShowError("Cannot load an RML with no process group."); + IsFree = true; + return; + } + else { - Name = "Process Table 1", - }); + ProcessParametersTablesGroup group = new ProcessParametersTablesGroup(); + group.Name = "Active Group"; + group.Active = true; + group.ProcessParametersTables.Add(new ProcessParametersTable() + { + Name = "Process Table 1", + }); - group.Rml = ActiveRML; + group.Rml = ActiveRML; - _active_context.ProcessParametersTablesGroups.Add(group); - _active_context.ProcessParametersTables.Add(group.ProcessParametersTables[0]); - await _active_context.SaveChangesAsync(); - LoadActiveRML(ActiveRML.Guid); - return; + _active_context.ProcessParametersTablesGroups.Add(group); + _active_context.ProcessParametersTables.Add(group.ProcessParametersTables[0]); + await _active_context.SaveChangesAsync(); + LoadActiveRML(ActiveRML.Guid); + return; + } } - } - - ActiveProcessParametersGroup = ActiveRML.ProcessParametersTablesGroups.ToList().FirstOrDefault(); - ActiveProcessParametersTableView = CollectionViewSource.GetDefaultView(ActiveProcessParametersGroup.ProcessParametersTables); - ActiveProcessParametersTableView.SortDescriptions.Add(new SortDescription(nameof(ProcessParametersTable.TableIndex), ListSortDirection.Ascending)); - CalibrationDataViewVM = new CalibrationDataViewVM(_notification); - LiquidTypesRmls = ActiveRML.LiquidTypesRmls; + ActiveProcessParametersGroup = ActiveRML.ProcessParametersTablesGroups.ToList().FirstOrDefault(); + ActiveProcessParametersTableView = CollectionViewSource.GetDefaultView(ActiveProcessParametersGroup.ProcessParametersTables); + ActiveProcessParametersTableView.SortDescriptions.Add(new SortDescription(nameof(ProcessParametersTable.TableIndex), ListSortDirection.Ascending)); - foreach (var liquidTypeRml in LiquidTypesRmls) - { - CalibrationDataVM catVM = new CalibrationDataVM(liquidTypeRml.LiquidType); + CalibrationDataViewVM = new CalibrationDataViewVM(_notification); + LiquidTypesRmls = ActiveRML.LiquidTypesRmls; - if (liquidTypeRml.DefaultCatData != null) + foreach (var liquidTypeRml in LiquidTypesRmls) { - catVM.CalibrationPoints = liquidTypeRml.GetCalibrationData().CalibrationPoints.Select(x => new CalibrationDataPointVM(x.X, x.Y)).ToObservableCollection(); - } + CalibrationDataVM catVM = new CalibrationDataVM(liquidTypeRml.LiquidType); - CalibrationDataViewVM.LiquidsCalibrationData.Add(catVM); - } + if (liquidTypeRml.DefaultCatData != null) + { + catVM.CalibrationPoints = liquidTypeRml.GetCalibrationData().CalibrationPoints.Select(x => new CalibrationDataPointVM(x.X, x.Y)).ToObservableCollection(); + } - ColorConversionViewVM = new ColorConversionViewVM(_notification) - { - RML = ActiveRML, - CCT = SelectedCCT, - LiquidsCalibrationData = CalibrationDataViewVM.LiquidsCalibrationData, - LiquidTypesRmls = LiquidTypesRmls, - }; + CalibrationDataViewVM.LiquidsCalibrationData.Add(catVM); + } + + ColorConversionViewVM = new ColorConversionViewVM(_notification) + { + RML = ActiveRML, + CCT = SelectedCCT, + LiquidsCalibrationData = CalibrationDataViewVM.LiquidsCalibrationData, + LiquidTypesRmls = LiquidTypesRmls, + }; - _rmlBeforeSave = RmlDTO.FromObservable(ActiveRML); + _rmlBeforeSave = RmlDTO.FromObservable(ActiveRML); - View.NavigateTo(RmlNavigationView.RmlView); + View.NavigateTo(RmlNavigationView.RmlView); - InvalidateRelayCommands(); + InvalidateRelayCommands(); - IsFree = true; + IsFree = true; + } + catch (Exception ex) + { + LogManager.Log($"Error loading RML '{ActiveRML.Name}'..."); + _notification.ShowError($"Error loading the selected thread.\n{ex.FlattenMessage()}"); + } + finally + { + IsFree = true; + } } } @@ -490,7 +502,7 @@ namespace Tango.MachineStudio.RML.ViewModels if (rml_jobs.Count > 0) { - _notification.ShowError($"The following jobs must be removed or change thread type before the selected thread can be deleted:\n{String.Join("\n",rml_jobs.Select(x => $"{x.Machine.SerialNumber} => {x.Name}"))}"); + _notification.ShowError($"The following jobs must be removed or change thread type before the selected thread can be deleted:\n{String.Join("\n", rml_jobs.Select(x => $"{x.Machine.SerialNumber} => {x.Name}"))}"); return; } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml index ab5207722..e52ac4ece 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml @@ -9,7 +9,7 @@ xmlns:local="clr-namespace:Tango.MachineStudio.RML.Views" mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> - <Grid> + <Grid IsEnabled="{Binding IsFree}"> <controls:NavigationControl x:Name="navigationControl" TransitionType="Slide"> <local:RmlsView /> <local:RmlView/> 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 6ee41ac38..e967c7d83 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 @@ -149,9 +149,12 @@ <Setter Property="Padding" Value="20,2"></Setter> </Style> </TabControl.Resources> - <TabItem Header="PROCESS PARAMETERS" Margin="-100 0 0 0 "> + <TabItem Header="PROCESS PARAMETERS" Margin="-100 0 0 0"> <local:ProcessParametersView x:Name="processParametersView" WidthLilquidFactors="{Binding ElementName=calibrationDataView,Path=ActualWidth}"/> </TabItem> + <TabItem Header="THREAD PARAMETERS" Margin="-100 0 0 0"> + <local:ThreadParametersView/> + </TabItem> <TabItem Header="COLOR CONVERSION" Margin="-100 0 0 0 "> <Grid> <Grid.ColumnDefinitions> 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 new file mode 100644 index 000000000..ef2923303 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ThreadParametersView.xaml @@ -0,0 +1,82 @@ +<UserControl x:Class="Tango.MachineStudio.RML.Views.ThreadParametersView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:vm="clr-namespace:Tango.MachineStudio.RML.ViewModels" + xmlns:global="clr-namespace:Tango.MachineStudio.RML" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:local="clr-namespace:Tango.MachineStudio.RML.Views" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + + <UserControl.Resources> + <converters:EmptyStringToNullConverter x:Key="EmptyStringToNullConverter" /> + </UserControl.Resources> + + <Grid> + <DockPanel> + <Border DockPanel.Dock="Top" Background="{StaticResource TransparentBackgroundBrush200}" Margin="20 0" Padding="5" CornerRadius="5"> + <Border.Effect> + <DropShadowEffect Opacity="0.4" /> + </Border.Effect> + <Grid> + <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16" Padding="2">THREAD PARAMETERS</TextBlock> + </Grid> + </Border> + + <Grid> + <DockPanel Grid.Column="1" Margin="25" HorizontalAlignment="Left" Width="400"> + <materialDesign:Card> + <StackPanel> + <DockPanel> + <TextBlock DockPanel.Dock="Top" Margin="20 10 0 10" FontSize="16">FEEDER</TextBlock> + <controls:TableGrid RowHeight="25" Margin="20 0"> + <TextBlock Text="Feeder P:" ></TextBlock> + <mahapps:NumericUpDown Value="{Binding ActiveRML.FeederP,Mode=TwoWay}" Minimum="-100000" Maximum="1000000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown> + + <TextBlock Text="Feeder I:" ></TextBlock> + <mahapps:NumericUpDown Value="{Binding ActiveRML.FeederI,Mode=TwoWay}" Minimum="-100000" Maximum="1000000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown> + + <TextBlock Text="Feeder D:" ></TextBlock> + <mahapps:NumericUpDown Value="{Binding ActiveRML.FeederD,Mode=TwoWay}" Minimum="-100000" Maximum="1000000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown> + </controls:TableGrid> + </DockPanel> + + <DockPanel> + <TextBlock DockPanel.Dock="Top" Margin="20 10 0 10" FontSize="16">PULLER</TextBlock> + <controls:TableGrid RowHeight="25" Margin="20 0"> + <TextBlock Text="Puller P:" ></TextBlock> + <mahapps:NumericUpDown Value="{Binding ActiveRML.PullerP,Mode=TwoWay}" Minimum="-100000" Maximum="1000000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown> + + <TextBlock Text="Puller I:" ></TextBlock> + <mahapps:NumericUpDown Value="{Binding ActiveRML.PullerI,Mode=TwoWay}" Minimum="-100000" Maximum="1000000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown> + + <TextBlock Text="Puller D:" ></TextBlock> + <mahapps:NumericUpDown Value="{Binding ActiveRML.PullerD,Mode=TwoWay}" Minimum="-100000" Maximum="1000000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown> + </controls:TableGrid> + </DockPanel> + + <DockPanel> + <TextBlock DockPanel.Dock="Top" Margin="20 10 0 10" FontSize="16">WINDER</TextBlock> + <controls:TableGrid RowHeight="25" Margin="20 0"> + <TextBlock Text="Winder P:" ></TextBlock> + <mahapps:NumericUpDown Value="{Binding ActiveRML.WinderP,Mode=TwoWay}" Minimum="-100000" Maximum="1000000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown> + + <TextBlock Text="Winder I:" ></TextBlock> + <mahapps:NumericUpDown Value="{Binding ActiveRML.WinderI,Mode=TwoWay}" Minimum="-100000" Maximum="1000000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown> + + <TextBlock Text="Winder D:" ></TextBlock> + <mahapps:NumericUpDown Value="{Binding ActiveRML.WinderD,Mode=TwoWay}" Minimum="-100000" Maximum="1000000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown> + </controls:TableGrid> + </DockPanel> + </StackPanel> + </materialDesign:Card> + </DockPanel> + </Grid> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ThreadParametersView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ThreadParametersView.xaml.cs new file mode 100644 index 000000000..aa63e48fb --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ThreadParametersView.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 +{ + /// <summary> + /// Interaction logic for SpoolsView.xaml + /// </summary> + public partial class ThreadParametersView : UserControl + { + public ThreadParametersView() + { + InitializeComponent(); + } + } +} |
