aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2025-06-16 07:21:31 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2025-06-16 07:21:31 +0300
commitfe7108fd24e8dd403b4efb3557d32013ce1f9a06 (patch)
tree64917dd788554eb6f60400ae066002e8d2a93205
parent56b93b90a8273af22b4430a2cf842d73163aafb6 (diff)
downloadTango-fe7108fd24e8dd403b4efb3557d32013ce1f9a06.tar.gz
Tango-fe7108fd24e8dd403b4efb3557d32013ce1f9a06.zip
Production data graph.
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml5
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs10
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs78
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml2
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest2
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchMultiLineTextBox.cs7
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchMultiLineTextBox.xaml1
7 files changed, 80 insertions, 25 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
index d13d6c124..f92b92b5e 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
@@ -192,6 +192,9 @@
<TextBlock VerticalAlignment="Bottom">Enable White Thread Trimming Feature</TextBlock>
<touch:TouchToggleSlider Style="{StaticResource TangoToggleButtonGrayAccent}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="90" IsChecked="{Binding Settings.EnableWhiteThreadSkip}" KeyboardNavigation.TabNavigation ="None" IsTabStop="False"></touch:TouchToggleSlider>
+
+ <TextBlock VerticalAlignment="Bottom">Production Data Graph Start Time</TextBlock>
+ <touch:TouchNumericTextBox HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" Minimum="0" Maximum="12" Value="{Binding Settings.ProductionDataStartTimeHours}" HasDecimalPoint="False" KeyboardContainer="{Binding ElementName=Container}"></touch:TouchNumericTextBox>
</controls:TableGrid>
<DockPanel Margin="10 -50 0 0">
@@ -413,7 +416,7 @@
</controls:TableGrid>
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" ><Run>Phone Numbers</Run> <Run FontSize="12" Foreground="{StaticResource TangoGrayTextBrush}"> (comma separated)</Run></TextBlock>
- <touch:TouchMultiLineTextBox IsEnabled="{Binding ElementName=chkEnableSMS,Path=IsChecked}" Height="80" Text="{Binding Settings.SMSNotificationSettings.Numbers}" FontSize="16" CaretBrush="Black"></touch:TouchMultiLineTextBox>
+ <touch:TouchMultiLineTextBox IsEnabled="{Binding ElementName=chkEnableSMS,Path=IsChecked}" Height="80" Text="{Binding Settings.SMSNotificationSettings.Numbers}" FontSize="16" CaretBrush="Black" KeyboardContainer="{Binding ElementName=Container}"></touch:TouchMultiLineTextBox>
</StackPanel>
</touch:TouchExpander>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs
index 55a8be975..d149fc16a 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs
@@ -434,10 +434,20 @@ namespace Tango.PPC.Common
public bool EnableWhiteThreadSkip { get; set; }
/// <summary>
+ /// Gets or sets the production data start time.
+ /// </summary>
+ public int ProductionDataStartTimeHours { get; set; }
+
+ public int ProductionDataRefreshRateSeconds { get; set; }
+
+
+ /// <summary>
/// Initializes a new instance of the <see cref="PPCSettings"/> class.
/// </summary>
public PPCSettings()
{
+ ProductionDataStartTimeHours = 6;
+ ProductionDataRefreshRateSeconds = 60;
EnableWhiteThreadSkip = false;
BuzzerDuration = 30;
EnableJerricanChangePopup = true;
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 2faee12ac..7b0f47927 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs
@@ -75,11 +75,14 @@ namespace Tango.PPC.UI.ViewModels
};
private DispatcherTimer _productiondata_timer;
+ private double _lastProductionDataProgress;
private bool startingJob = false;
private bool _jerricanDialogShowing;
private List<ColorSpace> _colorSpaces;
private bool _conversion_Busy;
private bool _printingEnded;
+ private double _totalProductionDataMeters;
+ private DateTime productionStartTime;
#region Properties
@@ -170,7 +173,7 @@ namespace Tango.PPC.UI.ViewModels
if (_isDyeingProcess != value)
{
_isDyeingProcess = value;
- RaisePropertyChangedAuto();
+ RaisePropertyChangedAuto();
}
}
}
@@ -330,7 +333,7 @@ namespace Tango.PPC.UI.ViewModels
}
}
- public WpfGraphController<DateTimeDataPoint, DoubleDataPoint> JobController { get; set; }
+ public WpfGraphController<TimeSpanDataPoint, DoubleDataPoint> JobController { get; set; }
private JobResumeModel _resumeModel;
public JobResumeModel ResumeModel
@@ -401,8 +404,10 @@ namespace Tango.PPC.UI.ViewModels
public MachineStatusViewVM()
{
+ productionStartTime = DateTime.Today.AddHours(Settings.ProductionDataStartTimeHours);
+
_productiondata_timer = new DispatcherTimer();
- _productiondata_timer.Interval = TimeSpan.FromMinutes(10);
+ _productiondata_timer.Interval = TimeSpan.FromSeconds(Settings.ProductionDataRefreshRateSeconds);
_productiondata_timer.Tick += _productiondata_timer_Tick;
@@ -469,10 +474,7 @@ namespace Tango.PPC.UI.ViewModels
MachineProvider.MachineOperator.MachineStatusChanged += MachineOperator_MachineStatusChanged;
- DateTime dateTime = DateTime.Now;
- DateTime onedayEarlier = dateTime.AddDays(-1);
-
- GetCollectionDyePropByStartTime(onedayEarlier);
+ GetCollectionDyePropByStartTime(productionStartTime);
_productiondata_timer.Start();
}
@@ -586,7 +588,29 @@ namespace Tango.PPC.UI.ViewModels
private void _productiondata_timer_Tick(object sender, EventArgs e)
{
- var CurrentDateTime = DateTime.Now;
+ if (MachineProvider.MachineOperator.IsPrinting)
+ {
+ if (RunningJobStatus != null)
+ {
+ var delta = RunningJobStatus.Progress - _lastProductionDataProgress;
+ _lastProductionDataProgress = RunningJobStatus.Progress;
+
+ if (BuildProvider.MachineType == MachineTypes.Eureka)
+ {
+ _totalProductionDataMeters += (delta * 4);
+ }
+ else
+ {
+ _totalProductionDataMeters += delta;
+ }
+
+ JobController.PushData(DateTime.Now.TimeOfDay, _totalProductionDataMeters);
+ }
+ else
+ {
+ _lastProductionDataProgress = 0;
+ }
+ }
}
private async void MidTankLevel_PressedEvent(object sender, JerricanLevelModel e)
@@ -641,6 +665,8 @@ namespace Tango.PPC.UI.ViewModels
CurrentBrushStop = null;
JobBrushStop = null;
+ JobController.PushData(DateTime.Now.TimeOfDay, _totalProductionDataMeters);
+
List<LiquidOutputModel> outputs = new List<LiquidOutputModel>();
var idsPacks = MachineProvider.Machine.Configuration.GetSupportedIdsPacks(Job.Rml).OrderBy(x => x.PackIndex).ToList();
@@ -1083,9 +1109,9 @@ namespace Tango.PPC.UI.ViewModels
public TimeToDyeValueCollection graphDyeingValuesCollection = new TimeToDyeValueCollection();
- private WpfGraphController<DateTimeDataPoint, DoubleDataPoint> CreateController(params WpfGraphDataSeries[] seriesCollection)
+ private WpfGraphController<TimeSpanDataPoint, DoubleDataPoint> CreateController(params WpfGraphDataSeries[] seriesCollection)
{
- var controller = new WpfGraphController<DateTimeDataPoint, DoubleDataPoint>();
+ var controller = new WpfGraphController<TimeSpanDataPoint, DoubleDataPoint>();
foreach (var series in seriesCollection)
{
@@ -1095,9 +1121,9 @@ namespace Tango.PPC.UI.ViewModels
controller.Range.AutoY = true;
controller.Range.MaximumY = 100;
controller.Range.MinimumY = 0;
- controller.Range.MaximumX = new DateTime(0).AddMinutes(30);
+ controller.Range.MaximumX = TimeSpan.FromHours(24);
- controller.RefreshRate = TimeSpan.FromMilliseconds(300000);//5 min
+ controller.RefreshRate = TimeSpan.FromSeconds(Settings.ProductionDataRefreshRateSeconds);
return controller;
}
@@ -1121,24 +1147,32 @@ namespace Tango.PPC.UI.ViewModels
{
using (ObservablesContext db = ObservablesContext.CreateDefault())
{
- var jobRuns = await db.JobRuns.Where(x => x.StartDate >= starttime).Select(x => new { x.StartDate, x.EndDate, x.EndPosition }).OrderBy(y => y.StartDate).ToListAsync();
- double allvalues = 0;
- graphDyeingValuesCollection.StartTime = starttime;
- for (int i = 0; i < jobRuns.Count; i++)
+ DateTime startTimeUTC = starttime.ToUniversalTime();
+
+ var jobRuns = await db.JobRuns.Where(x => x.StartDate >= startTimeUTC).Select(x => new { x.StartDate, x.EndDate, x.ActualStartPosition, x.ActualEndPosition }).OrderBy(y => y.StartDate).ToListAsync();
+
+ JobController.PushData(starttime.TimeOfDay, _totalProductionDataMeters);
+
+ foreach (var jobRun in jobRuns)
{
- JobController.PushData(jobRuns[i].StartDate, allvalues);
- if (i > 0)
+ JobController.PushData(jobRun.StartDate.ToLocalTime().TimeOfDay, _totalProductionDataMeters);
+
+ if (BuildProvider.MachineType == MachineTypes.Eureka)
+ {
+ _totalProductionDataMeters += (jobRun.ActualEndPosition - jobRun.ActualStartPosition) * 4;
+ }
+ else
{
- allvalues += jobRuns[i - 1].EndPosition;
+ _totalProductionDataMeters += jobRun.ActualEndPosition - jobRun.ActualStartPosition;
}
- graphDyeingValuesCollection.items.Add(new TimeToDyeValueItem() { startTime = jobRuns[i].StartDate, endTime = jobRuns[i].EndDate, totalValue = allvalues });
- JobController.PushData(jobRuns[i].EndDate, allvalues);
+
+ JobController.PushData(jobRun.EndDate.ToLocalTime().TimeOfDay, _totalProductionDataMeters);
}
}
}
catch (Exception ex)
{
- LogManager.Log(ex, "Error loading machine counters.");
+ LogManager.Log(ex, "Error loading production data.");
}
}
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 a269c590d..2f1a54e64 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml
@@ -1409,7 +1409,7 @@
<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="{StaticResource Tango_RealTimeGraph_ForegroundBrush}" BorderBrush="Transparent"
- VerticalAxisVisibility="Visible" HorizontalAxisVisibility="Visible" VerticalTicks =" 5" AxisLabelAngle="0.0"/>
+ VerticalAxisVisibility="Visible" HorizontalAxisVisibility="Visible" VerticalTicks ="6" AxisLabelAngle="0.0"/>
</Grid>
</Grid>
</Grid>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
index d72e75011..efc5f8179 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
@@ -16,7 +16,7 @@
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
- <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
+ <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />-->
</requestedPrivileges>
</security>
</trustInfo>
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchMultiLineTextBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchMultiLineTextBox.cs
index f3c554a8c..70e9608bd 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/TouchMultiLineTextBox.cs
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchMultiLineTextBox.cs
@@ -18,6 +18,13 @@ namespace Tango.Touch.Controls
public static readonly DependencyProperty CornerRadiusProperty =
DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(TouchMultiLineTextBox), new PropertyMetadata(new CornerRadius(0)));
+ public FrameworkElement KeyboardContainer
+ {
+ get { return (FrameworkElement)GetValue(KeyboardContainerProperty); }
+ set { SetValue(KeyboardContainerProperty, value); }
+ }
+ public static readonly DependencyProperty KeyboardContainerProperty =
+ DependencyProperty.Register("KeyboardContainer", typeof(FrameworkElement), typeof(FrameworkElement), new PropertyMetadata(null));
static TouchMultiLineTextBox()
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchMultiLineTextBox.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchMultiLineTextBox.xaml
index 494e7442e..69bdcb756 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/TouchMultiLineTextBox.xaml
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchMultiLineTextBox.xaml
@@ -19,6 +19,7 @@
<Setter Property="CornerRadius" Value="3"></Setter>
<Setter Property="BorderThickness" Value="1"></Setter>
<Setter Property="keyboard:KeyboardView.Mode" Value="AlphaNumeric"></Setter>
+ <Setter Property="keyboard:KeyboardView.Container" Value="{Binding RelativeSource={RelativeSource Self},Path=KeyboardContainer}"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:TouchMultiLineTextBox}">