Add platform powder catalog, catalog-first lookup, and label scanner

- Platform PowderCatalogItem table (IPlainRepository, no tenant filter) with
  full spec fields: cure temp/time, finish, color families, clear coat flag,
  coverage sq ft/lb, transfer efficiency, IsUserContributed
- Two EF migrations: AddPowderCatalogItem + AddPowderCatalogSpecFields
- PowderCatalogController (SuperAdminOnly): import from Prismatic JSON scrape,
  Lookup AJAX endpoint (catalog-first, ranked by SKU exact match), stats view
  with Tenant Contributed card
- Unified smart Lookup button on inventory Create/Edit: catalog hit fills all
  fields via catalogSnapshot pattern; AI augments cure/finish data from product
  URL if subscription enabled; catalog miss falls through to AI lookup
- In-browser label scanner (_LabelScanModal): getUserMedia live camera feed,
  jsQR auto-detects QR codes in rAF loop; "Scan Label Text" fallback sends
  captured frame to Claude vision via /Inventory/ScanLabel
- ScanLabel endpoint handles both QR URL path (LookupByUrlAsync) and vision
  path (ScanLabelAsync); auto-inserts unrecognized products as
  IsUserContributed=true; returns wasInCatalog/addedToCatalog flags

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-03 16:36:25 -04:00
parent 90f333c8f3
commit 1fc79b77fe
25 changed files with 21279 additions and 23 deletions
@@ -27,6 +27,8 @@ public class InventoryItem : BaseEntity
public bool RequiresClearCoat { get; set; } // True if this powder requires a clear coat topcoat
public string? SpecPageUrl { get; set; } // Link to manufacturer's product/spec page
public string? ImageUrl { get; set; } // Product image URL (sourced from og:image on AI lookup)
public string? SdsUrl { get; set; } // Safety Data Sheet URL (from powder catalog or manual entry)
public string? TdsUrl { get; set; } // Technical Data Sheet URL (from powder catalog or manual entry)
// Sample Panel Tracking (coating category items only)
public bool HasSamplePanel { get; set; } = false;
@@ -0,0 +1,71 @@
namespace PowderCoating.Core.Entities;
/// <summary>
/// Platform-level master list of powder coating products across all vendors.
/// Not tenant-scoped — no BaseEntity, no CompanyId, no soft delete.
/// Used as a lookup table to auto-fill inventory records without an API call.
/// </summary>
public class PowderCatalogItem
{
public int Id { get; set; }
/// <summary>Vendor name — e.g. "Prismatic Powders", "Columbia Coatings". Unique index with Sku.</summary>
public string VendorName { get; set; } = string.Empty;
/// <summary>Vendor's product SKU. Unique per vendor.</summary>
public string Sku { get; set; } = string.Empty;
public string ColorName { get; set; } = string.Empty;
/// <summary>Cleaned short description — boilerplate stripped at import time.</summary>
public string? Description { get; set; }
/// <summary>Base unit price (lowest quantity tier).</summary>
public decimal UnitPrice { get; set; }
/// <summary>Full price tier JSON for future quantity-break pricing support.</summary>
public string? PriceTiersJson { get; set; }
public string? ImageUrl { get; set; }
public string? SdsUrl { get; set; }
public string? TdsUrl { get; set; }
public string? ApplicationGuideUrl { get; set; }
public string? ProductUrl { get; set; }
// ── Coating specification fields ──────────────────────────────────────
/// <summary>Cure temperature in degrees Fahrenheit.</summary>
public decimal? CureTemperatureF { get; set; }
/// <summary>Cure hold time at cure temperature, in minutes.</summary>
public int? CureTimeMinutes { get; set; }
/// <summary>Finish type — e.g. Gloss, Matte, Satin, Metallic, Texture.</summary>
public string? Finish { get; set; }
/// <summary>Comma-separated color family tags — e.g. "Blue,Purple".</summary>
public string? ColorFamilies { get; set; }
/// <summary>Whether this product requires a clear coat to activate its effect.</summary>
public bool? RequiresClearCoat { get; set; }
/// <summary>Theoretical coverage in sq ft per pound. Typical 80120.</summary>
public decimal? CoverageSqFtPerLb { get; set; }
/// <summary>Powder transfer efficiency percentage. Typical 6075%.</summary>
public decimal? TransferEfficiency { get; set; }
// ── Catalog management ────────────────────────────────────────────────
/// <summary>True when the vendor has discontinued this product. Kept for historical lookups.</summary>
public bool IsDiscontinued { get; set; } = false;
/// <summary>True when this record was contributed by a tenant label scan rather than a curated import.</summary>
public bool IsUserContributed { get; set; } = false;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime? UpdatedAt { get; set; }
/// <summary>Timestamp of the last successful sync run for this record.</summary>
public DateTime? LastSyncedAt { get; set; }
}
@@ -33,6 +33,7 @@ public interface IUnitOfWork : IDisposable
IRepository<QuoteItemPrepService> QuoteItemPrepServices { get; }
IRepository<QuoteChangeHistory> QuoteChangeHistories { get; }
IRepository<InventoryItem> InventoryItems { get; }
IPlainRepository<PowderCatalogItem> PowderCatalog { get; }
IInventoryTransactionRepository InventoryTransactions { get; }
IRepository<Equipment> Equipment { get; }
IRepository<OvenCost> OvenCosts { get; }