fix to remove fallback from LCSC barcode part resolver as the PC code is the ultimate source of truth.

This commit is contained in:
swdee 2026-03-09 10:48:57 +13:00
parent 343c078b7d
commit fb22117f10

View file

@ -217,7 +217,6 @@ final readonly class BarcodeScanResultHandler
* Resolve LCSC barcode -> Part. * Resolve LCSC barcode -> Part.
* Strategy: * Strategy:
* 1) Try providerReference.provider_id == pc (LCSC "Cxxxxxx") if you store it there * 1) Try providerReference.provider_id == pc (LCSC "Cxxxxxx") if you store it there
* 2) Fallback to manufacturer_product_number == pm (MPN)
* Returns first match (consistent with EIGP114 logic) * Returns first match (consistent with EIGP114 logic)
*/ */
private function resolvePartFromLCSC(LCSCBarcodeScanResult $barcodeScan): ?Part private function resolvePartFromLCSC(LCSCBarcodeScanResult $barcodeScan): ?Part
@ -231,15 +230,10 @@ final readonly class BarcodeScanResultHandler
} }
} }
// Fallback to MPN (pm) // part does not exist in DB
$pm = $barcodeScan->mpn; // e.g. RC0402FR-071ML
if (!$pm) {
return null; return null;
} }
return $this->em->getRepository(Part::class)->getPartByMPN($pm);
}
/** /**
* Tries to extract creation information for a part from the given barcode scan result. This can be used to * Tries to extract creation information for a part from the given barcode scan result. This can be used to