diff options
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobProgressViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobProgressViewVM.cs | 147 |
1 files changed, 145 insertions, 2 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobProgressViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobProgressViewVM.cs index 8756a6a57..b879831b9 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobProgressViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobProgressViewVM.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.Logging; @@ -37,7 +38,12 @@ namespace Tango.PPC.Jobs.ViewModels public Job Job { get { return _job; } - set { _job = value; RaisePropertyChangedAuto(); } + set { _job = value; + if(_job == null) + { + IsDyeingProcess = false; + } + RaisePropertyChangedAuto(); } } private RunningJobStatus _runningJobStatus; @@ -47,7 +53,14 @@ namespace Tango.PPC.Jobs.ViewModels public RunningJobStatus RunningJobStatus { get { return _runningJobStatus; } - set { _runningJobStatus = value; RaisePropertyChangedAuto(); } + set { + _runningJobStatus = value; + if(_runningJobStatus == null) + { + IsDyeingProcess = false; + } + RaisePropertyChangedAuto(); + } } private bool _isDisplayJobOutline; @@ -70,6 +83,73 @@ namespace Tango.PPC.Jobs.ViewModels set { _jobOutlineTicket = value; RaisePropertyChangedAuto(); } } + private bool _isDyeingProcess; + + public bool IsDyeingProcess + { + get { return _isDyeingProcess; } + set + { + if (_isDyeingProcess != value) + { + _isDyeingProcess = value; + RaisePropertyChangedAuto(); + } + } + } + + private BrushStop _currentBrushStop; + public BrushStop CurrentBrushStop + { + get { return _currentBrushStop; } + set + { + // if (_currentBrushStop != value) + { + _currentBrushStop = value; + OnUpdateCurrentBrush(); + RaisePropertyChangedAuto(); + } + } + } + + public JobBrushStop JobBrushStop { get; set; } + + 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); } + } + #endregion #region Commands @@ -123,6 +203,31 @@ namespace Tango.PPC.Jobs.ViewModels NavigationManager.ClearHistoryExcept<JobsView>(); } + protected void OnUpdateCurrentBrush() + { + RaisePropertyChanged(nameof(CyanOutput)); + RaisePropertyChanged(nameof(LightCyanOutput)); + RaisePropertyChanged(nameof(MagentaOutput)); + RaisePropertyChanged(nameof(LightMagentaOutput)); + RaisePropertyChanged(nameof(YellowOutput)); + RaisePropertyChanged(nameof(LightYellowOutput)); + RaisePropertyChanged(nameof(BlackOutput)); + } + + private double GetVolumeLiquidType(LiquidTypes liquidType) + { + if (JobBrushStop != null && JobBrushStop.Dispensers != null && JobBrushStop.Dispensers.Count > 0) + { + var lt = JobBrushStop.Dispensers.FirstOrDefault(x => x.DispenserLiquidType == (DispenserLiquidType)liquidType); + + if (lt != null) + { + return Math.Round(lt.Volume, 2); + } + } + return 0; + } + #endregion #region Override Methods @@ -160,6 +265,7 @@ namespace Tango.PPC.Jobs.ViewModels if (_handler != null) { _handler.Cancel(); + IsDyeingProcess = false; } } @@ -228,6 +334,7 @@ namespace Tango.PPC.Jobs.ViewModels _handler.SpoolChangeRequired -= JobHandler_SpoolChangeRequired; _handler.Stopped -= JobHandler_Stopped; _handler.CanCancelChanged -= JobHandler_CanCancelChanged; + IsDyeingProcess = false; } } @@ -241,6 +348,42 @@ namespace Tango.PPC.Jobs.ViewModels InvokeUI(() => { RunningJobStatus = e; + IsDyeingProcess = (RunningJobStatus != null && RunningJobStatus.CurrentSegment != null); + if (RunningJobStatus != null && RunningJobStatus.CurrentSegment != null) + { + if (_runningJobStatus.CurrentSegment.IsInterSegment) + { + CurrentBrushStop = _runningJobStatus.CurrentSegment.BrushStops.FirstOrDefault(); + JobBrushStop = null; + } + else + { + var realsegmIndex = 1; + if (Job.EnableInterSegment && Job.InterSegmentLength > 0) + { + int segmentIndex = _runningJobStatus.CurrentSegment.SegmentIndex - (Job.EffectiveSegments.Count * RunningJobStatus.CurrentUnit); + if (RunningJobStatus.CurrentUnit > 0) + { + segmentIndex -= RunningJobStatus.CurrentUnit;// inter segment between units + } + realsegmIndex = (int)(segmentIndex / 2) + 1; + } + else + { + realsegmIndex = Math.Max(_runningJobStatus.CurrentSegment.SegmentIndex - (Job.Segments.Count * RunningJobStatus.CurrentUnit), 0); + } + + var segment = Job.Segments.FirstOrDefault(x => x.SegmentIndex == realsegmIndex); + if (segment != null) + { + if (_handler.JobTicket.Segments.Count > 0) + { + JobBrushStop = _handler.JobTicket.Segments[Job.OrderedSegments.IndexOf(segment)].BrushStops.First(); + } + } + CurrentBrushStop = RunningJobStatus.CurrentSegment.FirstBrushStop; + } + } }); } |
