From 3c7fe666b10d131da99076d81a50c7887a4caed6 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Mon, 18 Aug 2025 10:33:28 +0300 Subject: Critical fix on machine operator number of segments duplication on job ticket. Removed number of spools references on X1 UI. --- Software/Visual_Studio/Tango.BL/Entities/Job.cs | 55 +++++++++++++------------ 1 file changed, 28 insertions(+), 27 deletions(-) (limited to 'Software/Visual_Studio/Tango.BL') diff --git a/Software/Visual_Studio/Tango.BL/Entities/Job.cs b/Software/Visual_Studio/Tango.BL/Entities/Job.cs index ba38d429c..54510a0f4 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Job.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Job.cs @@ -119,9 +119,9 @@ namespace Tango.BL.Entities { if (Rml == null) return 0; - + var gramPerlength = Rml.GetGramPer1000mLength; - var weight = (LengthIncludingNumberOfUnits * gramPerlength) / (1000 );//(g) + var weight = (LengthIncludingNumberOfUnits * gramPerlength) / (1000);//(g) return weight; } } @@ -157,7 +157,8 @@ namespace Tango.BL.Entities return NumberOfUnits * NumberOfSpools; } } - return NumberOfUnits; + + return NumberOfUnits; } } @@ -227,7 +228,7 @@ namespace Tango.BL.Entities RaisePropertyChangedAuto(); } } - + /// /// Gets or sets the effective segments. /// @@ -407,13 +408,13 @@ namespace Tango.BL.Entities [NotMapped] [JsonIgnore] - public double GramPerLength { get; set;} + public double GramPerLength { get; set; } [NotMapped] [JsonIgnore] public String ThreadName { - get { return Rml == null ? "" : Rml.DisplayName;} + get { return Rml == null ? "" : Rml.DisplayName; } } #endregion @@ -486,7 +487,7 @@ namespace Tango.BL.Entities protected override void OnRmlChanged(Rml rml) { base.OnRmlChanged(rml); - if(rml != null) + if (rml != null) { GramPerLength = Rml.GetGramPer1000mLength; } @@ -561,12 +562,12 @@ namespace Tango.BL.Entities if (this.Name.Contains(copy)) { int last = this.Name.LastIndexOf(copy); - baseName = this.Name.Substring(0,last); - string index_str = this.Name.Substring(last+ copy.Length); - if(!String.IsNullOrEmpty(index_str)) + baseName = this.Name.Substring(0, last); + string index_str = this.Name.Substring(last + copy.Length); + if (!String.IsNullOrEmpty(index_str)) { int result; - if(int.TryParse(index_str, out result)) + if (int.TryParse(index_str, out result)) index = result + 1; } } @@ -581,7 +582,7 @@ namespace Tango.BL.Entities cloned.WindingMethod = WindingMethod; cloned.JobStatus = JobStatuses.Draft; - + cloned.Segments = Segments.Where(x => x.SegmentsGroupGuid == null).Select(x => x.Clone(cloned)).ToSynchronizedObservableCollection(); cloned.SegmentsGroups = SegmentsGroups.Select(x => x.Clone(cloned)).ToSynchronizedObservableCollection(); @@ -590,7 +591,7 @@ namespace Tango.BL.Entities segment.JobGuid = cloned.Guid; segment.Job = cloned; } - + return cloned; } @@ -609,7 +610,7 @@ namespace Tango.BL.Entities { if (s is Segment segment) { - length += segment.LengthWithFactor + ((EnableInterSegment && IsAllSegmentsPerSpool && segment.SegmentIndex != max) ? InterSegmentLength : 0); + length += segment.LengthWithFactor + ((EnableInterSegment && IsAllSegmentsPerSpool && segment.SegmentIndex != max) ? InterSegmentLength : 0); } else if (s is SegmentsGroup segmentsGroup) { @@ -645,12 +646,12 @@ namespace Tango.BL.Entities private double GetWeigth() { - if(Rml == null) + if (Rml == null) return 0; double length = GetLength(); - - var weight = (length * GramPerLength) / (1000 );//length in m, return value in g + + var weight = (length * GramPerLength) / (1000);//length in m, return value in g return weight; } @@ -673,22 +674,22 @@ namespace Tango.BL.Entities int fromAngle = -90; double totalLength = 0;//Segments.Sum(x => x.Length); //Excluding inter segment. - foreach(var isegm in OrderedSegmentsWithGroups) + foreach (var isegm in OrderedSegmentsWithGroups) { if (isegm is SegmentsGroup group) { foreach (var innerSegment in group.Segments) { - totalLength += innerSegment.Length*group.Repeats; + totalLength += innerSegment.Length * group.Repeats; } } - else if(isegm is Segment segment) + else if (isegm is Segment segment) { totalLength += segment.Length; } } - - + + foreach (var segm in OrderedSegmentsWithGroups) { if (segm is SegmentsGroup group) @@ -708,7 +709,7 @@ namespace Tango.BL.Entities } } } - else if(segm is Segment segment) + else if (segm is Segment segment) { int toAngle = (int)((segment.Length / totalLength) * 360d); Rectangle rect = new Rectangle(0, 0, bmp.Width - 2, bmp.Height - 2); @@ -956,14 +957,14 @@ namespace Tango.BL.Entities jobFile.ColorCatalogGuid = job.ColorCatalogGuid.ToStringOrEmpty(); jobFile.NumberOfSpools = job.NumberOfSpools; jobFile.Version = job.Version; - + foreach (var segm in job.OrderedSegmentsWithGroups) { JobFileSegment s = new JobFileSegment(); if (segm is SegmentsGroup group) { s.Repeats = group.Repeats; - foreach(var innerSegment in group.Segments) + foreach (var innerSegment in group.Segments) { JobFileSegment innerFileSegment = new JobFileSegment(); innerFileSegment.Length = innerSegment.Length; @@ -1009,7 +1010,7 @@ namespace Tango.BL.Entities catch (Exception ex) { throw new InvalidOperationException($"Error extracting liquid volume from ids pack {idsPack.PackIndex}", ex); - } + } } s.BrushStops.Add(st); } @@ -1187,7 +1188,7 @@ namespace Tango.BL.Entities } s.UpdateMiddleColorBrush(); } - + /// /// Removes this entity and all dependent entities from the specified db context. /// -- cgit v1.3.1