From da1c997c138633c46daa8dc3c099b7164a536eb9 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Wed, 2 Aug 2023 15:44:56 +0300 Subject: Job Running Progress - added inter segments to logic. --- .../Controls/RunningJobViewerEureka.xaml | 72 ++++++++++++++++------ .../Controls/RunningJobViewerEureka.xaml.cs | 54 ++++++++++++---- 2 files changed, 94 insertions(+), 32 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Controls') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml index 4c39bded0..dfbd47514 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml @@ -12,6 +12,7 @@ d:DesignHeight="60" d:DesignWidth="500" Height="38" d:DataContext="{d:DesignInstance Type=local:RunningJobViewerEureka, IsDesignTimeCreatable=False}"> + - - - - - - - - - + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs index 95fe5cd10..c87c50db2 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs @@ -17,6 +17,7 @@ using System.Windows.Navigation; using System.Windows.Shapes; using Tango.BL.Entities; using Tango.Integration.Operation; +using Tango.Logging; namespace Tango.PPC.UI.Controls { @@ -26,9 +27,9 @@ namespace Tango.PPC.UI.Controls public partial class RunningJobViewerEureka : UserControl { List _segments; + List _lastsegments; + - - private double _prevOffset; private double _addOffset; private int _prevUnit; @@ -80,27 +81,36 @@ namespace Tango.PPC.UI.Controls { if(Job != null) { + JobUnitLength = Job.Length; _segments = Job.EffectiveSegments.ToList(); if (Job.NumberOfUnits > 1 && _segments.Count > 0 && (_segments.Count > 1 || _segments[0].BrushStops.Count > 1)) { - //if (Job.EnableInterSegment && Job.InterSegmentLength > 0) - //{ - // _segments.Add(Job.CreateInterSegment(Job.InterSegmentLength)); - //} + if (Job.EnableInterSegment && Job.InterSegmentLength > 0) + { + _segments.Add(Job.CreateInterSegment(Job.InterSegmentLength)); + } _segments.AddRange(Job.EffectiveSegments.ToList()); - //if (Job.EnableInterSegment && Job.InterSegmentLength > 0) - //{ - // _segments.Add(Job.CreateInterSegment(Job.InterSegmentLength)); - //}//without check if last segment and last unit + if(Job.NumberOfUnits > 2 && Job.EnableInterSegment && Job.InterSegmentLength > 0) + { + _segments.Add(Job.CreateInterSegment(Job.InterSegmentLength)); + JobUnitLength += Job.InterSegmentLength; + //_segments.AddRange(Job.EffectiveSegments.ToList());//third set to use in end printing without intersegment + } + _lastsegments = Job.EffectiveSegments.ToList();; + IsHasMultipleColorsSegments = true; } else + { IsHasMultipleColorsSegments = false; + } SegmentsItemsControl.ItemsSource = _segments; SegmentsItemsControl.InvalidateVisual(); + LastSegmentsItemsControl.ItemsSource = _lastsegments; + LastSegmentsItemsControl.InvalidateVisual(); _prevOffset = _addOffset = 0.0; _prevUnit = 0; @@ -188,6 +198,20 @@ namespace Tango.PPC.UI.Controls DependencyProperty.Register("IsHasMultipleColorsSegments", typeof(bool), typeof(RunningJobViewerEureka), new PropertyMetadata(false)); + + public double JobUnitLength + { + get { return (double)GetValue(JobUnitLengthProperty); } + set { SetValue(JobUnitLengthProperty, value); } + } + + // Using a DependencyProperty as the backing store for JobUnitLength. This enables animation, styling, binding, etc... + public static readonly DependencyProperty JobUnitLengthProperty = + DependencyProperty.Register("JobUnitLength", typeof(double), typeof(RunningJobViewerEureka), new FrameworkPropertyMetadata(0.0)); + + + + /// /// Initializes a new instance of the class. /// @@ -228,14 +252,20 @@ namespace Tango.PPC.UI.Controls if(_prevUnit < currentUnit) { _addOffset = _prevOffset; + //Debug.WriteLine($"OnSliderValueChanged prevOffset: '{_prevOffset}' currentUnit = {currentUnit}, total:{total}"); } offset += _addOffset; - if (offset >= ControlWidth) + if (offset >= ControlWidth && currentUnit < (Job.NumberOfUnits - 2)) { - offset -= ControlWidth;//round + offset -= ControlWidth;//round + //Debug.WriteLine($"OnSliderValueChanged round!!! offset: '{offset}' currentUnit = {currentUnit}, total:{total}"); } + //if(currentUnit == (Job.NumberOfUnits - 1)) + //{ + // Debug.WriteLine($"OnSliderValueChanged offset: '{offset}' currentUnit = {currentUnit}. ControlWidth = {ControlWidth} total:{total}"); + //} _prevOffset = offset; _prevUnit = currentUnit; -- cgit v1.3.1 From ba0fa1fa68767b7264803019ade99f5e123a5d1a Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Thu, 10 Aug 2023 12:21:34 +0300 Subject: ResumeJob. Bug in Emulator, - the job does not complete properly. --- .../PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs | 2 +- .../PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs | 4 ++++ Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs | 3 ++- Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Controls') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs index 5738fe8a0..c874e5fc2 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs @@ -1805,7 +1805,7 @@ namespace Tango.PPC.Jobs.ViewModels { if (!e.JobHandler.Status.IsCompleted) { - if (e.JobHandler.JobStatus.Progress <= 0) return; + if (e.JobHandler.JobStatus.Progress <= e.JobHandler.ProcessParameters.DryerBufferLengthMeters) return; var model = JobResumeDB.Default.Get(e.Job.Guid); bool insert = false; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs index c87c50db2..11823f797 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs @@ -251,6 +251,10 @@ namespace Tango.PPC.UI.Controls if(_prevUnit < currentUnit) { + if(_prevOffset == 0)//resume + { + _prevOffset = ControlWidth * (1-multiplier) * currentUnit; + } _addOffset = _prevOffset; //Debug.WriteLine($"OnSliderValueChanged prevOffset: '{_prevOffset}' currentUnit = {currentUnit}, total:{total}"); } diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index 9464b37ec..7074582d0 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -847,10 +847,11 @@ namespace Tango.Emulations.Emulators double firstUnitStartPosition = request.Message.FirstUnitStartPosition; bool addedResume = firstUnitStartPosition <= 0; + bool bIsResumeProcess = firstUnitStartPosition > 0; for (int i = 0; i < units; i++) { - while (progress < unit_length + (i == units - 1 ? dryerLength : 0) && !_cancelJob) + while (progress < unit_length + (!bIsResumeProcess && i == units - 1 ? dryerLength : 0) && !_cancelJob) { var status = new PMR.Printing.JobStatus(); status.Progress = progress; diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index d159b20bc..11634109f 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -3254,6 +3254,7 @@ namespace Tango.Integration.Operation { resumePreProgress = config.ResumeConfig.GlobalStartPosition - request.FirstUnitStartPosition; request.FirstUnitStartPosition = config.ResumeConfig.FirstUnitStartPosition; + request.JobTicket.Length = (request.JobTicket.Length / Math.Max(request.JobTicket.NumberOfUnits, 1)) *(int)Math.Max(config.ResumeConfig.RemainingUnits, 1); request.JobTicket.NumberOfUnits = (uint)Math.Max(config.ResumeConfig.RemainingUnits, 1); } -- cgit v1.3.1 From f6b8be518df438baa155f718619ad04905b4fae5 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Fri, 25 Aug 2023 19:26:42 +0300 Subject: Resume button. Set SettingUpTotalProgress as global Start Position. --- .../Controls/RunningJobViewerEureka.xaml.cs | 12 ++-- .../Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs | 77 +++++++++++++++++++++- .../Tango.Emulations/Emulators/MachineEmulator.cs | 10 +-- .../Tango.Integration/Operation/JobHandler.cs | 38 +++++++++-- .../Tango.Integration/Operation/MachineOperator.cs | 11 ++-- 5 files changed, 126 insertions(+), 22 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Controls') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs index 11823f797..60c5a0346 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs @@ -236,14 +236,14 @@ namespace Tango.PPC.UI.Controls if(slider_control != null) { slider_control.Value = SliderValue; - if(RunningJobStatus != null && RunningJobStatus.IsSettingUp == false && IsHasMultipleColorsSegments && ColorCanvas != null && ControlWidth > 0) + if(RunningJobStatus != null && RunningJobStatus.IsSettingUp == false && IsHasMultipleColorsSegments && ColorCanvas != null && ControlWidth > 0 && RunningJobStatus.CurrentUnitProgress > 0.01 && RunningJobStatus.CurrentUnitTotalProgress > 0) { double progress = RunningJobStatus.CurrentUnitProgress; double total = RunningJobStatus.CurrentUnitTotalProgress; int currentUnit = RunningJobStatus.CurrentUnit; - int totalUnits = Job.NumberOfUnits; - + int totalUnits = RunningJobStatus.RemainingUnits + RunningJobStatus.CurrentUnit;//Job.NumberOfUnits; + double simpleoffset = ((progress / total) * ControlWidth) ; double multiplier = (((double)(totalUnits - 1)) / (double)totalUnits); @@ -256,16 +256,16 @@ namespace Tango.PPC.UI.Controls _prevOffset = ControlWidth * (1-multiplier) * currentUnit; } _addOffset = _prevOffset; - //Debug.WriteLine($"OnSliderValueChanged prevOffset: '{_prevOffset}' currentUnit = {currentUnit}, total:{total}"); } - + // Debug.WriteLine($"OnSliderValueChanged Offset: '{offset}' CurrentUnitProgress = {RunningJobStatus.CurrentUnitProgress} progress= {progress} currentUnit = {currentUnit}, total:{total}"); offset += _addOffset; if (offset >= ControlWidth && currentUnit < (Job.NumberOfUnits - 2)) { offset -= ControlWidth;//round - //Debug.WriteLine($"OnSliderValueChanged round!!! offset: '{offset}' currentUnit = {currentUnit}, total:{total}"); + // Debug.WriteLine($"OnSliderValueChanged round!!! offset: '{offset}' currentUnit = {currentUnit}, total:{total}"); } + //if(currentUnit == (Job.NumberOfUnits - 1)) //{ // Debug.WriteLine($"OnSliderValueChanged offset: '{offset}' currentUnit = {currentUnit}. ControlWidth = {ControlWidth} total:{total}"); 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 f8c139cf6..131476c9e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs @@ -24,6 +24,9 @@ using System.ComponentModel; using RealTimeGraphX.WPF; using RealTimeGraphX.DataPoints; using Tango.PPC.UI.Graphs; +using Tango.BL; +using System.Data.Entity; +using System.Windows.Media; namespace Tango.PPC.UI.ViewModels { @@ -41,6 +44,25 @@ namespace Tango.PPC.UI.ViewModels Motor = 3 } + public class TimeToDyeValueItem + { + public DateTime startTime; + public DateTime endTime; + public double totalValue; + }; + + public class TimeToDyeValueCollection + { + public DateTime StartTime { get; set;} + public List items; + public TimeToDyeValueCollection() + { + items = new List(); + } + }; + + private DispatcherTimer _productiondata_timer; + #region Properties [TangoInject] @@ -344,7 +366,10 @@ namespace Tango.PPC.UI.ViewModels public MachineStatusViewVM() { - + _productiondata_timer = new DispatcherTimer(); + _productiondata_timer.Interval = TimeSpan.FromMinutes(10); + _productiondata_timer.Tick += _productiondata_timer_Tick; + StopCommand = new RelayCommand(StopJob, () => CanStopped()); AbortCommand = new RelayCommand(AbortJob, () => CanStopped()); @@ -355,7 +380,7 @@ namespace Tango.PPC.UI.ViewModels ClearJobCommand = new RelayCommand(ClearJob, () => CanStopped()); - GoToJobCommand = new RelayCommand(GoToJob, () => IsEnableGoToJob()); + GoToJobCommand = new RelayCommand(GoToJob, () => IsEnableGoToJob()); JobStatusViewCommand = new RelayCommand(JobStatusView); OverviewViewCommand = new RelayCommand(OverviewView); ClearAllNotificationsCommand = new RelayCommand(ClearAllNotifications); @@ -397,6 +422,12 @@ namespace Tango.PPC.UI.ViewModels MachineProvider.MachineOperator.MachineStatusChanged += MachineOperator_MachineStatusChanged; + DateTime dateTime = DateTime.Now; + DateTime onedayEarlier = dateTime.AddDays(-1); + + GetCollectionDyePropByStartTime(onedayEarlier); + + _productiondata_timer.Start(); } #region Events @@ -520,6 +551,10 @@ namespace Tango.PPC.UI.ViewModels //} } + private void _productiondata_timer_Tick(object sender, EventArgs e) + { + var CurrentDateTime = DateTime.Now; + } #endregion #region printing @@ -749,6 +784,12 @@ namespace Tango.PPC.UI.ViewModels IsDisplayJobOutline = true; } } + + #endregion + + #region graph + + public TimeToDyeValueCollection graphDyeingValuesCollection = new TimeToDyeValueCollection(); private WpfGraphController CreateController(params WpfGraphDataSeries[] seriesCollection) { @@ -771,7 +812,10 @@ namespace Tango.PPC.UI.ViewModels private WpfGraphDataSeries CreateSeries(String name, GraphHelper.GraphColor fill) { - WpfGraphDataSeries series = new WpfGraphDataSeries(); + WpfGraphDataSeries series = new WpfGraphDataSeries() + { + Stroke = Colors.DodgerBlue, + }; series.Name = name; series.Fill = GraphHelper.GetGraphBrush(fill); series.StrokeThickness = 1; @@ -779,6 +823,33 @@ namespace Tango.PPC.UI.ViewModels return series; } + public async void GetCollectionDyePropByStartTime(DateTime starttime) + { + try + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var jobRuns = await db.JobRuns.Where(x => x.StartDate >= starttime).Select(x => new { x.StartDate, x.EndDate, x.EndPosition }).OrderBy(y => y.StartDate).ToListAsync(); + double allvalues = 0; + graphDyeingValuesCollection.StartTime = starttime; + for ( int i = 0; i < jobRuns.Count; i++) + { + JobController.PushData(jobRuns[i].StartDate, allvalues); + if (i > 0) + { + allvalues += jobRuns[i-1].EndPosition; + } + graphDyeingValuesCollection.items.Add( new TimeToDyeValueItem(){ startTime = jobRuns[i].StartDate, endTime = jobRuns[i].EndDate, totalValue = allvalues }); + JobController.PushData(jobRuns[i].EndDate, allvalues); + } + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error loading machine counters."); + + } + } #endregion } } diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index 7074582d0..61d069847 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -851,10 +851,11 @@ namespace Tango.Emulations.Emulators for (int i = 0; i < units; i++) { - while (progress < unit_length + (!bIsResumeProcess && i == units - 1 ? dryerLength : 0) && !_cancelJob) - { - var status = new PMR.Printing.JobStatus(); - status.Progress = progress; + // while (progress < unit_length + (!bIsResumeProcess && i == units - 1 ? dryerLength : 0) && !_cancelJob) + while (progress < unit_length + ( i == units - 1 ? dryerLength : 0) && !_cancelJob) + { + var status = new PMR.Printing.JobStatus(); + status.Progress = progress; if (!message_sent) { @@ -891,6 +892,7 @@ namespace Tango.Emulations.Emulators addedResume = true; progress = firstUnitStartPosition; } + //LogManager.Log($" Emulator Progress = {progress}, units = {units}"); double currentPosition = 0; double nextStopPosition = unit_length; diff --git a/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs b/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs index 4579ff08c..5d62f4269 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs @@ -9,6 +9,7 @@ using Tango.BL.Enumerations; using Tango.Core; using Tango.Logging; using Tango.PMR.Printing; +using static Tango.Integration.Operation.AdditionalJobConfiguration; namespace Tango.Integration.Operation { @@ -139,6 +140,8 @@ namespace Tango.Integration.Operation /// public JobTicket JobTicket { get; private set; } + public ResumeConfiguration ResumeConfig { get; private set; } + #endregion #region Constructors @@ -155,13 +158,14 @@ namespace Tango.Integration.Operation /// Initializes a new instance of the class. /// /// The cancel action. - public JobHandler(Action cancelAction, Job job, JobTicket jobTicket, ProcessParametersTable processParameters, JobHandlerModes mode) : this() + public JobHandler(Action cancelAction, Job job, JobTicket jobTicket, ProcessParametersTable processParameters, JobHandlerModes mode, ResumeConfiguration resumeConfig = null) : this() { _mode = mode; ProcessParameters = processParameters; Job = job; JobTicket = jobTicket; + ResumeConfig = resumeConfig; foreach (var s in Job.Segments) { @@ -187,6 +191,11 @@ namespace Tango.Integration.Operation Status.RemainingProgress = Status.TotalProgress; Status.CurrentUnitSegments = _effectiveSegments.ToList(); Status.SettingUpTotalProgress = processParameters.DryerBufferLengthMeters; + if (resumeConfig != null && resumeConfig.GlobalStartPosition > 0) + { + Status.SettingUpTotalProgress = resumeConfig.GlobalStartPosition; + Status.CurrentUnitProgress = ResumeConfig.FirstUnitStartPosition; + } Status.TotalProgressMinusSettingUp = Job.LengthIncludingNumberOfUnits; Status.IsSettingUp = true; @@ -332,7 +341,7 @@ namespace Tango.Integration.Operation protected virtual void InvalidateJobProgress(JobStatus s) { JobStatus = s; - + if (_last_progress != s.Progress) { if (s.Progress <= PROGRESS_REPORT_RANGE_METERS || s.Progress >= Status.TotalProgress - PROGRESS_REPORT_RANGE_METERS) @@ -383,7 +392,16 @@ namespace Tango.Integration.Operation Status.IsSettingUp = false; } - Status.ProgressMinusSettingUp = s.Progress - this.Status.SettingUpTotalProgress; + if (ResumeConfig != null && ResumeConfig.GlobalStartPosition > 0) + { + Status.ProgressMinusSettingUp = s.Progress - ProcessParameters.DryerBufferLengthMeters; + //LogManager.Log($" Status.ProgressMinusSettingUp {Status.ProgressMinusSettingUp} progress = {s.Progress}"); + + } + else + { + Status.ProgressMinusSettingUp = s.Progress - this.Status.SettingUpTotalProgress; + } } int units = (int)Math.Max(Job.NumberOfUnits, 1); @@ -411,6 +429,15 @@ namespace Tango.Integration.Operation break; } } + else if(ResumeConfig != null && ResumeConfig.GlobalStartPosition > 0) + { + if (!Status.IsSettingUp && s.Progress <= previousUnitsLengthWithoutThis + unitLength + ProcessParameters.DryerBufferLengthMeters) + { + currentUnitProgress = s.Progress - previousUnitsLengthWithoutThis - ProcessParameters.DryerBufferLengthMeters; + //LogManager.Log($"currentUnitProgress before ={currentUnitProgress} progress = {s.Progress}"); + break; + } + } else if (s.Progress <= previousUnitsLengthWithoutThis + unitLength + Status.SettingUpProgress) { if (!Status.IsSettingUp) @@ -425,6 +452,7 @@ namespace Tango.Integration.Operation Status.CurrentUnit = currentUnit; Status.CurrentUnitProgress = currentUnitProgress; + //LogManager.Log($"CurrentUnit {Status.CurrentUnit} currentUnitProgress {Status.CurrentUnitProgress} "); Status.RemainingUnits = this.Job.NumberOfUnits - this.Status.CurrentUnit; @@ -444,7 +472,7 @@ namespace Tango.Integration.Operation { Status.Message = s.Message; } - + _lastStatusMessage = s.Message; @@ -527,7 +555,7 @@ namespace Tango.Integration.Operation Status.CurrentSegment = segment; } } - + //if (Status.Progress >= previousSegmentsLengthWithThis) if (Status.ProgressMinusSettingUp >= previousSegmentsLengthWithThis) { diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 11634109f..07d2c9881 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -2596,6 +2596,8 @@ namespace Tango.Integration.Operation /// public Task Print(Job job, ProcessParametersTable processParameters, AdditionalJobConfiguration config = null) { + //processParameters.DryerBufferLength = 10; //TODO: REMOVE !!! + return Task.Factory.StartNew(() => { if (config == null) config = new AdditionalJobConfiguration(); @@ -2916,7 +2918,7 @@ namespace Tango.Integration.Operation handler.CanCancel = true; LogManager.Log(ex, "Failed to cancel job."); } - }, clonedJob, ticket, processParameters, JobHandlingMode); + }, clonedJob, ticket, processParameters, JobHandlingMode, config.ResumeConfig); handler.StatusChanged += (x, s) => { @@ -3252,9 +3254,10 @@ namespace Tango.Integration.Operation if (config.ResumeConfig != null) { - resumePreProgress = config.ResumeConfig.GlobalStartPosition - request.FirstUnitStartPosition; + resumePreProgress = config.ResumeConfig.GlobalStartPosition - processParameters.DryerBufferLengthMeters; request.FirstUnitStartPosition = config.ResumeConfig.FirstUnitStartPosition; - request.JobTicket.Length = (request.JobTicket.Length / Math.Max(request.JobTicket.NumberOfUnits, 1)) *(int)Math.Max(config.ResumeConfig.RemainingUnits, 1); + //LogManager.Log($" resumePreProgress = {resumePreProgress}, GlobalStartPosition {config.ResumeConfig.GlobalStartPosition} FirstUnitStartPosition {request.FirstUnitStartPosition}"); + request.JobTicket.Length = (request.JobTicket.Length / Math.Max(request.JobTicket.NumberOfUnits, 1)) * (int)Math.Max(config.ResumeConfig.RemainingUnits, 1); request.JobTicket.NumberOfUnits = (uint)Math.Max(config.ResumeConfig.RemainingUnits, 1); } @@ -3263,7 +3266,7 @@ namespace Tango.Integration.Operation if (!completed) { response.Message.Status.Progress += resumePreProgress; - + handler.RaiseStatusReceived(response.Message.Status); _last_job_status = handler.Status; -- cgit v1.3.1