namespace PowderCoating.Core.Entities; /// /// Records actual powder consumption against a specific coat on a job. /// Links the InventoryTransaction (the deduction) to the JobItemCoat (what the powder was used on). /// This is the bridge that enables prediction vs actual reporting per powder SKU. /// public class PowderUsageLog : BaseEntity { public int JobId { get; set; } public int JobItemId { get; set; } public int JobItemCoatId { get; set; } public int? InventoryItemId { get; set; } // null for custom/vendor powder public int? InventoryTransactionId { get; set; } // FK to the inventory deduction (if auto-linked) public decimal ActualLbsUsed { get; set; } public decimal EstimatedLbs { get; set; } // Snapshot of PowderToOrder at time of recording public decimal VarianceLbs { get; set; } // ActualLbsUsed - EstimatedLbs (positive = used more than estimated) public string RecordedByUserId { get; set; } = string.Empty; public DateTime RecordedAt { get; set; } = DateTime.UtcNow; public string? Notes { get; set; } // Navigation public virtual Job Job { get; set; } = null!; public virtual JobItem JobItem { get; set; } = null!; public virtual JobItemCoat JobItemCoat { get; set; } = null!; public virtual InventoryItem? InventoryItem { get; set; } public virtual InventoryTransaction? InventoryTransaction { get; set; } }