diff options
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs | 126 |
1 files changed, 104 insertions, 22 deletions
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 f9bc4cefb..8e5d3e0f9 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.BL.Entities; +using Tango.BL.Enumerations; using Tango.Core.Commands; using Tango.Integration.Operation; using Tango.PPC.Common; @@ -44,7 +45,9 @@ namespace Tango.PPC.UI.ViewModels IsDyeingProcess = (_runningJobStatus != null && _runningJobStatus.CurrentSegment != null); if(_runningJobStatus != null && _runningJobStatus.CurrentSegment != null) { - CurrentBrushStop = _runningJobStatus.CurrentSegment.FirstBrushStop; + var segment = Job.Segments.FirstOrDefault(x=>x.SegmentIndex == _runningJobStatus.CurrentSegment.SegmentIndex); + if(segment != null) + CurrentBrushStop = segment.FirstBrushStop; } RaisePropertyChangedAuto(); } @@ -101,11 +104,56 @@ namespace Tango.PPC.UI.ViewModels if(_currentBrushStop != value) { _currentBrushStop = value; + OnUpdateCurrentBrush(); RaisePropertyChangedAuto(); } } } + public double CyanOutput + { + get { return GetVolumeLiquidType(LiquidTypes.Cyan); } + } + + public double MagentaOutput + { + get { return GetVolumeLiquidType(LiquidTypes.Magenta); } + } + + public double YellowOutput + { + get { return GetVolumeLiquidType(LiquidTypes.Yellow); } + } + + public double BlackOutput + { + get { return GetVolumeLiquidType(LiquidTypes.Black); } + } + + public double LightCyanOutput + { + get { return GetVolumeLiquidType(LiquidTypes.LightCyan); } + } + + public double LightMagentaOutput + { + get { return GetVolumeLiquidType(LiquidTypes.LightMagenta); } + } + + public double LightYellowOutput + { + get { return GetVolumeLiquidType(LiquidTypes.LightYellow); } + } + + //public double TransparentInkOutput + //{ + // get { return GetVolumeLiquidType(LiquidTypes.TransparentInk); } + //} + + //public double LubricantOutput + //{ + // get { return GetVolumeLiquidType(LiquidTypes.Lubricant); } + //} #endregion @@ -127,6 +175,8 @@ namespace Tango.PPC.UI.ViewModels /// </summary> public RelayCommand OverviewViewCommand { get; set; } + public RelayCommand ClearAllNotificationsCommand { get; set; } + #endregion public MachineStatusViewVM() @@ -136,23 +186,21 @@ namespace Tango.PPC.UI.ViewModels GoToJobCommand = new RelayCommand(GoToJob, () => CanStopped()); JobStatusViewCommand = new RelayCommand(JobStatusView); OverviewViewCommand = new RelayCommand(OverviewView); + ClearAllNotificationsCommand = new RelayCommand(ClearAllNotifications); IsJobStatusViewEnable = true; IsEnabledStopButton = false; IsSpoolView = false; } - + + #region printing + public override void OnApplicationStarted() { MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted; MachineProvider.MachineOperator.PrintingEnded += MachineOperator_PrintingEnded; } - - private bool CanStopped() - { - return IsEnabledStopButton; - } - + private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e) { _handler = e.JobHandler; @@ -211,17 +259,10 @@ namespace Tango.PPC.UI.ViewModels AbortCommand.RaiseCanExecuteChanged(); }); } + + #endregion - private void StopJob() - { - _handler?.Cancel(); - } - - private void AbortJob() - { - _handler?.Cancel(); - Job = null; - } + #region Methods private void GoToJob() { @@ -230,8 +271,6 @@ namespace Tango.PPC.UI.ViewModels NavigationManager.ClearHistoryExcept<JobsView>(); } - #region Public Methods - /// <summary> /// Toggles the application technician mode. /// </summary> @@ -246,9 +285,7 @@ namespace Tango.PPC.UI.ViewModels ApplicationManager.ExitTechnicianMode(); } } - - protected void JobStatusView() { IsJobStatusViewEnable = true; @@ -259,6 +296,51 @@ namespace Tango.PPC.UI.ViewModels IsJobStatusViewEnable = false; } + private double GetVolumeLiquidType(LiquidTypes liquidType) + { + if(CurrentBrushStop != null && CurrentBrushStop.LiquidVolumes != null && CurrentBrushStop.LiquidVolumes.Count > 0) + { + var lt = CurrentBrushStop.LiquidVolumes.FirstOrDefault(x => x.LiquidType == liquidType); + + if (lt != null) + { + return Math.Round(lt.Volume, 2); + } + } + return 0; + } + + private bool CanStopped() + { + return IsEnabledStopButton; + } + + private void StopJob() + { + _handler?.Cancel(); + } + + private void AbortJob() + { + _handler?.Cancel(); + Job = null; + } + + protected void ClearAllNotifications() + { + NotificationProvider.NotificationItems.Where(x=>x.CanClose).ToList().ForEach(y=> NotificationProvider.PopNotification(y)); + } + + protected void OnUpdateCurrentBrush() + { + RaisePropertyChanged(nameof(CyanOutput)); + RaisePropertyChanged(nameof(LightCyanOutput)); + RaisePropertyChanged(nameof(MagentaOutput)); + RaisePropertyChanged(nameof(LightMagentaOutput)); + RaisePropertyChanged(nameof(YellowOutput)); + RaisePropertyChanged(nameof(LightYellowOutput)); + RaisePropertyChanged(nameof(BlackOutput)); + } #endregion } |
