OBLS-936 Fix duplicate product scan in sorted putaway on DataWedge scans - #444
Conversation
The user-directed putaway list decided whether a validation scan was required from React state written in ScannerInput's onChange handler. A DataWedge scan arrives as an intent broadcast, which calls onChange and onSubmit back to back in the same tick, so the submit handler still read the previous value and treated the scan as a manual entry. The product then had to be scanned again after the destination. Keep the flag in a ref so it updates synchronously and both input paths agree. Only the intent path is affected, so this reproduces on Zebra devices running the DataWedge profile (confirmed on TC52 and TC53) but not on the emulator, on keystroke wedge scanners, or when the code is typed by hand, where the submit lands in a later tick.
awalkowiak
left a comment
There was a problem hiding this comment.
@jmiranda Do you have an option to test it from the experimental build?
|
@awalkowiak yes, i can use the experimental build or build the branch locally. |
…nner
DataWedge rejected every profile config the app sent, logging
"Key PROFILE_ENABLED expected String but value was a java.lang.Boolean"
and the same for RESET_CONFIG, so the OPENBOXES profile was never
enabled and the integrated scanner did not deliver scans to the app.
react-native-datawedge-intents builds the config bundle by calling
String.valueOf() on the object it is given and re-parsing the result as
JSON. A nested object arrives at the native side as a Java Map, whose
toString() ("{PROFILE_ENABLED=true, ...}") re-parses with unquoted values
as booleans and numbers - DataWedge requires Strings there and drops
them. Serialising the config with JSON.stringify keeps every value a
String; the bridge parses the JSON into the same nested bundle.
Also associate the profile with the package the app is actually running
under (DeviceInfo.getBundleId()) instead of a hardcoded
com.openboxes.android, so branded and experimental builds whose
applicationId carries a suffix activate the profile too.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HePztn8cebd1ecp7pmZrPv
|
@olewandowski1 @awalkowiak Not sure if you saw this but I (Claude) added a potential fix to this last week. I tested this on the Zebra TC20 and TC52. We probably need to test in the emulator as well as with an external barcode scanner to see how it behaves. |
There was a problem hiding this comment.
Pull request overview
Fixes an issue in the sorted putaway task list where DataWedge hardware scans could be misclassified as manual entry due to onChange/onSubmit occurring in the same tick, leading to duplicate/incorrect scan handling.
Changes:
- Track “scan vs manual” using a ref in
PutawayTaskListScreensoonSubmitsees the updated flag immediately for DataWedge scans. - Update DataWedge profile configuration to use the app’s runtime bundle ID and to send config as JSON strings to preserve DataWedge’s expected “all values are strings” behavior.
- Split/clarify DataWedge config constants into
getProfileConfig(...)andINTENT_OUTPUT_CONFIG.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/screens/SortationPutaway/PutawayTaskListScreen.tsx |
Switches enteredManually tracking from state to a ref to correctly classify DataWedge scan submissions. |
src/hooks/useScanListener.ts |
Adjusts DataWedge profile setup to use runtime bundle ID and sends profile config via JSON strings for correct native parsing. |
src/hooks/constant.ts |
Refactors DataWedge config constants to support dynamic package names and intent output configuration with string-only values. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@olewandowski1 could you review this sometime this week? |
|
@jmiranda @awalkowiak I just tested it on the emulator, all works as expected. Scan path takes me directly to the Putaway Qty screen, manual path redirects to Putaway Product and the validation scan is required. In that case I believe we're good to go. |
https://openboxes.atlassian.net/browse/OBLS-936
Changes:
Before:
https://github.com/user-attachments/assets/fb5bc4ba-f522-434a-a929-842e4344d299
After:
https://github.com/user-attachments/assets/17706681-43e2-41a0-a58c-9f3aa4bbe985