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

Added capability to scan Digikey barcodes and open the local part part page based on the result #811

Merged
merged 11 commits into from
Jan 4, 2025

Conversation

Treeed
Copy link
Contributor

@Treeed Treeed commented Dec 21, 2024

All of the digikey bags already have barcodes with all the information needed to find a part, so registering the barcodes individually doesn't seem so useful. I added a decoder for the digikey barcodes which allows directly jumping to the part without registering the barcode. It should be noted, that the current implementation of the barcode scanner is hardly able to scan Digikey's Datamatrix codes, so more work needs to be done to make this pull request useful.
See this discussion for more info: #808

This feature has a bit of an issue naming wise. The existing implementation already defines vendor barcodes as user defined ids that can be added as a way to identify a lot (and find that lot by scanning a barcode with that id). I find that naming very confusing, because the way the feature works doesn't care about whether this is a vendor barcode or anything else that you're adding; it's just any user defined scanned string that you want to use. When I first found that feature it took me a good while to understand what it actually does, especially since I could find any documentation on it and I didn't manage to connect the name "part lot" to "part stock".
Since this pull request adds support for actually reading and extracting the information from, specifically, vendor barcodes I felt it would be best to rename the old feature to "user defined barcodes". I found however, that the naming spans across so many files, that the merit is questionable. In the files I committed I started this renaming process but didn't complete it across all usages of the term "vendor" in properties and variables. (variable names for the same variable are consistent, i.e. no functionality is broken, only the naming among different variables or properties is not consistent)
Generally, introducing barcodes that actually contain information is rather different from the old concept where a barcode was just an identifier. I have created a new data class VendorBarcodeScanResult, but that means some of the functions now have to handle two different kinds of objects. Maybe it makes sense to separate concerns further and break the interpretation of id barcodes and information barcodes up into two classes. Also, in contrast to id barcodes, vendor barcode formats should be easy to add. It might make sense to create a list of known formats and corresponding parser functions somewhere and use that to generate the options in the ui and try out the different parsers

@jbtronics jbtronics merged commit 9e85b70 into Part-DB:master Jan 4, 2025
14 checks passed
@jbtronics
Copy link
Member

Thank you.
I have extracted the EIGP114 decoding into its own data class, so that you can access the label info in a typesafe way, and hopefully be able to reuse that info in other places.

Also I added a little option to just list all the decoded content of a barcode in the scanner tool:

image

Copy link

codecov bot commented Jan 4, 2025

Codecov Report

Attention: Patch coverage is 64.24242% with 59 lines in your changes missing coverage. Please review.

Project coverage is 60.81%. Comparing base (9c99217) to head (9284764).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...s/LabelSystem/BarcodeScanner/BarcodeRedirector.php 33.33% 32 Missing ⚠️
...System/BarcodeScanner/EIGP114BarcodeScanResult.php 81.81% 12 Missing ⚠️
...elSystem/BarcodeScanner/LocalBarcodeScanResult.php 0.00% 6 Missing ⚠️
...s/LabelSystem/BarcodeScanner/BarcodeScanHelper.php 77.27% 5 Missing ⚠️
src/Controller/ScanController.php 62.50% 3 Missing ⚠️
src/DataFixtures/PartFixtures.php 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #811      +/-   ##
============================================
- Coverage     60.86%   60.81%   -0.05%     
- Complexity     5887     5925      +38     
============================================
  Files           523      524       +1     
  Lines         19919    20040     +121     
============================================
+ Hits          12123    12187      +64     
- Misses         7796     7853      +57     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants