From eabb1db02a3ed3a183e3d8d7373e99785fe6a884 Mon Sep 17 00:00:00 2001 From: Sergio De la torre Date: Wed, 7 Aug 2024 11:46:53 +0200 Subject: [PATCH] feat boxPickingCheck refs #7751 --- .../feature/boxPicking/BoxPickingFragment.kt | 13 +++++++------ .../feature/boxPicking/BoxPickingViewModel.kt | 18 +++++++++--------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/boxPicking/BoxPickingFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/boxPicking/BoxPickingFragment.kt index 83baa62d..8b9e2faf 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/boxPicking/BoxPickingFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/boxPicking/BoxPickingFragment.kt @@ -5,6 +5,7 @@ import android.view.inputmethod.EditorInfo import es.verdnatura.R import es.verdnatura.databinding.FragmentGeneralBlackBinding import es.verdnatura.presentation.base.BaseFragment +import es.verdnatura.presentation.common.ExpeditionPrintOut import es.verdnatura.presentation.common.OnCollectionSelectedListener import es.verdnatura.presentation.view.component.CustomDialogInput @@ -35,7 +36,7 @@ class BoxPickingFragment(var title: String) : binding.scanInput.hint = getString(R.string.scanLabelExpedition) binding.scanInput.requestFocus() binding.scanInput.setOnEditorActionListener { _, actionId, _ -> - if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { + if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE) { if (!binding.scanInput.text.isNullOrEmpty()) { try { @@ -100,7 +101,7 @@ class BoxPickingFragment(var title: String) : override fun observeViewModel() { with(viewModel) { - isBoxPickingInPrintOut.observe(viewLifecycleOwner) { + /*isBoxPickingInPrintOut.observe(viewLifecycleOwner) { ma.messageWithSound( message = getString(R.string.errorInput), @@ -111,13 +112,13 @@ class BoxPickingFragment(var title: String) : ) binding.scanInput.requestFocus() - } + }*/ //Tarea 7751 - /* isBoxPickingInPrintOut.observe(viewLifecycleOwner) { + isBoxPickingInPrintOut.observe(viewLifecycleOwner) { if (it.isChecked){ ma.messageWithSound( - message = "La expedición ya ha sido revisada. Pregunta encargado por si se ha preparado dos veces.", + message = getString(R.string.errorBoxPicking), isError = true, isPlayed = true, isToasted = false @@ -141,7 +142,7 @@ class BoxPickingFragment(var title: String) : ) binding.scanInput.requestFocus() - }*/ + } } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/boxPicking/BoxPickingViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/boxPicking/BoxPickingViewModel.kt index 13168d7a..49afcaea 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/boxPicking/BoxPickingViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/boxPicking/BoxPickingViewModel.kt @@ -12,12 +12,12 @@ import retrofit2.Response class BoxPickingViewModel(val context: Context) : BaseViewModel(context) { private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix) - private val _isBoxPickingInPrintOut by lazy { MutableLiveData() } - val isBoxPickingInPrintOut: LiveData = _isBoxPickingInPrintOut + /*private val _isBoxPickingInPrintOut by lazy { MutableLiveData() } + val isBoxPickingInPrintOut: LiveData = _isBoxPickingInPrintOut*/ //Tarea 7751 - /*private val _isBoxPickingInPrintOut by lazy { MutableLiveData() } - val isBoxPickingInPrintOut: LiveData = _isBoxPickingInPrintOut*/ + private val _isBoxPickingInPrintOut by lazy { MutableLiveData() } + val isBoxPickingInPrintOut: LiveData = _isBoxPickingInPrintOut private val _responseCode by lazy { MutableLiveData() } val responseCode: LiveData = _responseCode @@ -28,7 +28,7 @@ class BoxPickingViewModel(val context: Context) : BaseViewModel(context) { salix.isBoxPickingInPrintOut( filter = """{"where":{"expeditionFk":$expeditionFk,"itemFk":$itemFk}}""" - ).enqueue(object : SalixCallback(context) { + /* ).enqueue(object : SalixCallback(context) { override fun onSuccess(response: Response) { _isBoxPickingInPrintOut.value = true @@ -37,10 +37,10 @@ class BoxPickingViewModel(val context: Context) : BaseViewModel(context) { _isBoxPickingInPrintOut.value = false } - }) + })*/ //Tarea 7751 //isChecked - /* ).enqueue(object : SalixCallback(context) { + ).enqueue(object : SalixCallback(context) { override fun onSuccess(response: Response) { _isBoxPickingInPrintOut.value = response.body() @@ -49,7 +49,7 @@ class BoxPickingViewModel(val context: Context) : BaseViewModel(context) { _isBoxPickingInPrintOut.value = ExpeditionPrintOut(0,0,false) } - })*/ + }) } fun isBoxPickingInPrintOut(expeditionFk: Long, barcode: String) { @@ -72,7 +72,7 @@ class BoxPickingViewModel(val context: Context) : BaseViewModel(context) { } fun updateExpeditionPrint(expeditionFk: Long, expeditionPrintOut: ExpeditionPrintOut) { salix.update(expeditionFk, expeditionPrintOut) - .enqueue(object : SalixCallback(context) { + .enqueue(object : SalixCallback(context) { }) }