diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-05-11 20:23:33 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-05-11 20:23:33 +0300 |
| commit | b597a69f85fec4f5b5a1aca65228fc840911d314 (patch) | |
| tree | 0a4e622292c48e788ce9c008bccaa0834c898db4 /Software/Visual_Studio/PPC | |
| parent | 7f3f3d55b9b3dfc66d0bbb2f778298e1e9b224b4 (diff) | |
| download | Tango-b597a69f85fec4f5b5a1aca65228fc840911d314.tar.gz Tango-b597a69f85fec4f5b5a1aca65228fc840911d314.zip | |
IMplemented dynamic mid tank capacity on TwineX4 & FSE.
Diffstat (limited to 'Software/Visual_Studio/PPC')
5 files changed, 163 insertions, 37 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Models/MidTankLevelModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Models/MidTankLevelModel.cs index 93af310ba..c656db8c0 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Models/MidTankLevelModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Models/MidTankLevelModel.cs @@ -29,6 +29,42 @@ namespace Tango.PPC.Maintenance.Models { get { return Level <= MachineOperator.EMPTY_MIDTANK_LITERS; } } + + private bool _bJerricanPresent; + + public bool JerricanPresent + { + get { return _bJerricanPresent; } + set { + _bJerricanPresent = value; + RaisePropertyChangedAuto(); + } + } + + private bool _fillingTimeoutError; + + public bool FillingTimeoutError + { + get { return _fillingTimeoutError; } + set { _fillingTimeoutError = value; RaisePropertyChangedAuto(); } + } + + private bool _midTankEmpty; + + public bool MidTankEmpty + { + get { return _midTankEmpty; } + set { _midTankEmpty = value; RaisePropertyChangedAuto();} + } + + private bool _midTankRefillPumpActive; + + public bool MidTankRefillPumpActive + { + get { return _midTankRefillPumpActive; } + set { _midTankRefillPumpActive = value; RaisePropertyChangedAuto(); } + } + public IdsPack IDSPack { get; set; } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/MidTankLevelToElementRectConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/MidTankLevelToElementRectConverter.cs index b82ed2b52..2f0e73e2f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/MidTankLevelToElementRectConverter.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/MidTankLevelToElementRectConverter.cs @@ -17,9 +17,10 @@ namespace Tango.PPC.UI.Converters { double actualHeight = (double)values[0]; double actualWidth = (double)values[1]; - double midTankLevel = Math.Min((double)values[2], MachineOperator.MAX_MIDTANK_LITERS); + double maxLiters = (double)values[3]; + double midTankLevel = Math.Min((double)values[2], maxLiters); - var offset = (midTankLevel / MachineOperator.MAX_MIDTANK_LITERS) * actualHeight; + var offset = (midTankLevel / maxLiters) * actualHeight; return new System.Windows.Rect(1, offset, actualWidth, actualHeight); } catch 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 6d77ebcb9..1f4040460 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs @@ -9,6 +9,7 @@ using Tango.Core.Commands; using Tango.Core.DI; using Tango.Integration.Operation; using Tango.PMR.Diagnostics; +using Tango.PMR.MachineStatus; using Tango.PPC.Common; using Tango.PPC.Common.Diagnostics; using Tango.PPC.Jobs; @@ -16,6 +17,9 @@ using Tango.PPC.Jobs.NavigationObjects; using Tango.PPC.Jobs.Views; using Tango.PPC.Maintenance.Models; using Tango.PPC.UI.Models; +using System.Timers; +using System.Windows.Threading; +using System.Diagnostics; namespace Tango.PPC.UI.ViewModels { @@ -26,6 +30,9 @@ namespace Tango.PPC.UI.ViewModels [TangoInject] public IDiagnosticsFrameProvider DefaultDiagnosticsFrameProvider { get; set; } + private DispatcherTimer _ink_timer; + private Stopwatch _stopwatch; + private JobHandler _handler; @@ -190,6 +197,15 @@ namespace Tango.PPC.UI.ViewModels public MachineOverviewModel OverviewModel { get; set; } + private TimeSpan _timer; + + public TimeSpan FullInkTimer + { + get { return _timer; } + set { _timer = value; RaisePropertyChangedAuto();} + } + + #endregion #region Commands @@ -216,6 +232,10 @@ namespace Tango.PPC.UI.ViewModels public MachineStatusViewVM() { + _ink_timer = new DispatcherTimer(); + _ink_timer.Interval = TimeSpan.FromSeconds(1); + _ink_timer.Tick += _ink_timer_Tick; + StopCommand = new RelayCommand(StopJob, () => CanStopped()); AbortCommand = new RelayCommand(AbortJob, () => CanStopped()); GoToJobCommand = new RelayCommand(GoToJob); @@ -237,11 +257,76 @@ namespace Tango.PPC.UI.ViewModels MidTankLevels = MachineProvider.Machine.Configuration.NoneEmptyIdsPacks.Where(x => x.MidTankType.HasLevelMeasure).OrderBy(x => x.PackIndex).Select(x => new MidTankLevelModel() { - Max = MachineOperator.MAX_MIDTANK_LITERS, + Max = x.MidTankType.LiterCapacity, IDSPack = x, }).OrderBy(y => y.IDSPack.LiquidType.Code).ToList(); + // MachineProvider.MachineOperator.InkFillingStatusChanged += MachineOperator_InkFillingStatusChanged; + MachineProvider.MachineOperator.MachineStatusChanged += MachineOperator_MachineStatusChanged; } + #region Events + + private void MachineOperator_MachineStatusChanged(object sender, MachineStatus status) + { + UpdateMidTankLevels(status); + } + private void UpdateMidTankLevels(MachineStatus status) + { + if (!IsJobStatusViewEnable) + { + foreach (var item in status.IDSPacksLevels) + { + var model = MidTankLevels.SingleOrDefault(x => x.IDSPack.PackIndex == item.Index); + + if (model != null) + { + model.Level = item.MidTankLevel; + model.JerricanPresent = item.JerricanPresent; + model.FillingTimeoutError = item.FillingTimeoutError; + model.MidTankEmpty = item.MidTankEmpty; + model.MidTankRefillPumpActive = item.MidTankRefillPumpActive; + if (model.FillingTimeoutError) + { + //StartInkTimer() + } + } + } + } + } + private void StartInkTimer() + { + _stopwatch = Stopwatch.StartNew(); + _ink_timer.Start(); + } + + private void StopInkTimer() + { + if (_stopwatch.IsRunning) + { + _stopwatch.Stop(); + _ink_timer.Stop(); + } + } + + private void _ink_timer_Tick(object sender, EventArgs e) + { + FullInkTimer = _stopwatch.Elapsed; + } + private void MachineOperator_InkFillingStatusChanged(object sender, InkFillingStatusChangedEventArgs e) + { + //foreach (var cartridge in e.Status.CartridgesStatuses.Where(x => x.Cartridge.Slot != CartridgeSlot.Ink)) + //{ + // var wasteState = WasteStates.SingleOrDefault(x => x.Slot == cartridge.Cartridge.Slot); + + // if (wasteState != null) + // { + // wasteState.State = cartridge.State; + // } + //} + } + + #endregion + #region printing public override void OnApplicationStarted() 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 6edc90844..998ab7db4 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml @@ -120,48 +120,52 @@ </UniformGrid> </DataTemplate> - <PathGeometry x:Key="InkContainerPath" Figures="M16.000001,0.5 C24.560414,0.5 31.500001,6.9918714 31.500001,15 31.500001,15.500508 31.472893,15.995093 31.419976,16.48254 L31.417605,16.5 31.500001,16.5 31.500001,71 31.500001,71.5 31.486487,71.5 31.479832,71.74617 C31.064694,79.407524 24.292901,85.5 16.000001,85.5 7.7070995,85.5 0.9353075,79.407524 0.52016807,71.74617 L0.51351446,71.5 0.5,71.5 0.5,71 0.5,16.5 0.58239609,16.5 0.58002502,16.48254 C0.52710831,15.995093 0.50000054,15.500508 0.5,15 0.50000054,6.9918714 7.4395867,0.5 16.000001,0.5 z"/> + <PathGeometry x:Key="InkContainerPath" Figures="M16.000001,0.5 C24.560414,0.5 31.500001,6.9918714 31.500001,15 31.500001,15.500508 31.472893,15.995093 31.419976,16.48254 L31.417605,16.5 31.500001,16.5 31.500001,71 31.500001,71.5 31.486487,71.5 31.479832,71.74617 C31.064694,79.407524 24.292901,85.5 16.000001,85.5 7.7070995,85.5 0.9353075,79.407524 0.52016807,71.74617 L0.51351446,71.5 0.5,71.5 0.5,71 0.5,16.5 0.58239609,16.5 0.58002502,16.48254 C0.52710831,15.995093 0.50000054,15.500508 0.5,15 0.50000054,6.9918714 7.4395867,0.5 16.000001,0.5 z"/> <DataTemplate x:Key="LiquidBox"> <DockPanel> <TextBlock DockPanel.Dock="Bottom" Text="{Binding IDSPack.LiquidType.ShortName}" HorizontalAlignment="Center" Margin="0 8 0 0"></TextBlock> - <Grid> - <Grid ClipToBounds="True" HorizontalAlignment="Center"> - <Path Fill="{Binding Path=IDSPack.LiquidType, Converter={StaticResource LiquidTypeToBrushConverter}}"> + <Grid> + <Grid ClipToBounds="True" HorizontalAlignment="Center"> + <Path Fill="{Binding Path=IDSPack.LiquidType, Converter={StaticResource LiquidTypeToBrushConverter}}" StrokeThickness="1.5" > <Path.Resources> <sys:Double x:Key="RectWidth">30</sys:Double> <sys:Double x:Key="RectHeight">88</sys:Double> </Path.Resources> - <Path.Data> - <CombinedGeometry GeometryCombineMode="Intersect"> - <CombinedGeometry.Geometry1> - <StaticResource ResourceKey="InkContainerPath"/> - </CombinedGeometry.Geometry1> - <CombinedGeometry.Geometry2> - <!--Rect="1,30 30,88"--> - <RectangleGeometry > + <Path.Data> + <CombinedGeometry GeometryCombineMode="Intersect"> + <CombinedGeometry.Geometry1> + <StaticResource ResourceKey="InkContainerPath"/> + </CombinedGeometry.Geometry1> + <CombinedGeometry.Geometry2> + <!--Rect="1,30 30,88"--> + <RectangleGeometry > <RectangleGeometry.Rect> <MultiBinding Converter="{StaticResource MidTankLevelToElementRectConverter}"> <Binding Source="{StaticResource RectHeight}"/> <Binding Source="{StaticResource RectWidth}"/> <Binding Path="Level" /> + <Binding Path="IDSPack.MidTankType.LiterCapacity" /> </MultiBinding> </RectangleGeometry.Rect> </RectangleGeometry> </CombinedGeometry.Geometry2> - </CombinedGeometry> - </Path.Data> - + </CombinedGeometry> + </Path.Data> + </Path> - <Path Stroke="Black" Fill="Transparent" StrokeThickness="1" Data="{StaticResource InkContainerPath}"> - + <Path Stroke="{StaticResource TangoTextWatermarkBrush}" Fill="Transparent" StrokeThickness="1" Data="{StaticResource InkContainerPath}"> + </Path> - </Grid> + </Grid> <UniformGrid Rows="4" Columns="1" Margin="0 15 0 15" HorizontalAlignment="Center"> - <Rectangle Width="10" Height="2" Stroke="Black"></Rectangle> - <Rectangle Width="10" Height="2" Stroke="Black"></Rectangle> - <Rectangle Width="10" Height="2" Stroke="Black"></Rectangle> - <Rectangle Width="10" Height="2" Stroke="Black"></Rectangle> + <Rectangle Width="10" Height="2" Stroke="{StaticResource TangoTextWatermarkBrush}"></Rectangle> + <Rectangle Width="10" Height="2" Stroke="{StaticResource TangoTextWatermarkBrush}"></Rectangle> + <Rectangle Width="10" Height="2" Stroke="{StaticResource TangoTextWatermarkBrush}"></Rectangle> + <Rectangle Width="10" Height="2" Stroke="{StaticResource TangoTextWatermarkBrush}"></Rectangle> </UniformGrid> + <Image Source="../Images/Overview Icons/error.png" Stretch="Fill" VerticalAlignment="Top" Width="24" Height="24" Margin="0 4 0 0" Visibility="Visible"/> + <Image Source="../Images/Overview Icons/Warning.png" Stretch="Fill" VerticalAlignment="Top" Width="24" Height="24" Visibility="Collapsed"/> + <Image Source="../Images/Overview Icons/UpdateInk.png" Stretch="Fill" VerticalAlignment="Top" Width="24" Height="24" Visibility="Collapsed"/> </Grid> </DockPanel> </DataTemplate> @@ -196,13 +200,13 @@ </CombinedGeometry> </Path.Data> </Path> - <Path Stroke="Black" Fill="Transparent" StrokeThickness="1" Data="{StaticResource InkContainerPath}"/> + <Path Stroke="{StaticResource TangoTextWatermarkBrush}" Fill="Transparent" StrokeThickness="1" Data="{StaticResource InkContainerPath}"/> </Grid> <UniformGrid Rows="4" Columns="1" Margin="0 15 0 15" HorizontalAlignment="Center"> - <Rectangle Stroke="Black" Width="10" Height="2" ></Rectangle> - <Rectangle Width="10" Height="2" Stroke="Black"></Rectangle> - <Rectangle Width="10" Height="2" Stroke="Black"></Rectangle> - <Rectangle Width="10" Height="2" Stroke="Black"></Rectangle> + <Rectangle Stroke="{StaticResource TangoTextWatermarkBrush}" Width="10" Height="2" ></Rectangle> + <Rectangle Width="10" Height="2" Stroke="{StaticResource TangoTextWatermarkBrush}"></Rectangle> + <Rectangle Width="10" Height="2" Stroke="{StaticResource TangoTextWatermarkBrush}"></Rectangle> + <Rectangle Width="10" Height="2" Stroke="{StaticResource TangoTextWatermarkBrush}"></Rectangle> </UniformGrid> </Grid> </DockPanel> @@ -238,13 +242,13 @@ </CombinedGeometry> </Path.Data> </Path> - <Path Stroke="Black" Fill="Transparent" StrokeThickness="1" Data="{StaticResource InkContainerPath}"/> + <Path Stroke="{StaticResource TangoTextWatermarkBrush}" Fill="Transparent" StrokeThickness="1" Data="{StaticResource InkContainerPath}"/> </Grid> <UniformGrid Rows="4" Columns="1" Margin="0 15 0 15" HorizontalAlignment="Center"> - <Rectangle Stroke="Black" Width="10" Height="2" ></Rectangle> - <Rectangle Width="10" Height="2" Stroke="Black"></Rectangle> - <Rectangle Width="10" Height="2" Stroke="Black"></Rectangle> - <Rectangle Width="10" Height="2" Stroke="Black"></Rectangle> + <Rectangle Stroke="{StaticResource TangoTextWatermarkBrush}" Width="10" Height="2" ></Rectangle> + <Rectangle Width="10" Height="2" Stroke="{StaticResource TangoTextWatermarkBrush}"></Rectangle> + <Rectangle Width="10" Height="2" Stroke="{StaticResource TangoTextWatermarkBrush}"></Rectangle> + <Rectangle Width="10" Height="2" Stroke="{StaticResource TangoTextWatermarkBrush}"></Rectangle> </UniformGrid> </Grid> </DockPanel> @@ -880,7 +884,7 @@ <SolidColorBrush Color="{Binding DryerZone3.Color}"/> </TextBlock.Foreground> </TextBlock> - <TextBlock VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0 0 0 10" FontSize="{StaticResource TangoComboBoxItemFontSize}" >ºC</TextBlock> + <TextBlock VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0 0 0 20" FontSize="{StaticResource TangoComboBoxItemFontSize}" >ºC</TextBlock> </Grid> <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center">Dryer Zone 3</TextBlock> 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> |
