f018653c18
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>
48 lines
2.8 KiB
C#
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; }
|
|
}
|