diff options
| author | Roy Ben-Shabat <Roy.mail.net@gmail.com> | 2023-05-24 11:23:39 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy.mail.net@gmail.com> | 2023-05-24 11:23:39 +0300 |
| commit | f63fd116590161620cd7eb1aaea83139fd1b9afd (patch) | |
| tree | f4be0ec7be2f153152b639acaafb9348626607ef /Software/Visual_Studio | |
| parent | 7c802a28b124836721202b8916a25f8e67df78a1 (diff) | |
| parent | d7a0d5e8d6804f5f739c223c123b4b2780af4e11 (diff) | |
| download | Tango-f63fd116590161620cd7eb1aaea83139fd1b9afd.tar.gz Tango-f63fd116590161620cd7eb1aaea83139fd1b9afd.zip | |
Merge branch 'eureka' of https://twinetfs.visualstudio.com/Tango/_git/Tango into eureka
Diffstat (limited to 'Software/Visual_Studio')
26 files changed, 587 insertions, 70 deletions
diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Models/StopModel.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Models/StopModel.cs index 24ddc80bf..3d616f957 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Models/StopModel.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Models/StopModel.cs @@ -29,6 +29,7 @@ namespace Tango.FSE.Statistics.Models public JobRunExtendedInfo ExtendedInfo { get; set; } public bool IsAdvancedMode { get; set; } public VectorFineTuningRunModel FineTuningModel { get; set; } + public bool IsEureka { get; set; } public bool IsFineTuning { @@ -163,7 +164,18 @@ namespace Tango.FSE.Statistics.Models public String LogicalLength { - get { return JobRun.NumberOfUnits > 1 ? $"{JobRun.JobLogicalLength} x{JobRun.NumberOfUnits}" : JobRun.JobLogicalLength.ToString(); } + get { var length = IsEureka ? JobRun.JobLogicalLength * 4 : JobRun.JobLogicalLength; + return JobRun.NumberOfUnits > 1 ? $"{length} x{JobRun.NumberOfUnits}" : length.ToString(); } + } + + public double JobLength + { + get { return IsEureka ? JobRun.JobLength * 4 : JobRun.JobLength; } + } + + public double EndPosition + { + get { return IsEureka ? JobRun.EndPosition * 4 : JobRun.EndPosition; } } public String FineTuningMeasured diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs index d77b0b5a1..ae4444f06 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs @@ -422,6 +422,7 @@ namespace Tango.FSE.Statistics.ViewModels stop.ThreadName = rmlName; stop.IsAdvancedMode = !BuildProvider.IsTwineRSM && CurrentUser.HasRole(Roles.FSEAdvancedTechnician); stop.FineTuningModel = fineTuningModel; + stop.IsEureka = MachineProvider.MachineOperator.MachineType == MachineTypes.Eureka; if (fineTuningModel != null) { @@ -735,11 +736,11 @@ namespace Tango.FSE.Statistics.ViewModels model.JobName = stop.JobRun.JobName; model.JobKind = ((JobDesignations)stop.JobRun.JobDesignation).ToDescription(); model.Thread = stop.ThreadName; - model.Length = ((int)stop.JobRun.JobLogicalLength).ToString(); + model.Length = stop.LogicalLength; model.NumberOfUnits = stop.JobRun.NumberOfUnits.ToString(); model.StartTime = stop.JobRun.StartDate.ToLocalTime().ToString(); model.Duration = stop.Duration.ToStringUnlimitedHours(); - model.EndPosition = stop.JobRun.EndPosition.ToString(); + model.EndPosition = stop.EndPosition.ToString(); model.Status = ((JobRunStatus)stop.JobRun.Status).ToString(); model.SegmentIndex = stop.SegmentIndex.ToString(); model.Offset = stop.StartMeters.ToString(); diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Views/MainView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Views/MainView.xaml index 5f0ceaa5a..88b460ab1 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Views/MainView.xaml +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Views/MainView.xaml @@ -138,13 +138,13 @@ <TextBlock> <Run>Actual Length:</Run> <LineBreak/> - <Run Text="{Binding Items[0].Items[0].JobRun.JobLength}"></Run> + <Run Text="{Binding Items[0].Items[0].JobLength, Mode=OneWay}"></Run> </TextBlock> </TextBlock.ToolTip> </TextBlock> <TextBlock Text="{Binding Items[0].Items[0].JobRun.StartDate,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" VerticalAlignment="Center" Width="120"></TextBlock> <TextBlock Text="{Binding Items[0].Items[0].Duration,Mode=OneWay,Converter={StaticResource TotalDyeTimeConverter}}" VerticalAlignment="Center" Width="100"></TextBlock> - <TextBlock Text="{Binding Items[0].Items[0].JobRun.EndPosition,StringFormat=N1}" VerticalAlignment="Center" Width="80"></TextBlock> + <TextBlock Text="{Binding Items[0].Items[0].EndPosition,StringFormat=N1}" VerticalAlignment="Center" Width="80"></TextBlock> </StackPanel> <Grid Visibility="{Binding IsAdvancedMode,Converter={StaticResource BooleanToVisibilityConverter}}" DataContext="{Binding Items[0].Items[0]}" Width="250" Margin="0 0 50 5" HorizontalAlignment="Right" VerticalAlignment="Bottom"> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobRingProgress.xaml b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobRingProgress.xaml index d0121afa5..b683ae0d2 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobRingProgress.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobRingProgress.xaml @@ -5,9 +5,14 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:behaviors="clr-namespace:Tango.FSE.Common.Behaviors" xmlns:local="clr-namespace:Tango.FSE.Common.Controls" + xmlns:localConverters="clr-namespace:Tango.FSE.Common.Converters" xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="450" x:Name="control"> + <UserControl.Resources> + <localConverters:ProgressLengthSpoolConverter x:Key="ProgressLengthSpoolConverter"/> + </UserControl.Resources> + <Grid Opacity="0.7"> <Viewbox> <Grid> @@ -50,10 +55,31 @@ <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Completed</TextBlock> </StackPanel> - <TextBlock FontWeight="Light" FontSize="25" Margin="0 10 0 0" HorizontalAlignment="Center"> + <TextBlock FontWeight="Light" FontSize="25" Margin="0 10 0 0" HorizontalAlignment="Center" Visibility="Collapsed"> <Run Text="{Binding ElementName=control,Path=RunningJobStatus.ProgressMinusSettingUp,StringFormat=0,FallbackValue=0}"></Run><Run Text="/" /><Run Text="{Binding RunningJobStatus.TotalProgressMinusSettingUp,StringFormat=0,FallbackValue=0}"/> <Run FontSize="16">m</Run> </TextBlock> + <StackPanel Orientation="Horizontal" Margin="0 10 0 0" HorizontalAlignment="Center" Visibility="Visible"> + <TextBlock FontWeight="Light" FontSize="25" VerticalAlignment="Center" > + <TextBlock.Text> + <MultiBinding Converter="{StaticResource ProgressLengthSpoolConverter}" StringFormat="0.#" TargetNullValue='-' FallbackValue='0' Mode="OneWay"> + <Binding Path="RunningJobStatus.TotalProgressMinusSettingUp" /> + <Binding Path="IsEureka"/> + <Binding Path="RunningJobStatus.ProgressMinusSettingUp" /> + </MultiBinding> + </TextBlock.Text> + </TextBlock> + <TextBlock FontWeight="Light" FontSize="25" VerticalAlignment="Center" Text="/"></TextBlock> + <TextBlock FontWeight="Light" FontSize="25" VerticalAlignment="Center" > + <TextBlock.Text> + <MultiBinding Converter="{StaticResource ProgressLengthSpoolConverter}" StringFormat="0" TargetNullValue='-' FallbackValue='0' Mode="OneWay"> + <Binding Path="RunningJobStatus.TotalProgressMinusSettingUp"/> + <Binding Path="IsEureka"/> + </MultiBinding> + </TextBlock.Text> + </TextBlock> + <TextBlock FontWeight="Light" FontSize="25" VerticalAlignment="Center" Text=" m"></TextBlock> + </StackPanel> </StackPanel> <StackPanel Height="90" Visibility="{Binding ElementName=control,Path=RunningJobStatus.IsSettingUp,Converter={StaticResource BooleanToVisibilityConverter}}"> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobRingProgress.xaml.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobRingProgress.xaml.cs index 5e0f28419..d8374573c 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobRingProgress.xaml.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobRingProgress.xaml.cs @@ -40,8 +40,15 @@ namespace Tango.FSE.Common.Controls public static readonly DependencyProperty IsRunningProperty = DependencyProperty.Register("IsRunning", typeof(bool), typeof(RunningJobRingProgress), new PropertyMetadata(false)); + public bool IsEureka + { + get { return (bool)GetValue(IsEurekaProperty); } + set { SetValue(IsEurekaProperty, value); } + } + public static readonly DependencyProperty IsEurekaProperty = + DependencyProperty.Register("IsEureka", typeof(bool), typeof(RunningJobRingProgress), new PropertyMetadata(false)); - + public RunningJobRingProgress() { InitializeComponent(); diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobViewer.xaml b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobViewer.xaml index 2cd4fa7ad..faf5e072f 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobViewer.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobViewer.xaml @@ -6,9 +6,14 @@ xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:local="clr-namespace:Tango.FSE.Common.Controls" + xmlns:localConverters="clr-namespace:Tango.FSE.Common.Converters" mc:Ignorable="d" d:DesignHeight="120" d:DesignWidth="800"> + <UserControl.Resources> + <localConverters:ProgressLengthSpoolConverter x:Key="ProgressLengthSpoolConverter"/> + </UserControl.Resources> + <DockPanel> <Canvas Height="50" Margin="0" DockPanel.Dock="Top"> <StackPanel> @@ -132,7 +137,15 @@ </Style.Triggers> </Style> </TextBlock.Style> - <Run Text="{Binding LengthWithFactor,Mode=OneWay,StringFormat=N0}"></Run><Run Text="m"></Run> + <Run > + <Run.Text> + <MultiBinding Converter="{StaticResource ProgressLengthSpoolConverter}" StringFormat="N0" TargetNullValue=' ' FallbackValue='0' Mode="OneWay"> + <Binding Path="LengthWithFactor"/> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="IsEureka"/> + </MultiBinding> + </Run.Text> + </Run> + <Run Text="m"></Run> </TextBlock> </Grid> </DataTemplate> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobViewer.xaml.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobViewer.xaml.cs index 4a970ffda..459728264 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobViewer.xaml.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobViewer.xaml.cs @@ -55,6 +55,14 @@ namespace Tango.FSE.Common.Controls public static readonly DependencyProperty JobProperty = DependencyProperty.Register("Job", typeof(Job), typeof(RunningJobViewer), new PropertyMetadata(null)); + public bool IsEureka + { + get { return (bool)GetValue(IsEurekaProperty); } + set { SetValue(IsEurekaProperty, value); } + } + public static readonly DependencyProperty IsEurekaProperty = + DependencyProperty.Register("IsEureka", typeof(bool), typeof(RunningJobViewer), new PropertyMetadata(false)); + /// <summary> /// Gets or sets the running job status. /// </summary> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Converters/ProgressLengthSpoolConverter.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Converters/ProgressLengthSpoolConverter.cs new file mode 100644 index 000000000..10c20c171 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Converters/ProgressLengthSpoolConverter.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; +using Tango.BL.Entities; + +namespace Tango.FSE.Common.Converters +{ + public class ProgressLengthSpoolConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + if (values.Count() == 2) + { + double length = System.Convert.ToDouble(values[0]); + bool isEureka = System.Convert.ToBoolean(values[1]); + int jobSpools = 1; + if (isEureka) + jobSpools = 4; + var totalBy4Spools = (double)length * jobSpools;// spools 4; + return totalBy4Spools; + + } + if (values.Count() == 3) + { + double length = System.Convert.ToDouble(values[0]); + var segment = values[1] as Segment; + bool isEureka = System.Convert.ToBoolean(values[1]); + int jobSpools = 1; + if (isEureka) + jobSpools = 4; + double currentProgresslength = System.Convert.ToDouble(values[2]); + + var totalBySpools = (double)length * jobSpools; + var currentProgressBySpools = (double)currentProgresslength * jobSpools; + + int coeff = (int)currentProgressBySpools / (int)totalBySpools; + var progressCurrent = (coeff == 0 || coeff == 1) ? currentProgressBySpools : currentProgressBySpools % (coeff * totalBySpools);//show for progress + + return progressCurrent; + } + return "-"; + } + catch + { + return "-"; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj index 82d62ff14..8ef3551d5 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj @@ -220,6 +220,7 @@ <Compile Include="Converters\LiquidTypeToShortNameConverter.cs" /> <Compile Include="Converters\NanolitersToLitersConverter.cs" /> <Compile Include="Converters\ObjectToJsonConverter.cs" /> + <Compile Include="Converters\ProgressLengthSpoolConverter.cs" /> <Compile Include="Converters\TimeSpanHumanizeConverter.cs" /> <Compile Include="Converters\TotalDyeTimeConverter.cs" /> <Compile Include="Converters\TotalMetersConverter.cs" /> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tiles/RemoteJob/RemoteJobProgressRingTileView.xaml b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tiles/RemoteJob/RemoteJobProgressRingTileView.xaml index 62e7c4798..c021b0a15 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tiles/RemoteJob/RemoteJobProgressRingTileView.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tiles/RemoteJob/RemoteJobProgressRingTileView.xaml @@ -9,6 +9,6 @@ mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=local:RemoteJobProgressRingTile, IsDesignTimeCreatable=False}"> <Grid Margin="30"> - <controls:RunningJobRingProgress RunningJobStatus="{Binding RunningJobStatus}" IsRunning="{Binding IsRunning}" /> + <controls:RunningJobRingProgress RunningJobStatus="{Binding RunningJobStatus}" IsRunning="{Binding IsRunning}" IsEureka ="{Binding IsEureka}" /> </Grid> </UserControl> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tiles/RemoteJob/RemoteJobTile.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tiles/RemoteJob/RemoteJobTile.cs index 650818c22..453a0892e 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tiles/RemoteJob/RemoteJobTile.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tiles/RemoteJob/RemoteJobTile.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Media; using Tango.BL.Entities; +using Tango.BL.Enumerations; using Tango.FSE.Common; using Tango.Integration.Operation; using Tango.PPC.Shared.Jobs; @@ -42,6 +43,15 @@ namespace Tango.FSE.UI.Tiles.RemoteJob set { _isRunning = value; RaisePropertyChangedAuto(); } } + private bool _isEureka; + + public bool IsEureka + { + get { return _isEureka; } + set { _isEureka = value; RaisePropertyChangedAuto(); } + } + + public RemoteJobTile() { Name = "Remote Job"; @@ -113,6 +123,7 @@ namespace Tango.FSE.UI.Tiles.RemoteJob Handler.StatusChanged += Handler_StatusChanged; Job = e.JobHandler.Job; IsRunning = true; + IsEureka = MachineProvider.MachineOperator.MachineType == MachineTypes.Eureka; } private void Handler_StatusChanged(object sender, RunningJobStatus status) diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tiles/RemoteJob/RemoteJobTileView.xaml b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tiles/RemoteJob/RemoteJobTileView.xaml index ee05314ce..1323c9298 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tiles/RemoteJob/RemoteJobTileView.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tiles/RemoteJob/RemoteJobTileView.xaml @@ -10,7 +10,7 @@ <Grid TextElement.Foreground="{StaticResource FSE_PrimaryAccentBrush}"> <Viewbox Width="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=ActualWidth}"> <Border Background="#292929" CornerRadius="10" VerticalAlignment="Bottom" Padding="20 0" Width="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=ActualWidth}"> - <controls:RunningJobViewer IsRunning="{Binding IsRunning}" Job="{Binding Job}" RunningJobStatus="{Binding RunningJobStatus}" IsActive="True" Margin="30 10" Height="90" /> + <controls:RunningJobViewer IsRunning="{Binding IsRunning}" Job="{Binding Job}" RunningJobStatus="{Binding RunningJobStatus}" IsEureka="{Binding IsEureka}" IsActive="True" Margin="30 10" Height="90" /> </Border> </Viewbox> </Grid> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressLengthSpoolConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressLengthSpoolConverter.cs index 3be7a8818..377d02d81 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressLengthSpoolConverter.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressLengthSpoolConverter.cs @@ -37,7 +37,7 @@ namespace Tango.PPC.UI.Converters var currentProgressBy4Spools = (double)currentProgresslength * 4 ; int coeff = (int)currentProgressBy4Spools / (int)totalBy4Spools; - var progressCurrent = coeff == 0 ? currentProgressBy4Spools : currentProgressBy4Spools % (coeff * totalBy4Spools);//show for progress + var progressCurrent = (coeff == 0 || coeff == 1) ? currentProgressBy4Spools : currentProgressBy4Spools % (coeff * totalBy4Spools);//show for progress if (forOneSpool) { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressUnitSpoolConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressUnitSpoolConverter.cs new file mode 100644 index 000000000..054ccd3df --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressUnitSpoolConverter.cs @@ -0,0 +1,40 @@ +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 ProgressUnitSpoolConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + if (values.Count() == 1)//may be added count of spools + { + int CurrentUnit = System.Convert.ToInt16(values[0]); + CurrentUnit +=1; + var totalBy4Spools = (double)CurrentUnit * 4;// spools ; + + return totalBy4Spools.ToString(); + + } + + return "-"; + } + catch + { + return "-"; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml index b4bc717cc..8ae0f4354 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml @@ -111,7 +111,61 @@ </Paragraph> </TableCell> </TableRow> - + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Up Time:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding UpTime,Mode=OneWay,StringFormat=hh\\:mm\\:ss,FallbackValue='00:00:00'}"></TextBlock> + </Paragraph> + </TableCell> + </TableRow> + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>IP Address:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding IPAddress,Mode=OneWay,FallbackValue=0}"></TextBlock> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Total Dye Time:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding TotalDyeTime,Mode=OneWay,FallbackValue=0}"></TextBlock> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Total Dye Meters:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding TotalDyeMeters,Mode=OneWay,FallbackValue=0}"></TextBlock> + </Paragraph> + </TableCell> + </TableRow> + </TableRowGroup> </Table> </FlowDocument> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationViewVM.cs index c680f4b90..7f810b2f3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationViewVM.cs @@ -12,6 +12,18 @@ using Tango.PPC.Common.Connection; using Tango.PPC.Common.Notifications; using Tango.Settings; using Tango.SharedUI; +using Tango.PPC.Common.UWF; +using Tango.Core.Commands; +using Tango.PPC.Common.OS; +using System.Collections.Generic; +using System.Diagnostics; +using System.Management; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; +using System.Timers; + namespace Tango.PPC.UI.Dialogs { @@ -48,11 +60,43 @@ namespace Tango.PPC.UI.Dialogs get { return CurrentSite == null ? "" : CurrentSite.Name; } } + private String _ipAddress; + public String IPAddress + { + get { return _ipAddress; } + set { _ipAddress = value; RaisePropertyChangedAuto(); } + } + + private String _totalDyeTime; + public String TotalDyeTime + { + get { return _totalDyeTime; } + set { _totalDyeTime = value; RaisePropertyChangedAuto(); } + } + + private String _totalDyeMeters; + public String TotalDyeMeters + { + get { return _totalDyeMeters; } + set { _totalDyeMeters = value; RaisePropertyChangedAuto(); } + } + + private TimeSpan _upTime; + public TimeSpan UpTime + { + get { return _upTime; } + set { _upTime = value; RaisePropertyChangedAuto(); } + } + public GeneralInformationViewVM( IMachineProvider provider, IPPCApplicationManager appManager) { MachineProvider = provider; ApplicationManager = appManager; InitSite(); + + IPAddress = GetIpv4Address(); + InitTotalDyeProp(); + UpTime = DateTime.Now - ApplicationManager.StartUpDate; } public async void InitSite() @@ -71,6 +115,48 @@ namespace Tango.PPC.UI.Dialogs } } } + + public String GetIpv4Address() + { + try + { + var host = Dns.GetHostEntry(Dns.GetHostName()); + foreach (var ip in host.AddressList) + { + if (ip.AddressFamily == AddressFamily.InterNetwork) + { + return ip.ToString(); + } + } + return "N/A"; + } + catch (Exception ex) + { + return "N/A"; + } + } + + public async void InitTotalDyeProp() + { + try + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var jobRuns = await db.JobRuns.Select(x => new { x.StartDate, x.EndDate, x.EndPosition }).ToListAsync(); + + TotalDyeTime = TimeSpan.FromHours(jobRuns.Select(x => x.EndDate - x.StartDate).Sum(x => x.TotalHours)).ToStringUnlimitedHours(); + + int meters = (int)jobRuns.Select(x => x.EndPosition).Sum(); + TotalDyeMeters = $"{meters.ToString("N0")} meters"; + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error loading machine counters."); + TotalDyeTime = "error!"; + TotalDyeMeters = "error!"; + } + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/Error.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/Error.png Binary files differindex b9138f444..a5a178bdb 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/Error.png +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/Error.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/Normal.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/Normal.png Binary files differindex a562e9228..8ddeecbe0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/Normal.png +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/Normal.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorItem.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorItem.cs new file mode 100644 index 000000000..3925a1752 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorItem.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; + +namespace Tango.PPC.UI.Models +{ + public class MachineOverviewErrorItem : ExtendedObject + { + private bool _isErrorState; + + public bool IsErrorState + { + get { return _isErrorState; } + set { _isErrorState = value; RaisePropertyChangedAuto();} + } + + public MachineOverviewErrorItem() + { + IsErrorState = false; + } + + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorStates.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorStates.cs new file mode 100644 index 000000000..1863b01e1 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorStates.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; + +namespace Tango.PPC.UI.Models +{ + public class MachineOverviewErrorStates : ExtendedObject + { + public ObservableCollection<MachineOverviewErrorItem> Winders { get; set; } + + public ObservableCollection<MachineOverviewErrorItem> Dancers { get; set; } + + public ObservableCollection<MachineOverviewErrorItem> BTSRs { get; set; } + + public MachineOverviewErrorStates() + { + Winders = new ObservableCollection<MachineOverviewErrorItem>(); + Dancers = new ObservableCollection<MachineOverviewErrorItem>(); + BTSRs = new ObservableCollection<MachineOverviewErrorItem>(); + for ( int i = 0; i < 4 ; i++) + { + Winders.Add( new MachineOverviewErrorItem()); + Dancers.Add(new MachineOverviewErrorItem()); + BTSRs.Add(new MachineOverviewErrorItem()); + } + } + + public void UpdateWinders(List<bool> updates) + { + if(!UpdateCollection(Winders, updates)) + { + LogManager.Log("Error in display Winders Errors. Number of Winders In Error is less then 4!"); + } + } + public void UpdateDancers(List<bool> updates) + { + if(!UpdateCollection(Dancers, updates)) + { + LogManager.Log("Error in display Dancers Errors. Number of Dancers In Error is less then 4!"); + } + } + public void UpdateBTSRs(List<bool> updates) + { + if(!UpdateCollection(BTSRs, updates)) + { + LogManager.Log("Error in display BTSRs Errors. Number of BTSRs In Error is less then 4!"); + } + } + + private bool UpdateCollection(ObservableCollection<MachineOverviewErrorItem> collection, List<bool> updates ) + { + if (collection.Count == updates.Count) + { + for (int i = 0; i < collection.Count; i++) + { + collection[i].IsErrorState = updates[i]; + } + return true; + } + return false; + + } + } +} 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 e02dba00e..a3ec9667f 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\LiquidTypeToBrushConverter.cs" /> <Compile Include="Converters\MidTankLevelToElementRectConverter.cs" /> <Compile Include="Converters\ProgressLengthSpoolConverter.cs" /> + <Compile Include="Converters\ProgressUnitSpoolConverter.cs" /> <Compile Include="Converters\ProgressWeightSpoolConverter.cs" /> <Compile Include="Dialogs\BitResultsView.xaml.cs"> <DependentUpon>BitResultsView.xaml</DependentUpon> @@ -237,9 +238,11 @@ <Compile Include="Dialogs\UpdateFromFileViewVM.cs" /> <Compile Include="Helpers\DpiHelper.cs" /> <Compile Include="InternalModule.cs" /> + <Compile Include="Models\MachineOverviewErrorStates.cs" /> <Compile Include="Models\MachineOverviewItem.cs" /> <Compile Include="Models\MachineOverviewModel.cs" /> <Compile Include="Models\JerricanLevelModel.cs" /> + <Compile Include="Models\MachineOverviewErrorItem.cs" /> <Compile Include="Modules\DefaultPPCModuleLoader.cs" /> <Compile Include="Navigation\EurekaNavigationManager.cs" /> <Compile Include="Navigation\DefaultNavigationManager.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 828047ccf..1182ba50e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs @@ -206,7 +206,9 @@ namespace Tango.PPC.UI.ViewModels get { return _jobOutlineTicket; } set { _jobOutlineTicket = value; RaisePropertyChangedAuto(); } } - + + public MachineOverviewErrorStates MachineErrorStates { get; set; } + #endregion #region Commands @@ -254,6 +256,7 @@ namespace Tango.PPC.UI.ViewModels IsWeghtView = false; OverviewModel = new MachineOverviewModel(); + MachineErrorStates = new MachineOverviewErrorStates(); } public override void OnApplicationReady() @@ -275,6 +278,7 @@ namespace Tango.PPC.UI.ViewModels private void MachineOperator_MachineStatusChanged(object sender, MachineStatus status) { UpdateMidTankLevels(status); + UpdateMachineStatusErrors(status); } private void UpdateMidTankLevels(MachineStatus status) { @@ -348,6 +352,16 @@ namespace Tango.PPC.UI.ViewModels } } + private void UpdateMachineStatusErrors(MachineStatus status) + { + var windersInError = status.WindersInError.ToList();// to test + MachineErrorStates.UpdateWinders(windersInError); + var dansersInError = status.DancersInError.ToList(); + MachineErrorStates.UpdateDancers(dansersInError); + var btsrsInErrors = status.BtsrsInError.ToList(); + MachineErrorStates.UpdateBTSRs(btsrsInErrors); + } + private void MachineOperator_InkFillingStatusChanged(object sender, InkFillingStatusChangedEventArgs e) { //foreach (var cartridge in e.Status.CartridgesStatuses.Where(x => x.Cartridge.Slot != CartridgeSlot.Ink)) 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 d9b37ac85..b6bda0892 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml @@ -24,6 +24,7 @@ <localConverters:ProgressWeightSpoolConverter x:Key="ProgressWeightSpoolConverter"/> <localConverters:LiquidTypeToBrushConverter x:Key="LiquidTypeToBrushConverter"/> <localConverters:MidTankLevelToElementRectConverter x:Key="MidTankLevelToElementRectConverter"/> + <localConverters:ProgressUnitSpoolConverter x:Key="ProgressUnitSpoolConverter"/> <Style x:Key="LinkRoundButtonStyle" TargetType="{x:Type touch:TouchButton}"> <Setter Property="Background" Value="{StaticResource TangoMidAccentBrush}"></Setter> @@ -167,19 +168,25 @@ <Rectangle Width="10" Height="2" Stroke="{StaticResource TangoTextWatermarkBrush}"></Rectangle> <Rectangle Width="10" Height="2" Stroke="{StaticResource TangoTextWatermarkBrush}"></Rectangle> </UniformGrid> - <Image Stretch="Fill" VerticalAlignment="Top" Width="24" Height="24" Margin="0 4 0 0"> + <Image Stretch="Fill" VerticalAlignment="Top" Margin="0 4 0 0"> <Image.Style> <Style TargetType="{x:Type Image}" > <Setter Property="Source" Value="{x:Null}"/> + <Setter Property="Image.Width" Value="24"/> + <Setter Property="Image.Height" Value="24"/> <Style.Triggers> <DataTrigger Binding="{Binding IsMidTankLow}" Value="True"> <Setter Property="Source" Value="../Images/Overview Icons/Warning.png"/> </DataTrigger> <DataTrigger Binding="{Binding FillingTimeoutError}" Value="True"> <Setter Property="Source" Value="../Images/Overview Icons/Error.png"/> + <Setter Property="Image.Width" Value="21"/> + <Setter Property="Image.Height" Value="26"/> </DataTrigger> <DataTrigger Binding="{Binding MidTankEmpty}" Value="True"> <Setter Property="Source" Value="../Images/Overview Icons/Error.png"/> + <Setter Property="Image.Width" Value="21"/> + <Setter Property="Image.Height" Value="26"/> </DataTrigger> <DataTrigger Binding="{Binding MidTankRefillPumpActive}" Value="True" > <Setter Property="Source" Value="../Images/Overview Icons/UpdateInk.png"/> @@ -239,6 +246,27 @@ </DockPanel> </DataTemplate> + <DataTemplate x:Key="ErrorState" DataType="{x:Type models:MachineOverviewErrorItem}"> + <Border Margin="0"> + <Image Stretch="Fill" HorizontalAlignment="Center" VerticalAlignment="Center" > + <Image.Style> + <Style> + <Setter Property="Image.Width" Value="24"/> + <Setter Property="Image.Height" Value="24"/> + <Setter Property="Image.Source" Value="../Images/Overview Icons/Normal.png"/> + <Style.Triggers> + <DataTrigger Binding="{Binding IsErrorState}" Value="True"> + <Setter Property="Image.Source" Value="../Images/Overview Icons/Error.png"/> + <Setter Property="Image.Width" Value="21"/> + <Setter Property="Image.Height" Value="26"/> + </DataTrigger> + </Style.Triggers> + </Style> + </Image.Style> + </Image> + </Border> + </DataTemplate> + </UserControl.Resources> <Grid Width="960" Height="1080"> <Grid > @@ -635,7 +663,13 @@ <Image Source="../Images/Job Issues/job_copies.png" Stretch="None" VerticalAlignment="Top"/> <StackPanel Orientation="Vertical" Margin="15 0 0 0"> <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}">Copies</TextBlock> - <TextBlock Text="{Binding RunningJobStatus.CurrentUnit,TargetNullValue='-', FallbackValue='-'}" FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"></TextBlock> + <TextBlock FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"> + <TextBlock.Text> + <MultiBinding Converter="{StaticResource ProgressUnitSpoolConverter}" TargetNullValue='-' FallbackValue='-' > + <Binding Path="RunningJobStatus.CurrentUnit" Mode="OneWay"/> + </MultiBinding> + </TextBlock.Text> + </TextBlock> </StackPanel> </StackPanel> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> @@ -956,43 +990,25 @@ <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> <StackPanel Orientation="Vertical"> <Border Height="184" Width="83" VerticalAlignment="Center" CornerRadius="2 0 0 2" BorderThickness="0" BorderBrush="{StaticResource TangoBlackInkBrush}"> - <UniformGrid Columns="1" Rows="4" Margin="24"> - <Image Stretch="Fill" Width="24" Height="24" Source="../Images/Overview Icons/Normal.png" HorizontalAlignment="Center" > - <!--<Image.Style> - <Style> - <Style.Triggers> - <DataTrigger Binding="{Binding Job.BTSR}}" Value="True"> - <Setter Property="Image.Source" Value="../Images/Overview Icons/Error.png"/> - </DataTrigger> - </Style.Triggers> - </Style> - </Image.Style>--> - </Image> - <Image Stretch="Fill" Width="24" Height="24" Source="../Images/Overview Icons/Normal.png" HorizontalAlignment="Center" ></Image> - <Image Stretch="Fill" Width="24" Height="24" Source="../Images/Overview Icons/Normal.png" HorizontalAlignment="Center" ></Image> - <Image Stretch="Fill" Width="24" Height="24" Source="../Images/Overview Icons/Normal.png" HorizontalAlignment="Center" ></Image> - </UniformGrid> + <ItemsControl Margin="0 21 0 9" ItemsSource="{Binding MachineErrorStates.Winders}" ItemTemplate="{StaticResource ErrorState}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Columns="1" Rows="4" IsItemsHost="True" VerticalAlignment="Stretch"></UniformGrid> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + </ItemsControl> </Border> <TextBlock HorizontalAlignment="Center" Margin="0 4 0 0" FontWeight="Thin">Winder</TextBlock> </StackPanel> <StackPanel Orientation="Vertical"> - <Border Height="171" Width="95" VerticalAlignment="Center" CornerRadius="0" BorderThickness="0" BorderBrush="{StaticResource TangoBlackInkBrush}"> - <UniformGrid Columns="1" Rows="4" Margin="0 21 0 9" VerticalAlignment="Stretch"> - <Image Stretch="Fill" Width="24" Height="24" Source="../Images/Overview Icons/Normal.png" HorizontalAlignment="Center" > - <!--<Image.Style> - <Style> - <Style.Triggers> - <DataTrigger Binding="{Binding Job.BTSR}}" Value="True"> - <Setter Property="Image.Source" Value="../Images/Overview Icons/Error.png"/> - </DataTrigger> - </Style.Triggers> - </Style> - </Image.Style>--> - </Image> - <Image Stretch="Fill" Width="24" Height="24" Source="../Images/Overview Icons/Normal.png" HorizontalAlignment="Center" ></Image> - <Image Stretch="Fill" Width="24" Height="24" Source="../Images/Overview Icons/Normal.png" HorizontalAlignment="Center" ></Image> - <Image Stretch="Fill" Width="24" Height="24" Source="../Images/Overview Icons/Normal.png" HorizontalAlignment="Center" ></Image> - </UniformGrid> + <Border Height="171" Width="95" VerticalAlignment="Center" CornerRadius="0" BorderThickness="0" BorderBrush="{StaticResource TangoBlackInkBrush}"> + <ItemsControl Margin="0 21 0 9" ItemsSource="{Binding MachineErrorStates.Dancers}" ItemTemplate="{StaticResource ErrorState}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Columns="1" Rows="4" IsItemsHost="True" VerticalAlignment="Stretch"></UniformGrid> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + </ItemsControl> </Border> <TextBlock HorizontalAlignment="Center" Margin="14 18 14 14" FontWeight="Thin">Dancer</TextBlock> </StackPanel> @@ -1000,22 +1016,13 @@ <StackPanel Orientation="Vertical" Margin="274 0 0 0"> <Border Height="171" Width="95" VerticalAlignment="Center" CornerRadius="0" BorderThickness="0" BorderBrush="{StaticResource TangoBlackInkBrush}"> - <UniformGrid Columns="1" Rows="4" Margin="0 21 0 9" VerticalAlignment="Stretch"> - <Image Stretch="Fill" Width="24" Height="24" Source="../Images/Overview Icons/Normal.png" HorizontalAlignment="Center" > - <!--<Image.Style> - <Style> - <Style.Triggers> - <DataTrigger Binding="{Binding Job.BTSR}}" Value="True"> - <Setter Property="Image.Source" Value="../Images/Overview Icons/Error.png"/> - </DataTrigger> - </Style.Triggers> - </Style> - </Image.Style>--> - </Image> - <Image Stretch="Fill" Width="24" Height="24" Source="../Images/Overview Icons/Normal.png" HorizontalAlignment="Center" ></Image> - <Image Stretch="Fill" Width="24" Height="24" Source="../Images/Overview Icons/Normal.png" HorizontalAlignment="Center" ></Image> - <Image Stretch="Fill" Width="24" Height="24" Source="../Images/Overview Icons/Normal.png" HorizontalAlignment="Center" ></Image> - </UniformGrid> + <ItemsControl Margin="0 21 0 9" ItemsSource="{Binding MachineErrorStates.BTSRs}" ItemTemplate="{StaticResource ErrorState}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Columns="1" Rows="4" IsItemsHost="True" VerticalAlignment="Stretch"></UniformGrid> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + </ItemsControl> </Border> <TextBlock HorizontalAlignment="Center" Margin="0 18 0 0" FontWeight="Thin">BTSR</TextBlock> </StackPanel> 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.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index 3543b8b3a..0e00bee3e 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -170,8 +170,22 @@ namespace Tango.Emulations.Emulators MidTankLevel = 2.5, }); } + for (int i = 0; i < 4; i++) + { + if( i == 2) + { + MachineStatus.WindersInError.Add(false); + MachineStatus.DancersInError.Add(true); + MachineStatus.BtsrsInError.Add(true); + } + else { + MachineStatus.WindersInError.Add(false); + MachineStatus.DancersInError.Add(false); + MachineStatus.BtsrsInError.Add(false); + } + } - EventsStates = MachineEventState.GetAllEventsStates(); + EventsStates = MachineEventState.GetAllEventsStates(); _valveStates = new List<ValveState>(); _blower_states = new List<SetBlowerStateRequest>(); diff --git a/Software/Visual_Studio/Tango.PMR/MachineStatus/MachineStatus.cs b/Software/Visual_Studio/Tango.PMR/MachineStatus/MachineStatus.cs index a50669c26..78301db82 100644 --- a/Software/Visual_Studio/Tango.PMR/MachineStatus/MachineStatus.cs +++ b/Software/Visual_Studio/Tango.PMR/MachineStatus/MachineStatus.cs @@ -24,17 +24,19 @@ namespace Tango.PMR.MachineStatus { string.Concat( "ChNNYWNoaW5lU3RhdHVzLnByb3RvEhdUYW5nby5QTVIuTWFjaGluZVN0YXR1", "cxoSTWFjaGluZVN0YXRlLnByb3RvGhJJRFNQYWNrTGV2ZWwucHJvdG8aEFNw", - "b29sU3RhdGUucHJvdG8i+AEKDU1hY2hpbmVTdGF0dXMSNAoFU3RhdGUYASAB", + "b29sU3RhdGUucHJvdG8ivgIKDU1hY2hpbmVTdGF0dXMSNAoFU3RhdGUYASAB", "KA4yJS5UYW5nby5QTVIuTWFjaGluZVN0YXR1cy5NYWNoaW5lU3RhdGUSPQoO", "SURTUGFja3NMZXZlbHMYAiADKAsyJS5UYW5nby5QTVIuTWFjaGluZVN0YXR1", "cy5JRFNQYWNrTGV2ZWwSGgoST3ZlcmFsbFRlbXBlcmF0dXJlGAMgASgBEjcK", "ClNwb29sU3RhdGUYBCABKA4yIy5UYW5nby5QTVIuTWFjaGluZVN0YXR1cy5T", - "cG9vbFN0YXRlEh0KFUF1dG9JbmtGaWxsaW5nRW5hYmxlZBgFIAEoCEIjCiFj", - "b20udHdpbmUudGFuZ28ucG1yLm1hY2hpbmVzdGF0dXNiBnByb3RvMw==")); + "cG9vbFN0YXRlEh0KFUF1dG9JbmtGaWxsaW5nRW5hYmxlZBgFIAEoCBIUCgxC", + "dHNyc0luRXJyb3IYCiADKAgSFgoORGFuY2Vyc0luRXJyb3IYCyADKAgSFgoO", + "V2luZGVyc0luRXJyb3IYDCADKAhCIwohY29tLnR3aW5lLnRhbmdvLnBtci5t", + "YWNoaW5lc3RhdHVzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Tango.PMR.MachineStatus.MachineStateReflection.Descriptor, global::Tango.PMR.MachineStatus.IDSPackLevelReflection.Descriptor, global::Tango.PMR.MachineStatus.SpoolStateReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.MachineStatus.MachineStatus), global::Tango.PMR.MachineStatus.MachineStatus.Parser, new[]{ "State", "IDSPacksLevels", "OverallTemperature", "SpoolState", "AutoInkFillingEnabled" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.MachineStatus.MachineStatus), global::Tango.PMR.MachineStatus.MachineStatus.Parser, new[]{ "State", "IDSPacksLevels", "OverallTemperature", "SpoolState", "AutoInkFillingEnabled", "BtsrsInError", "DancersInError", "WindersInError" }, null, null, null) })); } #endregion @@ -70,6 +72,9 @@ namespace Tango.PMR.MachineStatus { overallTemperature_ = other.overallTemperature_; spoolState_ = other.spoolState_; autoInkFillingEnabled_ = other.autoInkFillingEnabled_; + btsrsInError_ = other.btsrsInError_.Clone(); + dancersInError_ = other.dancersInError_.Clone(); + windersInError_ = other.windersInError_.Clone(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -131,6 +136,36 @@ namespace Tango.PMR.MachineStatus { } } + /// <summary>Field number for the "BtsrsInError" field.</summary> + public const int BtsrsInErrorFieldNumber = 10; + private static readonly pb::FieldCodec<bool> _repeated_btsrsInError_codec + = pb::FieldCodec.ForBool(82); + private readonly pbc::RepeatedField<bool> btsrsInError_ = new pbc::RepeatedField<bool>(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField<bool> BtsrsInError { + get { return btsrsInError_; } + } + + /// <summary>Field number for the "DancersInError" field.</summary> + public const int DancersInErrorFieldNumber = 11; + private static readonly pb::FieldCodec<bool> _repeated_dancersInError_codec + = pb::FieldCodec.ForBool(90); + private readonly pbc::RepeatedField<bool> dancersInError_ = new pbc::RepeatedField<bool>(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField<bool> DancersInError { + get { return dancersInError_; } + } + + /// <summary>Field number for the "WindersInError" field.</summary> + public const int WindersInErrorFieldNumber = 12; + private static readonly pb::FieldCodec<bool> _repeated_windersInError_codec + = pb::FieldCodec.ForBool(98); + private readonly pbc::RepeatedField<bool> windersInError_ = new pbc::RepeatedField<bool>(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField<bool> WindersInError { + get { return windersInError_; } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as MachineStatus); @@ -149,6 +184,9 @@ namespace Tango.PMR.MachineStatus { if (OverallTemperature != other.OverallTemperature) return false; if (SpoolState != other.SpoolState) return false; if (AutoInkFillingEnabled != other.AutoInkFillingEnabled) return false; + if(!btsrsInError_.Equals(other.btsrsInError_)) return false; + if(!dancersInError_.Equals(other.dancersInError_)) return false; + if(!windersInError_.Equals(other.windersInError_)) return false; return true; } @@ -160,6 +198,9 @@ namespace Tango.PMR.MachineStatus { if (OverallTemperature != 0D) hash ^= OverallTemperature.GetHashCode(); if (SpoolState != 0) hash ^= SpoolState.GetHashCode(); if (AutoInkFillingEnabled != false) hash ^= AutoInkFillingEnabled.GetHashCode(); + hash ^= btsrsInError_.GetHashCode(); + hash ^= dancersInError_.GetHashCode(); + hash ^= windersInError_.GetHashCode(); return hash; } @@ -187,6 +228,9 @@ namespace Tango.PMR.MachineStatus { output.WriteRawTag(40); output.WriteBool(AutoInkFillingEnabled); } + btsrsInError_.WriteTo(output, _repeated_btsrsInError_codec); + dancersInError_.WriteTo(output, _repeated_dancersInError_codec); + windersInError_.WriteTo(output, _repeated_windersInError_codec); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -205,6 +249,9 @@ namespace Tango.PMR.MachineStatus { if (AutoInkFillingEnabled != false) { size += 1 + 1; } + size += btsrsInError_.CalculateSize(_repeated_btsrsInError_codec); + size += dancersInError_.CalculateSize(_repeated_dancersInError_codec); + size += windersInError_.CalculateSize(_repeated_windersInError_codec); return size; } @@ -226,6 +273,9 @@ namespace Tango.PMR.MachineStatus { if (other.AutoInkFillingEnabled != false) { AutoInkFillingEnabled = other.AutoInkFillingEnabled; } + btsrsInError_.Add(other.btsrsInError_); + dancersInError_.Add(other.dancersInError_); + windersInError_.Add(other.windersInError_); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -256,6 +306,21 @@ namespace Tango.PMR.MachineStatus { AutoInkFillingEnabled = input.ReadBool(); break; } + case 82: + case 80: { + btsrsInError_.AddEntriesFrom(input, _repeated_btsrsInError_codec); + break; + } + case 90: + case 88: { + dancersInError_.AddEntriesFrom(input, _repeated_dancersInError_codec); + break; + } + case 98: + case 96: { + windersInError_.AddEntriesFrom(input, _repeated_windersInError_codec); + break; + } } } } |
