-
-
Notifications
You must be signed in to change notification settings - Fork 180
Label Scanner Enhancements: LCSC barcode, create part, augmented scanning #1194
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
base: master
Are you sure you want to change the base?
Conversation
|
I have setup a test server instance of Part-DB with these PR changes for end user to try out.
InstructionsLogin with the above credentials and click on the Check the Feedback RequestPlease provide feedback on UI usage, bugs, or any problems you experience with these enhancements. |
…canning subsequent parts was not possible without reloading the browser page. fixed the barcode scanner initialization and shutdown so it redraws properly after part not found
…nd mouser barcodes. added create part button if part does not exist in database
…ookup to see part storage location quickly
…checkbox. changed barcode scanner to use XHR callback for barcode decoding to avoid problems with form submission and camera caused by page reloaded when part not found.
…art lots. made scan result messages conditional for parts or other non-part barcodes
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1194 +/- ##
============================================
+ Coverage 58.23% 58.34% +0.11%
- Complexity 7430 7510 +80
============================================
Files 582 583 +1
Lines 23644 23877 +233
============================================
+ Hits 13768 13932 +164
- Misses 9876 9945 +69 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hey, The functionality for handling what should happen for part creation should be extracted to its own service. |
To confirm what you mean. We should;
This would then leave |
|
I just tried it out with a few LCSC components I had lying around, works flawlessly |
|
@jbtronics I will be away from my development environment for a couple of weeks, when I get back I will rebase the code and make any changes you recommend after you have had time to review. |


Overview
This PR makes changes to the Label Scanner to enhance its functionality in the following ways.
These improvements provide a solution to the open issues #937 #520
It also provides functions for addressing #464
Use Case
In addition to the open Issues above, my use case for these enhancements is as follows.
I have 500+ components and loading them into Part-DB is a difficult and slow task, using the Tools->Create parts from info provider tool is slow to type in the Part numbers, it would be much easier to scan the vendor barcodes to create Parts.
The next problem is the Scanner only loads barcodes of Parts with a Part-DB barcode. It would be a hard task for someone wanting to use or migrate to Part-DB and having to load and print hundreds of labels/stickers for the Scanner to be usable.
Supplier barcodes (lcsc, mouser etc) already have all the necessary information on their labels to make the system work. There is however one important piece missing from the supplier label and that is the Storage Location. By providing an augmented view we can quickly scan the supplier barcode to return the component to its correct Storage location. This avoids the more complicated and current workflow of scanning a barcode, redirecting to the part page, clicking on the Stocks tab, then returning to the scanner page which has to go through the camera initialization routine again.
Demo
The existing function of Scanning parts and redirecting to the Part page has been preserved, to use these new enhancements tick the
Info Modecheckbox to activate them.The following video demonstrates the Augmented view which allows you to scan quickly supplier barcodes to perform part lookup and storage location retreival.
scan-parts-quickly.mp4
In the next video it demonstrates how you can create a new part when it is not found as well as showing support for decoding LCSC, Digikey, and Mouser barcodes.
add-parts-from-scan.mp4
Camera Bugs
Whilst developing these enhancements we have also fixed a number of bugs in the scanner, the CSRF token failure in #1191 and we found in Info Mode the camera would constantly connect and disconnect and sometimes become invisible/broken on view requiring a page reload in the browser.
To fix these we changed the architecure of the Scanner page to perform XHR requests for the barcode decoding, and then on the client side we either redirect to the Parts page to preverse the existing function, or display the decoded and augmented information. This allows us to stay on the Scanner page without causing the QR Code scanner to be constructed and destructed all the time.
As the QR Code scanner is persistently scanning, we also implemented logic to only do an XHR callback when it sees a new barcode to avoid multiple requests of the same barcode to the server. In comparison to the existing/old function which resulted in a reload loop in the browser after we fixed the QR Code scanner construct/destruct issues causing the camera interface to break under undetermined race conditions.
Development Status
This code is not yet ready to be merged, from our side we need;
People to test this for any bugs or edge cases we have not come across.
We are not sure how the Translation implementation works. For now we edited the translations/messages.en.xlf file and manually inserted our new language units. Would you please advise how we should approach this properly?
And of course we need feedback from the maintainers on our code changes.