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
@@ -279,6 +279,12 @@ public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
/// </summary>
public DbSet<SubscriptionPlanConfig> SubscriptionPlanConfigs { get; set; }
/// <summary>
/// Platform-level master list of powder coating products across all vendors.
/// Not tenant-scoped — no global query filters applied.
/// </summary>
public DbSet<PowderCatalogItem> PowderCatalogItems { get; set; }
/// <summary>User-submitted bug reports; tenant-filtered with soft delete.</summary>
public DbSet<BugReport> BugReports { get; set; }
/// <summary>File attachments for bug reports; soft-delete only (no tenant filter — access controlled via parent BugReport).</summary>
@@ -1680,6 +1686,16 @@ public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
.IsUnique()
.HasDatabaseName("IX_NotificationTemplates_Company_Type_Channel");
// PowderCatalogItem — platform-level, no tenant filter, unique on (VendorName, Sku)
modelBuilder.Entity<PowderCatalogItem>()
.HasIndex(p => new { p.VendorName, p.Sku })
.IsUnique()
.HasDatabaseName("IX_PowderCatalogItems_Vendor_Sku");
modelBuilder.Entity<PowderCatalogItem>()
.HasIndex(p => p.ColorName)
.HasDatabaseName("IX_PowderCatalogItems_ColorName");
// OvenBatch → Equipment (nullable, legacy — batches are historical records)
modelBuilder.Entity<OvenBatch>()
.HasOne(b => b.Equipment)