Files
PowderCoatingLogix/src/PowderCoating.Core/Entities/ReworkRecord.cs
T
spouliot f018653c18 Add rework pricing type (Fixed vs Per-Item) and inline rework flow on Job Details
Adds a PricingType enum to ReworkRecord (FixedPrice | PerItem), surfaces the
choice in the rework modal on Job Details, and wires the resulting unit/total
price display. Includes migration AddReworkPricingType, updated repository
query for rework history, and help article updates.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 09:27:34 -04:00

48 lines
2.8 KiB
C#

using PowderCoating.Core.Enums;
namespace PowderCoating.Core.Entities;
/// <summary>
/// Tracks defect, warranty, or damage rework on a job.
/// The original job owns the cost; a new linked job (ReworkJobId) handles the shop floor workflow.
/// </summary>
public class ReworkRecord : BaseEntity
{
// ── Links ─────────────────────────────────────────────────────────────────
public int JobId { get; set; }
public int? JobItemId { get; set; } // null = whole job; set = specific item
// Optional new job created to do the redo work on the shop floor
public int? ReworkJobId { get; set; }
// ── Classification ────────────────────────────────────────────────────────
public ReworkType ReworkType { get; set; }
public ReworkReason Reason { get; set; }
public string DefectDescription { get; set; } = string.Empty;
// ── Discovery ─────────────────────────────────────────────────────────────
public ReworkDiscoveredBy DiscoveredBy { get; set; }
public DateTime DiscoveredDate { get; set; } = DateTime.UtcNow;
public string? ReportedByName { get; set; } // Customer name if external report
// ── Cost & Billing ────────────────────────────────────────────────────────
public decimal EstimatedReworkCost { get; set; }
public decimal ActualReworkCost { get; set; }
public bool IsBillableToCustomer { get; set; }
public string? BillingNotes { get; set; }
// Pricing attribution for the linked rework job (null on pre-existing records)
public ReworkPricingType? ReworkPricingType { get; set; }
// ── Resolution ────────────────────────────────────────────────────────────
public ReworkStatus Status { get; set; } = ReworkStatus.Open;
public ReworkResolution? Resolution { get; set; }
public DateTime? ResolvedDate { get; set; }
public string? ResolutionNotes { get; set; }
// ── Navigation ────────────────────────────────────────────────────────────
public virtual Job Job { get; set; } = null!;
public virtual JobItem? JobItem { get; set; }
public virtual Job? ReworkJob { get; set; }
}