diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-10-13 09:50:38 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-10-13 09:50:38 +0300 |
| commit | ba7f3bc94afb0495d8301f9676ac9269434a944e (patch) | |
| tree | 32a7ad453dddc61bea2f80ada7c79c0a084229ba /Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance | |
| parent | d7451646eacefc0a93ecbf742ab6d0b2f053ec96 (diff) | |
| download | Tango-ba7f3bc94afb0495d8301f9676ac9269434a944e.tar.gz Tango-ba7f3bc94afb0495d8301f9676ac9269434a944e.zip | |
Implemented PPC maintenance Waste status.
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance')
7 files changed, 111 insertions, 13 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/absent.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/absent.png Binary files differnew file mode 100644 index 000000000..8fc4e1b33 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/absent.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/present_empty_error.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/present_empty_error.png Binary files differnew file mode 100644 index 000000000..ff2411eb5 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/present_empty_error.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/present_empty_right.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/present_empty_right.png Binary files differnew file mode 100644 index 000000000..08b9a7076 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/present_empty_right.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/present_full_right.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/present_full_right.png Binary files differnew file mode 100644 index 000000000..a39b6f073 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/present_full_right.png 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 21b2eeb0a..94dc4e2cb 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 @@ -290,10 +290,20 @@ <Resource Include="Images\cone-empty.png" /> <Resource Include="Images\cone-full.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\Waste\present_empty_error.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Waste\absent.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Waste\present_empty_right.png" /> + <Resource Include="Images\Waste\present_full_right.png" /> + </ItemGroup> <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 f8535ad35..9de8313f8 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 @@ -7,10 +7,13 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.BL; +using Tango.Core; using Tango.Core.Commands; using Tango.Explorer; using Tango.Integration.Operation; using Tango.Logging; +using Tango.PMR.Diagnostics; +using Tango.PMR.IFS; using Tango.PMR.MachineStatus; using Tango.PPC.Common; using Tango.PPC.Maintenance.Commands; @@ -24,6 +27,18 @@ namespace Tango.PPC.Maintenance.ViewModels { public class MaintenanceViewVM : PPCViewModel { + public class WasteStateModel : ExtendedObject + { + private CartridgeState _state; + public CartridgeState State + { + get { return _state; } + set { _state = value; RaisePropertyChangedAuto(); } + } + + public CartridgeSlot Slot { get; set; } + } + public ObservableCollection<GuideBase> Guides { get; set; } public RelayCommand<GuideBase> OpenGuideCommand { get; set; } @@ -70,6 +85,12 @@ namespace Tango.PPC.Maintenance.ViewModels } } + private List<WasteStateModel> _wasteStates; + public List<WasteStateModel> WasteStates + { + get { return _wasteStates; } + set { _wasteStates = value; RaisePropertyChangedAuto(); } + } public RelayCommand ExportLogsCommand { get; set; } @@ -97,13 +118,21 @@ namespace Tango.PPC.Maintenance.ViewModels OpenCloseLeftLeadingWheelsCommand = new OpenCloseLeftLeadingWheelsCommand(); OpenCloseRightLeadingWheelsCommand = new OpenCloseRightLeadingWheelsCommand(); ResetThreadLoadingCommand = new ResetThreadLoadingCommand(); - HeadCleaningCommand = new RelayCommand(PerformHeadCleaning,() => MachineProvider.MachineOperator.CanPrint); + HeadCleaningCommand = new RelayCommand(PerformHeadCleaning, () => MachineProvider.MachineOperator.CanPrint); StartThreadLoadingCommand = new RelayCommand(StartThreadLoading, () => MachineProvider.MachineOperator.CanPrint); + + WasteStates = new List<WasteStateModel>() + { + new WasteStateModel() { Slot = CartridgeSlot.WasteMiddle, State = CartridgeState.Absent }, + new WasteStateModel() { Slot = CartridgeSlot.WasteLower, State = CartridgeState.Absent } + }; } public override void OnApplicationStarted() { - + MachineProvider.MachineOperator.InkFillingStatusChanged += MachineOperator_InkFillingStatusChanged; + MachineProvider.MachineOperator.MachineStatusChanged += MachineOperator_MachineStatusChanged; + MachineProvider.MachineOperator.MachineEventsStateProvider.EventsChanged += MachineEventsStateProvider_EventsChanged; } public override void OnApplicationReady() @@ -114,10 +143,7 @@ namespace Tango.PPC.Maintenance.ViewModels { Max = MachineOperator.MAX_MIDTANK_LITERS, IDSPack = x, - }).OrderBy(y=>y.IDSPack.LiquidType.Code).ToList(); - - MachineProvider.MachineOperator.MachineStatusChanged += MachineOperator_MachineStatusChanged; - MachineProvider.MachineOperator.MachineEventsStateProvider.EventsChanged += MachineEventsStateProvider_EventsChanged; + }).OrderBy(y => y.IDSPack.LiquidType.Code).ToList(); } private void MachineEventsStateProvider_EventsChanged(object sender, IEnumerable<BL.Entities.MachinesEvent> e) @@ -133,6 +159,19 @@ namespace Tango.PPC.Maintenance.ViewModels InvalidateRelayCommands(); } + 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; + } + } + } + public async void OpenGuide(GuideBase guide) { await NavigationManager.NavigateWithObject<MaintenanceModule, GeneralGuideView, GuideBase>(guide); @@ -180,7 +219,7 @@ namespace Tango.PPC.Maintenance.ViewModels var appFileLogger = LogManager.RegisteredLoggers.FirstOrDefault(x => x is FileLogger) as FileLogger; - await Task.Factory.StartNew(() => + await Task.Factory.StartNew(() => { using (ZipFile zip = new ZipFile(file)) { 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 6c48888af..188983b3f 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 @@ -5,6 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:vm="clr-namespace:Tango.PPC.Maintenance.ViewModels" xmlns:global="clr-namespace:Tango.PPC.Maintenance" + xmlns:ifs="clr-namespace:Tango.PMR.IFS;assembly=Tango.PMR" xmlns:arr="clr-namespace:System.Collections;assembly=mscorlib" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:localConverters="clr-namespace:Tango.PPC.Maintenance.Converters" @@ -111,13 +112,13 @@ <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Current Status</TextBlock> </StackPanel> - <StackPanel Style="{StaticResource Level2ContainerExtraMargin}"> + <StackPanel Margin="20 40 40 0"> <Grid> <Grid.ColumnDefinitions> - <ColumnDefinition Width="150*" /> - <ColumnDefinition Width="200*" /> - <ColumnDefinition Width="150*" /> - <ColumnDefinition Width="100*" /> + <ColumnDefinition Width="180" /> + <ColumnDefinition Width="1*" /> + <ColumnDefinition Width="180" /> + <ColumnDefinition Width="100" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="100" /> @@ -169,9 +170,57 @@ </Image.Style> </Image> + <Grid Grid.Column="3"> + <ItemsControl ItemsSource="{Binding WasteStates}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Columns="2" /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Image Stretch="None" HorizontalAlignment="Right"> + <Image.Style> + <Style TargetType="Image"> + <Setter Property="Source" Value="../Images/Waste/absent.png"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding State}" Value="{x:Static ifs:CartridgeState.Absent}"> + <Setter Property="Source" Value="../Images/Waste/absent.png"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding State}" Value="{x:Static ifs:CartridgeState.Present}"> + <Setter Property="Source" Value="../Images/Waste/present_empty_right.png"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding State}" Value="{x:Static ifs:CartridgeState.Empty}"> + <Setter Property="Source" Value="../Images/Waste/present_empty_right.png"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding State}" Value="{x:Static ifs:CartridgeState.Full}"> + <Setter Property="Source" Value="../Images/Waste/present_full_right.png"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding State}" Value="{x:Static ifs:CartridgeState.Emptying}"> + <Setter Property="Source" Value="../Images/Waste/present_full_right.png"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding State}" Value="{x:Static ifs:CartridgeState.Inserted}"> + <Setter Property="Source" Value="../Images/Waste/present_empty_right.png"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding State}" Value="{x:Static ifs:CartridgeState.EmptyingCompleted}"> + <Setter Property="Source" Value="../Images/Waste/present_empty_right.png"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding State}" Value="{x:Static ifs:CartridgeState.Error}"> + <Setter Property="Source" Value="../Images/Waste/present_empty_error.png"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Image.Style> + </Image> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </Grid> + <TextBlock Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Temperature</TextBlock> <TextBlock Grid.Column="1" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Inks</TextBlock> <TextBlock Grid.Column="2" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Collecting Cone</TextBlock> + <TextBlock Margin="20 0 0 0" Grid.Column="3" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Waste</TextBlock> </Grid> </StackPanel> </StackPanel> |
