aboutsummaryrefslogtreecommitdiffstats
path: root/Software
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2023-08-02 15:44:56 +0300
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2023-08-02 15:44:56 +0300
commitda1c997c138633c46daa8dc3c099b7164a536eb9 (patch)
treeb04bf3110ae27ebbea1b7aafe9d2efeec45fccff /Software
parent027f92e62bf5c3d018b6d789b54c5ce78af2b03b (diff)
downloadTango-da1c997c138633c46daa8dc3c099b7164a536eb9.tar.gz
Tango-da1c997c138633c46daa8dc3c099b7164a536eb9.zip
Job Running Progress - added inter segments to logic.
Diffstat (limited to 'Software')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml72
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs54
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressBorderWidthConverter.cs24
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj3
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs39
5 files changed, 150 insertions, 42 deletions
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 4c39bded0..dfbd47514 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml
@@ -12,6 +12,7 @@
d:DesignHeight="60" d:DesignWidth="500" Height="38" d:DataContext="{d:DesignInstance Type=local:RunningJobViewerEureka, IsDesignTimeCreatable=False}">
<UserControl.Resources>
<converters:DoubleWidthConverter x:Key="DoubleWidthConverter" />
+ <converters:ProgressBorderWidthConverter x:Key="ProgressBorderWidthConverter" />
</UserControl.Resources>
<Grid>
<touch:SliderContentControl x:Name="slider_control" ThumbColor="{StaticResource TangoPrimaryAccentColor}"
@@ -37,28 +38,59 @@
</Border.Clip>
<Grid>
<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>
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate>
+ <Border x:Name="ItemsBorder" ClipToBounds="False" Margin="0 0 0 0" Height="{Binding ElementName=slider_control, Path=ActualHeight}" >
+ <Grid ClipToBounds="False" HorizontalAlignment="Stretch" >
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto"/>
+ <ColumnDefinition Width="1*"/>
+ </Grid.ColumnDefinitions>
<Grid>
- <Grid.Width>
- <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}">
- <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>
- </Grid.Width>
- <Rectangle Fill="{Binding SegmentBrush}"></Rectangle>
+ <ItemsControl HorizontalAlignment="Left" x:Name="SegmentsItemsControl" Width="{Binding ElementName=brush_border, Path=ActualWidth, Converter={StaticResource DoubleWidthConverter}}">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <StackPanel Orientation="Horizontal" ></StackPanel>
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Grid>
+ <Grid.Width>
+ <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}">
+ <Binding RelativeSource="{RelativeSource AncestorType=local:RunningJobViewerEureka}" Path="JobUnitLength" Converter="{StaticResource DoubleWidthConverter}"></Binding>
+ <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding>
+ <Binding Path="LengthWithFactor"></Binding>
+ </MultiBinding>
+ </Grid.Width>
+ <Rectangle Fill="{Binding SegmentBrush}"></Rectangle>
+ </Grid>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
</Grid>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
+ <Grid Grid.Column="1">
+ <ItemsControl x:Name="LastSegmentsItemsControl" HorizontalAlignment="Right" Margin="0 0 0 0" Width="{Binding ElementName=brush_border, Path=ActualWidth}">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <StackPanel Orientation="Horizontal" ></StackPanel>
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Grid>
+ <Grid.Width>
+ <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}">
+ <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="RunningJobStatus.CurrentUnitTotalProgress" ></Binding>
+ <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding>
+ <Binding Path="LengthWithFactor"></Binding>
+ </MultiBinding>
+ </Grid.Width>
+ <Rectangle Fill="{Binding SegmentBrush}"></Rectangle>
+ </Grid>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </Grid>
+ </Grid>
</Border>
</Canvas>
<Rectangle Stroke="{StaticResource TangoGrayBrush}" StrokeThickness="1" StrokeDashArray="5 5 5 5" RadiusX="7" RadiusY="7" />
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 95fe5cd10..c87c50db2 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
@@ -17,6 +17,7 @@ using System.Windows.Navigation;
using System.Windows.Shapes;
using Tango.BL.Entities;
using Tango.Integration.Operation;
+using Tango.Logging;
namespace Tango.PPC.UI.Controls
{
@@ -26,9 +27,9 @@ namespace Tango.PPC.UI.Controls
public partial class RunningJobViewerEureka : UserControl
{
List<Segment> _segments;
+ List<Segment> _lastsegments;
+
-
-
private double _prevOffset;
private double _addOffset;
private int _prevUnit;
@@ -80,27 +81,36 @@ namespace Tango.PPC.UI.Controls
{
if(Job != null)
{
+ JobUnitLength = Job.Length;
_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));
- //}
+ 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
+ if(Job.NumberOfUnits > 2 && Job.EnableInterSegment && Job.InterSegmentLength > 0)
+ {
+ _segments.Add(Job.CreateInterSegment(Job.InterSegmentLength));
+ JobUnitLength += Job.InterSegmentLength;
+ //_segments.AddRange(Job.EffectiveSegments.ToList());//third set to use in end printing without intersegment
+ }
+ _lastsegments = Job.EffectiveSegments.ToList();;
+
IsHasMultipleColorsSegments = true;
}
else
+ {
IsHasMultipleColorsSegments = false;
+ }
SegmentsItemsControl.ItemsSource = _segments;
SegmentsItemsControl.InvalidateVisual();
+ LastSegmentsItemsControl.ItemsSource = _lastsegments;
+ LastSegmentsItemsControl.InvalidateVisual();
_prevOffset = _addOffset = 0.0;
_prevUnit = 0;
@@ -188,6 +198,20 @@ namespace Tango.PPC.UI.Controls
DependencyProperty.Register("IsHasMultipleColorsSegments", typeof(bool), typeof(RunningJobViewerEureka), new PropertyMetadata(false));
+
+ public double JobUnitLength
+ {
+ get { return (double)GetValue(JobUnitLengthProperty); }
+ set { SetValue(JobUnitLengthProperty, value); }
+ }
+
+ // Using a DependencyProperty as the backing store for JobUnitLength. This enables animation, styling, binding, etc...
+ public static readonly DependencyProperty JobUnitLengthProperty =
+ DependencyProperty.Register("JobUnitLength", typeof(double), typeof(RunningJobViewerEureka), new FrameworkPropertyMetadata(0.0));
+
+
+
+
/// <summary>
/// Initializes a new instance of the <see cref="RunningJobViewerEureka"/> class.
/// </summary>
@@ -228,14 +252,20 @@ namespace Tango.PPC.UI.Controls
if(_prevUnit < currentUnit)
{
_addOffset = _prevOffset;
+ //Debug.WriteLine($"OnSliderValueChanged prevOffset: '{_prevOffset}' currentUnit = {currentUnit}, total:{total}");
}
offset += _addOffset;
- if (offset >= ControlWidth)
+ if (offset >= ControlWidth && currentUnit < (Job.NumberOfUnits - 2))
{
- offset -= ControlWidth;//round
+ offset -= ControlWidth;//round
+ //Debug.WriteLine($"OnSliderValueChanged round!!! offset: '{offset}' currentUnit = {currentUnit}, total:{total}");
}
+ //if(currentUnit == (Job.NumberOfUnits - 1))
+ //{
+ // Debug.WriteLine($"OnSliderValueChanged offset: '{offset}' currentUnit = {currentUnit}. ControlWidth = {ControlWidth} total:{total}");
+ //}
_prevOffset = offset;
_prevUnit = currentUnit;
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressBorderWidthConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressBorderWidthConverter.cs
new file mode 100644
index 000000000..3345798eb
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressBorderWidthConverter.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 ProgressBorderWidthConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ double length = System.Convert.ToDouble(value);
+ return length * 3;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
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 e364c530c..705c042c5 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
@@ -174,6 +174,7 @@
<Compile Include="Converters\LengthWithSpoolsConverter.cs" />
<Compile Include="Converters\LiquidTypeToBrushConverter.cs" />
<Compile Include="Converters\MidTankLevelToElementRectConverter.cs" />
+ <Compile Include="Converters\ProgressBorderWidthConverter.cs" />
<Compile Include="Converters\ProgressLengthSpoolConverter.cs" />
<Compile Include="Converters\ProgressUnitSpoolConverter.cs" />
<Compile Include="Converters\ProgressWeightSpoolConverter.cs" />
@@ -990,7 +991,7 @@ if $(ConfigurationName) == Eureka copy /Y "$(ProjectDir)Intro.wmv" "$(TargetDir)
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
<Import Project="..\..\packages\WPFMediaKit.2.2.0\build\WPFMediaKit.targets" Condition="Exists('..\..\packages\WPFMediaKit.2.2.0\build\WPFMediaKit.targets')" />
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 684b9bd8c..f8c139cf6 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs
@@ -184,7 +184,7 @@ namespace Tango.PPC.UI.ViewModels
{
get { return GetVolumeLiquidType(LiquidTypes.LightYellow); }
}
-
+
//public double TransparentInkOutput
//{
// get { return GetVolumeLiquidType(LiquidTypes.TransparentInk); }
@@ -584,17 +584,38 @@ namespace Tango.PPC.UI.ViewModels
IsDyeingProcess = (RunningJobStatus != null && RunningJobStatus.CurrentSegment != null);
if (RunningJobStatus != null && RunningJobStatus.CurrentSegment != null)
{
- 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(_runningJobStatus.CurrentSegment.IsInterSegment)
{
- if (_handler.JobTicket.Segments.Count > 0)
+ CurrentBrushStop = _runningJobStatus.CurrentSegment.BrushStops.FirstOrDefault();
+ JobBrushStop = null;
+ }
+ else
+ {
+ var realsegmIndex = 1;
+ if (Job.EnableInterSegment && Job.InterSegmentLength > 0)
{
- JobBrushStop = _handler.JobTicket.Segments[Job.OrderedSegments.IndexOf(segment)].BrushStops.First();
- }
+ int segmentIndex = _runningJobStatus.CurrentSegment.SegmentIndex - (Job.EffectiveSegments.Count * RunningJobStatus.CurrentUnit);
+ if(RunningJobStatus.CurrentUnit > 0)
+ {
+ segmentIndex -= RunningJobStatus.CurrentUnit;// inter segment between units
+ }
+ realsegmIndex = (int)(segmentIndex/2) + 1;
+ }
+ else
+ {
+ realsegmIndex = Math.Max(_runningJobStatus.CurrentSegment.SegmentIndex - (Job.Segments.Count * RunningJobStatus.CurrentUnit), 0);
+ }
+
+ var segment = Job.Segments.FirstOrDefault(x => x.SegmentIndex == realsegmIndex);
+ if (segment != null)
+ {
+ if (_handler.JobTicket.Segments.Count > 0)
+ {
+ JobBrushStop = _handler.JobTicket.Segments[Job.OrderedSegments.IndexOf(segment)].BrushStops.First();
+ }
+ }
+ CurrentBrushStop = RunningJobStatus.CurrentSegment.FirstBrushStop;
}
- CurrentBrushStop = RunningJobStatus.CurrentSegment.FirstBrushStop;
}
}