inventree / InvenTree

Open Source Inventory Management System
https://docs.inventree.org
MIT License
4.12k stars 740 forks source link

Direct barcode entry #1087

Open rco3 opened 3 years ago

rco3 commented 3 years ago

PartKeepr did this neat thing: you could assign a key combination that caused the following text to be piped directly into the barcode decoding module. If your wedge was fancy enough, you could assign that key combo as a prefix and a CR/LF as the suffix and simply scan a barcode into any page without focusing on a text entry field. Open webpage, scan barcode, StockItem appears.

Is this the sort of thing that Django inherently supports, such that this is a super-simple "hey, great idea!" kind of feature suggestion, or more of a "No, we would have to re-write Django ground-up, take a hike," kind of thing?

SchrodingersGat commented 3 years ago

Interesting concept. It's not something that Django supports per se, but it would be reasonably easy to handle on the front-end using javascript.

Essentially, setup some sort of key-press sequence event listener which responds to something that looks like barcode data, silently send that data to the server via AJAX, and wait for a response.

If the server recognizes the barcode data it can send back an instruction to the javascript function running in the browser, with an action to perform.

For example, jump to the page displaying the item that has just been scanned.

rco3 commented 3 years ago

Yes, exactly that. Or, depending upon perhaps which page is currently active, might default to other action upon the entity whose barcode was just scanned, e.g. counting or transferring or something. I imagine a small kiosk with a scanner, walk a part label up to it and scan it and it's automatically placed in a queue for re-supply, that kind of thing.

amishHammer commented 3 years ago

Take a look at this jQuery module, it works well, you can configure it to detect the prefix keystrokes from your wedge and then act on the key data it receives after that:

https://github.com/julien-maurel/jQuery-Scanner-Detection

I have used it in opencart to automatically take you to the order details page after scanning a barcode that is either on the box or the shipping manifest.

matmair commented 2 years ago

@SchrodingersGat is this something we should implement?

SchrodingersGat commented 2 years ago

I'd be open to it, but don't have time or desire to implement it myself. Looks like the jquery-scanner-detection library is outdated, might want to use https://github.com/axenox/onscan.js instead

matmair commented 2 years ago

@SchrodingersGat should we tag this for hacktoberfest?

SchrodingersGat commented 2 years ago

Done!