aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2023-07-02 13:37:17 +0300
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2023-07-02 13:37:17 +0300
commit38ed93f95bb5af92bc84599ebb9c0c6895b0b989 (patch)
tree2cdffd5247aa51bfbfb5d896e4ce1d8e7e400c20 /Software/Visual_Studio
parenta5de87ea9863c6e7053e09ed1c2eabf58285af48 (diff)
downloadTango-38ed93f95bb5af92bc84599ebb9c0c6895b0b989.tar.gz
Tango-38ed93f95bb5af92bc84599ebb9c0c6895b0b989.zip
Job running progress bar. Set running background in progress bar by unit from right to left as auto reverse ( not animation).
Bug in current segment in JobHandler.
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml15
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs108
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/DoubleWidthConverter.cs24
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj1
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs10
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml6
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs8
7 files changed, 154 insertions, 18 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 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/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj
index e2d447be5..f5d3502c0 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" />
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..614da8fea 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml
@@ -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">
@@ -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/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)
{