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) {
|
if ($barcodeScan instanceof LCSCBarcodeScanResult) {
|
||||||
return $this->resolvePartFromLCSC($barcodeScan)
|
return $this->resolvePartFromLCSC($barcodeScan);
|
||||||
?? $this->em->getRepository(Part::class)->getPartBySPN($barcodeScan->mpn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($barcodeScan instanceof AmazonBarcodeScanResult) {
|
if ($barcodeScan instanceof AmazonBarcodeScanResult) {
|
||||||
|
|
@ -219,6 +218,7 @@ final readonly class BarcodeScanResultHandler
|
||||||
* 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
|
||||||
* Returns first match (consistent with EIGP114 logic)
|
* Returns first match (consistent with EIGP114 logic)
|
||||||
|
* 2) Fallback to search across supplier part number (SPN)
|
||||||
*/
|
*/
|
||||||
private function resolvePartFromLCSC(LCSCBarcodeScanResult $barcodeScan): ?Part
|
private function resolvePartFromLCSC(LCSCBarcodeScanResult $barcodeScan): ?Part
|
||||||
{
|
{
|
||||||
|
|
@ -231,8 +231,8 @@ final readonly class BarcodeScanResultHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// part does not exist in DB
|
// fallback to search by SPN
|
||||||
return null;
|
return $this->em->getRepository(Part::class)->getPartBySPN($pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue