2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-16 12:15:31 +00:00

[refactor] Scan improvements (#577)

* Handle error on unexpected barcode response

* Add ManufacturerPart detail view

* Support barcode scanning for manufacturer part

* Refactoring for null checks

* Ignore selected errors in sentry

* Fix API implementation for ManufacturerPart

* Update release notes

* More error handling

* Decode quantity betterer

* Refactoring

* Add option to confirm checkin details

* Improve response handlign

* Cleanup

* Remove unused imports

* Fix async function

* Fix for assigning custom barcode

* Handle barcode scan result for company

* Fix

* Adjust scan priority

* Refactoring MODEL_TYPE

- Use instead of duplicated const strings

* @override fix
This commit is contained in:
Oliver
2024-12-14 15:24:23 +11:00
committed by GitHub
parent 6b179d108c
commit 524c5469f1
24 changed files with 576 additions and 220 deletions

View File

@ -79,14 +79,27 @@ class BarcodeHandler {
return;
}
var response = await InvenTreeAPI().post(
APIResponse? response;
try {
response = await InvenTreeAPI().post(
url,
body: {
"barcode": barcode,
...extra_data,
},
expectedStatusCode: null, // Do not show an error on "unexpected code"
);
expectedStatusCode: null, // Do not show an error on "unexpected code"
);
} catch (error, stackTrace) {
sentryReportError("Barcode.processBarcode", error, stackTrace);
response = null;
}
if (response == null) {
barcodeFailureTone();
showSnackIcon(L10().barcodeError, success: false);
return;
}
debug("Barcode scan response" + response.data.toString());
@ -94,7 +107,7 @@ class BarcodeHandler {
// Handle strange response from the server
if (!response.isValid() || !response.isMap()) {
onBarcodeUnknown({});
await onBarcodeUnknown({});
showSnackIcon(L10().serverError, success: false);