Add a new web-based frontend for cut list optimization using: - Blazor Server with .NET 8 - Entity Framework Core with MSSQL LocalDB - Full CRUD for Materials, Suppliers, Projects, and Cutting Tools - Supplier stock length management for quick project setup - Integration with CutList.Core for bin packing optimization - Print-friendly HTML reports with efficiency statistics Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
36 lines
840 B
C#
36 lines
840 B
C#
using CutList.Core;
|
|
using CutList.Core.Formatting;
|
|
using CutList.Core.Nesting;
|
|
using CutList.Web.Data.Entities;
|
|
|
|
namespace CutList.Web.Services;
|
|
|
|
public class ReportService
|
|
{
|
|
public string FormatLength(double inches)
|
|
{
|
|
return ArchUnits.FormatFromInches(inches);
|
|
}
|
|
|
|
public List<ItemGroup> GroupItems(IReadOnlyList<BinItem> items)
|
|
{
|
|
return items
|
|
.GroupBy(i => new { i.Name, i.Length })
|
|
.Select(g => new ItemGroup
|
|
{
|
|
Name = g.Key.Name,
|
|
Length = g.Key.Length,
|
|
Count = g.Count()
|
|
})
|
|
.OrderByDescending(g => g.Length)
|
|
.ToList();
|
|
}
|
|
}
|
|
|
|
public class ItemGroup
|
|
{
|
|
public string Name { get; set; } = string.Empty;
|
|
public double Length { get; set; }
|
|
public int Count { get; set; }
|
|
}
|