mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-16 20:28:19 +01:00
Bug fix: Remove fallback from LCSC barcode part resolver (#1302)
This commit is contained in:
@@ -217,8 +217,8 @@ final readonly class BarcodeScanResultHandler
|
||||
* Resolve LCSC barcode -> Part.
|
||||
* Strategy:
|
||||
* 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)
|
||||
* 2) Fallback to search across supplier part number (SPN)
|
||||
*/
|
||||
private function resolvePartFromLCSC(LCSCBarcodeScanResult $barcodeScan): ?Part
|
||||
{
|
||||
@@ -231,13 +231,8 @@ final readonly class BarcodeScanResultHandler
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback to MPN (pm)
|
||||
$pm = $barcodeScan->mpn; // e.g. RC0402FR-071ML
|
||||
if (!$pm) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->em->getRepository(Part::class)->getPartByMPN($pm);
|
||||
// fallback to search by SPN
|
||||
return $this->em->getRepository(Part::class)->getPartBySPN($pc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user