feat itemToBarCode refs #7614
This commit is contained in:
parent
566c90aed4
commit
caf220442a
|
@ -4,11 +4,14 @@ import android.content.Context
|
|||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.SalixCallback
|
||||
import es.verdnatura.domain.userCases.UserCases
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import retrofit2.Response
|
||||
|
||||
class BoxPickingViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val userCase = UserCases(context)
|
||||
|
||||
private val _isBoxPickingInPrintOut by lazy { MutableLiveData<Boolean>() }
|
||||
val isBoxPickingInPrintOut: LiveData<Boolean> = _isBoxPickingInPrintOut
|
||||
|
||||
|
@ -35,21 +38,22 @@ class BoxPickingViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
|
||||
fun isBoxPickingInPrintOut(expeditionFk: Long, barcode: String) {
|
||||
salix.barcodesToItem(barcode).enqueue(object : SalixCallback<Int?>(context) {
|
||||
userCase.itemToBarCode(barcode, salix)
|
||||
.enqueue(object : SalixCallback<Int?>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<Int?>) {
|
||||
override fun onSuccess(response: Response<Int?>) {
|
||||
|
||||
if (response.body() != null) {
|
||||
isBoxPickingOk(
|
||||
itemFk = response.body().toString().toLong(),
|
||||
expeditionFk = expeditionFk
|
||||
)
|
||||
} else {
|
||||
_isBoxPickingInPrintOut.value = false
|
||||
}
|
||||
|
||||
if (response.body() != null) {
|
||||
isBoxPickingOk(
|
||||
itemFk = response.body().toString().toLong(),
|
||||
expeditionFk = expeditionFk
|
||||
)
|
||||
} else {
|
||||
_isBoxPickingInPrintOut.value = false
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
}
|
|
@ -187,7 +187,7 @@ class PhotosFragment(
|
|||
|
||||
}
|
||||
responseCode.observe(viewLifecycleOwner) {
|
||||
if (it.isNotBlank()) {
|
||||
if (it!=null) {
|
||||
viewModel.getItemCard(
|
||||
it.toLong(),
|
||||
mobileApplication.dataStoreApp.readDataStoreKey(WAREHOUSEFK)
|
||||
|
|
Loading…
Reference in New Issue