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.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()
}*/
}
}
}

View File

@ -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<Boolean>() }
val isBoxPickingInPrintOut: LiveData<Boolean> = _isBoxPickingInPrintOut
/*private val _isBoxPickingInPrintOut by lazy { MutableLiveData<Boolean>() }
val isBoxPickingInPrintOut: LiveData<Boolean> = _isBoxPickingInPrintOut*/
//Tarea 7751
/*private val _isBoxPickingInPrintOut by lazy { MutableLiveData<ExpeditionPrintOut>() }
val isBoxPickingInPrintOut: LiveData<ExpeditionPrintOut> = _isBoxPickingInPrintOut*/
private val _isBoxPickingInPrintOut by lazy { MutableLiveData<ExpeditionPrintOut>() }
val isBoxPickingInPrintOut: LiveData<ExpeditionPrintOut> = _isBoxPickingInPrintOut
private val _responseCode by lazy { MutableLiveData<Boolean>() }
val responseCode: LiveData<Boolean> = _responseCode
@ -28,7 +28,7 @@ class BoxPickingViewModel(val context: Context) : BaseViewModel(context) {
salix.isBoxPickingInPrintOut(
filter = """{"where":{"expeditionFk":$expeditionFk,"itemFk":$itemFk}}"""
).enqueue(object : SalixCallback<Any>(context) {
/* ).enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
_isBoxPickingInPrintOut.value = true
@ -37,10 +37,10 @@ class BoxPickingViewModel(val context: Context) : BaseViewModel(context) {
_isBoxPickingInPrintOut.value = false
}
})
})*/
//Tarea 7751
//isChecked
/* ).enqueue(object : SalixCallback<ExpeditionPrintOut>(context) {
).enqueue(object : SalixCallback<ExpeditionPrintOut>(context) {
override fun onSuccess(response: Response<ExpeditionPrintOut>) {
_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<Any>(context) {
.enqueue(object : SalixCallback<ExpeditionPrintOut>(context) {
})
}