Files
PowderCoatingLogix/src/PowderCoating.Core/Entities/JobItem.cs
T
spouliot 539c6c2559 Fix oven batch conversion, invoice quantity, AI photo pricing, and enforce pricing flag propagation
- Carry OvenBatches/OvenCycleMinutes from Quote → Job entity (was missing fields; all job pricing recalcs hardcoded 1/null)
- Fix invoice creation from job always showing Quantity=1 (was using TotalPrice as UnitPrice with qty 1)
- Add IsAiItem to JobItem + migration; map in all 3 JobItemAssemblyService.CreateJobItem overloads so AI photo jobs no longer double-price on first edit after quote→job conversion
- Propagate IsAiItem through all existingItemsData JSON blocks in Jobs views (Edit, EditItems, Create) so the wizard preserves AI routing on re-edit
- Add PricingRoutingFlags_ExistOnBothQuoteItemAndJobItem structural test + 3 behavioral IsAiItem tests to JobItemAssemblyServiceTests
- Consolidate item wizard partials (_ItemWizardModal, _SqFtCalculatorModal) and item-wizard.css into shared locations
- Document pricing flag propagation checklist in CLAUDE.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 16:54:22 -04:00

61 lines
2.4 KiB
C#

namespace PowderCoating.Core.Entities;
public class JobItem : BaseEntity
{
public int JobId { get; set; }
public string Description { get; set; } = string.Empty;
public decimal Quantity { get; set; }
// Powder/Material Information
public string? ColorName { get; set; }
public string? ColorCode { get; set; }
public string? Finish { get; set; } // Gloss, Matte, Satin, etc.
// Measurements
public decimal? SurfaceArea { get; set; }
public decimal SurfaceAreaSqFt { get; set; }
// Catalog item reference (optional — null for generic/labor items)
public int? CatalogItemId { get; set; }
// Pricing
public decimal UnitPrice { get; set; }
public decimal TotalPrice { get; set; }
public decimal LaborCost { get; set; }
public bool IsGenericItem { get; set; }
public decimal? ManualUnitPrice { get; set; }
public decimal? PowderCostOverride { get; set; } // Optional unit price override for catalog items
public bool IsLaborItem { get; set; }
public bool IsSalesItem { get; set; }
public string? Sku { get; set; }
public bool IncludePrepCost { get; set; } = true;
// Processing Details
public bool RequiresSandblasting { get; set; }
public bool RequiresMasking { get; set; }
public int EstimatedMinutes { get; set; }
public string? Notes { get; set; }
// Part complexity level — applies a price multiplier for calculated items
// Values: "Simple" | "Moderate" | "Complex" | "Extreme"
public string? Complexity { get; set; }
// True when this item originated from an AI Photo Quote — ManualUnitPrice is used as-is
// and oven cost is not double-charged (it was excluded from the AI estimate at quote level).
public bool IsAiItem { get; set; }
// AI-generated standardized tags (comma-separated, e.g. "automotive,tubular")
public string? AiTags { get; set; }
// Link to shared AI prediction record (null for non-AI items; shared with QuoteItem when converted)
public int? AiPredictionId { get; set; }
public virtual AiItemPrediction? AiPrediction { get; set; }
// Relationships
public virtual Job Job { get; set; } = null!;
public virtual CatalogItem? CatalogItem { get; set; }
public virtual ICollection<JobItemCoat> Coats { get; set; } = new List<JobItemCoat>();
public virtual ICollection<JobItemPrepService> PrepServices { get; set; } = new List<JobItemPrepService>();
}