refactor: Refactors reception scan and updates app name
Optimizes product lookup during reception scanning by removing redundant database calls. Adds error feedback for quantity increment failures, enhancing user experience. Updates the application name from 'BarcodeScan' to 'eScan'.
This commit is contained in:
parent
5f158fb24e
commit
e6901eae8f
@ -38,7 +38,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
||||
backgroundColor: AppTheme.of(context).primaryBackground,
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
'BarcodeScan',
|
||||
'eScan',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppTheme.of(context).titleLarge,
|
||||
),
|
||||
|
@ -103,18 +103,17 @@ class _ReceptionScanPageState extends ConsumerState<ReceptionScanPage>
|
||||
return;
|
||||
}
|
||||
// find product in local database
|
||||
final isProductExist = model.getProduct(
|
||||
final product = model.getProduct(
|
||||
receptionId: widget.receptionId,
|
||||
barcode: qrcodeValue,
|
||||
);
|
||||
if (isProductExist != null) {
|
||||
final product = model.getProduct(
|
||||
receptionId: widget.receptionId,
|
||||
barcode: qrcodeValue,
|
||||
);
|
||||
if (product != null) {
|
||||
model.incrementMoveLineQuantity(
|
||||
barcode: qrcodeValue,
|
||||
receptionId: widget.receptionId,
|
||||
onError: () {
|
||||
Toast.showError('Aucun produit trouvé.');
|
||||
},
|
||||
);
|
||||
//show dialog
|
||||
await showDialog(
|
||||
@ -137,7 +136,7 @@ class _ReceptionScanPageState extends ConsumerState<ReceptionScanPage>
|
||||
child: SizedBox(
|
||||
width: MediaQuery.sizeOf(context).width * 0.9,
|
||||
child: ProductScannedComponent(
|
||||
productStruct: product!,
|
||||
productStruct: product,
|
||||
onRescan: () async {
|
||||
Navigator.of(context).pop();
|
||||
qrcodeFound = false;
|
||||
@ -169,15 +168,11 @@ class _ReceptionScanPageState extends ConsumerState<ReceptionScanPage>
|
||||
final model = ref.read(receptionScanPageModelProvider.notifier);
|
||||
mobileScannerController.stop();
|
||||
// find product in local database
|
||||
final isProductExist = model.getProduct(
|
||||
final product = model.getProduct(
|
||||
receptionId: widget.receptionId,
|
||||
barcode: qrcodeValue,
|
||||
);
|
||||
if (isProductExist != null) {
|
||||
final product = model.getProduct(
|
||||
receptionId: widget.receptionId,
|
||||
barcode: qrcodeValue,
|
||||
);
|
||||
if (product != null) {
|
||||
model.incrementMoveLineQuantity(
|
||||
barcode: qrcodeValue,
|
||||
receptionId: widget.receptionId,
|
||||
@ -206,7 +201,7 @@ class _ReceptionScanPageState extends ConsumerState<ReceptionScanPage>
|
||||
child: SizedBox(
|
||||
width: MediaQuery.sizeOf(context).width * 0.9,
|
||||
child: ProductScannedComponent(
|
||||
productStruct: product!,
|
||||
productStruct: product,
|
||||
onRescan: () async {
|
||||
qrcodeFound = false;
|
||||
mobileScannerController.start();
|
||||
|
Loading…
x
Reference in New Issue
Block a user