mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-16 12:15:31 +00:00
Stock location scan (#169)
* Add action for scanning a stock location into another location * Adds barcode scan handler for new functionality * Handle scanning of stock location * Cleanup * Refactor existing barcode scanning functions - Will require extensive testing and validation * Add entry to release notes * Delete dead code * Improved ordering based on stock quantity * Bug fix for 'adjustStock' function * Improve error responses for barcode scanning * Improve error responses for barcode scanning * Remove old debug statements * Add some extra explanatory texts * Icon change * Fixes for unit tests * Adds extra functionality for user profile manager * Refactor barcode code - do not rely on BuildContext * Adds initial unit testing for barcode scanning - Work on mocking barcode data - Add hooks for testing snackBar and audio files * Linting fixes * More barcode unit tests * Cleanup unit tests for barcode * Remove unused import * Handle HTTPException in API * Improvements for API unit testing * Unit testing for scanning item into location * Add unit test for scanning in items from a location context * Unit test for scanning location into parent location * Improve feedback for barcode scanning events
This commit is contained in:
@ -402,20 +402,23 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
||||
|
||||
Future<void> _unassignBarcode(BuildContext context) async {
|
||||
|
||||
final bool result = await item.update(values: {"uid": ""});
|
||||
final response = await item.update(values: {"uid": ""});
|
||||
|
||||
if (result) {
|
||||
showSnackIcon(
|
||||
L10().stockItemUpdateSuccess,
|
||||
success: true
|
||||
);
|
||||
} else {
|
||||
showSnackIcon(
|
||||
L10().stockItemUpdateFailure,
|
||||
success: false,
|
||||
);
|
||||
switch (response.statusCode) {
|
||||
case 200:
|
||||
case 201:
|
||||
showSnackIcon(
|
||||
L10().stockItemUpdateSuccess,
|
||||
success: true
|
||||
);
|
||||
break;
|
||||
default:
|
||||
showSnackIcon(
|
||||
L10().stockItemUpdateFailure,
|
||||
success: false,
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
refresh(context);
|
||||
}
|
||||
|
||||
@ -779,6 +782,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text(L10().transferStock),
|
||||
subtitle: Text(L10().transferStockDetail),
|
||||
leading: FaIcon(FontAwesomeIcons.exchangeAlt, color: COLOR_CLICK),
|
||||
onTap: () { _transferStockDialog(context); },
|
||||
)
|
||||
@ -788,6 +792,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text(L10().scanIntoLocation),
|
||||
subtitle: Text(L10().scanIntoLocationDetail),
|
||||
leading: FaIcon(FontAwesomeIcons.exchangeAlt, color: COLOR_CLICK),
|
||||
trailing: Icon(Icons.qr_code_scanner),
|
||||
onTap: () {
|
||||
@ -806,6 +811,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text(L10().barcodeAssign),
|
||||
subtitle: Text(L10().barcodeAssignDetail),
|
||||
leading: Icon(Icons.qr_code),
|
||||
trailing: Icon(Icons.qr_code_scanner),
|
||||
onTap: () {
|
||||
@ -815,17 +821,23 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
||||
values: {
|
||||
"uid": hash,
|
||||
}
|
||||
).then((result) {
|
||||
if (result) {
|
||||
barcodeSuccessTone();
|
||||
).then((response) {
|
||||
|
||||
showSnackIcon(
|
||||
L10().barcodeAssigned,
|
||||
success: true,
|
||||
icon: Icons.qr_code,
|
||||
);
|
||||
switch (response.statusCode) {
|
||||
case 200:
|
||||
case 201:
|
||||
barcodeSuccessTone();
|
||||
|
||||
refresh(context);
|
||||
showSnackIcon(
|
||||
L10().barcodeAssigned,
|
||||
success: true,
|
||||
icon: Icons.qr_code,
|
||||
);
|
||||
|
||||
refresh(context);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user