feat boxPickingCheck refs #7751

This commit is contained in:
Sergio De la torre 2024-08-07 11:46:53 +02:00
parent a9feca596a
commit eabb1db02a
2 changed files with 16 additions and 15 deletions

View File

@ -5,6 +5,7 @@ import android.view.inputmethod.EditorInfo
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentGeneralBlackBinding import es.verdnatura.databinding.FragmentGeneralBlackBinding
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.ExpeditionPrintOut
import es.verdnatura.presentation.common.OnCollectionSelectedListener import es.verdnatura.presentation.common.OnCollectionSelectedListener
import es.verdnatura.presentation.view.component.CustomDialogInput 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.hint = getString(R.string.scanLabelExpedition)
binding.scanInput.requestFocus() binding.scanInput.requestFocus()
binding.scanInput.setOnEditorActionListener { _, actionId, _ -> 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()) { if (!binding.scanInput.text.isNullOrEmpty()) {
try { try {
@ -100,7 +101,7 @@ class BoxPickingFragment(var title: String) :
override fun observeViewModel() { override fun observeViewModel() {
with(viewModel) { with(viewModel) {
isBoxPickingInPrintOut.observe(viewLifecycleOwner) { /*isBoxPickingInPrintOut.observe(viewLifecycleOwner) {
ma.messageWithSound( ma.messageWithSound(
message = getString(R.string.errorInput), message = getString(R.string.errorInput),
@ -111,13 +112,13 @@ class BoxPickingFragment(var title: String) :
) )
binding.scanInput.requestFocus() binding.scanInput.requestFocus()
} }*/
//Tarea 7751 //Tarea 7751
/* isBoxPickingInPrintOut.observe(viewLifecycleOwner) { isBoxPickingInPrintOut.observe(viewLifecycleOwner) {
if (it.isChecked){ if (it.isChecked){
ma.messageWithSound( 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, isError = true,
isPlayed = true, isPlayed = true,
isToasted = false isToasted = false
@ -141,7 +142,7 @@ class BoxPickingFragment(var title: String) :
) )
binding.scanInput.requestFocus() binding.scanInput.requestFocus()
}*/ }
} }
} }

View File

@ -12,12 +12,12 @@ import retrofit2.Response
class BoxPickingViewModel(val context: Context) : BaseViewModel(context) { class BoxPickingViewModel(val context: Context) : BaseViewModel(context) {
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix) private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
private val _isBoxPickingInPrintOut by lazy { MutableLiveData<Boolean>() } /*private val _isBoxPickingInPrintOut by lazy { MutableLiveData<Boolean>() }
val isBoxPickingInPrintOut: LiveData<Boolean> = _isBoxPickingInPrintOut val isBoxPickingInPrintOut: LiveData<Boolean> = _isBoxPickingInPrintOut*/
//Tarea 7751 //Tarea 7751
/*private val _isBoxPickingInPrintOut by lazy { MutableLiveData<ExpeditionPrintOut>() } private val _isBoxPickingInPrintOut by lazy { MutableLiveData<ExpeditionPrintOut>() }
val isBoxPickingInPrintOut: LiveData<ExpeditionPrintOut> = _isBoxPickingInPrintOut*/ val isBoxPickingInPrintOut: LiveData<ExpeditionPrintOut> = _isBoxPickingInPrintOut
private val _responseCode by lazy { MutableLiveData<Boolean>() } private val _responseCode by lazy { MutableLiveData<Boolean>() }
val responseCode: LiveData<Boolean> = _responseCode val responseCode: LiveData<Boolean> = _responseCode
@ -28,7 +28,7 @@ class BoxPickingViewModel(val context: Context) : BaseViewModel(context) {
salix.isBoxPickingInPrintOut( salix.isBoxPickingInPrintOut(
filter = """{"where":{"expeditionFk":$expeditionFk,"itemFk":$itemFk}}""" filter = """{"where":{"expeditionFk":$expeditionFk,"itemFk":$itemFk}}"""
).enqueue(object : SalixCallback<Any>(context) { /* ).enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) { override fun onSuccess(response: Response<Any>) {
_isBoxPickingInPrintOut.value = true _isBoxPickingInPrintOut.value = true
@ -37,10 +37,10 @@ class BoxPickingViewModel(val context: Context) : BaseViewModel(context) {
_isBoxPickingInPrintOut.value = false _isBoxPickingInPrintOut.value = false
} }
}) })*/
//Tarea 7751 //Tarea 7751
//isChecked //isChecked
/* ).enqueue(object : SalixCallback<ExpeditionPrintOut>(context) { ).enqueue(object : SalixCallback<ExpeditionPrintOut>(context) {
override fun onSuccess(response: Response<ExpeditionPrintOut>) { override fun onSuccess(response: Response<ExpeditionPrintOut>) {
_isBoxPickingInPrintOut.value = response.body() _isBoxPickingInPrintOut.value = response.body()
@ -49,7 +49,7 @@ class BoxPickingViewModel(val context: Context) : BaseViewModel(context) {
_isBoxPickingInPrintOut.value = ExpeditionPrintOut(0,0,false) _isBoxPickingInPrintOut.value = ExpeditionPrintOut(0,0,false)
} }
})*/ })
} }
fun isBoxPickingInPrintOut(expeditionFk: Long, barcode: String) { fun isBoxPickingInPrintOut(expeditionFk: Long, barcode: String) {
@ -72,7 +72,7 @@ class BoxPickingViewModel(val context: Context) : BaseViewModel(context) {
} }
fun updateExpeditionPrint(expeditionFk: Long, expeditionPrintOut: ExpeditionPrintOut) { fun updateExpeditionPrint(expeditionFk: Long, expeditionPrintOut: ExpeditionPrintOut) {
salix.update(expeditionFk, expeditionPrintOut) salix.update(expeditionFk, expeditionPrintOut)
.enqueue(object : SalixCallback<Any>(context) { .enqueue(object : SalixCallback<ExpeditionPrintOut>(context) {
}) })
} }