aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-12-01 02:36:51 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-12-01 02:36:51 +0200
commit4225ba2cde1b0cfdb57196cb832dbec2dfca5707 (patch)
tree61c6f053c1a9bf008f9dbca04eaaac272c95d256 /Software/Visual_Studio/PPC/Modules
parent3877280203ea1898b9d9b71306dc9d30f9bc29e4 (diff)
downloadTango-4225ba2cde1b0cfdb57196cb832dbec2dfca5707.tar.gz
Tango-4225ba2cde1b0cfdb57196cb832dbec2dfca5707.zip
Cleaner dispensing dialog.
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Converters/MachineEventToViewConverter.cs6
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingView.xaml49
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingView.xaml.cs28
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingViewVM.cs128
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj10
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs26
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml2
7 files changed, 248 insertions, 1 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Converters/MachineEventToViewConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Converters/MachineEventToViewConverter.cs
index 6981bd5d6..56d7149d3 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Converters/MachineEventToViewConverter.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Converters/MachineEventToViewConverter.cs
@@ -18,11 +18,17 @@ namespace Tango.PPC.Events.Converters
static MachineEventToViewConverter()
{
+ //Jobs
_eventViews.Add(EventTypes.JOB_STARTED, typeof(JobEventView));
_eventViews.Add(EventTypes.JOB_ABORTED, typeof(JobEventView));
_eventViews.Add(EventTypes.JOB_COMPLETED, typeof(JobEventView));
_eventViews.Add(EventTypes.JOB_FAILED, typeof(JobEventView));
+
+ //Thread Break
_eventViews.Add(EventTypes.THREAD_BREAK, typeof(ThreadBreakView));
+ _eventViews.Add(EventTypes.THREAD_TENSION_CONTROL_FAILURE_FEEDER_DANCER, typeof(ThreadBreakView));
+ _eventViews.Add(EventTypes.THREAD_TENSION_CONTROL_FAILURE_PULLER_DANCER, typeof(ThreadBreakView));
+ _eventViews.Add(EventTypes.THREAD_TENSION_CONTROL_FAILURE_WINDER_DANCER, typeof(ThreadBreakView));
}
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingView.xaml
new file mode 100644
index 000000000..5fa737221
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingView.xaml
@@ -0,0 +1,49 @@
+<UserControl x:Class="Tango.PPC.Maintenance.Dialogs.CleanerDispensingView"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ 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:local="clr-namespace:Tango.PPC.Maintenance.Dialogs"
+ mc:Ignorable="d"
+ Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="560" Width="600" Height="800" d:DataContext="{d:DesignInstance Type=local:CleanerDispensingViewVM, IsDesignTimeCreatable=False}">
+ <Grid>
+ <StackPanel Margin="0 50 0 0" HorizontalAlignment="Center">
+ <Image Source="../Images/head_cleaning.png" RenderOptions.BitmapScalingMode="Fant" Stretch="Uniform" Height="120"></Image>
+ <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}" Margin="0 30 0 0">Dispense Cleaning Liquid</TextBlock>
+
+ <Label Margin="20 10" HorizontalAlignment="Center">
+ <Label.Style>
+ <Style TargetType="Label">
+ <Setter Property="Content">
+ <Setter.Value>
+ <TextBlock>
+ <Run>Press 'start' to initiate the cleaner liquid dispensing</Run>
+ </TextBlock>
+ </Setter.Value>
+ </Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding IsStarted}" Value="True">
+ <Setter Property="Content" Value="Cleaner dispensing in progress"></Setter>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding IsCompleted}" Value="True">
+ <Setter Property="Content" Value="Cleaner dispensing completed"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Label.Style>
+ </Label>
+
+ <Grid>
+ <touch:TouchButton Command="{Binding StartCommand}" Margin="0 100 0 0" Style="{StaticResource TangoHollowButton}" HorizontalAlignment="Center" Padding="80 15" CornerRadius="25">START</touch:TouchButton>
+ </Grid>
+
+ <StackPanel Margin="40 150 40 40">
+ <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding Status}"></TextBlock>
+ <touch:TouchProgressBar Margin="0 5 0 0" VerticalAlignment="Bottom" Width="500" Height="10" Minimum="0" Maximum="100" Value="0" IsIndeterminate="{Binding IsStarted}">
+
+ </touch:TouchProgressBar>
+ </StackPanel>
+ </StackPanel>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingView.xaml.cs
new file mode 100644
index 000000000..6f1ebb4ed
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingView.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Tango.PPC.Maintenance.Dialogs
+{
+ /// <summary>
+ /// Interaction logic for PowerUpView.xaml
+ /// </summary>
+ public partial class CleanerDispensingView : UserControl
+ {
+ public CleanerDispensingView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingViewVM.cs
new file mode 100644
index 000000000..b84cd83de
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingViewVM.cs
@@ -0,0 +1,128 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Timers;
+using Tango.BL.Entities;
+using Tango.Core.Commands;
+using Tango.Core.DI;
+using Tango.Integration.Operation;
+using Tango.PMR.Printing;
+using Tango.PPC.Common;
+using Tango.PPC.Common.Connection;
+using Tango.PPC.Common.Notifications;
+using Tango.Settings;
+using Tango.SharedUI;
+
+namespace Tango.PPC.Maintenance.Dialogs
+{
+ public class CleanerDispensingViewVM : DialogViewVM
+ {
+ private const int JOGGING_TIME_SEC = 10;
+ private const int JOGGING_SPEED = 400;
+
+ [TangoInject]
+ private IMachineProvider MachineProvider { get; set; }
+
+ [TangoInject]
+ private INotificationProvider NotificationProvider { get; set; }
+
+ private bool _isStarted;
+ public bool IsStarted
+ {
+ get { return _isStarted; }
+ set { _isStarted = value; RaisePropertyChangedAuto(); }
+ }
+
+ private bool _isCompleted;
+ public bool IsCompleted
+ {
+ get { return _isCompleted; }
+ set { _isCompleted = value; RaisePropertyChangedAuto(); }
+ }
+
+ private bool _isFailed;
+ public bool IsFailed
+ {
+ get { return _isFailed; }
+ set { _isFailed = value; RaisePropertyChangedAuto(); }
+ }
+
+ private String _status;
+ public String Status
+ {
+ get { return _status; }
+ set { _status = value; RaisePropertyChangedAuto(); }
+ }
+
+ public RelayCommand StartCommand { get; set; }
+
+ public CleanerDispensingViewVM()
+ {
+ Status = "Ready...";
+ CanClose = true;
+ TangoIOC.Default.Inject(this);
+ StartCommand = new RelayCommand(Start, () => !IsStarted);
+ }
+
+ private async void Start()
+ {
+ try
+ {
+ CanClose = false;
+ IsStarted = true;
+ IsCompleted = false;
+ IsFailed = false;
+ InvalidateRelayCommands();
+
+ Status = "Dispensing cleaner liquid...";
+
+ var cleanerPack = MachineProvider.Machine.Configuration.NoneEmptyIdsPacks.FirstOrDefault(x => x.LiquidType.Type == BL.Enumerations.LiquidTypes.Cleaner);
+
+ if (cleanerPack == null)
+ {
+ throw new InvalidOperationException("'Cleaner' liquid type was not found on the machine configuration.");
+ }
+
+ var cleanerIndex = cleanerPack.PackIndex;
+
+ await MachineProvider.MachineOperator.StartDispenserJogging(new PMR.Diagnostics.DispenserJoggingRequest()
+ {
+ Direction = PMR.Diagnostics.MotorDirection.Forward,
+ Speed = JOGGING_SPEED,
+ Index = cleanerIndex
+ });
+
+ await Task.Delay(TimeSpan.FromSeconds(JOGGING_TIME_SEC));
+
+ await MachineProvider.MachineOperator.StopDispenserJogging(new PMR.Diagnostics.DispenserAbortJoggingRequest()
+ {
+ Index = cleanerIndex
+ });
+
+ IsCompleted = true;
+ Status = "Cleaner liquid dispensing completed.";
+ }
+ catch (Exception ex)
+ {
+ Status = "Cleaner liquid dispensing failed.";
+ IsFailed = true;
+ await NotificationProvider.ShowError($"Error occurred while trying to perform the cleaner liquid dispensing.\n{ex.FlattenMessage()}");
+ }
+ finally
+ {
+ CanClose = true;
+ IsStarted = false;
+ }
+ }
+
+ protected override void Cancel()
+ {
+ if (CanClose)
+ {
+ base.Cancel();
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj
index f334dac5b..9dd45add4 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj
@@ -80,6 +80,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
+ <Page Include="Dialogs\CleanerDispensingView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="Dialogs\HeadCleaningView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -120,9 +124,13 @@
<Compile Include="Converters\LiquidTypeToShortNameConverter.cs" />
<Compile Include="Converters\MidTankLevelToElementHeightConverter.cs" />
<Compile Include="Converters\StringToFirstLetterConverter.cs" />
+ <Compile Include="Dialogs\CleanerDispensingView.xaml.cs">
+ <DependentUpon>CleanerDispensingView.xaml</DependentUpon>
+ </Compile>
<Compile Include="Dialogs\HeadCleaningView.xaml.cs">
<DependentUpon>HeadCleaningView.xaml</DependentUpon>
</Compile>
+ <Compile Include="Dialogs\CleanerDispensingViewVM.cs" />
<Compile Include="Dialogs\HeadCleaningViewVM.cs" />
<Compile Include="GuideBase.cs" />
<Compile Include="GuideStep.cs" />
@@ -306,7 +314,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
+ <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs
index c8cb4415d..f7269e0b1 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs
@@ -108,6 +108,8 @@ namespace Tango.PPC.Maintenance.ViewModels
public RelayCommand StartThreadBreakCommand { get; set; }
+ public RelayCommand DispenseCleanerLiquidCommand { get; set; }
+
public MaintenanceViewVM()
{
Guides = new ObservableCollection<GuideBase>(GuideHelper.CreateAllGuides());
@@ -136,6 +138,20 @@ namespace Tango.PPC.Maintenance.ViewModels
MachineProvider.MachineOperator.InkFillingStatusChanged += MachineOperator_InkFillingStatusChanged;
MachineProvider.MachineOperator.MachineStatusChanged += MachineOperator_MachineStatusChanged;
MachineProvider.MachineOperator.MachineEventsStateProvider.EventsChanged += MachineEventsStateProvider_EventsChanged;
+
+ DispenseCleanerLiquidCommand = new RelayCommand(DispenseCleanerLiquid, () =>
+ {
+ if (MachineProvider.Machine.MachineHeadType == BL.Enumerations.HeadTypes.Arc)
+ {
+ return MachineProvider.MachineOperator.MachineEventsStateProvider.Events.Any(x => x.Type == BL.Enumerations.EventTypes.DYEING_HEAD_ARC_LID_IS_OPEN);
+ }
+ else
+ {
+ return true;
+ }
+ });
+
+ RaisePropertyChanged(nameof(DispenseCleanerLiquidCommand));
}
public override void OnApplicationReady()
@@ -152,6 +168,11 @@ namespace Tango.PPC.Maintenance.ViewModels
private void MachineEventsStateProvider_EventsChanged(object sender, IEnumerable<BL.Entities.MachinesEvent> e)
{
OpenCloseDyeingHeadCommand.IsEnabled = !e.Any(x => x.Type == BL.Enumerations.EventTypes.DRYER_DOOR_OPEN);
+
+ InvokeUI(() =>
+ {
+ DispenseCleanerLiquidCommand.RaiseCanExecuteChanged();
+ });
}
private void MachineOperator_MachineStatusChanged(object sender, MachineStatus status)
@@ -294,5 +315,10 @@ namespace Tango.PPC.Maintenance.ViewModels
{
ThreadLoadingService.StartThreadBreakWizard();
}
+
+ private async void DispenseCleanerLiquid()
+ {
+ await NotificationProvider.ShowDialog<CleanerDispensingViewVM>();
+ }
}
}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml
index a24d336ee..286485d47 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml
@@ -254,6 +254,8 @@
<touch:TouchButton Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Command="{Binding HeadCleaningCommand}">RUN HEAD CLEANING</touch:TouchButton>
+ <touch:TouchButton Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Command="{Binding DispenseCleanerLiquidCommand}">DISPENSE CLEANING LIQUID</touch:TouchButton>
+
<touch:TouchButton Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Command="{Binding ExportLogsCommand}" Visibility="{Binding ApplicationManager.IsInTechnicianMode,Converter={StaticResource BooleanToVisibilityConverter}}">EXPORT SYSTEM LOGS</touch:TouchButton>
</UniformGrid>
</StackPanel>