diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2022-03-01 14:19:50 +0200 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2022-03-01 14:19:50 +0200 |
| commit | 38052847502dd46b47269addae91aef0aa8fb747 (patch) | |
| tree | acb339261eb604991b71edfeb21e626e44a01a58 /Software/Visual_Studio/Tango.Integration | |
| parent | 1f6b9e23c21b2f31781f4372378a965c109657ca (diff) | |
| download | Tango-38052847502dd46b47269addae91aef0aa8fb747.tar.gz Tango-38052847502dd46b47269addae91aef0aa8fb747.zip | |
Group Repeating - add logic in Dyeing.
Related Work Items: #6229
Diffstat (limited to 'Software/Visual_Studio/Tango.Integration')
| -rw-r--r-- | Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs | 62 |
1 files changed, 52 insertions, 10 deletions
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 957c53a89..03d21c980 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -2532,7 +2532,7 @@ namespace Tango.Integration.Operation try { bool useLightInks = config.UseLightInks; - if (job.Segments.Count > 1 && !job.EnableInterSegment) useLightInks = false; + if (job.OrderedSegmentsWithGroups.Count > 1 && !job.EnableInterSegment) useLightInks = false; processParameters = converter.GetRecommendedProcessParameters(job, useLightInks); } @@ -2548,7 +2548,7 @@ namespace Tango.Integration.Operation try { - foreach (var stop in job.Segments.SelectMany(x => x.BrushStops).ToList()) + foreach (var stop in job.OrderedSegmentsWithGroups.SelectMany(x => x.BrushStops).ToList()) { stop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, processParameters); } @@ -2611,7 +2611,7 @@ namespace Tango.Integration.Operation job.Guid = originalJob.Guid; job.Name = originalJob.Name; - var jobSegments = job.OrderedSegments; + var jobSegments = job.OrderedSegmentsWithGroups; //Color Conversion if (config.UseColorConversion) @@ -2621,7 +2621,7 @@ namespace Tango.Integration.Operation bool useLightInks = config.UseLightInks; //Use light inks only if one segment or inter segment is enabled. - if (job.Segments.Count > 1 && !job.EnableInterSegment) useLightInks = false; + if (job.OrderedSegmentsWithGroups.Count > 1 && !job.EnableInterSegment) useLightInks = false; foreach (var segment in jobSegments) { @@ -2679,7 +2679,7 @@ namespace Tango.Integration.Operation //Modify transparent/white brush stops. (Transparent/white stops should be all zeros and 100% TI) LogManager.Log("Modifying all 'white' brush stops..."); - foreach (var stop in job.Segments.SelectMany(x => x.BrushStops).Where(x => x.IsTransparent || x.IsWhite).ToList()) + foreach (var stop in job.OrderedSegmentsWithGroups.SelectMany(x => x.BrushStops).Where(x => x.IsTransparent || x.IsWhite).ToList()) { foreach (var liquidVolume in stop.LiquidVolumes.Where(x => x.LiquidType != LiquidTypes.TransparentInk && x.LiquidType != LiquidTypes.Lubricant).ToList()) { @@ -2694,7 +2694,7 @@ namespace Tango.Integration.Operation } } - var segments = job.OrderedSegments.ToList(); + var segments = job.OrderedSegmentsWithGroups.ToList(); List<RequiredLiquid> requiredLiquids = null; @@ -2712,7 +2712,24 @@ namespace Tango.Integration.Operation foreach (var segment in segments) { - t.Segments.Add(CreatePMRJobSegment(segment, originalJob, processParameters)); + if (segment is Segment simpleSegment) + { + t.Segments.Add(CreatePMRJobSegment(simpleSegment, originalJob, processParameters)); + } + else if (segment is SegmentsGroup group) + { + List<JobSegment> groupSegments = new List<JobSegment>(); + + foreach (var innerSegment in group.OrderedSegments) + { + groupSegments.Add(CreatePMRJobSegment(innerSegment, originalJob, processParameters)); + } + + for (int i = 0; i < group.Repeats; i++) + { + t.Segments.AddRange(groupSegments.ToList()); + } + } } requiredLiquids = ValidateJobLiquidQuantity(t, processParameters, job.Machine.Configuration); @@ -2727,7 +2744,7 @@ namespace Tango.Integration.Operation JobRequest request = new JobRequest(); - int max = job.OrderedSegments.Last().SegmentIndex + 1; + int max = job.OrderedSegmentsWithGroups.Last().SegmentIndex + 1; for (int i = 0; i < job.NumberOfUnits - 1; i++) { @@ -2735,7 +2752,15 @@ namespace Tango.Integration.Operation { var cloned = s.Clone(job); cloned.SegmentIndex = max++; - job.Segments.Add(cloned); + + if (cloned is Segment simpleSegment) + { + job.Segments.Add(simpleSegment); + } + else if (cloned is SegmentsGroup g) + { + job.SegmentsGroups.Add(g); + } } } @@ -2885,7 +2910,24 @@ namespace Tango.Integration.Operation { try { - ticket.Segments.Add(CreatePMRJobSegment(segment, originalJob, processParameters)); + if (segment is Segment simpleSegment) + { + ticket.Segments.Add(CreatePMRJobSegment(simpleSegment, originalJob, processParameters)); + } + else if (segment is SegmentsGroup group) + { + List<JobSegment> groupSegments = new List<JobSegment>(); + + foreach (var innerSegment in group.OrderedSegments) + { + groupSegments.Add(CreatePMRJobSegment(innerSegment, originalJob, processParameters)); + } + + for (int i = 0; i < group.Repeats; i++) + { + ticket.Segments.AddRange(groupSegments.ToList()); + } + } } catch (Exception ex) { |
