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:
@@ -24,6 +24,8 @@ public class InventoryItemDto
|
||||
public bool RequiresClearCoat { get; set; }
|
||||
public string? SpecPageUrl { get; set; }
|
||||
public string? ImageUrl { get; set; }
|
||||
public string? SdsUrl { get; set; }
|
||||
public string? TdsUrl { get; set; }
|
||||
public decimal QuantityOnHand { get; set; }
|
||||
public string UnitOfMeasure { get; set; } = "lbs";
|
||||
public decimal ReorderPoint { get; set; }
|
||||
@@ -149,6 +151,14 @@ public class CreateInventoryItemDto
|
||||
[Display(Name = "Product Image URL")]
|
||||
public string? ImageUrl { get; set; }
|
||||
|
||||
[StringLength(1000, ErrorMessage = "URL cannot exceed 1000 characters")]
|
||||
[Display(Name = "Safety Data Sheet URL")]
|
||||
public string? SdsUrl { get; set; }
|
||||
|
||||
[StringLength(1000, ErrorMessage = "URL cannot exceed 1000 characters")]
|
||||
[Display(Name = "Technical Data Sheet URL")]
|
||||
public string? TdsUrl { get; set; }
|
||||
|
||||
[Range(0, 999999999, ErrorMessage = "Quantity on hand must be 0 or greater")]
|
||||
[Display(Name = "Quantity on Hand")]
|
||||
public decimal QuantityOnHand { get; set; }
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
namespace PowderCoating.Application.DTOs.Inventory;
|
||||
|
||||
/// <summary>Result returned by the catalog lookup endpoint to auto-fill inventory fields.</summary>
|
||||
public class PowderCatalogLookupResult
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string VendorName { get; set; } = string.Empty;
|
||||
public string Sku { get; set; } = string.Empty;
|
||||
public string ColorName { get; set; } = string.Empty;
|
||||
public string? Description { get; set; }
|
||||
public decimal UnitPrice { 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; }
|
||||
public bool IsDiscontinued { get; set; }
|
||||
|
||||
// Coating specs — populated for scan-contributed entries and AI-augmented lookups
|
||||
public decimal? CureTemperatureF { get; set; }
|
||||
public int? CureTimeMinutes { get; set; }
|
||||
public string? Finish { get; set; }
|
||||
public string? ColorFamilies { get; set; }
|
||||
public bool? RequiresClearCoat { get; set; }
|
||||
public decimal? CoverageSqFtPerLb { get; set; }
|
||||
public decimal? TransferEfficiency { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Stats shown on the SuperAdmin Powder Catalog management page.</summary>
|
||||
public class PowderCatalogStatsDto
|
||||
{
|
||||
public int TotalProducts { get; set; }
|
||||
public int ActiveProducts { get; set; }
|
||||
public int DiscontinuedProducts { get; set; }
|
||||
public int VendorCount { get; set; }
|
||||
public int UserContributedProducts { get; set; }
|
||||
public DateTime? LastImportedAt { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Result returned after a catalog import operation.</summary>
|
||||
public class PowderCatalogImportResult
|
||||
{
|
||||
public bool Success { get; set; }
|
||||
public int Inserted { get; set; }
|
||||
public int Updated { get; set; }
|
||||
public int Skipped { get; set; }
|
||||
public int Errors { get; set; }
|
||||
public string? ErrorMessage { get; set; }
|
||||
}
|
||||
@@ -40,4 +40,16 @@ public interface IInventoryAiLookupService
|
||||
string? colorName,
|
||||
string? colorCode,
|
||||
string? partNumber);
|
||||
|
||||
/// <summary>
|
||||
/// Fetch cure specs, color families, finish, and clear-coat data from a known product URL.
|
||||
/// Skips the Serper search step; used after a catalog hit to augment catalog fields.
|
||||
/// </summary>
|
||||
Task<InventoryAiLookupResult> LookupByUrlAsync(string url, string? colorName);
|
||||
|
||||
/// <summary>
|
||||
/// Read a powder label photo and extract manufacturer, color name, SKU, and cure specs
|
||||
/// using Claude vision. Used by the in-browser label scanner.
|
||||
/// </summary>
|
||||
Task<InventoryAiLookupResult> ScanLabelAsync(string base64Image, string mediaType);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user