feat: Update service layer for new stock model

- Add StockItemService for CRUD operations on stock items
- Update SupplierService to manage SupplierOfferings instead of
  SupplierStock (GetOfferingsForSupplierAsync, AddOfferingAsync, etc.)
- Update CutListPackingService to use StockItems for available lengths
- Register StockItemService in Program.cs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-02 22:32:25 -05:00
parent c4fc88f7d2
commit 6797d1e4fd
4 changed files with 142 additions and 41 deletions

View File

@@ -38,8 +38,8 @@ public class CutListPackingService
.Where(s => s.MaterialId == materialId && s.IsActive && s.Quantity > 0)
.ToListAsync();
// Get supplier stock lengths for this material (for purchase)
var supplierLengths = await _context.SupplierStocks
// Get stock item lengths for this material (for purchase)
var stockItemLengths = await _context.StockItems
.Where(s => s.MaterialId == materialId && s.IsActive)
.Select(s => s.LengthInches)
.Distinct()
@@ -60,8 +60,8 @@ public class CutListPackingService
});
}
// Supplier stock bins with unlimited quantity
foreach (var length in supplierLengths)
// Stock item bins with unlimited quantity
foreach (var length in stockItemLengths)
{
// Only add if not already covered by in-stock
if (!stockBins.Any(b => b.LengthInches == length && b.IsInStock))