-
Notifications
You must be signed in to change notification settings - Fork 15
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
5390 correctly handle gs1 2d data matrix format #5401
base: v2.4.0
Are you sure you want to change the base?
5390 correctly handle gs1 2d data matrix format #5401
Conversation
Bundle size differenceComparing this PR to
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working great! Thanks James π
Maybe/probably should remove the parsing of human readable string? Figured I'd leave it there for now as it might come in handy, and I didn't want to have to re-create data for all my tests cases and aiming for minimal changes here :)
I feel ok leaving it there, it's pretty isolated and comes in handy for testing if nothing else π
client/packages/coldchain/src/Equipment/ListView/AddFromScannerButton.tsx
Outdated
Show resolved
Hide resolved
client/packages/coldchain/src/Equipment/ListView/AddFromScannerButton.tsx
Show resolved
Hide resolved
client/packages/coldchain/src/Equipment/ListView/AddFromScannerButton.tsx
Outdated
Show resolved
Hide resolved
HAHA kidding wait I built it I didn't test hold fire |
#exposed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I see the issue, doing a quick test build now, will update you :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok there are two issues:
The parseResult
being called in the electron scanning code, but not for android:
open-msupply/client/packages/common/src/utils/BarcodeScannerContext.tsx
Lines 173 to 190 in 1d76ccd
if (hasNativeBarcodeScanner) { | |
setIsScanning(true); | |
const timeout = setTimeout(async () => { | |
await stopScan(); | |
if (!hasElectronApi) error(t('error.unable-to-read-barcode'))(); | |
}, SCAN_TIMEOUT_IN_MS); | |
// Check camera permission | |
await BarcodeScannerPlugin.checkPermission({ force: true }); | |
// make background of WebView transparent | |
BarcodeScannerPlugin.hideBackground(); | |
const result = await BarcodeScannerPlugin.startScan(); // start scanning and wait for a result | |
clearTimeout(timeout); | |
setIsScanning(false); | |
BarcodeScannerPlugin.showBackground(); | |
callback(result); | |
} |
However, I added the parseResult
call there, and still the gs1 result of parseBarcode
is coming back empty... don't have time to investigate further tonight sorry, I think a tomorrow problem π
Dang, was hopeful! Thanks for testing! |
Fixes #5390
π©π»βπ» What does this PR do?
I tried to make minimal changes for this, but it should allow us to scan GS1 formatted barcodes and create assets from them.
π Any notes for the reviewer?
Maybe/probably should remove the parsing of human readable string? Figured I'd leave it there for now as it might come in handy, and I didn't want to have to re-create data for all my tests cases and aiming for minimal changes here :)
Thoughts on this?
π§ͺ Testing
Scan
button (this doesn't show on web)Scan a GS1 formatted Data Matrix here (Note: or create your own for testing)
PQS Asset Type: E003/002
Serial Number: S12345678
https://bwipjs-api.metafloor.com/?bcid=gs1datamatrix&text=(01)09506000134352(11)241007(21)S12345678(241)E003/002(3121)820000(3131)670000(3111)630000(90)001(91)241007-310101
PQS Asset Type: E004/055
Serial Number: S1
https://bwipjs-api.metafloor.com/?bcid=gs1datamatrix&text=(01)09506000134352(11)241007(21)S1(241)E004/055(3121)820000(3131)670000(3111)630000(90)001(91)241007-310101
PQS Asset Type: E004/055
Serial Number S2
https://bwipjs-api.metafloor.com/?bcid=gs1datamatrix&text=(01)09506000134352(11)241007(21)S1(241)E004/055(3121)820000(3131)670000(3111)630000(90)001(91)241007-310101
π Documentation
1.
2.