From 3512e61875fd8a2f4ddcbd667788e746e97ae841 Mon Sep 17 00:00:00 2001 From: Sergio De la torre Date: Mon, 12 Aug 2024 12:32:09 +0200 Subject: [PATCH] feat issues refs #7636 --- .../fragment/ControladorFragment.kt | 38 ++++++++++++++----- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/controlador/fragment/ControladorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/controlador/fragment/ControladorFragment.kt index 92e6d1ac..834a51c4 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/controlador/fragment/ControladorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/controlador/fragment/ControladorFragment.kt @@ -62,7 +62,9 @@ class ControladorFragment : try { binding.scanInput.setText( itemScanValue( - binding.scanInput.text.toString(), arrayOf("ticket","saleGroup"), "id" + binding.scanInput.text.toString(), + arrayOf("ticket", "saleGroup"), + "id" ).toString().toInt().toString(), ) } catch (ex: Exception) { @@ -77,7 +79,9 @@ class ControladorFragment : try { collectionViewModel!!.ticketState( itemScanValue( - binding.scanInput.text.toString(), arrayOf("ticket","saleGroup"), "id" + binding.scanInput.text.toString(), + arrayOf("ticket", "saleGroup"), + "id" ).toString().toInt() ) } catch (ex: Exception) { @@ -105,13 +109,25 @@ class ControladorFragment : .setOkButton(getString(R.string.aware)) { customDialogWarning.dismiss() - viewModel.getSales( - collectionFk = itemScanValue( - binding.scanInput.text.toString(), arrayOf("ticket","saleGroup"), "id" - ).toString().toInt(), - print = false, - source = ConstAndValues.ON_CHECKING - ) + try { + viewModel.getSales( + collectionFk = itemScanValue( + binding.scanInput.text.toString(), + arrayOf("ticket", "saleGroup"), + "id" + ).toString().toInt(), + print = false, + source = ConstAndValues.ON_CHECKING + ) + + } catch (ex: Exception) { + ma.messageWithSound( + message = getString(R.string.errorScanItem), + isError = true, + isToasted = true, + isPlayed = true + ) + } /* viewModel.getSales( collectionFk = binding.scanInput.text.toString() @@ -128,7 +144,9 @@ class ControladorFragment : } else { viewModel.getSales( collectionFk = itemScanValue( - binding.scanInput.text.toString(), arrayOf("ticket","saleGRoup"), "id" + binding.scanInput.text.toString(), + arrayOf("ticket", "saleGRoup"), + "id" ).toString().toInt(), print = false, source = ConstAndValues.ON_CHECKING