Files
PowderCoatingLogix/src/PowderCoating.Application/Interfaces/IInventoryAiLookupService.cs
T
spouliot fc35fd123c Add IsIncoming inventory flag and catalog-to-incoming powder flow in item wizard
- InventoryItem.IsIncoming: marks powder ordered but not yet received; enables QR code
  printing on work orders while the shipment is in transit
- InventoryController.CreateIncomingFromCatalog: POST endpoint creates a 0-balance inventory
  record from a PowderCatalogItem and returns it in wizard-compatible shape
- item-wizard.js: custom coat tab now searches the platform powder catalog as a fallback;
  catalog results show an 'Add as Incoming Order' option; createIncomingFromCatalog POSTs
  to server and selects the new item without a page refresh
- QuoteItemCoatDto: CatalogItemId + AddAsIncoming fields so the wizard can signal server-side
  incoming-item creation during quote save
- Inventory Create/Edit/Index views: IsIncoming badge and field
- IInventoryAiLookupService: minor interface update
- Migration: AddInventoryIsIncoming

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 20:47:19 -04:00

68 lines
3.2 KiB
C#

namespace PowderCoating.Application.Interfaces;
public class InventoryAiLookupResult
{
public bool Success { get; set; }
public string? ErrorMessage { get; set; }
// Identity
public string? Manufacturer { get; set; }
public string? ManufacturerPartNumber { get; set; }
public string? ColorName { get; set; }
public string? ColorCode { get; set; }
public string? Description { get; set; }
// Coating specs
public string? Finish { get; set; }
public decimal? CureTemperatureF { get; set; }
public int? CureTimeMinutes { get; set; }
public string? ColorFamilies { get; set; } // comma-separated e.g. "Green,Blue"
public bool? RequiresClearCoat { get; set; }
// Application properties
public decimal? SpecificGravity { get; set; } // used to derive theoretical coverage when docs omit coverage
public decimal? CoverageSqFtPerLb { get; set; } // typical ~80-120 sq ft/lb
public decimal? TransferEfficiency { get; set; } // typical 50-75%
public decimal? UnitCostPerLb { get; set; } // price per lb/unit if found in search results
public string? VendorName { get; set; } // manufacturer/vendor name for dropdown matching
public string? SpecPageUrl { get; set; } // URL of the product page that was fetched
public string? ImageUrl { get; set; } // og:image or first product image found on the page
public string? SdsUrl { get; set; } // Safety Data Sheet URL if found on product page
public string? TdsUrl { get; set; } // Technical Data Sheet URL if found on product page
public string? Reasoning { get; set; } // brief explanation of what was found
}
public interface IInventoryAiLookupService
{
/// <summary>
/// Search the web for powder coating product info and use AI to extract structured data.
/// </summary>
Task<InventoryAiLookupResult> LookupAsync(
string? manufacturer,
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.
/// When <paramref name="tdsFallbackUrl"/> is supplied and cure specs are still null after
/// the main fetch, the TDS page is tried automatically before returning.
/// </summary>
Task<InventoryAiLookupResult> LookupByUrlAsync(string url, string? colorName, string? tdsFallbackUrl = null);
/// <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);
/// <summary>
/// Fetches a Technical Data Sheet URL and extracts cure temperature and cure time.
/// Called when the main lookup found a TDS URL but cure specs are still missing.
/// Returns Success=false silently (no UI error) when the TDS is a PDF or unreachable.
/// </summary>
Task<InventoryAiLookupResult> FetchTdsCureSpecsAsync(string tdsUrl, string? colorName);
}