Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Barcode scanning bug on Add Part page #305

Open
replaysMike opened this issue Jan 24, 2025 · 10 comments
Open

[Bug]: Barcode scanning bug on Add Part page #305

replaysMike opened this issue Jan 24, 2025 · 10 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@replaysMike
Copy link
Owner

Binner version

v2.6.3

Operating System

Windows 11

Describe the bug and the steps to reproduce it

When scanning a DigiKey part label to add the part to Binner, a BadRequest error is displayed even though the DigiKey api result returned the part. This appears to be a UI bug but needs further investigation. Not all parts encountered this issue.

The part appeared in the UI along with the error message (see screenshot)

Would you like to attach your appsetings.json configuration?

No response

Screenshots or Videos (Optional, but they help!)

Image

Are you able to contribute a PR? (No is ok!)

None

@replaysMike replaysMike added the bug Something isn't working label Jan 24, 2025
@replaysMike replaysMike added this to the v2.6.4 milestone Jan 24, 2025
@replaysMike replaysMike self-assigned this Jan 24, 2025
@wdtj
Copy link

wdtj commented Jan 27, 2025

Fresh install of binner (as well as trying this on the web site). Using NetumScan NSLS scanner with default settings. Set up Digikey Client ID and Secrets.

When I attempt to scan a DigiKey Part Label I get the error:

Image

@wdtj
Copy link

wdtj commented Jan 27, 2025

appsettings - Copy.json

@wdtj
Copy link

wdtj commented Jan 27, 2025

Ran output of scanner through cat and xxd (i.e. dumped the text in hex/ascii) and got this:

$ cat | xxd.exe
[)>06PBINNER ESD1PJ112-D26Z30PJ112-D26ZCT-NDK1K8982380910K1086008309D24161TGR160030AB11K14LCNQ2011ZPICK12Z350450613Z99999920Z00000000000000000000000000000000000
00000000: 5b29 3e1b 5b32 307e 3036 1b5b 3139 7e50  [)>.[20~06.[19~P
00000010: 4249 4e4e 4552 2045 5344 1b5b 3139 7e31  BINNER ESD.[19~1
00000020: 504a 3131 322d 4432 365a 1b5b 3139 7e33  PJ112-D26Z.[19~3
00000030: 3050 4a31 3132 2d44 3236 5a43 542d 4e44  0PJ112-D26ZCT-ND
00000040: 1b5b 3139 7e4b 1b5b 3139 7e31 4b38 3938  .[19~K.[19~1K898
00000050: 3233 3830 391b 5b31 397e 3130 4b31 3038  23809.[19~10K108
00000060: 3630 3038 3330 1b5b 3139 7e39 4432 3431  600830.[19~9D241
00000070: 361b 5b31 397e 3154 4752 3136 3030 3330  6.[19~1TGR160030
00000080: 4142 1b5b 3139 7e31 314b 311b 5b31 397e  AB.[19~11K1.[19~
00000090: 344c 434e 1b5b 3139 7e51 3230 1b5b 3139  4LCN.[19~Q20.[19
000000a0: 7e31 315a 5049 434b 1b5b 3139 7e31 325a  ~11ZPICK.[19~12Z
000000b0: 3335 3034 3530 361b 5b31 397e 3133 5a39  3504506.[19~13Z9
000000c0: 3939 3939 391b 5b31 397e 3230 5a30 3030  99999.[19~20Z000
000000d0: 3030 3030 3030 3030 3030 3030 3030 3030  0000000000000000
000000e0: 3030 3030 3030 3030 3030 3030 3030 3030  0000000000000000
000000f0: 3030 3030 3030 3030 3030 3030 3030 3030  0000000000000000
00000100: 3030 3030 3030 3030 3030 3030 3030 3030  0000000000000000
00000110: 3030 3030 3030 3030 3030 3030 3030 3030  0000000000000000
00000120: 3030 3030 3030 3030 301b 5b32 307e 1b5b  000000000.[20~.[

@wdtj
Copy link

wdtj commented Feb 14, 2025

Is there documentation on what format the barcode scanner should send it's messages. I see dozens of different options in the barcode reader manual.

I have tried several different configs on 2 different scanners.

@replaysMike
Copy link
Owner Author

that's a good question. I'm not aware if there's an actual standard here that should be applied as the barcode scanners all seem to vary by brand. I've bought a few barcode scanners and tried to add support for the different formats they output. I based most of my work on what DigiKey likes to see for barcode input in their API, and this has to do with how the Group Separator (GS) and Record Separators (RS) values are encoded. Most barcode scanners have a way to configure them, but many manufacturers have different default values.

I probably need to add more information to the Barcode wiki, and after doing some testing just now I can see it's not working very reliably. Could be from a browser update, or could have been affected by some other related changes in the past. I'll try to prioritize investigating and fixing this very soon, if anyone else has barcode scan data they can share it would help.

The support I wrote will try to convert different formats before they are processed in an attempt to standardize the input. So it's supposed to support the following GS code characters: \u001d, \u005d, \u241d (␝, ] , ␝) and for RS code characters: "\u001e", "\u005e", "\u241e" (␞,^ ,␞). The code for this translation is handled in the UI components BarcodeScannerInput.js

Here's the raw output from one of my barcode scanners (Tera 2D D5100), on a DigiKey part label:

[)>06PBINNER 24V CAB U71PAOZ2261BQI-2830P785-AOZ2261BQI-28CT-NDK1K8836736610K1067370119D24221TARN1154.0111K14LCNQ1011ZPICK12Z2224887213Z99999920Z000000000000000000000000000000000000000000000000000000000000000000000000

It's hard to see the unicode characters here, but here's what it looks like in the Binner Barcode Scanner tool where it is outputting the ␝ and ␞ characters in rawValueFormatted:

Image
{
  "type": "datamatrix",
  "value": {
    "description": "BINNER 24V CAB U7",
    "mfgPartNumber": "AOZ2261BQI-28",
    "salesOrder": "88367366",
    "invoice": "106737011",
    "unknown1": "1",
    "countryOfOrigin": "CN",
    "quantity": 10,
    "pick": "PICK",
    "partId": "22248872",
    "loadId": "999999"
  },
  "correctedValue": "[)>␞06␝PBINNER 24V CAB U7␝1PAOZ2261BQI-28␝30P785-AOZ2261BQI-28CT-ND␝K␝1K88367366␝10K106737011␝9D2422␝1TARN1154.01␝11K1␝4LCN␝Q10␝11ZPICK␝12Z22248872␝13Z999999␝20Z000000000000000000000000000000000000000000000000000000000000000000000000\r\r",
  "rawValue": "[)>06\u001dPBINNER 24V CAB U7\u001d1PAOZ2261BQI-28\u001d30P785-AOZ2261BQI-28CT-ND\u001dK\u001d1K88367366\u001d10K106737011\u001d9D2422\u001d1TARN1154.01\u001d11K1\u001d4LCN\u001dQ10\u001d11ZPICK\u001d12Z22248872\u001d13Z999999\u001d20Z000000000000000000000000000000000000000000000000000000000000000000000000\r",
  "rsDetected": false,
  "gsDetected": true,
  "eotDetected": false,
  "invalidBarcodeDetected": false,
  "rawValueFormatted": "[)>06␝PBINNER 24V CAB U7␝1PAOZ2261BQI-28␝30P785-AOZ2261BQI-28CT-ND␝K␝1K88367366␝10K106737011␝9D2422␝1TARN1154.01␝11K1␝4LCN␝Q10␝11ZPICK␝12Z22248872␝13Z999999␝20Z000000000000000000000000000000000000000000000000000000000000000000000000␍"
}

@replaysMike replaysMike modified the milestones: v2.6.4, v2.6.6 Feb 16, 2025
@wdtj
Copy link

wdtj commented Feb 17, 2025

I just got my Tera D5100. Decided wireless was much handier.

Unfortunately, it's got similar issues. Running this on the barcode tool (nice took BTW), it seems to recognize the bar code, but still returns errors from Digi-key.

Here's the output of my new D5100:

{
  "type": "datamatrix",
  "value": {
    "description": "15281066ND",
    "mfgPartNumber": "1206",
    "salesOrder": "89049100",
    "invoice": "107611037",
    "unknown1": "1",
    "countryOfOrigin": "CN",
    "quantity": 2,
    "pick": "PICK",
    "partId": "5022795",
    "loadId": "999999"
  },
  "correctedValue": "[)>␞06␝P15281066ND␝1P1206␝30P15281066ND␝K␝1K89049100␝10K107611037␝9D␝1T␝11K1␝4LCN␝Q2␝11ZPICK␝12Z5022795␝13Z999999␝20Z0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\r␄\r",
  "rawValue": "[)>06\u001dP15281066ND\u001d1P1206\u001d30P15281066ND\u001dK\u001d1K89049100\u001d10K107611037\u001d9D\u001d1T\u001d11K1\u001d4LCN\u001dQ2\u001d11ZPICK\u001d12Z5022795\u001d13Z999999\u001d20Z0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\r",
  "rsDetected": false,
  "gsDetected": true,
  "eotDetected": false,
  "invalidBarcodeDetected": false,
  "rawValueFormatted": "[)>06␝P15281066ND␝1P1206␝30P15281066ND␝K␝1K89049100␝10K107611037␝9D␝1T␝11K1␝4LCN␝Q2␝11ZPICK␝12Z5022795␝13Z999999␝20Z0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000␍"
}

Still get the errors:

Image

When I go to the settings/Digikey I can run the test and it says it's succeeding.

Image

@wdtj
Copy link

wdtj commented Feb 17, 2025

How should I have the Digikey API set up?

@replaysMike
Copy link
Owner Author

replaysMike commented Feb 19, 2025

Your configuration looks correct for DigiKey, assuming you have it correct on the DigiKey side. You may have already seen the help page for setting it up.

I'm taking a guess here but I think you're affected by the bug that's popped up in version 2.6.4 and 2.6.5. I'm currently trying to debug the cause and get a release pushed out to fix it - hopefully by today by worst case tomorrow.

@replaysMike
Copy link
Owner Author

yep, confirmed it's the same issue. I'll ping this issue once the new release is up for this

@replaysMike
Copy link
Owner Author

the issue you are seeing is actually a little different but also related to DigiKey search results, I've managed to fix this one (incorrect parametric filtering, some really old code but unrelated to barcode stuff) and once I've got the other one I'll get a release up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants