aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC
diff options
context:
space:
mode:
authorRoy <Roy.mail.net@gmail.com>2022-12-26 21:33:29 +0200
committerRoy <Roy.mail.net@gmail.com>2022-12-26 21:33:29 +0200
commite89f04cbdda4e34baef11d43c9f812773911a33c (patch)
treebc7d1a8684d7e7487b80c9ab3801b3bc988cbb65 /Software/Visual_Studio/PPC
parent2bb75ed18045f59ae694adf04439e0297f77a89f (diff)
downloadTango-e89f04cbdda4e34baef11d43c9f812773911a33c.tar.gz
Tango-e89f04cbdda4e34baef11d43c9f812773911a33c.zip
Implemented Waste Replace Handling.
Implemented Job Stop on Out Of Range on MachineOperator. Implemented job upload error on Volumes out of range.
Diffstat (limited to 'Software/Visual_Studio/PPC')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs14
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/WasteReplacementView.xaml37
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/WasteReplacementView.xaml.cs28
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/WasteReplacementViewVM.cs69
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Images/waste_replace.pngbin0 -> 6701 bytes
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs2
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj11
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs19
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest2
9 files changed, 178 insertions, 4 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs
index 38413b24c..6a1c830b5 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs
@@ -928,6 +928,8 @@ namespace Tango.PPC.Jobs.ViewModels
rmlGuid = Settings.DefaultRmlGuid;
}
+ var machine = await new MachineBuilder(db).SetFirst().WithConfiguration().BuildAsync();
+
Job job = new Job();
job.LastUpdated = DateTime.UtcNow;
job.JobSource = JobSource.Local;
@@ -954,8 +956,11 @@ namespace Tango.PPC.Jobs.ViewModels
IColorConverter converter = new DefaultColorConverter();
+ int segmentIndex = 0;
+
foreach (var stop in segments.SelectMany(x => x.BrushStops).Where(x => x.BrushColorSpace != ColorSpaces.RGB))
{
+ segmentIndex++;
var output = converter.Convert(stop, false);
var suggestion = output.CreateSingleSuggestion();
stop.Red = suggestion.Color.R;
@@ -964,13 +969,20 @@ namespace Tango.PPC.Jobs.ViewModels
stop.BestMatchR = suggestion.Color.R;
stop.BestMatchG = suggestion.Color.G;
stop.BestMatchB = suggestion.Color.B;
+
+ stop.SetLiquidVolumes(machine.Configuration, job.Rml, job.Rml.GetActiveProcessGroup().ProcessParametersTables[suggestion.ProcessParametersTableIndex]);
+
+ if (stop.IsLiquidVolumesOutOfRange)
+ {
+ throw new InvalidOperationException($"Volumes out of range for thread '{job.Rml.FinalName}' at segment {segmentIndex}.");
+ }
}
db.Jobs.Add(job);
await db.SaveChangesAsync();
}
- LoadJobs(() =>
+ LoadJobs(() =>
{
NotificationProvider.PushNotification(new MessageNotificationItem($"Csv job '{e.Name}' received successfully.", "", MessageNotificationItem.MessageNotificationItemTypes.Success, () => { }, NotificationItem.NotificationPriority.Low));
e.Confirm();
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/WasteReplacementView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/WasteReplacementView.xaml
new file mode 100644
index 000000000..6279ce81c
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/WasteReplacementView.xaml
@@ -0,0 +1,37 @@
+<UserControl x:Class="Tango.PPC.UI.Dialogs.WasteReplacementView"
+ 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.UI.Dialogs"
+ mc:Ignorable="d"
+ Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="560" Width="570" Height="700" d:DataContext="{d:DesignInstance Type=local:WasteReplacementViewVM, IsDesignTimeCreatable=False}">
+ <Grid Margin="20">
+ <DockPanel>
+ <Grid DockPanel.Dock="Bottom">
+ <touch:TouchButton HorizontalAlignment="Left" CornerRadius="25" Command="{Binding CloseCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">LATER</touch:TouchButton>
+ <touch:TouchButton HorizontalAlignment="Right" CornerRadius="25" Command="{Binding OKCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">DONE</touch:TouchButton>
+ </Grid>
+ <StackPanel DockPanel.Dock="Top">
+ <Image Source="/Images/waste_replace.png" RenderOptions.BitmapScalingMode="Fant" Stretch="Uniform" Height="120"></Image>
+ <TextBlock HorizontalAlignment="Center" Margin="0 20 0 0" FontSize="{StaticResource TangoHeaderFontSize}">Replace Waste Cartridge</TextBlock>
+ <TextBlock Margin="20 10" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center">
+ <Run>The waste cartridge is close to full and needs to be replaced.</Run>
+ <LineBreak/>
+ <Run>Please open the cartridge door, insert two empty cartridges then close the door.</Run>
+ <LineBreak/>
+ <LineBreak/>
+ <Run>When finish press "DONE".</Run>
+ </TextBlock>
+ </StackPanel>
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="219*"/>
+ <ColumnDefinition Width="311*"/>
+ </Grid.ColumnDefinitions>
+
+ </Grid>
+ </DockPanel>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/WasteReplacementView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/WasteReplacementView.xaml.cs
new file mode 100644
index 000000000..5bddf160b
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/WasteReplacementView.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.UI.Dialogs
+{
+ /// <summary>
+ /// Interaction logic for SpoolReplaceView.xaml
+ /// </summary>
+ public partial class WasteReplacementView : UserControl
+ {
+ public WasteReplacementView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/WasteReplacementViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/WasteReplacementViewVM.cs
new file mode 100644
index 000000000..0e2f4bb56
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/WasteReplacementViewVM.cs
@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL.Entities;
+using Tango.Core.DI;
+using Tango.PMR.Diagnostics;
+using Tango.PPC.Common.Connection;
+using Tango.SharedUI;
+
+namespace Tango.PPC.UI.Dialogs
+{
+ public class WasteReplacementViewVM : DialogViewVM
+ {
+ private bool _doorClosed;
+ private bool _doorOpened;
+
+ [TangoInject]
+ private IMachineProvider MachineProvider { get; set; }
+
+ public WasteReplacementViewVM()
+ {
+ TangoIOC.Default.Inject(this);
+ MachineProvider.MachineOperator.EventsNotification += MachineOperator_EventsNotification;
+ }
+
+ private void MachineOperator_EventsNotification(object sender, StartEventsNotificationResponse e)
+ {
+ if (!_doorOpened)
+ {
+ if (e.Events.Select(x => x.Type).Contains(PMR.Diagnostics.EventType.CartridgesCoverOpen))
+ {
+ _doorOpened = true;
+ }
+ }
+ else
+ {
+ if (!e.Events.Select(x => x.Type).Contains(PMR.Diagnostics.EventType.CartridgesCoverOpen))
+ {
+ _doorClosed = true;
+ InvalidateRelayCommands();
+ }
+ }
+ }
+
+ protected override void Accept()
+ {
+ DisposeEvents();
+ base.Accept();
+ }
+
+ protected override void Cancel()
+ {
+ DisposeEvents();
+ base.Cancel();
+ }
+
+ protected override bool CanOK()
+ {
+ return base.CanOK() && _doorClosed && _doorOpened;
+ }
+
+ private void DisposeEvents()
+ {
+ MachineProvider.MachineOperator.EventsNotification -= MachineOperator_EventsNotification;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/waste_replace.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/waste_replace.png
new file mode 100644
index 000000000..f39a6f94d
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/waste_replace.png
Binary files differ
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
index 83f4d4f29..d920b32a4 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
@@ -340,7 +340,7 @@ namespace Tango.PPC.UI.Printing
}
if (job.Segments.SelectMany(x => x.BrushStops).Any(x => x.IsLiquidVolumesOutOfRange))
{
- throw new InvalidOperationException("Error starting job. Total ink volume is out of range.");
+ throw new InvalidOperationException($"The specified ink volumes at segment {job.Segments.SelectMany(x => x.BrushStops).First(x => x.IsLiquidVolumesOutOfRange).Segment.SegmentIndex} exceeds the maximum allowed total volume for the current thread.");
}
if (job.Segments.SelectMany(x => x.BrushStops).Any(x => x.BrushColorSpace == ColorSpaces.Catalog && x.ColorCatalogsItem == null && !x.IsTransparent && !x.IsWhite))
{
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 26ab3293a..464de7da9 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
@@ -152,6 +152,10 @@
<DependentUpon>SafetyLevelOperationsConfirmationView.xaml</DependentUpon>
</Compile>
<Compile Include="Dialogs\SafetyLevelOperationsConfirmationViewVM.cs" />
+ <Compile Include="Dialogs\WasteReplacementViewVM.cs" />
+ <Compile Include="Dialogs\WasteReplacementView.xaml.cs">
+ <DependentUpon>WasteReplacementView.xaml</DependentUpon>
+ </Compile>
<Compile Include="Dialogs\SpoolReplaceView.xaml.cs">
<DependentUpon>SpoolReplaceView.xaml</DependentUpon>
</Compile>
@@ -292,6 +296,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Dialogs\WasteReplacementView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="Dialogs\SpoolReplaceView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -499,6 +507,7 @@
<Link>rc.exe</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
+ <Resource Include="Images\waste_replace.png" />
<Content Include="Manifests\release.xml" />
<Content Include="Manifests\debug.xml" />
<None Include="firmware_package.tfp">
@@ -827,7 +836,7 @@ if $(ConfigurationName) == Debug "rc.exe" "$(TargetPath)" --set-version-string "
</PropertyGroup>
<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/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs
index e35ed3591..50f4ed054 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs
@@ -100,10 +100,29 @@ namespace Tango.PPC.UI.ViewModels
MachineProvider.MachineConnected += MachineProvider_MachineConnected;
+ MachineProvider.MachineOperator.WasteReplacementRequired += MachineOperator_WasteReplacementRequired;
+
_screenSaverTimer.Elapsed += _screenSaverTimer_Elapsed;
_screenSaverTimer.Start();
}
+ #region Waste Replacement
+
+ private void MachineOperator_WasteReplacementRequired(object sender, EventArgs e)
+ {
+ InvokeUI(async () =>
+ {
+ var vm = await NotificationProvider.ShowDialog<WasteReplacementViewVM>();
+
+ if (MachineProvider.IsConnected)
+ {
+ await MachineProvider.MachineOperator.CompleteWasteReplacement(vm.DialogResult);
+ }
+ });
+ }
+
+ #endregion
+
#region Power Up
private void MachineOperator_PowerUpEnded(object sender, EventArgs e)
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>