diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index d6d926800..6b90ef393 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -40,6 +40,7 @@ using Tango.Integration.Emergency; using Tango.PMR.MachineStatus; using Newtonsoft.Json; using Tango.PMR.Integration; +using System.Globalization; namespace Tango.Integration.Operation { @@ -1425,9 +1426,9 @@ namespace Tango.Integration.Operation { var segment = job.Segments[segmentIndex]; var segment_length_cm = segment.Length * 100d; - + List<BrushStop> orderedBrushCollection = segment.BrushStops.OrderBy(x => x.OffsetMeters).ToList(); - + int solid_gradient_oeff = orderedBrushCollection.Count == 1 ? 1 : 2; double prev_offset_cm = 0; for (int brushIndex = 0; brushIndex < orderedBrushCollection.Count; brushIndex++) @@ -1450,7 +1451,7 @@ namespace Tango.Integration.Operation brush_length_centimeters -= resolution; } prev_offset_cm = brush_offset_cm; - + foreach (var liquidVolumes in brush.LiquidVolumes) { liquidQuantities[liquidVolumes.IdsPack.PackIndex] += liquidVolumes.NanoliterPerCentimeter * (brush_length_centimeters / solid_gradient_oeff); @@ -1477,12 +1478,21 @@ namespace Tango.Integration.Operation { IdsPack = idsPack, Current = packLevel.DispenserLevel, - Required = (int)liquidQuantities[index] + Required = (int)liquidQuantities[index], + Maximum = MAX_DISPENSER_NANOLITER, }; - if (liquidQuantities[index] > packLevel.DispenserLevel) + if (idsLevel.Required > idsLevel.Current) { shouldThrow = true; + string display_value = (((double)(idsLevel.Required - idsLevel.Current) / 1000000000)).ToString("N2", CultureInfo.InvariantCulture); + idsLevel.Message = $"Missing {display_value} liters to complete the job."; + + if (idsLevel.Required > idsLevel.Maximum) + { + display_value = (((double)(idsLevel.Required - idsLevel.Maximum)) / 1000000000).ToString("N2", CultureInfo.InvariantCulture); + idsLevel.Message = $"Required ink exceeds the maximum capacity of the dispenser by {display_value} liters. Please reduce the segment length."; + } } exception.IdsPackLevels.Add(idsLevel); @@ -1561,7 +1571,8 @@ namespace Tango.Integration.Operation { IdsPack = idsPack, Current = packLevel.DispenserLevel, - Required = (int)liquidQuantities[index] + Required = (int)liquidQuantities[index], + Maximum = MAX_DISPENSER_NANOLITER, }; if (liquidQuantities[index] > packLevel.DispenserLevel) @@ -1623,7 +1634,16 @@ namespace Tango.Integration.Operation throw new NullReferenceException("Could not locate an active process parameters tables group for RML " + job.Rml.Name); } - var processParameters = converter.GetRecommendedProcessParameters(job); + ProcessParametersTable processParameters = null; + + try + { + processParameters = converter.GetRecommendedProcessParameters(job); + } + catch (Exception ex) + { + throw LogManager.Log(new InvalidOperationException($"An error occurred while trying to resolve the recommended process parameters.\n{ex.Message}")); + } if (processParameters == null) { @@ -1769,7 +1789,7 @@ namespace Tango.Integration.Operation if (EnableJobLiquidQuantityValidation) { - ValidateJobLiquidQuantity(job, processParameters, job.Machine.Configuration); + ValidateJobLiquidQuantity(job, processParameters, job.Machine.Configuration); } var originalJob = job; @@ -1916,25 +1936,6 @@ namespace Tango.Integration.Operation return; } - if (EnableJobLiquidQuantityValidation) - { - try - { - //ValidateJobLiquidQuantity(originalJob, processParameters, job.Machine.Configuration); - var ticketForValidation = ticket.Clone(); - ticketForValidation.NumberOfUnits = (uint)originalJob.NumberOfUnits; - ValidateJobLiquidQuantity(ticketForValidation, processParameters, job.Machine.Configuration); - } - catch (Exception ex) - { - Status = MachineStatuses.ReadyToDye; - PrintingFailed?.Invoke(this, new PrintingFailedEventArgs(handler, clonedJob, ex)); - PrintingEnded?.Invoke(this, new PrintingEventArgs(handler, clonedJob)); - handler.RaiseFailed(ex); - return; - } - } - var segs = new List<JobSegment>(); if (JobUnitsMethod == JobUnitsMethods.Operator) |
