refactor: Rename Project to Job with enhanced model
Rename the Project concept to Job for clarity: - Add Job, JobPart, JobStock entities - JobStock supports both inventory stock and custom lengths - Add JobNumber field for job identification - Add priority-based stock allocation for cut optimization - Include Jobs UI pages (Index, Edit, Results) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
19
CutList.Web/Data/Entities/Job.cs
Normal file
19
CutList.Web/Data/Entities/Job.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace CutList.Web.Data.Entities;
|
||||
|
||||
public class Job
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string JobNumber { get; set; } = string.Empty;
|
||||
public string? Name { get; set; }
|
||||
public string? Customer { get; set; }
|
||||
public int? CuttingToolId { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
|
||||
public CuttingTool? CuttingTool { get; set; }
|
||||
public ICollection<JobPart> Parts { get; set; } = new List<JobPart>();
|
||||
public ICollection<JobStock> Stock { get; set; } = new List<JobStock>();
|
||||
|
||||
public string DisplayName => string.IsNullOrWhiteSpace(Name) ? JobNumber : $"{JobNumber} - {Name}";
|
||||
}
|
||||
15
CutList.Web/Data/Entities/JobPart.cs
Normal file
15
CutList.Web/Data/Entities/JobPart.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace CutList.Web.Data.Entities;
|
||||
|
||||
public class JobPart
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int JobId { get; set; }
|
||||
public int MaterialId { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public decimal LengthInches { get; set; }
|
||||
public int Quantity { get; set; } = 1;
|
||||
public int SortOrder { get; set; }
|
||||
|
||||
public Job Job { get; set; } = null!;
|
||||
public Material Material { get; set; } = null!;
|
||||
}
|
||||
46
CutList.Web/Data/Entities/JobStock.cs
Normal file
46
CutList.Web/Data/Entities/JobStock.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
namespace CutList.Web.Data.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Represents stock allocated to a specific job.
|
||||
/// Can reference an existing StockItem with quantity override,
|
||||
/// or define a custom length just for this job.
|
||||
/// </summary>
|
||||
public class JobStock
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int JobId { get; set; }
|
||||
public int MaterialId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If set, references an existing stock item. Null for custom job-specific lengths.
|
||||
/// </summary>
|
||||
public int? StockItemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Length in inches. For stock items, copied from StockItem.LengthInches.
|
||||
/// For custom lengths, user-specified.
|
||||
/// </summary>
|
||||
public decimal LengthInches { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Quantity to use for this job. Can be less than or equal to available stock.
|
||||
/// For custom lengths, represents unlimited available.
|
||||
/// </summary>
|
||||
public int Quantity { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// True if this is a custom length just for this job (not from inventory).
|
||||
/// </summary>
|
||||
public bool IsCustomLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Priority for bin packing. Lower values are used first.
|
||||
/// </summary>
|
||||
public int Priority { get; set; } = 10;
|
||||
|
||||
public int SortOrder { get; set; }
|
||||
|
||||
public Job Job { get; set; } = null!;
|
||||
public Material Material { get; set; } = null!;
|
||||
public StockItem? StockItem { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user