diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2024-12-05 02:38:10 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2024-12-05 02:38:10 +0200 |
| commit | b77fbb01ed5b63b65f6e755fef9ca49c3e58ea50 (patch) | |
| tree | 40013e359a230404d0bf4fd4e6fbfb7bdd862432 /Software/Visual_Studio/PPC | |
| parent | ec3b8fd0d0b4d980a5d93c5fa11b4717cbd0c875 (diff) | |
| download | Tango-b77fbb01ed5b63b65f6e755fef9ca49c3e58ea50.tar.gz Tango-b77fbb01ed5b63b65f6e755fef9ca49c3e58ea50.zip | |
Last say on extra inks branch
Diffstat (limited to 'Software/Visual_Studio/PPC')
7 files changed, 151 insertions, 78 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml index 240abc688..5f1ff4c9d 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml @@ -527,7 +527,7 @@ <RowDefinition Height="1*" /> </Grid.RowDefinitions> - <touch:TouchImageButton Grid.Row="0" Margin="0 2 45 0" HorizontalAlignment="Right" Width="Auto" Height="70" EnableDropShadow="False" Background="Transparent" BorderThickness="0" + <touch:TouchImageButton Grid.Row="0" Margin="0 2 45 0" HorizontalAlignment="Right" Width="Auto" Height="70" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{ Binding VectorFineTuningCommand}" > <touch:TouchImageButton.Template> <ControlTemplate TargetType="touch:TouchImageButton"> @@ -596,7 +596,7 @@ <RowDefinition Height="1*" /> </Grid.RowDefinitions> - <touch:TouchImageButton Grid.Row="0" Margin="0 2 45 0" HorizontalAlignment="Right" Width="Auto" Height="70" EnableDropShadow="False" Background="Transparent" BorderThickness="0" + <touch:TouchImageButton Visibility="{Binding FineTuningEnabled,Converter={StaticResource BooleanToVisibilityConverter}}" Grid.Row="0" Margin="0 2 45 0" HorizontalAlignment="Right" Width="Auto" Height="70" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{ Binding VectorFineTuningCommand}" > <touch:TouchImageButton.Template> <ControlTemplate TargetType="touch:TouchImageButton"> @@ -614,8 +614,8 @@ <Grid x:Name="CMYKgrid" Grid.Row="2" Margin="80 0 93 0" Style="{StaticResource DisableOnSaveMyColorsGrid}"> <DockPanel> - <ItemsControl DockPanel.Dock="Top" ItemsSource="{Binding SelectedBrushStop.LiquidVolumes}" IsTabStop="False" MinWidth="200"> - <ItemsControl.ItemTemplate> + <touch:TouchListBox DockPanel.Dock="Top" ItemsSource="{Binding SelectedBrushStop.LiquidVolumes}" IsTabStop="False" MinWidth="200"> + <touch:TouchListBox.ItemTemplate> <DataTemplate DataType="{x:Type models:LiquidVolumeModel}"> <touch:TouchColorPickerControl Margin=" 0 10 0 0" MinWidth="200" MinValue="0" IsTabStop="False" ColorPickerText="{Binding IdsPack.LiquidType.Name}" @@ -636,8 +636,8 @@ </touch:TouchColorPickerControl.PickerBrush> </touch:TouchColorPickerControl> </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> + </touch:TouchListBox.ItemTemplate> + </touch:TouchListBox> <!--<touch:TouchColorPickerCMYKControl DockPanel.Dock="Top" x:Name="CMYKPicker" ThumbHeight="30" ThumbHeightInside="28" IsTabStop="False" diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs index 4ba8a6ebf..5b750189f 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs @@ -414,6 +414,21 @@ namespace Tango.PPC.Jobs.Dialogs set { _vectorFineTuningDialogVM = value; RaisePropertyChangedAuto(); } } + public bool FineTuningEnabled + { + get + { + if (SelectedBrushStop == null) return false; + var idsPacks = MachineProvider.Machine.Configuration.GetSupportedIdsPacks(SelectedBrushStop.SegmentModel.Job.Rml).ToList(); + if (!idsPacks.Exists(x => x.LiquidType.Type == LiquidTypes.Cyan)) return false; + if (!idsPacks.Exists(x => x.LiquidType.Type == LiquidTypes.Magenta)) return false; + if (!idsPacks.Exists(x => x.LiquidType.Type == LiquidTypes.Yellow)) return false; + if (!idsPacks.Exists(x => x.LiquidType.Type == LiquidTypes.Black)) return false; + + return true; + } + } + private String _myColorName; public String MyColorName @@ -634,6 +649,7 @@ namespace Tango.PPC.Jobs.Dialogs SelectedBrushStop.ColorChanged += OnBrushColorChanged; CheckIsSelectedColorInLibrary(); SelectedBrushStop.ConvertColor();//test OOG + RaisePropertyChanged(nameof(FineTuningEnabled)); } private void OnSelectedtabChanged() diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Statistics/DefaultStatisticsService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Statistics/DefaultStatisticsService.cs index a98641b25..d05b4c6bf 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Statistics/DefaultStatisticsService.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Statistics/DefaultStatisticsService.cs @@ -29,6 +29,7 @@ namespace Tango.PPC.Common.Statistics private List<ColorCatalog> _catalogs; private List<ColorCatalogsItem> _color_catalog_Items; private List<ColorSpace> _colorSpaces; + private Dictionary<String, LiquidType> _liquidTypes; public bool Enabled { get; set; } = true; @@ -107,6 +108,8 @@ namespace Tango.PPC.Common.Statistics using (ObservablesContext db = ObservablesContext.CreateDefault()) { + response.Result.LiquidTypes = db.LiquidTypes.ToList().Select(x => LiquidTypeDTO.FromObservable(x)).ToList(); + var filters = request.Filters; var db_JobRuns = db.JobRuns.Where(x => (x.StartDate <= filters.EndDateUTC && x.StartDate >= filters.StartDateUTC)); @@ -173,6 +176,19 @@ namespace Tango.PPC.Common.Statistics } } + if (_liquidTypes == null) + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var types = await db.LiquidTypes.ToListAsync(); + _liquidTypes = new Dictionary<string, LiquidType>(); + foreach (var t in types) + { + _liquidTypes.Add(t.Name, t); + } + } + } + JobRunComposition jobRunComposition = new JobRunComposition(); jobRunComposition.JobRun = JobRunDTO.FromObservable(jobRun); @@ -197,11 +213,17 @@ namespace Tango.PPC.Common.Statistics foreach (var liquidType in stop.LiquidVolumes) { PresentationLiquidVolume plt = new PresentationLiquidVolume(); - plt.LiquidType = (LiquidTypes)Enum.Parse(typeof(LiquidTypes), liquidType.LiquidTypeName.Replace(" ", "")); - plt.Volume = liquidType.Volume; - pbs.LiquidVolumes.Add(plt); + + if (_liquidTypes.ContainsKey(liquidType.LiquidTypeName)) + { + plt.LiquidType = _liquidTypes[liquidType.LiquidTypeName]; + plt.Volume = liquidType.Volume; + pbs.LiquidVolumes.Add(plt); + } } + pbs.LiquidVolumes = pbs.LiquidVolumes.OrderBy(x => x.LiquidType.PreferredIndex).ToList(); + switch (pbs.ColorSpace) { case ColorSpaces.RGB: @@ -215,29 +237,16 @@ namespace Tango.PPC.Common.Statistics pbs.B = stop.B; break; case ColorSpaces.Volume: - pbs.Cyan = pbs.LiquidVolumes.First(x => x.LiquidType == LiquidTypes.Cyan).Volume; - pbs.Magenta = pbs.LiquidVolumes.First(x => x.LiquidType == LiquidTypes.Magenta).Volume; - pbs.Yellow = pbs.LiquidVolumes.First(x => x.LiquidType == LiquidTypes.Yellow).Volume; - pbs.Black = pbs.LiquidVolumes.First(x => x.LiquidType == LiquidTypes.Black).Volume; - - var lightCyan = pbs.LiquidVolumes.FirstOrDefault(x => x.LiquidType == LiquidTypes.LightCyan); - var lightMagenta = pbs.LiquidVolumes.FirstOrDefault(x => x.LiquidType == LiquidTypes.LightMagenta); - var lightYellow = pbs.LiquidVolumes.FirstOrDefault(x => x.LiquidType == LiquidTypes.LightYellow); - - if (lightCyan != null && lightCyan.Volume > 0) - { - pbs.Cyan = lightCyan.Volume / 10d; - } - - if (lightMagenta != null && lightMagenta.Volume > 0) - { - pbs.Magenta = lightMagenta.Volume / 10d; - } - if (lightYellow != null && lightYellow.Volume > 0) - { - pbs.Yellow = lightYellow.Volume / 10d; - } + //foreach (var lightInk in pbs.LiquidVolumes.Where(x => x.LiquidType.IsLightInk && x.Volume > 0)) + //{ + // var darkInk = pbs.LiquidVolumes.FirstOrDefault(x => x.LiquidType.Code == lightInk.LiquidType.DarkInkCode); + // if (darkInk != null) + // { + // darkInk.Volume = (double)((decimal)lightInk.Volume / 10m); + // lightInk.Volume = 0; + // } + //} break; case ColorSpaces.Catalog: diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationBrushStop.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationBrushStop.cs index d17cc8d42..2f5e7aea6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationBrushStop.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationBrushStop.cs @@ -9,6 +9,8 @@ namespace Tango.PPC.Shared.Statistics { public class PresentationBrushStop { + + private List<PresentationLiquidVolume> _inputVolumes; public ColorSpaces ColorSpace { get; set; } public double StartMeters { get; set; } public int Red { get; set; } @@ -17,10 +19,7 @@ namespace Tango.PPC.Shared.Statistics public double L { get; set; } public double A { get; set; } public double B { get; set; } - public double Cyan { get; set; } - public double Magenta { get; set; } - public double Yellow { get; set; } - public double Black { get; set; } + public String Catalog { get; set; } public String CatalogItem { get; set; } @@ -30,6 +29,47 @@ namespace Tango.PPC.Shared.Statistics public List<PresentationLiquidVolume> LiquidVolumes { get; set; } + public double GetLiquidVolumeOutputOrZero(LiquidTypes liquidType) + { + var lv = LiquidVolumes.FirstOrDefault(x => x.LiquidType.Type == liquidType); + return lv != null ? lv.Volume : 0.0; + } + + public double GetLiquidVolumeInputOrZero(LiquidTypes liquidType) + { + var lv = GetVolumeInputs().FirstOrDefault(x => x.LiquidType.Type == liquidType); + return lv != null ? lv.Volume : 0.0; + } + + public List<PresentationLiquidVolume> GetVolumeInputs() + { + if (_inputVolumes == null) + { + _inputVolumes = new List<PresentationLiquidVolume>(); + var clones = LiquidVolumes.Select(x => new PresentationLiquidVolume() { LiquidType = x.LiquidType, Volume = x.Volume }).ToList(); + + + foreach (var liquidVolume in clones.Where(x => x.LiquidType.HasPigment)) + { + if (liquidVolume.LiquidType.IsLightInk && liquidVolume.Volume > 0) + { + var darkInk = clones.FirstOrDefault(x => x.LiquidType.Code == liquidVolume.LiquidType.DarkInkCode); + if (darkInk != null) + { + darkInk.Volume = (double)((decimal)liquidVolume.Volume / 10m); + + continue; + } + } + + _inputVolumes.Add(liquidVolume); + } + } + + return _inputVolumes; + } + + public PresentationBrushStop() { LiquidVolumes = new List<PresentationLiquidVolume>(); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationLiquidVolume.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationLiquidVolume.cs index c370d1f5d..fb560ca0c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationLiquidVolume.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/PresentationLiquidVolume.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; using Tango.BL.Enumerations; namespace Tango.PPC.Shared.Statistics { public class PresentationLiquidVolume { - public LiquidTypes LiquidType { get; set; } + public LiquidType LiquidType { get; set; } public double Volume { get; set; } } }
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/StatisticsResult.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/StatisticsResult.cs index 8cee4c545..3cbd26e32 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/StatisticsResult.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Statistics/StatisticsResult.cs @@ -11,9 +11,12 @@ namespace Tango.PPC.Shared.Statistics { public List<JobRunComposition> JobRuns { get; set; } + public List<LiquidTypeDTO> LiquidTypes { get; set; } + public StatisticsResult() { JobRuns = new List<JobRunComposition>(); + LiquidTypes = new List<LiquidTypeDTO>(); } } } 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 74db8e471..27fb531c3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml @@ -45,22 +45,24 @@ </Style> <DataTemplate x:Key="CMYK_Template" DataType="{x:Type entities:BrushStop}"> - <ItemsControl ItemsSource="{Binding LiquidVolumesOrderedPigmentedForStandardUser}" MinWidth="180" HorizontalAlignment="Left" Height="Auto"> - <ItemsControl.ItemsPanel> - <ItemsPanelTemplate> - <StackPanel Orientation="Horizontal"></StackPanel> - </ItemsPanelTemplate> - </ItemsControl.ItemsPanel> - <ItemsControl.ItemTemplate> - <DataTemplate> - <StackPanel Orientation="Vertical" Margin="0 0 10 0"> - <Border Width="50" Height="50" Background="{Binding IdsPack.LiquidType.LiquidTypeBrush}" CornerRadius="16" HorizontalAlignment="Left"></Border> - <TextBlock Margin="0 10 0 0" Text="{Binding IdsPack.LiquidType.ShortName}" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> - <TextBlock Margin="0 10 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Volume, StringFormat=0.##}" ></TextBlock> - </StackPanel> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> + <Viewbox MaxHeight="120" MaxWidth="300"> + <ItemsControl ItemsSource="{Binding LiquidVolumesOrderedPigmentedForStandardUser}" MinWidth="180" HorizontalAlignment="Left" Height="Auto"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal"></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Vertical" Margin="0 0 10 0"> + <Border Width="50" Height="50" Background="{Binding IdsPack.LiquidType.LiquidTypeBrush}" CornerRadius="16" HorizontalAlignment="Left"></Border> + <TextBlock Margin="0 10 0 0" Text="{Binding IdsPack.LiquidType.ShortName}" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> + <TextBlock Margin="0 10 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Volume, StringFormat=0.##}" ></TextBlock> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </Viewbox> </DataTemplate> <DataTemplate x:Key="RGB_Template" DataType="{x:Type entities:BrushStop}"> @@ -69,13 +71,13 @@ <Border Width="50" Height="50" Background="Red" CornerRadius="16" HorizontalAlignment="Left"></Border> <TextBlock Margin="0 10 0 0" Text="R" FontSize="{StaticResource TangoDefaultFontSize}" VerticalAlignment="Center" HorizontalAlignment="Center"/> <TextBlock Margin="0 10 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Red}" ></TextBlock> - + </StackPanel> <StackPanel Orientation="Vertical" Margin="4 0 0 0"> <Border Width="50" Height="50" Background="Green" CornerRadius="16" HorizontalAlignment="Left"></Border> <TextBlock Margin="0 10 0 0" Text="G" FontSize="{StaticResource TangoDefaultFontSize}" VerticalAlignment="Center" HorizontalAlignment="Center"/> <TextBlock Margin="0 10 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Green}" ></TextBlock> - + </StackPanel> <StackPanel Orientation="Vertical" Margin="4 0 0 0"> <Border Width="50" Height="50" Background="Blue" CornerRadius="16" HorizontalAlignment="Left"></Border> @@ -91,7 +93,7 @@ <Border Width="50" Height="50" Background="Gray" CornerRadius="16" HorizontalAlignment="Left"></Border> <TextBlock Margin="0 10 0 0 " Text="L" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> <TextBlock Margin="0 10 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding L, StringFormat=0.##}" ></TextBlock> - + </StackPanel> <StackPanel Orientation="Vertical" Width="50" HorizontalAlignment="Left" Margin="5 0 0 0"> <Border Width="50" Height="50" Background="red" CornerRadius="16" HorizontalAlignment="Left"></Border> @@ -309,8 +311,8 @@ <DockPanel> <TextBlock DockPanel.Dock="Bottom" Text="Waste" HorizontalAlignment="Center" Margin="0 8 0 0"></TextBlock> <Grid Height="15" DockPanel.Dock="Top"> - </Grid> - <Grid DockPanel.Dock="Top"> + </Grid> + <Grid DockPanel.Dock="Top"> <Grid ClipToBounds="True" HorizontalAlignment="Center"> <Path Fill="#CCCCCC"> <Path.Resources> @@ -323,7 +325,7 @@ <StaticResource ResourceKey="InkContainerPath"/> </CombinedGeometry.Geometry1> <CombinedGeometry.Geometry2> - + <RectangleGeometry Rect="1,0,30,88"> <!--<RectangleGeometry.Rect> <MultiBinding Converter="{StaticResource MidTankLevelToElementRectConverter}"> @@ -984,22 +986,24 @@ </StackPanel> </UniformGrid> - <ItemsControl ItemsSource="{Binding LiquidOutputs}" Margin="0 20 0 0" HorizontalAlignment="Left" Visibility="{Binding IsDyeingProcess,Converter={StaticResource BooleanToVisibilityConverter}}"> - <ItemsControl.ItemsPanel> - <ItemsPanelTemplate> - <StackPanel Orientation="Horizontal" /> - </ItemsPanelTemplate> - </ItemsControl.ItemsPanel> - <ItemsControl.ItemTemplate> - <DataTemplate> - <StackPanel Margin="0 0 10 0" Orientation="Vertical" Width="50" HorizontalAlignment="Left"> - <Border Width="50" Height="50" Background="{Binding LiquidType.LiquidTypeBrush}" CornerRadius="16" HorizontalAlignment="Left"></Border> - <TextBlock Margin="0 10 0 0 " HorizontalAlignment="Center" Text="{Binding LiquidType.ShortName}"></TextBlock> - <TextBlock Margin="0 10 0 0 " HorizontalAlignment="Center" Text="{Binding Volume}"></TextBlock> - </StackPanel> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> + <Viewbox Margin="0 20 0 0" MaxHeight="120"> + <ItemsControl ItemsSource="{Binding LiquidOutputs}" HorizontalAlignment="Left" Visibility="{Binding IsDyeingProcess,Converter={StaticResource BooleanToVisibilityConverter}}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal" /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel Margin="0 0 10 0" Orientation="Vertical" Width="50" HorizontalAlignment="Left"> + <Border Width="50" Height="50" Background="{Binding LiquidType.LiquidTypeBrush}" CornerRadius="16" HorizontalAlignment="Left"></Border> + <TextBlock Margin="0 10 0 0 " HorizontalAlignment="Center" Text="{Binding LiquidType.ShortName}"></TextBlock> + <TextBlock Margin="0 10 0 0 " HorizontalAlignment="Center" Text="{Binding Volume}"></TextBlock> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </Viewbox> </StackPanel> </Grid> @@ -1139,9 +1143,9 @@ </Grid> <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center">Dryer Zone 3</TextBlock> </StackPanel> - - - + + + <!--<StackPanel Orientation="Vertical"> <Grid> @@ -1199,7 +1203,7 @@ </Grid> <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center">Dryer Air</TextBlock> </StackPanel>--> - + <StackPanel Orientation="Vertical"> <Grid> <touch:TouchArcProgress RingThickness="8" Value="{Binding Tunnel.Value}" Maximum="{Binding Tunnel.MaxValue}" Minimum="0" Width="100" Height="100"> |
