From 8ebb48694f648340bbec51c357eac6c43a6418ca Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Sat, 10 Oct 2026 13:14:25 -0400 Subject: [PATCH] fix(report): rename plate copies to quantity --- OpenNest.Reporting/NestPdfWriter.cs | 6 +++--- OpenNest.Tests/Reporting/NestPdfLayoutTests.cs | 2 +- OpenNest.Tests/Reporting/NestPdfWriterTests.cs | 3 ++- docs/nest-reports.md | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/OpenNest.Reporting/NestPdfWriter.cs b/OpenNest.Reporting/NestPdfWriter.cs index edf5a0a..890833f 100644 --- a/OpenNest.Reporting/NestPdfWriter.cs +++ b/OpenNest.Reporting/NestPdfWriter.cs @@ -131,7 +131,7 @@ public static class NestPdfWriter else { var plates = AddTable(section, 60, 200, 80, 100, 100); - AddHeader(plates, "Plate", "Stock size", "Copies", "Parts/sheet", "Utilization"); + AddHeader(plates, "Plate", "Stock size", "Quantity", "Parts/sheet", "Utilization"); foreach (var plate in snapshot.Plates) AddRow(plates, $"Plate {plate.Number}", false, plate.Number.ToString(Invariant), SheetSize(snapshot, plate), plate.Copies.ToString(Invariant), plate.Parts.Length.ToString(Invariant), Percent(plate.Utilization)); @@ -175,7 +175,7 @@ public static class NestPdfWriter var info = AddTable(section, 80, 280, 90, 270); info.Borders.Visible = false; AddInfoRow(info, "Nest:", snapshot.Name, "Sheet size:", SheetSize(snapshot, plate)); - AddInfoRow(info, "Material:", Material(snapshot), "Copies:", plate.Copies.ToString(Invariant)); + AddInfoRow(info, "Material:", Material(snapshot), "Quantity:", plate.Copies.ToString(Invariant)); AddInfoRow(info, "Thickness:", Thickness(snapshot), "Part spacing:", $"{Number(plate.PartSpacing)} {snapshot.Units}"); AddInfoRow(info, "Parts/sheet:", plate.Parts.Length.ToString(Invariant), "Utilization:", @@ -204,7 +204,7 @@ public static class NestPdfWriter var perSheet = plate.Parts.GroupBy(part => part.ReportId, StringComparer.Ordinal) .ToDictionary(group => group.Key, group => (long)group.Count(), StringComparer.Ordinal); var parts = AddTable(section, 60, 400, 110, 150); - AddHeader(parts, "ID", "Drawing", "Qty/sheet", $"Total ({plate.Copies} copies)"); + AddHeader(parts, "ID", "Drawing", "Qty/sheet", $"Total ({plate.Copies} plates)"); foreach (var drawing in snapshot.Drawings.Where(drawing => perSheet.ContainsKey(drawing.Id))) { var count = perSheet[drawing.Id]; diff --git a/OpenNest.Tests/Reporting/NestPdfLayoutTests.cs b/OpenNest.Tests/Reporting/NestPdfLayoutTests.cs index d3434f2..ef22830 100644 --- a/OpenNest.Tests/Reporting/NestPdfLayoutTests.cs +++ b/OpenNest.Tests/Reporting/NestPdfLayoutTests.cs @@ -85,7 +85,7 @@ public sealed class NestPdfLayoutTests : IDisposable // Every page carrying plate-table rows repeats the table heading. var tablePages = platePages.Where(page => Regex.IsMatch(page, @"(?m)^R\d{3}\s+Demand \d{2}\s+1\s+2$")).ToList(); Assert.True(tablePages.Count >= 2, $"plate table pages: {tablePages.Count}"); - Assert.All(tablePages, page => Assert.Matches(@"ID\s+Drawing\s+Qty/sheet\s+Total \(2 copies\)", page)); + Assert.All(tablePages, page => Assert.Matches(@"ID\s+Drawing\s+Qty/sheet\s+Total \(2 plates\)", page)); var plateText = string.Join("\n", platePages); for (var i = 0; i < 40; i++) Assert.Matches($@"R{i + 4:D3}\s+Demand {i:D2}\s+1\s+2", plateText); diff --git a/OpenNest.Tests/Reporting/NestPdfWriterTests.cs b/OpenNest.Tests/Reporting/NestPdfWriterTests.cs index 86fc995..76fa7d1 100644 --- a/OpenNest.Tests/Reporting/NestPdfWriterTests.cs +++ b/OpenNest.Tests/Reporting/NestPdfWriterTests.cs @@ -53,10 +53,11 @@ public sealed class NestPdfWriterTests : IDisposable Assert.Matches(@"R003\s+Bracket\s+7\s+2\s+5\s+0\s+1", summary); Assert.Matches(@"R004\s+Unplaced\s+3\s+0\s+3\s+0\s+-", summary); Assert.Contains("Page 1 of 2", summary); + Assert.DoesNotContain("Copies", summary + plate); Assert.Contains("Plate 1", plate); Assert.Contains("Report test job", plate); - Assert.Matches(@"Copies:\s+2", plate); + Assert.Matches(@"Quantity:\s+2", plate); Assert.Matches(@"R001\s+Bracket\s+2\s+4", plate); Assert.Matches(@"R002\s+Rotated\s+1\s+2", plate); Assert.Matches(@"R003\s+Bracket\s+1\s+2", plate); diff --git a/docs/nest-reports.md b/docs/nest-reports.md index 5a17f26..e8febc4 100644 --- a/docs/nest-reports.md +++ b/docs/nest-reports.md @@ -54,7 +54,7 @@ each plate's part table across pages with the heading row repeated, and notes flow as an ordinary paragraph. No row, table or note text is ever dropped or truncated to fit a page. -Stock sizes read **width x length** in job units. +Stock sizes read **width x length** in job units. Plate counts use **Quantity**. Each part ID is centered on its part's pole of inaccessibility (`PolyLabel`, the same method `PlateView`'s `LayoutPart` uses), computed on a