diff options
| author | Roy <Roy.mail.net@gmail.com> | 2023-07-10 08:59:44 +0300 |
|---|---|---|
| committer | Roy <Roy.mail.net@gmail.com> | 2023-07-10 08:59:44 +0300 |
| commit | 98998e64bd4bd1c7c516019eeb2649693eee175f (patch) | |
| tree | 2b85378d410b244f4b4673ff5023d92b9f91213e /Software/Visual_Studio | |
| parent | 29c5cb29d6653164328720f7b360f234d9b68a56 (diff) | |
| parent | a906e7316bc179888f475f6bcff5ddc20a501346 (diff) | |
| download | Tango-98998e64bd4bd1c7c516019eeb2649693eee175f.tar.gz Tango-98998e64bd4bd1c7c516019eeb2649693eee175f.zip | |
Merge branch 'eureka' of https://twinetfs.visualstudio.com/Tango/_git/Tango into eureka
Diffstat (limited to 'Software/Visual_Studio')
19 files changed, 362 insertions, 90 deletions
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 b1be35a38..dce3432e2 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 @@ -11,10 +11,16 @@ namespace Tango.MachineStudio.RML.Models { public class RmlModel : ExtendedObject { + public class LiquidTypeColorValue + { + public int Color { get; set; } + + public double LiquidTypeValue { get; set; } + } public String Guid { get; set; } public String Name { get; set; } - + public String DisplayName { get; set; } public String CCT { get; set; } @@ -27,8 +33,23 @@ namespace Tango.MachineStudio.RML.Models public String Btsr { get; set; } + public String DyeingSpeed { get; set; } + + public String Zone1InkUptake { get; set; } + + public String Zone2InkUptake { get; set; } + public DateTime LastUpdated { get; set; } public List<int> LiquidTypes { get; set; } + + public List<LiquidTypeColorValue> LiquidTypesR { get; set; } + + public RmlModel() + { + DyeingSpeed = "-"; + Zone1InkUptake = "-"; + Zone2InkUptake = "-"; + } } } 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 fd276ea65..7eb6e9058 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 @@ -28,6 +28,7 @@ using Tango.BL.Enumerations; using Google.Protobuf; using Tango.ColorConversion; using Tango.CSV; +using Tango.Core; namespace Tango.MachineStudio.RML.ViewModels { @@ -345,18 +346,21 @@ namespace Tango.MachineStudio.RML.ViewModels private async Task LoadRmls() { var filter = RMLFilter.ToStringOrEmpty().ToLower(); - + using (ObservablesContext db = ObservablesContext.CreateDefault()) { + var rmls = await db.Rmls.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)) .Include(x => x.BtsrApplicationType.Name) .Include(x => x.BtsrYarnType.Name) + .Include(x => x.ProcessParametersTablesGroups) .Select(x => new { - x.Guid, x.Name, + x.Guid, x.DisplayName, x.Cct.FileName, x.ColorConversionVersion, @@ -366,13 +370,44 @@ namespace Tango.MachineStudio.RML.ViewModels x.LastUpdated, BtsrApplicationType = x.BtsrApplicationType != null ? x.BtsrApplicationType.Name : String.Empty, BtsrYarnType = x.BtsrYarnType != null ? x.BtsrYarnType.Name : String.Empty, - LiquidTypes = x.LiquidTypesRmls.Select(y => y.LiquidType) + LiquidTypesRmls = x.LiquidTypesRmls, + LiquidTypes = x.LiquidTypesRmls.Select(y => y.LiquidType), + ProcessParametersTables = x.ProcessParametersTablesGroups }).ToListAsync(); + List<RmlModel> models = new List<RmlModel>(); + //var tables = ActiveRML.GetActiveProcessGroup().ProcessParametersTables; + foreach (var rml in rmls.OrderBy(x => x.Name).ToList()) { + ProcessParametersTable tableZone1 = null; + ProcessParametersTable tableZone2 = null; + if (rml.ProcessParametersTables != null) + { + var activeTablesGroup = rml.ProcessParametersTables.Where(x=>x.Active).FirstOrDefault(); + if ( activeTablesGroup != null) + { + try + { + var tables = await db.ProcessParametersTables.Where(x => x.ProcessParametersTablesGroupGuid == activeTablesGroup.Guid).OrderBy(x => x.TableIndex).ToListAsync(); + if (tables.Count > 0) + { + tableZone1 = tables[0]; + } + if (tables.Count > 1) + { + tableZone2 = tables[1]; + } + } + catch (Exception ex) + { + LogManager.Log($"Error loading ProcessParametersTables {ex.Message}"); + } + }; + } + RmlModel model = new RmlModel(); model.Guid = rml.Guid; model.Name = rml.Name; @@ -383,8 +418,21 @@ namespace Tango.MachineStudio.RML.ViewModels model.UseLightInks = rml.UseLightInks; model.HeadType = (HeadTypes)rml.HeadType; model.Btsr = (String.IsNullOrEmpty(rml.BtsrApplicationType) ? "N/A" : rml.BtsrApplicationType) + ", " + (String.IsNullOrEmpty(rml.BtsrYarnType) ? "N/A" : rml.BtsrYarnType); - model.LiquidTypes = rml.LiquidTypes.OrderBy(x => x.Code).Select(x => x.Color).ToList(); + + if( tableZone1 != null) + { + model.Zone1InkUptake = String.Format($"{tableZone1.MinInkUptake}-{tableZone1.MaxInkUptake}"); + model.DyeingSpeed = tableZone1.DyeingSpeed.ToString(); + } + if(tableZone2 != null) + { + model.DyeingSpeed += String.Format($"-{tableZone2.DyeingSpeed}"); + model.Zone2InkUptake = tableZone2 == null ? "-" : String.Format($"{tableZone2.MinInkUptake}-{tableZone2.MaxInkUptake}"); + } + model.LiquidTypes = rml.LiquidTypes.OrderBy(x => x.Code).Select(x => x.Color).ToList(); + model.LiquidTypesR = rml.LiquidTypesRmls.OrderBy(x => x.LiquidType.Code).ToList().Select((n) => new RmlModel.LiquidTypeColorValue(){ Color = n.LiquidType.Color, LiquidTypeValue = n.MaxNlPerCm }).ToList(); + models.Add(model); } @@ -482,6 +530,11 @@ namespace Tango.MachineStudio.RML.ViewModels } ActiveProcessParametersGroup = ActiveRML.ProcessParametersTablesGroups.ToList().FirstOrDefault(); + + var tables= ActiveRML.ProcessParametersTablesGroups.ToList(); + var zone1 = tables[0].ProcessParametersTables; + /* + * */ ActiveProcessParametersTableView = CollectionViewSource.GetDefaultView(ActiveProcessParametersGroup.ProcessParametersTables); ActiveProcessParametersTableView.SortDescriptions.Add(new SortDescription(nameof(ProcessParametersTable.TableIndex), ListSortDirection.Ascending)); @@ -1075,10 +1128,10 @@ namespace Tango.MachineStudio.RML.ViewModels } } - private void BackToRmls() + private async void BackToRmls() { View.NavigateTo(RmlNavigationView.RmlsView); - LoadRmls(); + await LoadRmls(); } #region Batch Conversion 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 d5f4165c9..9c684c052 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 @@ -81,7 +81,7 @@ </StackPanel> </Grid> <Grid> - <DataGrid Margin="0 0 0 10" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" SelectionUnit="FullRow" RowHeight="60" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML}" HorizontalScrollBarVisibility="Disabled"> + <DataGrid Margin="0 0 0 10" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" SelectionUnit="FullRow" RowHeight="60" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML}" HorizontalScrollBarVisibility="Disabled" EnableRowVirtualization="False"> <DataGrid.CellStyle> <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> <Setter Property="BorderThickness" Value="0"/> @@ -90,31 +90,34 @@ </Style> </DataGrid.CellStyle> <DataGrid.Columns> - <DataGridTemplateColumn Header="NAME" Width="200"> + <DataGridTemplateColumn Header="NAME" Width="220"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <StackPanel> - <TextBlock Text="{Binding Name}"></TextBlock> - <TextBlock Visibility="{Binding DisplayName,Converter={StaticResource IsNullToVisibilityConverter}}" FontSize="11" Foreground="{StaticResource GrayBrush}" Margin="2 2 0 0"> + <TextBlock Text="{Binding Name}" TextTrimming="CharacterEllipsis"></TextBlock> + <TextBlock Visibility="{Binding DisplayName,Converter={StaticResource IsNullToVisibilityConverter}}" FontSize="11" Foreground="{StaticResource GrayBrush}" Margin="2 2 0 0" TextTrimming="CharacterEllipsis"> <Run>(</Run><Run Text="{Binding DisplayName,Mode=OneWay}"></Run><Run>)</Run> </TextBlock> </StackPanel> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> - <DataGridTextColumn Header="HEAD" Binding="{Binding HeadType}" Width="Auto" /> - <DataGridTextColumn Header="BTSR" Binding="{Binding Btsr}" 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="CL GR" Binding="{Binding UseGradients,Converter={StaticResource BooleanToYesNoConverter}}" Width="Auto" /> - <DataGridTextColumn Header="LIGHT INKS" Binding="{Binding UseLightInks,Converter={StaticResource BooleanToYesNoConverter}}" 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" /> <DataGridTemplateColumn Header="LIQUID FACTORS" Width="1*"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> - <ItemsControl ItemsSource="{Binding LiquidTypes}" Margin="0 -5 0 0"> + <ItemsControl ItemsSource="{Binding LiquidTypesR}" Margin="0 -5 0 0"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> - <StackPanel HorizontalAlignment="Left" Orientation="Horizontal" IsItemsHost="True"></StackPanel> + <StackPanel HorizontalAlignment="Left" Orientation="Horizontal" IsItemsHost="True" ></StackPanel> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> @@ -123,11 +126,12 @@ <shapes:Hexagon StrokeThickness="1" Stroke="Gray"> <shapes:Hexagon.Fill> <LinearGradientBrush Opacity="0.7" > - <GradientStop Color="{Binding Converter={StaticResource ColorToIntegerConverter}}"/> + <GradientStop Color="{Binding Color, Converter={StaticResource ColorToIntegerConverter}}"/> <GradientStop Color="White" Offset="1"/> </LinearGradientBrush> </shapes:Hexagon.Fill> </shapes:Hexagon> + <TextBlock Text="{Binding LiquidTypeValue, TargetNullValue=0}" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="9"></TextBlock> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml index 165f251c3..fa8fc0b9d 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml @@ -1029,7 +1029,7 @@ <Border Margin="140 0 0 0" BorderThickness="1" Height="44" CornerRadius="12" BorderBrush="{StaticResource TangoMidAccentBrush}" Visibility="{Binding ElementName=segmentsGrid, Path=DataContext.IsWeightView, Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <touch:TouchNumericTextBox Margin="20 0 0 0" Width="192" FocusSelectionMode="SelectAll" HorizontalAlignment="Left" HideUnderline="True" VerticalAlignment="Center" Value="{Binding Length, UpdateSourceTrigger=LostFocus}" VerticalContentAlignment="Center" - StringFormat="0.0" AutoCalculateJogStep="False" + StringFormat='#,0.0' AutoCalculateJogStep="False" HasDecimalPoint="True" Minimum="1" Maximum="1000000" KeyboardContainer="{Binding ElementName=Container}" FontSize="18" ValueChangedEnd="Length_ValueChanged" @@ -1039,7 +1039,7 @@ <Border Margin="140 0 0 0" BorderThickness="1" Height="44" CornerRadius="12" BorderBrush="{StaticResource TangoMidAccentBrush}" Visibility="{Binding ElementName=segmentsGrid, Path=DataContext.IsWeightView, Converter={StaticResource BooleanToVisibilityConverter}}"> <touch:TouchNumericTextBox Margin="20 0 0 0" Width="192" FocusSelectionMode="SelectAll" HorizontalAlignment="Left" HideUnderline="True" VerticalAlignment="Center" Value="{Binding Weight, UpdateSourceTrigger=LostFocus}" VerticalContentAlignment="Center" - StringFormat="0.0" AutoCalculateJogStep="False" + StringFormat="#,0.0" AutoCalculateJogStep="False" HasDecimalPoint="True" Minimum="0" Maximum="100000" KeyboardContainer="{Binding ElementName=Container}" FontSize="18" RippleBrush="Transparent"/> @@ -1197,14 +1197,14 @@ <StackPanel Orientation="Horizontal" Visibility="{Binding IsSummaryOpened, Converter={StaticResource BooleanToVisibilityInverseConverter}, Mode=TwoWay}"> <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}" Visibility="{Binding IsWeightView, Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <Run Text="Copy:" FontWeight="Normal"></Run> - <Run Text="{Binding JobModel.Length,Mode=OneWay,StringFormat=0.##}" FontWeight="DemiBold"/> + <Run Text="{Binding JobModel.Length,Mode=OneWay,StringFormat='#,0.##'}" FontWeight="DemiBold"/> <Run Text="m" FontWeight="DemiBold"></Run> </TextBlock> <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}" Visibility="{Binding IsWeightView, Converter={StaticResource BooleanToVisibilityConverter}}"> <Run Text="Copy:" FontWeight="Normal"></Run> <Run FontWeight="DemiBold"> <Run.Text> - <MultiBinding Converter="{StaticResource LengthToWeightConverter}" StringFormat="0.##" > + <MultiBinding Converter="{StaticResource LengthToWeightConverter}" StringFormat="#,0.##" > <Binding Path="JobModel.Length" Mode="OneWay"/> <Binding Path="JobModel.GramPerLength" Mode="OneWay"/> </MultiBinding> @@ -1214,14 +1214,14 @@ </TextBlock> <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" FontSize="{StaticResource TangoTitleFontSize}" Visibility="{Binding IsWeightView, Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <Run Text="Total:" FontWeight="Normal"></Run> - <Run Text="{Binding JobModel.LengthIncludingNumberOfUnitsAndSpools,Mode=OneWay, StringFormat=0.##}" FontWeight="Bold"/> + <Run Text="{Binding JobModel.LengthIncludingNumberOfUnitsAndSpools,Mode=OneWay, StringFormat='#,0.##'}" FontWeight="Bold"/> <Run Text="m" FontWeight="Bold"></Run> </TextBlock> <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" FontSize="{StaticResource TangoTitleFontSize}" Visibility="{Binding IsWeightView, Converter={StaticResource BooleanToVisibilityConverter}}"> <Run Text="Total:" FontWeight="Normal"></Run> <Run FontWeight="Bold"> <Run.Text> - <MultiBinding Converter="{StaticResource LengthToWeightConverter}" StringFormat="0.##" > + <MultiBinding Converter="{StaticResource LengthToWeightConverter}" StringFormat="#,0.##" > <Binding Path="JobModel.LengthIncludingNumberOfUnitsAndSpools" Mode="OneWay"/> <Binding Path="JobModel.GramPerLength" Mode="OneWay"/> </MultiBinding> @@ -1258,14 +1258,14 @@ <TextBlock Text="Total:" FontWeight="Bold" FontSize="{StaticResource TangoTitleFontSize}" ></TextBlock> <TextBlock FontSize="{StaticResource TangoTitleFontSize}" Visibility="{Binding IsWeightView, Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <Run Text="Copy:" FontWeight="Normal"></Run> - <Run Text="{Binding JobModel.Length,Mode=OneWay,StringFormat=0.##}" FontWeight="Bold"/> + <Run Text="{Binding JobModel.Length,Mode=OneWay,StringFormat='#,0.##'}" FontWeight="Bold"/> <Run Text="m" FontWeight="Bold"></Run> </TextBlock> <TextBlock FontSize="{StaticResource TangoTitleFontSize}" Visibility="{Binding IsWeightView, Converter={StaticResource BooleanToVisibilityConverter}}"> <Run Text="Copy:" FontWeight="Normal"></Run> <Run FontWeight="Bold"> <Run.Text> - <MultiBinding Converter="{StaticResource LengthToWeightConverter}" StringFormat="0.##" > + <MultiBinding Converter="{StaticResource LengthToWeightConverter}" StringFormat="#,0.##" > <Binding Path="JobModel.Length" Mode="OneWay"/> <Binding Path="JobModel.GramPerLength" Mode="OneWay"/> </MultiBinding> @@ -1279,14 +1279,14 @@ </TextBlock> <TextBlock FontSize="{StaticResource TangoTitleFontSize}" Visibility="{Binding IsWeightView, Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <Run Text="Total:" FontWeight="Normal"></Run> - <Run Text="{Binding JobModel.LengthIncludingNumberOfUnitsAndSpools,Mode=OneWay, StringFormat=0.##}" FontWeight="Bold"/> + <Run Text="{Binding JobModel.LengthIncludingNumberOfUnitsAndSpools,Mode=OneWay, StringFormat='#,0.##'}" FontWeight="Bold"/> <Run Text="m" FontWeight="Bold"></Run> </TextBlock> <TextBlock FontSize="{StaticResource TangoTitleFontSize}" Visibility="{Binding IsWeightView, Converter={StaticResource BooleanToVisibilityConverter}}"> <Run Text="Total:" FontWeight="Normal"></Run> <Run FontWeight="Bold"> <Run.Text> - <MultiBinding Converter="{StaticResource LengthToWeightConverter}" StringFormat="0.##" > + <MultiBinding Converter="{StaticResource LengthToWeightConverter}" StringFormat="#,0.##" > <Binding Path="JobModel.LengthIncludingNumberOfUnitsAndSpools" Mode="OneWay"/> <Binding Path="JobModel.GramPerLength" Mode="OneWay"/> </MultiBinding> @@ -1307,14 +1307,14 @@ </TextBlock> <TextBlock FontSize="{StaticResource TangoTitleFontSize}" Visibility="{Binding IsWeightView, Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <Run Text="Total:" FontWeight="Normal"></Run> - <Run Text="{Binding JobModel.LengthIncludingNumberOfUnits,Mode=OneWay, StringFormat=0.##}" FontWeight="Bold"/> + <Run Text="{Binding JobModel.LengthIncludingNumberOfUnits,Mode=OneWay, StringFormat='#,0.##'}" FontWeight="Bold"/> <Run Text="m" FontWeight="Bold"></Run> </TextBlock> <TextBlock FontSize="{StaticResource TangoTitleFontSize}" Visibility="{Binding IsWeightView, Converter={StaticResource BooleanToVisibilityConverter}}"> <Run Text="Total:" FontWeight="Normal"></Run> <Run FontWeight="Bold"> <Run.Text> - <MultiBinding Converter="{StaticResource LengthToWeightConverter}" StringFormat="0.##" > + <MultiBinding Converter="{StaticResource LengthToWeightConverter}" StringFormat="#,0.##" > <Binding Path="JobModel.LengthIncludingNumberOfUnits" Mode="OneWay"/> <Binding Path="JobModel.GramPerLength" Mode="OneWay"/> </MultiBinding> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobsView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobsView.xaml index 0e9e6d617..d3fdedde5 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobsView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobsView.xaml @@ -264,7 +264,7 @@ <DataTemplate> <TextBlock IsHitTestVisible="False"> <TextBlock.Text> - <MultiBinding Converter="{StaticResource LengthWithSpoolsConverter}" StringFormat="0.0" TargetNullValue='0' FallbackValue='0' Mode="OneWay"> + <MultiBinding Converter="{StaticResource LengthWithSpoolsConverter}" StringFormat="#,0.0" TargetNullValue='0' FallbackValue='0' Mode="OneWay"> <Binding Path="LengthIncludingNumberOfUnits" Mode="OneWay"/> <Binding Path="DataContext.BuildProvider.IsEureka" Mode="OneWay" RelativeSource="{RelativeSource AncestorType=UserControl}"/> <Binding Path="Spools" Mode="OneWay"/> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs index e478dba77..4dab04327 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs @@ -3,12 +3,14 @@ using System.Collections.Generic; using System.Configuration; using System.Data; using System.Diagnostics; +using System.Globalization; using System.IO; using System.Linq; using System.Net; using System.Threading; using System.Threading.Tasks; using System.Windows; +using System.Windows.Markup; using Tango.BL; using Tango.Core; using Tango.Core.DI; @@ -52,9 +54,21 @@ namespace Tango.PPC.UI { Debugger.Launch(); } - StartupArgs = e.Args; + //Set culture info. + /* var enUSCulture = new CultureInfo("en-US") + { NumberFormat = { NumberDecimalSeparator = "." } }; + + Thread.CurrentThread.CurrentCulture = enUSCulture; + Thread.CurrentThread.CurrentUICulture = enUSCulture; + CultureInfo.DefaultThreadCurrentCulture = enUSCulture; + CultureInfo.DefaultThreadCurrentUICulture = enUSCulture; + + FrameworkElement.LanguageProperty.OverrideMetadata( + typeof(FrameworkElement), + new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));*/ + //LogManager.RegisterLogger(new ConsoleLogger("Tango PPC Debug")); LogManager.RegisterLogger(new FileLogger() { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml index 39c032145..4c39bded0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml @@ -4,12 +4,14 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:converters="clr-namespace:Tango.PPC.UI.Converters" xmlns:local="clr-namespace:Tango.PPC.UI.Controls" xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" mc:Ignorable="d" + Name="RunningJobViewerEurekaContr" d:DesignHeight="60" d:DesignWidth="500" Height="38" d:DataContext="{d:DesignInstance Type=local:RunningJobViewerEureka, IsDesignTimeCreatable=False}"> <UserControl.Resources> - + <converters:DoubleWidthConverter x:Key="DoubleWidthConverter" /> </UserControl.Resources> <Grid> <touch:SliderContentControl x:Name="slider_control" ThumbColor="{StaticResource TangoPrimaryAccentColor}" @@ -19,7 +21,7 @@ Minimum="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka}, Path=MinimumValue}" Maximum="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka}, Path=MaximumValue}" - MouseDown="SliderContentControl_MouseDown" TouchDown="SliderContentControl_TouchDown"> + MouseDown="SliderContentControl_MouseDown" TouchDown="SliderContentControl_TouchDown" SizeChanged="Slider_control_SizeChanged" > <Border x:Name="brush_border" ClipToBounds="False" CornerRadius="7" Margin="0 0 0 0" Background="{StaticResource TangoLightForegroundBrush}"> @@ -34,7 +36,9 @@ </RectangleGeometry> </Border.Clip> <Grid> - <ItemsControl ClipToBounds="False" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka},Path=RunningJobStatus.CurrentUnitSegments, Delay=100}"> + <Canvas x:Name="ColorCanvas" Width="{Binding ElementName=slider_control, Path=ActualWidth}" Height="{Binding ElementName=slider_control, Path=ActualHeight}" ClipToBounds="True" > + <Border x:Name="ItemsBorder" ClipToBounds="False" Margin="0 0 0 0" Height="{Binding ElementName=slider_control, Path=ActualHeight}" Width="{Binding ElementName=brush_border, Path=ActualWidth, Converter={StaticResource DoubleWidthConverter}}" > + <ItemsControl x:Name="SegmentsItemsControl" ClipToBounds="False" > <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal" ClipToBounds="False"></StackPanel> @@ -45,7 +49,7 @@ <Grid> <Grid.Width> <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}"> - <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="RunningJobStatus.CurrentUnitTotalProgress"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="RunningJobStatus.CurrentUnitTotalProgress" Converter="{StaticResource DoubleWidthConverter}"></Binding> <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> <Binding Path="LengthWithFactor"></Binding> </MultiBinding> @@ -55,7 +59,8 @@ </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> - + </Border> + </Canvas> <Rectangle Stroke="{StaticResource TangoGrayBrush}" StrokeThickness="1" StrokeDashArray="5 5 5 5" RadiusX="7" RadiusY="7" /> </Grid> </Border> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs index 29efaad72..95fe5cd10 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs @@ -1,5 +1,8 @@ using System; +using System.Collections; using System.Collections.Generic; +using System.Collections.Specialized; +using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -22,6 +25,24 @@ namespace Tango.PPC.UI.Controls /// </summary> public partial class RunningJobViewerEureka : UserControl { + List<Segment> _segments; + + + + private double _prevOffset; + private double _addOffset; + private int _prevUnit; + + private double _controlWidth; + + public double ControlWidth + { + get { return _controlWidth; } + set { + _controlWidth = value;//for debug + } + } + /// <summary> /// Maybe not necessary! /// </summary> @@ -43,7 +64,7 @@ namespace Tango.PPC.UI.Controls } public static readonly DependencyProperty DisplayMarkersProperty = DependencyProperty.Register("DisplayMarkers", typeof(bool), typeof(RunningJobViewerEureka), new PropertyMetadata(true)); - + /// <summary> /// Gets or sets the job. /// </summary> @@ -53,7 +74,40 @@ namespace Tango.PPC.UI.Controls set { SetValue(JobProperty, value); } } public static readonly DependencyProperty JobProperty = - DependencyProperty.Register("Job", typeof(Job), typeof(RunningJobViewerEureka), new PropertyMetadata(null)); + DependencyProperty.Register("Job", typeof(Job), typeof(RunningJobViewerEureka), new PropertyMetadata(null, (d, e) => (d as RunningJobViewerEureka).OnUpdateJob())); + + private void OnUpdateJob() + { + if(Job != null) + { + _segments = Job.EffectiveSegments.ToList(); + + if (Job.NumberOfUnits > 1 && _segments.Count > 0 + && (_segments.Count > 1 || _segments[0].BrushStops.Count > 1)) + { + //if (Job.EnableInterSegment && Job.InterSegmentLength > 0) + //{ + // _segments.Add(Job.CreateInterSegment(Job.InterSegmentLength)); + //} + _segments.AddRange(Job.EffectiveSegments.ToList()); + //if (Job.EnableInterSegment && Job.InterSegmentLength > 0) + //{ + // _segments.Add(Job.CreateInterSegment(Job.InterSegmentLength)); + //}//without check if last segment and last unit + IsHasMultipleColorsSegments = true; + } + else + IsHasMultipleColorsSegments = false; + + SegmentsItemsControl.ItemsSource = _segments; + SegmentsItemsControl.InvalidateVisual(); + + _prevOffset = _addOffset = 0.0; + _prevUnit = 0; + ItemsBorder.SetValue(Canvas.LeftProperty, 0.0); + ItemsBorder.InvalidateVisual(); + } + } /// <summary> /// Gets or sets the running job status. @@ -121,7 +175,19 @@ namespace Tango.PPC.UI.Controls // Using a DependencyProperty as the backing store for ThumbHeight. This enables animation, styling, binding, etc... public static readonly DependencyProperty ThumbHeightProperty = DependencyProperty.Register("ThumbHeight", typeof(double), typeof(RunningJobViewerEureka), new FrameworkPropertyMetadata(0.0)); + + public bool IsHasMultipleColorsSegments + { + get { return (bool)GetValue(IsHasMultipleColorsSegmentsProperty); } + set { SetValue(IsHasMultipleColorsSegmentsProperty, value); } + } + + // Using a DependencyProperty as the backing store for IsHasMultipleColorsSegments. This enables animation, styling, binding, etc... + public static readonly DependencyProperty IsHasMultipleColorsSegmentsProperty = + DependencyProperty.Register("IsHasMultipleColorsSegments", typeof(bool), typeof(RunningJobViewerEureka), new PropertyMetadata(false)); + + /// <summary> /// Initializes a new instance of the <see cref="RunningJobViewerEureka"/> class. /// </summary> @@ -139,11 +205,49 @@ namespace Tango.PPC.UI.Controls { e.Handled = true; } + private void OnSliderValueChanged() { if(slider_control != null) + { slider_control.Value = SliderValue; + if(RunningJobStatus != null && RunningJobStatus.IsSettingUp == false && IsHasMultipleColorsSegments && ColorCanvas != null && ControlWidth > 0) + { + double progress = RunningJobStatus.CurrentUnitProgress; + double total = RunningJobStatus.CurrentUnitTotalProgress; + + int currentUnit = RunningJobStatus.CurrentUnit; + int totalUnits = Job.NumberOfUnits; + + double simpleoffset = ((progress / total) * ControlWidth) ; + + double multiplier = (((double)(totalUnits - 1)) / (double)totalUnits); + double offset = simpleoffset * multiplier; + + if(_prevUnit < currentUnit) + { + _addOffset = _prevOffset; + } + + offset += _addOffset; + + if (offset >= ControlWidth) + { + offset -= ControlWidth;//round + } + _prevOffset = offset; + _prevUnit = currentUnit; + + ItemsBorder.SetValue(Canvas.LeftProperty, (-1) * offset); + ItemsBorder.InvalidateVisual(); + } + } + } + + private void Slider_control_SizeChanged(object sender, SizeChangedEventArgs e) + { + ControlWidth = e.NewSize.Width; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/DoubleWidthConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/DoubleWidthConverter.cs new file mode 100644 index 000000000..3ddcc5f3c --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/DoubleWidthConverter.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.PPC.UI.Converters +{ + public class DoubleWidthConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + double length = System.Convert.ToDouble(value); + return length * 2; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaView.xaml index f5b1116c0..3ef594046 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaView.xaml @@ -6,7 +6,7 @@ xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:local="clr-namespace:Tango.PPC.UI.Dialogs" mc:Ignorable="d" - Width="500" Height="462" + Width="500" Height="625" Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="500" d:DataContext="{d:DesignInstance Type=local:PowerEurekaViewVM, IsDesignTimeCreatable=False}"> <UserControl.Resources> @@ -36,17 +36,27 @@ <touch:TouchIconButton DockPanel.Dock="Right" VerticalAlignment="Center" Height="25" Width="25" Command="{Binding CloseCommand}" Foreground="{StaticResource TangoDarkForegroundBrush}" RippleBrush="{StaticResource TangoRippleDarkBrush}" Icon="Close" HorizontalAlignment="Right" /> <TextBlock FontSize="{StaticResource TangoButtonFontSize}" FontWeight="SemiBold" HorizontalAlignment="Center"> Power</TextBlock> </DockPanel> - <Grid HorizontalAlignment="Center" Width="470" VerticalAlignment="Top" Margin="0 20 0 0"> - <Image Source="../Images/Menu/Power_image.png" Stretch="UniformToFill" VerticalAlignment="Center" HorizontalAlignment="Left" Height="50" Width="120"/> - <touch:TouchButton Margin="0" Command="{Binding TurnOffCommand}" HorizontalAlignment="Center"> Turn off</touch:TouchButton> - </Grid> - <touch:TouchButton Margin="0 35 0 0" Content="Stand By" Command="{Binding StandByCommand}" ></touch:TouchButton> - <touch:TouchButton Margin="0 35 0 0" Command="{Binding RestartCommand}">Restart</touch:TouchButton> + <UniformGrid Rows="3" > + <Grid VerticalAlignment="Top" Margin="0 30 0 0"> + <Image Source="../Images/Menu/AppPower_image.png" Stretch="UniformToFill" HorizontalAlignment="Left" Width="120" VerticalAlignment="Center" Margin="0 0 0 0"/> + <touch:TouchButton Margin="0" Command="{Binding MinimizeCommand}">Minimize</touch:TouchButton> + </Grid> + <touch:TouchButton Margin="0 35 0 0" Command="{Binding RestartTabletCommand}">Restart UI</touch:TouchButton> + <touch:TouchButton Margin="0 35 0 0" Command="{Binding CloseAppCommand}">Close</touch:TouchButton> + </UniformGrid> + <Border Height="2" Width="380" Background="{StaticResource TangoLightBorderBrush}" VerticalAlignment="Bottom" Margin="0 36 0 0" CornerRadius="2"></Border> - <Grid Margin="0 43 0 43" VerticalAlignment="Bottom"> - <Image Source="../Images/Menu/restart_t.png" Stretch="UniformToFill" HorizontalAlignment="Left" Width="30" VerticalAlignment="Center" Margin="46 0 0 0"/> - <touch:TouchButton Margin="0" Command="{Binding RestartTabletCommand}">Restart</touch:TouchButton> - </Grid> + + <UniformGrid Rows="3"> + <Grid HorizontalAlignment="Center" Width="470" VerticalAlignment="Top" Margin="0 30 0 0"> + <Image Source="../Images/Menu/Power_image.png" Stretch="UniformToFill" VerticalAlignment="Center" HorizontalAlignment="Left" Height="50" Width="120"/> + <touch:TouchButton Margin="0" Command="{Binding StandByCommand}" HorizontalAlignment="Center">Power Save</touch:TouchButton> + </Grid> + <touch:TouchButton Margin="0 35 0 0" Command="{Binding RestartCommand}">Restart FW</touch:TouchButton> + <touch:TouchButton Margin="0 35 0 0" Content="Turn Off" Command="{Binding TurnOffCommand}" ></touch:TouchButton> + + </UniformGrid> + </StackPanel> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaViewVM.cs index 2dc8f7b6e..292c4b2d6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaViewVM.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows; using Tango.Core.Commands; using Tango.SharedUI; @@ -10,7 +11,7 @@ namespace Tango.PPC.UI.Dialogs { public class PowerEurekaViewVM : DialogViewVM { - public enum PowerActionEnum { TurnOff, StandBy, Restart, RestartT }; + public enum PowerActionEnum { TurnOff, StandBy, Restart, RestartT, CloseApp }; private PowerActionEnum _powerAction; @@ -26,6 +27,8 @@ namespace Tango.PPC.UI.Dialogs public RelayCommand StandByCommand { get; set;} public RelayCommand RestartCommand { get; set; } public RelayCommand RestartTabletCommand { get; set; } + public RelayCommand MinimizeCommand { get; set; } + public RelayCommand CloseAppCommand { get; set; } public PowerEurekaViewVM() @@ -35,6 +38,19 @@ namespace Tango.PPC.UI.Dialogs StandByCommand = new RelayCommand(OnStandBy); RestartCommand = new RelayCommand(OnRestart); RestartTabletCommand = new RelayCommand(OnRestartTablet); + MinimizeCommand = new RelayCommand(OnMinimize); + CloseAppCommand = new RelayCommand(OnCloseApp); + } + + private void OnCloseApp(object obj) + { + PowerAction = PowerActionEnum.CloseApp; + base.Accept(); + } + + private void OnMinimize(object obj) + { + Application.Current.MainWindow.WindowState = WindowState.Minimized; } private void OnRestartTablet(object obj) diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Menu/AppPower_image.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Menu/AppPower_image.png Binary files differnew file mode 100644 index 000000000..e81b56d37 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Menu/AppPower_image.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index e2d447be5..e364c530c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -168,6 +168,7 @@ <Compile Include="Converters\AppBarItemConverter.cs" /> <Compile Include="Converters\CollectionToCountConverter.cs" /> <Compile Include="Converters\ComapareModulNameConverter.cs" /> + <Compile Include="Converters\DoubleWidthConverter.cs" /> <Compile Include="Converters\ItemBaseConverter.cs" /> <Compile Include="Converters\LengthToWeightConverter.cs" /> <Compile Include="Converters\LengthWithSpoolsConverter.cs" /> @@ -643,6 +644,7 @@ <Resource Include="Images\Overview Icons\pr_data.png" /> <Resource Include="Images\Overview Icons\temperature.png" /> <Resource Include="Images\screw.png" /> + <Resource Include="Images\Menu\AppPower_image.png" /> <Content Include="Intro.wmv" /> <Content Include="Manifests\release.xml" /> <Content Include="Manifests\debug.xml" /> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs index f40a89f42..17b676499 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -361,6 +361,9 @@ namespace Tango.PPC.UI.ViewModels if (MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected) ResetMachine(); return; + case PowerEurekaViewVM.PowerActionEnum.CloseApp: + CloseApplication(); + return; default: return; } @@ -455,6 +458,14 @@ namespace Tango.PPC.UI.ViewModels } } + private async void CloseApplication() + { + if (await NotificationProvider.ShowQuestion("Are you sure you want to close the application?")) + { + ApplicationManager.ShutDown(); + } + } + /// <summary> /// Powers off the machine. /// </summary> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs index 103084e11..653c2368f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs @@ -571,17 +571,17 @@ namespace Tango.PPC.UI.ViewModels IsDyeingProcess = (RunningJobStatus != null && RunningJobStatus.CurrentSegment != null); if (RunningJobStatus != null && RunningJobStatus.CurrentSegment != null) { - var segment = Job.Segments.FirstOrDefault(x => x.SegmentIndex == _runningJobStatus.CurrentSegment.SegmentIndex); + var currentSegmentIndex = Math.Max(_runningJobStatus.CurrentSegment.SegmentIndex - (Job.Segments.Count * RunningJobStatus.CurrentUnit), 0); + var segment = Job.Segments.FirstOrDefault(x => x.SegmentIndex == currentSegmentIndex); + // var segment = Job.Segments.FirstOrDefault(x => x.SegmentIndex == _runningJobStatus.CurrentSegment.SegmentIndex); if (segment != null) { - if (_handler.JobTicket.Segments.Count > 0) { JobBrushStop = _handler.JobTicket.Segments[Job.OrderedSegments.IndexOf(segment)].BrushStops.First(); - } - - CurrentBrushStop = segment.FirstBrushStop; + } } + CurrentBrushStop = RunningJobStatus.CurrentSegment.FirstBrushStop; } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml index 9e766fffc..4dec7d481 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml @@ -481,10 +481,10 @@ <TextBlock FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"> <TextBlock.Style> <Style TargetType="{x:Type TextBlock}"> - <Setter Property="Text" Value="{Binding Job.LengthIncludingNumberOfUnitsAndSpools, TargetNullValue='-', FallbackValue='-', StringFormat=0.##}" /> + <Setter Property="Text" Value="{Binding Job.LengthIncludingNumberOfUnitsAndSpools, TargetNullValue='-', FallbackValue='-', StringFormat='#,0.##'}" /> <Style.Triggers> <DataTrigger Binding="{Binding IsSpoolView}" Value="True"> - <Setter Property="Text" Value="{Binding Job.LengthIncludingNumberOfUnits, TargetNullValue='-', FallbackValue='-', StringFormat=0.##}" /> + <Setter Property="Text" Value="{Binding Job.LengthIncludingNumberOfUnits, TargetNullValue='-', FallbackValue='-', StringFormat='#,0.##'}" /> </DataTrigger> </Style.Triggers> </Style> @@ -499,10 +499,10 @@ <TextBlock FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"> <TextBlock.Style> <Style TargetType="{x:Type TextBlock}"> - <Setter Property="Text" Value="{Binding Job.WeightIncludingNumberOfUnitsAndSpools, TargetNullValue='-', FallbackValue='-', StringFormat=0.##}" /> + <Setter Property="Text" Value="{Binding Job.WeightIncludingNumberOfUnitsAndSpools, TargetNullValue='-', FallbackValue='-', StringFormat='#,0.##'}" /> <Style.Triggers> <DataTrigger Binding="{Binding IsSpoolView}" Value="True"> - <Setter Property="Text" Value="{Binding Job.WeightIncludingNumberOfUnits, TargetNullValue='-', FallbackValue='-', StringFormat=0.##}" /> + <Setter Property="Text" Value="{Binding Job.WeightIncludingNumberOfUnits, TargetNullValue='-', FallbackValue='-', StringFormat='#,0.##'}" /> </DataTrigger> </Style.Triggers> </Style> @@ -517,10 +517,10 @@ <TextBlock FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"> <TextBlock.Style> <Style TargetType="{x:Type TextBlock}"> - <Setter Property="Text" Value="{Binding Job.NumberOfUnitsMultipliedBySpools, TargetNullValue='-', FallbackValue='-', StringFormat=0.##}" /> + <Setter Property="Text" Value="{Binding Job.NumberOfUnitsMultipliedBySpools, TargetNullValue='-', FallbackValue='-', StringFormat='#,0.##'}" /> <Style.Triggers> <DataTrigger Binding="{Binding IsSpoolView}" Value="True"> - <Setter Property="Text" Value="{Binding Job.NumberOfUnits, TargetNullValue='-', FallbackValue='-', StringFormat=0.##}" /> + <Setter Property="Text" Value="{Binding Job.NumberOfUnits, TargetNullValue='-', FallbackValue='-', StringFormat='#,0.#'}" /> </DataTrigger> </Style.Triggers> </Style> @@ -607,7 +607,7 @@ <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center"> - <StackPanel Visibility="{Binding RunningJobStatus.IsSettingUp, TargetNullValue=true, Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <StackPanel Visibility="{Binding RunningJobStatus.IsSettingUp, Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> <Image Source="../Images/JobProgressView/drop.png" Stretch="None" VerticalAlignment="Center" /> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> @@ -620,7 +620,7 @@ <StackPanel Orientation="Horizontal" Margin="0 15 0 0" HorizontalAlignment="Center" Visibility="{Binding IsWeghtView, Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <TextBlock FontSize="{StaticResource TangoLargeInfoFontSize}" VerticalAlignment="Center"> <TextBlock.Text> - <MultiBinding Converter="{StaticResource ProgressLengthSpoolConverter}" StringFormat="0.0" TargetNullValue='-' FallbackValue='0' Mode="OneWay"> + <MultiBinding Converter="{StaticResource ProgressLengthSpoolConverter}" StringFormat="#,0." TargetNullValue='-' FallbackValue='0' Mode="OneWay"> <Binding Path="RunningJobStatus.TotalProgressMinusSettingUp" /> <Binding Path="IsSpoolView"/> <Binding Path="RunningJobStatus.ProgressMinusSettingUp" /> @@ -630,7 +630,7 @@ <TextBlock FontSize="{StaticResource TangoLargeInfoFontSize}" VerticalAlignment="Center" Text="/"></TextBlock> <TextBlock FontSize="{StaticResource TangoTitleFontSize}" VerticalAlignment="Center"> <TextBlock.Text> - <MultiBinding Converter="{StaticResource ProgressLengthSpoolConverter}" StringFormat="0" TargetNullValue='-' FallbackValue='0' Mode="OneWay"> + <MultiBinding Converter="{StaticResource ProgressLengthSpoolConverter}" StringFormat="#,0" TargetNullValue='-' FallbackValue='0' Mode="OneWay"> <Binding Path="RunningJobStatus.TotalProgressMinusSettingUp"/> <Binding Path="IsSpoolView"/> </MultiBinding> @@ -642,7 +642,7 @@ <StackPanel Orientation="Horizontal" Margin="0 10 0 0" HorizontalAlignment="Center" Visibility="{Binding IsWeghtView, Converter={StaticResource BooleanToVisibilityConverter}}"> <TextBlock FontSize="{StaticResource TangoLargeInfoFontSize}" VerticalAlignment="Center"> <TextBlock.Text> - <MultiBinding Converter="{StaticResource ProgressWeightSpoolConverter}" StringFormat="0.00" TargetNullValue='-' FallbackValue='0'> + <MultiBinding Converter="{StaticResource ProgressWeightSpoolConverter}" StringFormat="#,0.00" TargetNullValue='-' FallbackValue='0'> <Binding Path="RunningJobStatus.TotalProgressMinusSettingUp" /> <Binding Path="IsSpoolView"/> <Binding Path="RunningJobStatus.ProgressMinusSettingUp" /> @@ -653,7 +653,7 @@ <TextBlock FontSize="{StaticResource TangoLargeInfoFontSize}" VerticalAlignment="Center" Text="/"></TextBlock> <TextBlock FontSize="{StaticResource TangoTitleFontSize}" VerticalAlignment="Center"> <TextBlock.Text> - <MultiBinding Converter="{StaticResource ProgressWeightSpoolConverter}" StringFormat="0.#" TargetNullValue='-' FallbackValue='0' > + <MultiBinding Converter="{StaticResource ProgressWeightSpoolConverter}" StringFormat="#,0.#" TargetNullValue='-' FallbackValue='0' > <Binding Path="RunningJobStatus.TotalProgressMinusSettingUp"/> <Binding Path="IsSpoolView"/> <Binding Path="Job.GramPerLength" Mode="OneWay"/> @@ -744,7 +744,7 @@ <TextBlock x:Name="ProgressLength" VerticalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}">Job Length (m)</TextBlock> <TextBlock FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"> <TextBlock.Text> - <MultiBinding Converter="{StaticResource LengthWithSpoolsConverter}" StringFormat="0.##" TargetNullValue='-' FallbackValue='-' Mode="OneWay"> + <MultiBinding Converter="{StaticResource LengthWithSpoolsConverter}" StringFormat="#,0" TargetNullValue='-' FallbackValue='-' Mode="OneWay"> <Binding Path="RunningJobStatus.ProgressMinusSettingUp" Mode="OneWay"/> <Binding Path="Job.Spools" Mode="OneWay"/> </MultiBinding> @@ -758,7 +758,7 @@ <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}">Job Weight (g)</TextBlock> <TextBlock FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"> <TextBlock.Text> - <MultiBinding Converter="{StaticResource LengthToWeightConverter}" StringFormat="0.##" TargetNullValue='-' FallbackValue='-' Mode="OneWay"> + <MultiBinding Converter="{StaticResource LengthToWeightConverter}" StringFormat="#,0.##" TargetNullValue='-' FallbackValue='-' Mode="OneWay"> <Binding Path="RunningJobStatus.ProgressMinusSettingUp" Mode="OneWay"/> <Binding Path="Job.GramPerLength" Mode="OneWay"/> <Binding Path="Job.Spools" Mode="OneWay"/> @@ -971,7 +971,7 @@ <Image Margin="0 2 0 0" Source="../Images/Job Issues/job_length.png" Stretch="Uniform" VerticalAlignment="Top" HorizontalAlignment="Left" Width="Auto" Height="32" /> <TextBlock Margin="20 5 0 0" Width="Auto" FontWeight="SemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}" VerticalAlignment="Top"> <TextBlock.Text> - <MultiBinding Converter="{StaticResource LengthWithSpoolsConverter}" StringFormat="0.##" TargetNullValue='-' FallbackValue='-' Mode="OneWay"> + <MultiBinding Converter="{StaticResource LengthWithSpoolsConverter}" StringFormat="#,0.##" TargetNullValue='-' FallbackValue='-' Mode="OneWay"> <Binding Path="RunningJobStatus.ProgressMinusSettingUp" Mode="OneWay"/> <Binding Path="Job.Spools" Mode="OneWay"/> </MultiBinding> @@ -1260,9 +1260,9 @@ </Rectangle.LayoutTransform> </Rectangle> </Grid> - <Grid Grid.Column="2" x:Name="StatGrid" Margin="0,0,0.4,0"> + <Grid Grid.Column="2" x:Name="StatGrid" Margin="0,30,0.4,0"> <Grid Visibility="{Binding SelectedStatisticTab,Converter={StaticResource StatisticTabToVisibilityConverter},ConverterParameter='Productiondata'}"> - <graphs:RealTimeGraph Style="{StaticResource PPC_RealTimeGraph_Flat}" Controller="{Binding JobController}" Background="Transparent" StringFormat="0" GridLinesBrush="red" BorderBrush="Transparent" + <graphs:RealTimeGraph Style="{StaticResource PPC_RealTimeGraph_Flat}" Controller="{Binding JobController}" Background="Transparent" StringFormat="0" GridLinesBrush="{StaticResource Tango_RealTimeGraph_ForegroundBrush}" BorderBrush="Transparent" VerticalAxisVisibility="Visible" HorizontalAxisVisibility="Visible" VerticalTicks =" 5"/> </Grid> </Grid> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/PowerOffView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/PowerOffView.xaml index 22952a827..b08aab298 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/PowerOffView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/PowerOffView.xaml @@ -11,7 +11,14 @@ d:DesignHeight="1280" d:DesignWidth="800" Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DataContext="{d:DesignInstance Type=vm:PowerOffViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.PowerOffViewVM}"> <Grid> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> - <touch:TouchGifAnimation Source="/Images/power_off_2.gif" EnableAnimation="{Binding IsVisible}" HorizontalAlignment="Center" /> + <TextBlock FontSize="{StaticResource TangoTitleFontSize}" HorizontalAlignment="Center" Margin="0 50 0 0" Text="{Binding Status.Message}" TextTrimming="CharacterEllipsis"/> + + <Grid Margin="0 30 0 0"> + <touch:TouchGifAnimation Source="/Images/power_off_2.gif" EnableAnimation="{Binding IsVisible}" HorizontalAlignment="Center" /> + <TextBlock FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="DemiBold" HorizontalAlignment="Center" Margin="0 50 0 0"> + <Run Text="{Binding Status.ProgressPercentage, TargetNullValue=0}"/>% + </TextBlock> + </Grid> <TextBlock HorizontalAlignment="Center" Margin="0 60 0 0" FontSize="{StaticResource TangoHeaderFontSize}">Machine is turning Off</TextBlock> <TextBlock HorizontalAlignment="Center" Margin="0 20 0 0" FontSize="{StaticResource TangoTitleFontSize}" Foreground="{StaticResource TangoGrayTextBrush}">Do not unplug machine while turning off</TextBlock> <touch:TouchButton Command="{Binding AbortCommand}" Style="{StaticResource TangoHollowButton}" Margin="0 100 0 0" HorizontalAlignment="Center" Width="200" Height="50">ABORT</touch:TouchButton> diff --git a/Software/Visual_Studio/Tango.BL/Entities/Rml.cs b/Software/Visual_Studio/Tango.BL/Entities/Rml.cs index 23aee0366..fdeb8f05e 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Rml.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Rml.cs @@ -310,20 +310,19 @@ namespace Tango.BL.Entities get { - if (LinearMassDensityUnit == null || FiberSize == 0) - return 1; - if (LinearMassDensityUnit.Name == "Tex") - return FiberSize; - if (LinearMassDensityUnit.Name == "DTEX") - return (FiberSize /10); - if (LinearMassDensityUnit.Name == "Ne") - return (590.5 / FiberSize); - if (LinearMassDensityUnit.Name == "Nm") - return (1000 / FiberSize); - if (LinearMassDensityUnit.Name == "Denier") - return FiberSize/9; - - return 1; + + //if (LinearMassDensityUnit.Name == "Tex") + // return FiberSize; + //if (LinearMassDensityUnit.Name == "DTEX") + // return (FiberSize /10); + //if (LinearMassDensityUnit.Name == "Ne") + // return (590.5 / FiberSize); + //if (LinearMassDensityUnit.Name == "Nm") + // return (1000 / FiberSize); + //if (LinearMassDensityUnit.Name == "Denier") + // return FiberSize/9; + + return DencityCount == 0? (1/9 ): (DencityCount / 9); } } diff --git a/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs b/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs index 23bd2b1ba..4579ff08c 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs @@ -516,7 +516,8 @@ namespace Tango.Integration.Operation TimeSpan segmentsDuration = Job.TranslateProgressToTime(previousSegmentsLengthWithThis, ProcessParameters); TimeSpan segmentRemainingTime = segmentsDuration - Job.TranslateProgressToTime(Status.Progress, ProcessParameters); - segment.Progress = Math.Min(Math.Max((previousSegmentsLengthWithThis - segment.Length - Status.Progress) * -1, 0), segment.Length); + // segment.Progress = Math.Min(Math.Max((previousSegmentsLengthWithThis - segment.Length - Status.Progress) * -1, 0), segment.Length); + segment.Progress = Math.Min(Math.Max((previousSegmentsLengthWithThis - segment.Length - Status.ProgressMinusSettingUp) * -1, 0), segment.Length); if (i == 0 && Status.Progress > 0) { @@ -526,8 +527,9 @@ namespace Tango.Integration.Operation Status.CurrentSegment = segment; } } - - if (Status.Progress >= previousSegmentsLengthWithThis) + + //if (Status.Progress >= previousSegmentsLengthWithThis) + if (Status.ProgressMinusSettingUp >= previousSegmentsLengthWithThis) { if (!segment.Completed) { |
