Files
CutList/CutList.Web/Data/Entities/Material.cs
AJ Isaacs 3b036308c8 refactor: Update Material and StockItem entities
Material entity changes:
- Shape property now uses MaterialShape enum
- Add Type (MaterialType) and Grade properties
- Add SortOrder for numeric sorting
- Add Dimensions navigation property (1:1)
- Replace ProjectParts with JobParts collection

StockItem entity changes:
- Add QuantityOnHand for inventory tracking
- Add Notes field
- Add Transactions navigation property

DbContext updates:
- Configure MaterialDimensions TPH inheritance
- Add enum-to-string conversions for MaterialShape and MaterialType
- Configure shared column names for TPH properties
- Add indexes on primary dimension columns
- Update all entity relationships for Job model

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 23:37:51 -05:00

39 lines
1.2 KiB
C#

namespace CutList.Web.Data.Entities;
public class Material
{
public int Id { get; set; }
public MaterialShape Shape { get; set; }
/// <summary>
/// Material type (Steel, Aluminum, Stainless, etc.)
/// </summary>
public MaterialType Type { get; set; }
/// <summary>
/// Grade or specification (e.g., "A36", "Hot Roll", "304", "6061-T6")
/// </summary>
public string? Grade { get; set; }
public string Size { get; set; } = string.Empty;
public string? Description { get; set; }
public bool IsActive { get; set; } = true;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime? UpdatedAt { get; set; }
/// <summary>
/// Sort order based on primary dimension (stored as thousandths of an inch for numeric sorting).
/// </summary>
public int SortOrder { get; set; }
public ICollection<StockItem> StockItems { get; set; } = new List<StockItem>();
public ICollection<JobPart> JobParts { get; set; } = new List<JobPart>();
/// <summary>
/// Optional parsed dimensions for decimal-based searching.
/// </summary>
public MaterialDimensions? Dimensions { get; set; }
public string DisplayName => $"{Shape.GetDisplayName()} - {Size}";
}