mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-05-19 18:01:30 +00:00
change SPN fallback to be in resolvePartFromLCSC() using PC code for lookup
This commit is contained in:
parent
e11c73aa6d
commit
c4fa30851a
1 changed files with 4 additions and 4 deletions
|
|
@ -142,8 +142,7 @@ final readonly class BarcodeScanResultHandler
|
|||
}
|
||||
|
||||
if ($barcodeScan instanceof LCSCBarcodeScanResult) {
|
||||
return $this->resolvePartFromLCSC($barcodeScan)
|
||||
?? $this->em->getRepository(Part::class)->getPartBySPN($barcodeScan->mpn);
|
||||
return $this->resolvePartFromLCSC($barcodeScan);
|
||||
}
|
||||
|
||||
if ($barcodeScan instanceof AmazonBarcodeScanResult) {
|
||||
|
|
@ -219,6 +218,7 @@ final readonly class BarcodeScanResultHandler
|
|||
* Strategy:
|
||||
* 1) Try providerReference.provider_id == pc (LCSC "Cxxxxxx") if you store it there
|
||||
* Returns first match (consistent with EIGP114 logic)
|
||||
* 2) Fallback to search across supplier part number (SPN)
|
||||
*/
|
||||
private function resolvePartFromLCSC(LCSCBarcodeScanResult $barcodeScan): ?Part
|
||||
{
|
||||
|
|
@ -231,8 +231,8 @@ final readonly class BarcodeScanResultHandler
|
|||
}
|
||||
}
|
||||
|
||||
// part does not exist in DB
|
||||
return null;
|
||||
// fallback to search by SPN
|
||||
return $this->em->getRepository(Part::class)->getPartBySPN($pc);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue