diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML')
7 files changed, 65 insertions, 26 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/threads.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/threads.png Binary files differindex 86eb0b335..6d7c680ec 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/threads.png +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/threads.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/RmlModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/RmlModel.cs index c2245bcb2..74bebef45 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/RmlModel.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/RmlModel.cs @@ -47,6 +47,8 @@ namespace Tango.MachineStudio.RML.Models public MachineTypes? MachineType { get; set; } + public double DefaultLiquidFactor { get; set; } + public RmlModel() { DyeingSpeed = "-"; 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 2fcb87c59..a8ec6a9ff 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 @@ -30,6 +30,7 @@ using Tango.ColorConversion; using Tango.CSV; using Tango.Core; using Tango.SharedUI.Helpers; +using Tango.MachineStudio.Common.Buid; namespace Tango.MachineStudio.RML.ViewModels { @@ -39,6 +40,7 @@ namespace Tango.MachineStudio.RML.ViewModels private IAuthenticationProvider _authentication; private IActionLogManager _actionLogManager; private RmlDTO _rmlBeforeSave; + private IBuildProvider _buildProvider; private ObservablesContext _active_context; @@ -320,8 +322,9 @@ namespace Tango.MachineStudio.RML.ViewModels #endregion - public MainViewVM(INotificationProvider notificationProvider, IAuthenticationProvider authentication, IActionLogManager actionLogManager) + public MainViewVM(IBuildProvider buildProvider, INotificationProvider notificationProvider, IAuthenticationProvider authentication, IActionLogManager actionLogManager) { + _buildProvider = buildProvider; _notification = notificationProvider; _authentication = authentication; _actionLogManager = actionLogManager; @@ -362,7 +365,7 @@ namespace Tango.MachineStudio.RML.ViewModels public override void OnApplicationReady() { - + } private async Task LoadRmls() @@ -375,8 +378,7 @@ namespace Tango.MachineStudio.RML.ViewModels using (ObservablesContext db = ObservablesContext.CreateDefault()) { - - var rmls = await db.Rmls.Where(x => x.Name.ToLower().Contains(filter) || x.DisplayName.ToLower().Contains(filter)) + var rmls = await db.Rmls.Where(x => x.CreatedByOrganizationGuid == _authentication.CurrentUser.Organization.Guid || _buildProvider.BuildType == MSBuildType.Default).Where(x => x.Name.ToLower().Contains(filter) || x.DisplayName.ToLower().Contains(filter)) .Include(x => x.Cct.FileName) .Include(x => x.LiquidTypesRmls) .Include(x => x.LiquidTypesRmls.Select(y => y.LiquidType)) @@ -395,11 +397,12 @@ namespace Tango.MachineStudio.RML.ViewModels x.HeadType, x.LastUpdated, x.MachineType, + x.DefaultLiquidFactor, BtsrApplicationType = x.BtsrApplicationType != null ? x.BtsrApplicationType.Name : String.Empty, BtsrYarnType = x.BtsrYarnType != null ? x.BtsrYarnType.Name : String.Empty, - //LiquidTypesRmls = x.LiquidTypesRmls, - //LiquidTypes = x.LiquidTypesRmls.Select(y => y.LiquidType), - ProcessParametersTables = x.ProcessParametersTablesGroups + //LiquidTypesRmls = x.LiquidTypesRmls, + //LiquidTypes = x.LiquidTypesRmls.Select(y => y.LiquidType), + ProcessParametersTables = x.ProcessParametersTablesGroups }).ToListAsync(); @@ -446,6 +449,7 @@ namespace Tango.MachineStudio.RML.ViewModels model.HeadType = (HeadTypes)rml.HeadType; model.Btsr = (String.IsNullOrEmpty(rml.BtsrApplicationType) ? "N/A" : rml.BtsrApplicationType) + ", " + (String.IsNullOrEmpty(rml.BtsrYarnType) ? "N/A" : rml.BtsrYarnType); model.MachineType = (MachineTypes?)rml.MachineType; + model.DefaultLiquidFactor = rml.DefaultLiquidFactor; if (tableZone1 != null) { @@ -570,7 +574,7 @@ namespace Tango.MachineStudio.RML.ViewModels ActiveProcessParametersGroup = ActiveRML.ProcessParametersTablesGroups.ToList().FirstOrDefault(); - var tables= ActiveRML.ProcessParametersTablesGroups.ToList(); + var tables = ActiveRML.ProcessParametersTablesGroups.ToList(); var zone1 = tables[0].ProcessParametersTables; /* * */ @@ -760,6 +764,16 @@ namespace Tango.MachineStudio.RML.ViewModels rml.QualificationDate = DateTime.UtcNow; rml.Manufacturer = "Twine"; rml.DefaultLiquidFactor = 140; + rml.ColorConversionVersion = 6; + rml.CreatedByUserGuid = _authentication.CurrentUser.Guid; + rml.CreatedByOrganizationGuid = _authentication.CurrentUser.Organization.Guid; + rml.VMax = 5; + rml.UseLightInks = true; + + if (_buildProvider.BuildType == MSBuildType.Lite) + { + rml.ForMachineType = _authentication.Machine.Type; + } using (ObservablesContext db = ObservablesContext.CreateDefault()) { @@ -787,13 +801,28 @@ namespace Tango.MachineStudio.RML.ViewModels group.Active = true; group.ProcessParametersTables.Add(new ProcessParametersTable() { - Name = "Process Table 1", + Name = "Zone 1", + }); + group.ProcessParametersTables.Add(new ProcessParametersTable() + { + Name = "Zone 2", }); group.Rml = rml; _active_context.ProcessParametersTablesGroups.Add(group); _active_context.ProcessParametersTables.Add(group.ProcessParametersTables[0]); + _active_context.ProcessParametersTables.Add(group.ProcessParametersTables[1]); + + LiquidTypesRml lubricantRelation = new LiquidTypesRml(); + lubricantRelation.LiquidTypeGuid = _active_context.LiquidTypes.FirstOrDefault(x => x.Code == (int)LiquidTypes.Lubricant).Guid; + lubricantRelation.RmlGuid = rml.Guid; + lubricantRelation.MaxNlPerCm = 1; + + _active_context.LiquidTypesRmls.Add(lubricantRelation); + + rml.CctGuid = _active_context.Ccts.OrderByDescending(x => x.LastUpdated).Take(1).Select(x => x.Guid).ToList().First(); + _active_context.Rmls.Add(rml); await _active_context.SaveChangesAsync(); @@ -903,6 +932,8 @@ namespace Tango.MachineStudio.RML.ViewModels cloned.DisplayName = name; cloned.RmlQualificationLevel = RmlQualifications.Provisional; cloned.QualificationDate = DateTime.UtcNow; + cloned.CreatedByUserGuid = _authentication.CurrentUser.Guid; + cloned.CreatedByOrganizationGuid = _authentication.CurrentUser.Organization.Guid; ProcessParametersTablesGroup group = new ProcessParametersTablesGroup(); group.Name = rml.GetActiveProcessGroup().Name; @@ -1183,7 +1214,7 @@ namespace Tango.MachineStudio.RML.ViewModels private async void ActivatedInSitesDialog() { - if(SelectedRML == null) + if (SelectedRML == null) return; try @@ -1191,9 +1222,9 @@ namespace Tango.MachineStudio.RML.ViewModels using (ObservablesContext db = ObservablesContext.CreateDefault()) { IsFree = false; - - var selSites = await db.SitesRmls.OrderBy(x => x.ID).Where(y => y.RmlGuid == SelectedRML.Guid).Include(x=>x.Site).Select(x => x.Site.Name).ToListAsync(); - + + var selSites = await db.SitesRmls.OrderBy(x => x.ID).Where(y => y.RmlGuid == SelectedRML.Guid).Include(x => x.Site).Select(x => x.Site.Name).ToListAsync(); + var vm = new RmlActiveSitesDialogVM(selSites, SelectedRML.Name); _notification.ShowModalDialog<RmlActiveSitesDialogVM, RmlActiveSitesDialog>(vm, (x) => { }, () => { }); @@ -1214,7 +1245,7 @@ namespace Tango.MachineStudio.RML.ViewModels IsFree = true; } } - + private async void BackToRmls() { View.NavigateTo(RmlNavigationView.RmlsView); @@ -1717,7 +1748,7 @@ namespace Tango.MachineStudio.RML.ViewModels { var json = File.ReadAllText(file); var rmlFile = await Rml.FromRmlFile(db, json); - + db.Rmls.Add(rmlFile); if (rmlFile.RmlsExtensions != null && rmlFile.RmlsExtensions.Count > 0) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/CalibrationDataView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/CalibrationDataView.xaml index f1995283c..9d1c4a947 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/CalibrationDataView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/CalibrationDataView.xaml @@ -21,7 +21,7 @@ <ItemsControl DockPanel.Dock="Top" ItemsSource="{Binding LiquidsCalibrationData}" IsEnabled="{Binding IsFree}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> - <UniformGrid Rows="1" /> + <StackPanel Orientation="Horizontal" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml index b9e9f30c3..12571ed6e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml @@ -158,12 +158,12 @@ <ItemsControl Width="{Binding WidthLilquidFactors, RelativeSource={RelativeSource AncestorType=UserControl}}" ItemsSource="{Binding LiquidTypesRmls}" Margin="0 10 0 0"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> - <UniformGrid IsItemsHost="True" Rows="1"></UniformGrid> + <StackPanel IsItemsHost="True" Orientation="Horizontal"></StackPanel> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate DataType="{x:Type observables:LiquidTypesRml}"> - <Grid Margin="20 0 20 0" MaxWidth="230"> + <Grid Margin="20 0 20 0" Width="200"> <Button HorizontalAlignment="Right" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Remove liquid factor" Width="30" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.RemoveLiquidFactorCommand}" CommandParameter="{Binding}"> <materialDesign:PackIcon Kind="Delete" Foreground="#FF7D7D" /> 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 7f6ebcbb6..de564c1ec 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 @@ -123,13 +123,13 @@ </ComboBox> <TextBlock Text="Count (den):" ></TextBlock> - <TextBlock Text="{Binding ActiveRML.DencityCount}" Foreground="Blue" ></TextBlock> + <TextBlock Text="{Binding ActiveRML.DencityCount}"></TextBlock> <TextBlock Text="Default Liquid Factor:" ></TextBlock> - <mahapps:NumericUpDown Minimum="1" Maximum="1000" Value="{Binding ActiveRML.DefaultLiquidFactor}" Foreground="Blue" ></mahapps:NumericUpDown> + <mahapps:NumericUpDown Minimum="1" Maximum="1000" Value="{Binding ActiveRML.DefaultLiquidFactor}"></mahapps:NumericUpDown> <TextBlock Text="Machine Type:" ></TextBlock> - <ComboBox ItemsSource="{Binding Source={x:Type enumerations:MachineTypes},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding ActiveRML.ForMachineType}" SelectedValuePath="Value" DisplayMemberPath="DisplayName" Foreground="Blue" ></ComboBox> + <ComboBox ItemsSource="{Binding Source={x:Type enumerations:MachineTypes},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding ActiveRML.ForMachineType}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox> <!--<TextBlock Text="Fiber Shape:" ></TextBlock> <ComboBox ItemsSource="{Binding FiberShapes}" SelectedItem="{Binding ActiveRML.FiberShape,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox>--> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml index ff341f5ed..8f75bea90 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml @@ -10,6 +10,7 @@ xmlns:shapes="clr-namespace:Tango.SharedUI.Shapes;assembly=Tango.SharedUI" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:commonConverters="clr-namespace:Tango.MachineStudio.Common.Converters;assembly=Tango.MachineStudio.Common" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:local="clr-namespace:Tango.MachineStudio.RML.Views" mc:Ignorable="d" @@ -22,15 +23,17 @@ <converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" /> <converters:IsNullToVisibilityConverter x:Key="IsNullToVisibilityConverter" /> <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> + <commonConverters:IsLiteToVisibilityInverseConverter x:Key="IsLiteToVisibilityInverseConverter" /> + <commonConverters:IsLiteToVisibilityConverter x:Key="IsLiteToVisibilityConverter" /> </UserControl.Resources> <Grid IsEnabled="{Binding IsFree}"> <DockPanel Margin="100 50 100 50" MaxWidth="1500"> <Grid DockPanel.Dock="Top"> - <Image Source="../Images/threads.png" Width="300" Margin="10" /> + <Image Source="../Images/threads.png" Width="250" RenderOptions.BitmapScalingMode="Fant" Margin="10" /> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="0 0 10 30"> <materialDesign:PackIcon Kind="Magnify" Width="26" Height="26"/> - <TextBox Width="300" materialDesign:HintAssist.Hint="Search by name" Text="{Binding RMLFilter,UpdateSourceTrigger=PropertyChanged,Delay=500}"></TextBox> + <TextBox Width="300" materialDesign:HintAssist.Hint="Search thread by name / description" Text="{Binding RMLFilter,UpdateSourceTrigger=PropertyChanged,Delay=500}"></TextBox> </StackPanel> </Grid> <Grid DockPanel.Dock="Bottom"> @@ -66,7 +69,7 @@ </StackPanel> </Grid> - <StackPanel Orientation="Horizontal" Margin="0 40 0 0"> + <StackPanel Orientation="Horizontal" Margin="0 40 0 0" Visibility="{Binding Converter={StaticResource IsLiteToVisibilityInverseConverter}}"> <Button Command="{Binding ImportRMLFileCommand}" Foreground="{StaticResource BlackForegroundBrush}" FontSize="16" Style="{StaticResource emptyButton}" Cursor="Hand"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon Kind="FileImport" VerticalAlignment="Center" Width="30" Height="30" /> @@ -112,7 +115,7 @@ </Style> </controls:DoubleClickDataGrid.CellStyle> <DataGrid.Columns> - <DataGridTemplateColumn Header="NAME" Width="220"> + <DataGridTemplateColumn Header="NAME" Width="420"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <StackPanel> @@ -124,16 +127,19 @@ </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> + <DataGridTextColumn Header="MACHINE TYPE" Binding="{Binding MachineType,Converter={StaticResource EnumToDescriptionConverter}}" Width="Auto" /> <DataGridTextColumn Header="Dyeing speed" Width="Auto" Binding="{Binding DyeingSpeed}"></DataGridTextColumn> <DataGridTextColumn Header="Zone1 ink uptake" Width="Auto" Binding="{Binding Zone1InkUptake}"></DataGridTextColumn> <DataGridTextColumn Header="Zone2 ink uptake" Width="Auto" Binding="{Binding Zone2InkUptake}"></DataGridTextColumn> <!--<DataGridTextColumn Header="HEAD" Binding="{Binding HeadType}" Width="Auto" />--> <!--<DataGridTextColumn Header="BTSR" Binding="{Binding Btsr}" Width="Auto" />--> <DataGridTextColumn Header="CCT" Binding="{Binding CCT}" Width="Auto" /> + <DataGridTextColumn Header="DEFAULT FACTOR" Binding="{Binding DefaultLiquidFactor}" Width="Auto" /> <!--<DataGridTextColumn Header="CL GR" Binding="{Binding UseGradients,Converter={StaticResource BooleanToYesNoConverter}}" Width="Auto" />--> <!--<DataGridTextColumn Header="LIGHT INKS" Binding="{Binding UseLightInks,Converter={StaticResource BooleanToYesNoConverter}}" Width="Auto" />--> + + <DataGridTextColumn Header="LAST UPDATED" Binding="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="Auto" /> - <DataGridTextColumn Header="MACHINE TYPE" Binding="{Binding MachineType,Converter={StaticResource EnumToDescriptionConverter}}" Width="Auto" /> <!--<DataGridTemplateColumn Header="LIQUID FACTORS" Width="1*"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> |
