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
@@ -3307,9 +3307,15 @@ namespace PowderCoating.Infrastructure.Migrations
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<string>("SdsUrl")
.HasColumnType("nvarchar(max)");
b.Property<string>("SpecPageUrl")
.HasColumnType("nvarchar(max)");
b.Property<string>("TdsUrl")
.HasColumnType("nvarchar(max)");
b.Property<decimal?>("TransferEfficiency")
.HasColumnType("decimal(18,2)");
@@ -5740,6 +5746,98 @@ namespace PowderCoating.Infrastructure.Migrations
b.ToTable("PlatformSettings");
});
modelBuilder.Entity("PowderCoating.Core.Entities.PowderCatalogItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ApplicationGuideUrl")
.HasColumnType("nvarchar(max)");
b.Property<string>("ColorFamilies")
.HasColumnType("nvarchar(max)");
b.Property<string>("ColorName")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<decimal?>("CoverageSqFtPerLb")
.HasColumnType("decimal(18,2)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<decimal?>("CureTemperatureF")
.HasColumnType("decimal(18,2)");
b.Property<int?>("CureTimeMinutes")
.HasColumnType("int");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("Finish")
.HasColumnType("nvarchar(max)");
b.Property<string>("ImageUrl")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDiscontinued")
.HasColumnType("bit");
b.Property<bool>("IsUserContributed")
.HasColumnType("bit");
b.Property<DateTime?>("LastSyncedAt")
.HasColumnType("datetime2");
b.Property<string>("PriceTiersJson")
.HasColumnType("nvarchar(max)");
b.Property<string>("ProductUrl")
.HasColumnType("nvarchar(max)");
b.Property<bool?>("RequiresClearCoat")
.HasColumnType("bit");
b.Property<string>("SdsUrl")
.HasColumnType("nvarchar(max)");
b.Property<string>("Sku")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<string>("TdsUrl")
.HasColumnType("nvarchar(max)");
b.Property<decimal?>("TransferEfficiency")
.HasColumnType("decimal(18,2)");
b.Property<decimal>("UnitPrice")
.HasColumnType("decimal(18,2)");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("datetime2");
b.Property<string>("VendorName")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("ColorName")
.HasDatabaseName("IX_PowderCatalogItems_ColorName");
b.HasIndex("VendorName", "Sku")
.IsUnique()
.HasDatabaseName("IX_PowderCatalogItems_Vendor_Sku");
b.ToTable("PowderCatalogItems");
});
modelBuilder.Entity("PowderCoating.Core.Entities.PowderUsageLog", b =>
{
b.Property<int>("Id")
@@ -5930,7 +6028,7 @@ namespace PowderCoating.Infrastructure.Migrations
{
Id = 1,
CompanyId = 0,
CreatedAt = new DateTime(2026, 5, 2, 0, 26, 49, 381, DateTimeKind.Utc).AddTicks(4933),
CreatedAt = new DateTime(2026, 5, 3, 20, 30, 44, 955, DateTimeKind.Utc).AddTicks(5184),
Description = "Standard pricing for regular customers",
DiscountPercent = 0m,
IsActive = true,
@@ -5941,7 +6039,7 @@ namespace PowderCoating.Infrastructure.Migrations
{
Id = 2,
CompanyId = 0,
CreatedAt = new DateTime(2026, 5, 2, 0, 26, 49, 381, DateTimeKind.Utc).AddTicks(4939),
CreatedAt = new DateTime(2026, 5, 3, 20, 30, 44, 955, DateTimeKind.Utc).AddTicks(5189),
Description = "5% discount for preferred customers",
DiscountPercent = 5m,
IsActive = true,
@@ -5952,7 +6050,7 @@ namespace PowderCoating.Infrastructure.Migrations
{
Id = 3,
CompanyId = 0,
CreatedAt = new DateTime(2026, 5, 2, 0, 26, 49, 381, DateTimeKind.Utc).AddTicks(4941),
CreatedAt = new DateTime(2026, 5, 3, 20, 30, 44, 955, DateTimeKind.Utc).AddTicks(5191),
Description = "10% discount for premium customers",
DiscountPercent = 10m,
IsActive = true,