feat itemToBarCode refs #7614
This commit is contained in:
parent
a7c66ff0b2
commit
566c90aed4
|
@ -4,10 +4,10 @@
|
||||||
<selectionStates>
|
<selectionStates>
|
||||||
<SelectionState runConfigName="app">
|
<SelectionState runConfigName="app">
|
||||||
<option name="selectionMode" value="DROPDOWN" />
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
<DropdownSelection timestamp="2024-06-28T11:42:38.581666500Z">
|
<DropdownSelection timestamp="2024-07-03T06:41:37.187789300Z">
|
||||||
<Target type="DEFAULT_BOOT">
|
<Target type="DEFAULT_BOOT">
|
||||||
<handle>
|
<handle>
|
||||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=21114523025303" />
|
<DeviceId pluginId="LocalEmulator" identifier="path=C:\Users\sergiodt\.android\avd\Pixel_7a_API_30.avd" />
|
||||||
</handle>
|
</handle>
|
||||||
</Target>
|
</Target>
|
||||||
</DropdownSelection>
|
</DropdownSelection>
|
||||||
|
|
|
@ -33,17 +33,18 @@ import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.Shelvi
|
||||||
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
|
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
|
||||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
||||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventoryParking
|
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventoryParking
|
||||||
|
import es.verdnatura.presentation.view.feature.login.model.AccessConfigSalix
|
||||||
import es.verdnatura.presentation.view.feature.login.model.DataUserSalix
|
import es.verdnatura.presentation.view.feature.login.model.DataUserSalix
|
||||||
import es.verdnatura.presentation.view.feature.login.model.LoginApp
|
import es.verdnatura.presentation.view.feature.login.model.LoginApp
|
||||||
import es.verdnatura.presentation.view.feature.login.model.LoginAppData
|
import es.verdnatura.presentation.view.feature.login.model.LoginAppData
|
||||||
import es.verdnatura.presentation.view.feature.login.model.LoginDevice
|
import es.verdnatura.presentation.view.feature.login.model.LoginDevice
|
||||||
import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO
|
import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO
|
||||||
import es.verdnatura.presentation.view.feature.login.model.NameWorker
|
import es.verdnatura.presentation.view.feature.login.model.NameWorker
|
||||||
|
import es.verdnatura.presentation.view.feature.login.model.OperatorAdd
|
||||||
import es.verdnatura.presentation.view.feature.login.model.OperatorSalix
|
import es.verdnatura.presentation.view.feature.login.model.OperatorSalix
|
||||||
import es.verdnatura.presentation.view.feature.login.model.RenewToken
|
import es.verdnatura.presentation.view.feature.login.model.RenewToken
|
||||||
import es.verdnatura.presentation.view.feature.login.model.SalixGrupo
|
import es.verdnatura.presentation.view.feature.login.model.SalixGrupo
|
||||||
import es.verdnatura.presentation.view.feature.login.model.VersionApp
|
import es.verdnatura.presentation.view.feature.login.model.VersionApp
|
||||||
import es.verdnatura.presentation.view.feature.login.model.accessConfigSalix
|
|
||||||
import es.verdnatura.presentation.view.feature.main.model.WorkerActionSalix
|
import es.verdnatura.presentation.view.feature.main.model.WorkerActionSalix
|
||||||
import es.verdnatura.presentation.view.feature.packaging.model.EntrySalix
|
import es.verdnatura.presentation.view.feature.packaging.model.EntrySalix
|
||||||
import es.verdnatura.presentation.view.feature.packaging.model.ItemSupplier
|
import es.verdnatura.presentation.view.feature.packaging.model.ItemSupplier
|
||||||
|
@ -880,7 +881,7 @@ interface SalixService {
|
||||||
//DE MOMENTO NO FUNCIONA, SE QUERÍA AÑADIR POR INSERTIGNORE
|
//DE MOMENTO NO FUNCIONA, SE QUERÍA AÑADIR POR INSERTIGNORE
|
||||||
@POST("Operators")
|
@POST("Operators")
|
||||||
fun operatorAdd(
|
fun operatorAdd(
|
||||||
@Body params: Any
|
@Body params: OperatorAdd
|
||||||
): Call<Any>
|
): Call<Any>
|
||||||
|
|
||||||
@POST("DeviceLogs")
|
@POST("DeviceLogs")
|
||||||
|
@ -947,11 +948,6 @@ interface SalixService {
|
||||||
@Query("itemFk") itemFk: Int,
|
@Query("itemFk") itemFk: Int,
|
||||||
): Call<Any>
|
): Call<Any>
|
||||||
|
|
||||||
@GET("ItemBarCodes/{barCodeValue}/toItem")
|
|
||||||
fun barcodes_toitem(
|
|
||||||
@Path("barCodeValue") barCodeValue: String
|
|
||||||
): Call<String?>
|
|
||||||
|
|
||||||
@GET("ItemBarCodes/{barCodeValue}/toItem")
|
@GET("ItemBarCodes/{barCodeValue}/toItem")
|
||||||
fun barcodesToItem(
|
fun barcodesToItem(
|
||||||
@Path("barCodeValue") barCodeValue: String
|
@Path("barCodeValue") barCodeValue: String
|
||||||
|
@ -1061,7 +1057,7 @@ interface SalixService {
|
||||||
|
|
||||||
@GET("AccessTokenConfigs")
|
@GET("AccessTokenConfigs")
|
||||||
fun getAccessTokenConfigs(
|
fun getAccessTokenConfigs(
|
||||||
): Call<List<accessConfigSalix>>
|
): Call<List<AccessConfigSalix>>
|
||||||
|
|
||||||
@POST("vnusers/renewToken")
|
@POST("vnusers/renewToken")
|
||||||
fun renewToken(
|
fun renewToken(
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package es.verdnatura.domain.userCases
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import es.verdnatura.domain.RestClient
|
||||||
|
import es.verdnatura.domain.SalixService
|
||||||
|
import retrofit2.Call
|
||||||
|
|
||||||
|
class UserCases(context: Context) : RestClient(context) {
|
||||||
|
|
||||||
|
fun itemToBarCode(barcode: String, salix: SalixService) : Call<Int?> {
|
||||||
|
|
||||||
|
return salix.barcodesToItem(barcode)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.map
|
import androidx.lifecycle.map
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
|
import es.verdnatura.domain.userCases.UserCases
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.common.Event
|
import es.verdnatura.presentation.common.Event
|
||||||
import es.verdnatura.presentation.common.ItemBarCodeSalix
|
import es.verdnatura.presentation.common.ItemBarCodeSalix
|
||||||
|
@ -24,6 +25,8 @@ import java.io.File
|
||||||
|
|
||||||
class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
|
private val userCase = UserCases(context)
|
||||||
|
|
||||||
private val _itemCard by lazy { MutableLiveData<ItemCardVO>() }
|
private val _itemCard by lazy { MutableLiveData<ItemCardVO>() }
|
||||||
val itemCard: LiveData<ItemCardVO>
|
val itemCard: LiveData<ItemCardVO>
|
||||||
get() = _itemCard
|
get() = _itemCard
|
||||||
|
@ -37,8 +40,8 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private val _responseCode by lazy { MutableLiveData<String>() }
|
private val _responseCode by lazy { MutableLiveData<Int?>() }
|
||||||
val responseCode: LiveData<String>
|
val responseCode: LiveData<Int?>
|
||||||
get() = _responseCode
|
get() = _responseCode
|
||||||
|
|
||||||
private val _itemProposalList by lazy { MutableLiveData<ItemProposalList>() }
|
private val _itemProposalList by lazy { MutableLiveData<ItemProposalList>() }
|
||||||
|
@ -152,10 +155,11 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getIdFromCodeSalix(code: String) {
|
fun getIdFromCodeSalix(code: String) {
|
||||||
salix.barcodes_toitem(code).enqueue(object : SalixCallback<String?>(context) {
|
userCase.itemToBarCode(code,salix)
|
||||||
|
.enqueue(object : SalixCallback<Int?>(context) {
|
||||||
|
|
||||||
override fun onSuccess(response: Response<String?>) {
|
override fun onSuccess(response: Response<Int?>) {
|
||||||
_responseCode.value = response.body() ?: ""
|
_responseCode.value = response.body()
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -630,29 +630,18 @@ class CollectionFragment(
|
||||||
responseCode.observe(viewLifecycleOwner, Observer {
|
responseCode.observe(viewLifecycleOwner, Observer {
|
||||||
|
|
||||||
if (!goBack2) {
|
if (!goBack2) {
|
||||||
if (it.isError) {
|
if (it == null) {
|
||||||
customDialog.setTitle(getString(R.string.error))
|
customDialog.setTitle(getString(R.string.error))
|
||||||
.setDescription(it.errorMessage)
|
showErrorMessage(getString(R.string.codeNotExist))
|
||||||
.setKoButton(getString(R.string.close)) {
|
|
||||||
scanRequest()
|
|
||||||
customDialog.dismiss()
|
|
||||||
}.show()
|
|
||||||
} else {
|
} else {
|
||||||
if (checkItemScan(it.response)) {
|
if (checkItemScan(it.toString())) {
|
||||||
scanRequest()
|
scanRequest()
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
mpok?.start()
|
mpok?.start()
|
||||||
onQuantityOfShelvingSelected(itemShelvingFkStored)
|
onQuantityOfShelvingSelected(itemShelvingFkStored)
|
||||||
} else {
|
} else {
|
||||||
var value = customDialogList.getValueTwo()
|
|
||||||
customDialogList.setValueTwo("")
|
|
||||||
if (it.response.isBlank() || it.response.isEmpty()) {
|
|
||||||
showErrorMessage(getString(R.string.codeNotExist))
|
|
||||||
|
|
||||||
} else {
|
|
||||||
showErrorMessage(getString(R.string.lineNotExist))
|
showErrorMessage(getString(R.string.lineNotExist))
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (mperror != null) mperror?.start()
|
if (mperror != null) mperror?.start()
|
||||||
}
|
}
|
||||||
|
|
|
@ -596,29 +596,21 @@ class CollectionFragmentPicker(
|
||||||
responseCode.observe(viewLifecycleOwner, Observer {
|
responseCode.observe(viewLifecycleOwner, Observer {
|
||||||
|
|
||||||
if (!goBack2) {
|
if (!goBack2) {
|
||||||
if (it.isError) {
|
if (it == null) {
|
||||||
customDialog.setTitle(getString(R.string.error))
|
customDialog.setTitle(getString(R.string.error))
|
||||||
.setDescription(it.errorMessage)
|
showErrorMessage(getString(R.string.codeNotExist))
|
||||||
.setKoButton(getString(R.string.close)) {
|
mperror?.start()
|
||||||
scanRequest()
|
|
||||||
customDialog.dismiss()
|
|
||||||
}.show()
|
|
||||||
} else {
|
} else {
|
||||||
if (checkItemScan(it.response)) {
|
if (checkItemScan(it.toString())) {
|
||||||
scanRequest()
|
scanRequest()
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
mpok?.start()
|
mpok?.start()
|
||||||
onQuantityOfShelvingSelected(itemShelvingFkStored)
|
onQuantityOfShelvingSelected(itemShelvingFkStored)
|
||||||
} else {
|
} else {
|
||||||
var value = customDialogList.getValueTwo()
|
|
||||||
customDialogList.setValueTwo("")
|
customDialogList.setValueTwo("")
|
||||||
if (it.response.isBlank() || it.response.isEmpty()) {
|
|
||||||
showErrorMessage(getString(R.string.codeNotExist))
|
|
||||||
|
|
||||||
} else {
|
|
||||||
showErrorMessage(getString(R.string.lineNotExist))
|
showErrorMessage(getString(R.string.lineNotExist))
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (mperror != null) mperror?.start()
|
if (mperror != null) mperror?.start()
|
||||||
}
|
}
|
||||||
|
|
|
@ -453,28 +453,19 @@ class CollectionFragmentPickerNew(
|
||||||
|
|
||||||
responseCode.observe(viewLifecycleOwner) {
|
responseCode.observe(viewLifecycleOwner) {
|
||||||
if (!goBack2) {
|
if (!goBack2) {
|
||||||
if (it.isError) {
|
if (it == null) {
|
||||||
customDialog.setTitle(getString(R.string.error))
|
customDialog.setTitle(getString(R.string.error))
|
||||||
.setDescription(it.errorMessage)
|
showErrorMessage(text = getString(R.string.codeNotExist))
|
||||||
.setKoButton(getString(R.string.close)) {
|
if (mperror != null) mperror?.start()
|
||||||
customDialog.dismiss()
|
|
||||||
scanRequest()
|
|
||||||
}.show()
|
|
||||||
} else {
|
} else {
|
||||||
if (checkItemScan(it.response)) {
|
if (checkItemScan(it.toString())) {
|
||||||
scanRequest()
|
scanRequest()
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
mpok?.start()
|
mpok?.start()
|
||||||
onQuantityOfShelvingSelected(itemShelvingFkStored)
|
onQuantityOfShelvingSelected(itemShelvingFkStored)
|
||||||
} else {
|
} else {
|
||||||
customDialogList.setValueTwo("")
|
|
||||||
if (it.response.isBlank() || it.response.isEmpty()) {
|
|
||||||
showErrorMessage(text = getString(R.string.codeNotExist))
|
|
||||||
|
|
||||||
} else {
|
|
||||||
showErrorMessage(text = getString(R.string.lineNotExist))
|
showErrorMessage(text = getString(R.string.lineNotExist))
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (mperror != null) mperror?.start()
|
if (mperror != null) mperror?.start()
|
||||||
}
|
}
|
||||||
|
|
|
@ -461,29 +461,18 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
responseCode.observe(viewLifecycleOwner) {
|
responseCode.observe(viewLifecycleOwner) {
|
||||||
|
|
||||||
if (!goBack2) {
|
if (!goBack2) {
|
||||||
if (it.isError) {
|
if (it == null) {
|
||||||
customDialog.setTitle(getString(R.string.error))
|
showErrorMessage(text = getString(R.string.codeNotExist))
|
||||||
.setDescription(it.errorMessage)
|
if (mperror != null) mperror?.start()
|
||||||
.setKoButton(getString(R.string.close)) {
|
|
||||||
customDialog.dismiss()
|
|
||||||
scanRequest()
|
|
||||||
}.show()
|
|
||||||
} else {
|
} else {
|
||||||
if (checkItemScan(it.response)) {
|
if (checkItemScan(it.toString())) {
|
||||||
scanRequest()
|
scanRequest()
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
mpok?.start()
|
mpok?.start()
|
||||||
markLine(storedPosition, quantityReserveToCheckItemScan, null)
|
markLine(storedPosition, quantityReserveToCheckItemScan, null)
|
||||||
} else {
|
} else {
|
||||||
customDialogList.setValueTwo("")
|
customDialogList.setValueTwo("")
|
||||||
if (it.response.isBlank() || it.response.isEmpty()) {
|
|
||||||
showErrorMessage(text = getString(R.string.codeNotExist))
|
|
||||||
|
|
||||||
} else {
|
|
||||||
showErrorMessage(text = getString(R.string.lineNotExist))
|
showErrorMessage(text = getString(R.string.lineNotExist))
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (mperror != null) mperror?.start()
|
if (mperror != null) mperror?.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -337,7 +337,6 @@ class CollectionFragmentPreChecker(
|
||||||
hideKeyboard()
|
hideKeyboard()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun scanRequest() {
|
private fun scanRequest() {
|
||||||
binding.scanInput.requestFocus()
|
binding.scanInput.requestFocus()
|
||||||
hideKeyboards()
|
hideKeyboards()
|
||||||
|
@ -425,7 +424,12 @@ class CollectionFragmentPreChecker(
|
||||||
source = type
|
source = type
|
||||||
)
|
)
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
ma.messageWithSound(message = getString(R.string.errorInput), isError = true, isPlayed = true, isToasted = true)
|
ma.messageWithSound(
|
||||||
|
message = getString(R.string.errorInput),
|
||||||
|
isError = true,
|
||||||
|
isPlayed = true,
|
||||||
|
isToasted = true
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// findSale(binding.scanInput.text.toString())
|
// findSale(binding.scanInput.text.toString())
|
||||||
|
@ -632,29 +636,19 @@ class CollectionFragmentPreChecker(
|
||||||
responseCode.observe(viewLifecycleOwner, Observer {
|
responseCode.observe(viewLifecycleOwner, Observer {
|
||||||
|
|
||||||
if (!goBack2) {
|
if (!goBack2) {
|
||||||
if (it.isError) {
|
if (it == null) {
|
||||||
customDialog.setTitle(getString(R.string.error))
|
showErrorMessage((getString(R.string.codeNotExist)))
|
||||||
.setDescription(it.errorMessage)
|
if (mperror != null) mperror?.start()
|
||||||
.setKoButton(getString(R.string.close)) {
|
|
||||||
scanRequest()
|
|
||||||
customDialog.dismiss()
|
|
||||||
}.show()
|
|
||||||
} else {
|
} else {
|
||||||
if (checkItemScan(it.response)) {
|
if (checkItemScan(it.toString())) {
|
||||||
scanRequest()
|
scanRequest()
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
mpok?.start()
|
mpok?.start()
|
||||||
onQuantityOfShelvingSelected(itemShelvingFkStored)
|
onQuantityOfShelvingSelected(itemShelvingFkStored)
|
||||||
} else {
|
} else {
|
||||||
var value = customDialogList.getValueTwo()
|
|
||||||
customDialogList.setValueTwo("")
|
customDialogList.setValueTwo("")
|
||||||
if (it.response.isBlank() || it.response.isEmpty()) {
|
|
||||||
showErrorMessage(getString(R.string.codeNotExist))
|
|
||||||
|
|
||||||
} else {
|
|
||||||
showErrorMessage(getString(R.string.lineNotExist))
|
showErrorMessage(getString(R.string.lineNotExist))
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (mperror != null) mperror?.start()
|
if (mperror != null) mperror?.start()
|
||||||
}
|
}
|
||||||
|
@ -741,7 +735,6 @@ class CollectionFragmentPreChecker(
|
||||||
})*/
|
})*/
|
||||||
responseGetExtensionFromUserId.observe(viewLifecycleOwner, Observer {
|
responseGetExtensionFromUserId.observe(viewLifecycleOwner, Observer {
|
||||||
|
|
||||||
|
|
||||||
if (it.isError) {
|
if (it.isError) {
|
||||||
if (!goMistakeBack)
|
if (!goMistakeBack)
|
||||||
ma.messageWithSound(
|
ma.messageWithSound(
|
||||||
|
@ -1488,7 +1481,6 @@ class CollectionFragmentPreChecker(
|
||||||
//Tarea #4371 se quita para ver si funciona correctamente
|
//Tarea #4371 se quita para ver si funciona correctamente
|
||||||
private fun saleTracking_mark(position: Int, type: String) {
|
private fun saleTracking_mark(position: Int, type: String) {
|
||||||
|
|
||||||
|
|
||||||
viewModel.run {
|
viewModel.run {
|
||||||
saleTracking_mark(
|
saleTracking_mark(
|
||||||
saleFk = sales[position].saleFk,
|
saleFk = sales[position].saleFk,
|
||||||
|
@ -1518,8 +1510,6 @@ class CollectionFragmentPreChecker(
|
||||||
setListPosition(position, false)
|
setListPosition(position, false)
|
||||||
if (type != PRECHECKER) {
|
if (type != PRECHECKER) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
viewModel.itemShelvingUpdateFromSale(
|
viewModel.itemShelvingUpdateFromSale(
|
||||||
sales[position].saleFk
|
sales[position].saleFk
|
||||||
)
|
)
|
||||||
|
@ -1910,7 +1900,6 @@ class CollectionFragmentPreChecker(
|
||||||
getString(R.string.Todosloscampossonobligatorios).toast(requireContext())
|
getString(R.string.Todosloscampossonobligatorios).toast(requireContext())
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
||||||
viewModel.collectionAddItem(
|
viewModel.collectionAddItem(
|
||||||
itemFk = customDialogList.getValue().toInt(),
|
itemFk = customDialogList.getValue().toInt(),
|
||||||
ticketFk = ticketSelected,
|
ticketFk = ticketSelected,
|
||||||
|
@ -2102,7 +2091,6 @@ class CollectionFragmentPreChecker(
|
||||||
private fun customDialogSetUsed() {
|
private fun customDialogSetUsed() {
|
||||||
if (!customDialogInput.getValue().isNullOrEmpty()) {
|
if (!customDialogInput.getValue().isNullOrEmpty()) {
|
||||||
|
|
||||||
|
|
||||||
viewModel.ticketCollection_setUsedShelves(
|
viewModel.ticketCollection_setUsedShelves(
|
||||||
ticketFk = collection.collectionFk,
|
ticketFk = collection.collectionFk,
|
||||||
usedShelves = customDialogInput.getValue().toInt()
|
usedShelves = customDialogInput.getValue().toInt()
|
||||||
|
|
|
@ -9,6 +9,7 @@ import es.verdnatura.MobileApplication
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
|
import es.verdnatura.domain.userCases.UserCases
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
|
@ -33,7 +34,7 @@ import es.verdnatura.presentation.view.feature.workermistake.model.SaleTrackingD
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
private val userCase = UserCases(context)
|
||||||
private val contextApp = context
|
private val contextApp = context
|
||||||
|
|
||||||
private val _responseState by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _responseState by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
|
@ -170,8 +171,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
val responseNew: LiveData<ResponseItemVO>
|
val responseNew: LiveData<ResponseItemVO>
|
||||||
get() = _responseNew
|
get() = _responseNew
|
||||||
|
|
||||||
private val _responseCode by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _responseCode by lazy { MutableLiveData<Int?>() }
|
||||||
val responseCode: LiveData<ResponseItemVO>
|
val responseCode: LiveData<Int?>
|
||||||
get() = _responseCode
|
get() = _responseCode
|
||||||
|
|
||||||
private val _responseIncQuantity by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _responseIncQuantity by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
|
@ -640,11 +641,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
//Tarea 6889
|
//Tarea 6889
|
||||||
salix.addSale(
|
salix.addSale(
|
||||||
id = ticketFk,
|
id = ticketFk, barcode = itemFk.toString(), quantity = quantity
|
||||||
barcode = itemFk.toString(),
|
)/* salix.addSaleByCode(
|
||||||
quantity = quantity
|
|
||||||
)
|
|
||||||
/* salix.addSaleByCode(
|
|
||||||
CollectionItemSalix(
|
CollectionItemSalix(
|
||||||
itemFk.toString(),
|
itemFk.toString(),
|
||||||
quantityFk,
|
quantityFk,
|
||||||
|
@ -830,21 +828,11 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getIdFromCodeSalix(code: String) {
|
fun getIdFromCodeSalix(code: String) {
|
||||||
salix.barcodes_toitem(code).enqueue(object : SalixCallback<String?>(context) {
|
userCase.itemToBarCode(code, salix)
|
||||||
override fun onError(t: Throwable) {
|
//salix.barcodes_toitem(code)
|
||||||
_responseCode.value = ResponseItemVO(
|
.enqueue(object : SalixCallback<Int?>(context) {
|
||||||
isError = true,
|
override fun onSuccess(response: Response<Int?>) {
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
_responseCode.value = response.body()
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSuccess(response: Response<String?>) {
|
|
||||||
|
|
||||||
_responseCode.value = ResponseItemVO(
|
|
||||||
isError = false, response = if (response.body() == null) "" else {
|
|
||||||
response!!.body().toString()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -858,16 +846,18 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
).enqueue(object : SalixCallback<Any>(context) {
|
).enqueue(object : SalixCallback<Any>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseIncQuantity.value = ResponseItemVO(
|
_responseIncQuantity.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true, errorMessage = getMessageFromAllResponse(
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
nameofFunction(this), t.message!!
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSuccess(response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
super.onSuccess(response)
|
super.onSuccess(response)
|
||||||
|
|
||||||
_responseIncQuantity.value =
|
_responseIncQuantity.value = ResponseItemVO(
|
||||||
ResponseItemVO(isError = false, response = response.message().toString())
|
isError = false, response = response.message().toString()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -878,13 +868,16 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
salix.saleMistakeAdd(
|
salix.saleMistakeAdd(
|
||||||
SaleMistakeSalix(
|
SaleMistakeSalix(
|
||||||
userFk = (context as MobileApplication).userId!!, saleFk = saleFk, typeFk = typeFk
|
userFk = (context as MobileApplication).userId!!,
|
||||||
|
saleFk = saleFk,
|
||||||
|
typeFk = typeFk
|
||||||
)
|
)
|
||||||
).enqueue(object : SalixCallback<Any>(context) {
|
).enqueue(object : SalixCallback<Any>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseSaleMistakeAdd.value = ResponseItemVO(
|
_responseSaleMistakeAdd.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true, errorMessage = getMessageFromAllResponse(
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
nameofFunction(this), t.message!!
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -897,10 +890,12 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun mistakeType() {
|
fun mistakeType() {
|
||||||
salix.getMistakeTypes().enqueue(object : SalixCallback<List<MistakeTypeVO>>(context) {
|
salix.getMistakeTypes()
|
||||||
|
.enqueue(object : SalixCallback<List<MistakeTypeVO>>(context) {
|
||||||
override fun onSuccess(response: Response<List<MistakeTypeVO>>) {
|
override fun onSuccess(response: Response<List<MistakeTypeVO>>) {
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_mistakeList.value = response.body()?.let { MistakeTypeListVO(it) }
|
_mistakeList.value =
|
||||||
|
response.body()?.let { MistakeTypeListVO(it) }
|
||||||
} else {
|
} else {
|
||||||
val listError: ArrayList<MistakeTypeVO> = ArrayList()
|
val listError: ArrayList<MistakeTypeVO> = ArrayList()
|
||||||
listError.add(MistakeTypeVO(0, ""))
|
listError.add(MistakeTypeVO(0, ""))
|
||||||
|
@ -932,8 +927,9 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseTicketClosure.value = ResponseItemVO(
|
_responseTicketClosure.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true, errorMessage = getMessageFromAllResponse(
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
nameofFunction(this), t.message!!
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -964,14 +960,17 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseTicketClosure.value = ResponseItemVO(
|
_responseTicketClosure.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true, errorMessage = getMessageFromAllResponse(
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
nameofFunction(this), t.message!!
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSuccess(response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
_responseTicketClosure.value = ResponseItemVO(
|
_responseTicketClosure.value = ResponseItemVO(
|
||||||
isError = false, response = response.body()!!.toString(), errorMessage = ""
|
isError = false,
|
||||||
|
response = response.body()!!.toString(),
|
||||||
|
errorMessage = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -987,8 +986,9 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
.enqueue(object : SalixCallback<String>(context) {
|
.enqueue(object : SalixCallback<String>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseCollectionUnchecked.value = ResponseItemVO(
|
_responseCollectionUnchecked.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true, errorMessage = getMessageFromAllResponse(
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
nameofFunction(this), t.message!!
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -996,7 +996,9 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
|
|
||||||
_responseCollectionUnchecked.value = ResponseItemVO(
|
_responseCollectionUnchecked.value = ResponseItemVO(
|
||||||
isError = false, response = response.body()!!, errorMessage = ""
|
isError = false,
|
||||||
|
response = response.body()!!,
|
||||||
|
errorMessage = ""
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
_responseCollectionUnchecked.value = ResponseItemVO(
|
_responseCollectionUnchecked.value = ResponseItemVO(
|
||||||
|
@ -1022,8 +1024,9 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
|
|
||||||
_responseState.value = ResponseItemVO(
|
_responseState.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true, errorMessage = getMessageFromAllResponse(
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
nameofFunction(this), t.message!!
|
||||||
|
)
|
||||||
)
|
)
|
||||||
super.onError(t)
|
super.onError(t)
|
||||||
}
|
}
|
||||||
|
|
|
@ -572,9 +572,9 @@ class InventaryParkingFragment(
|
||||||
callGetInventory(parkingFrom, parkingTo)
|
callGetInventory(parkingFrom, parkingTo)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkItem(itemCode: String) {
|
private fun checkItem(itemCode: Int) {
|
||||||
positionItemChecking = myListInventory.indexOfFirst { item ->
|
positionItemChecking = myListInventory.indexOfFirst { item ->
|
||||||
item.itemFk == itemCode.toInt() && item.shelvingFk.uppercase() == myListInventory[positionShelvingChecking].shelvingFk.uppercase() && item.isChecked == null
|
item.itemFk == itemCode && item.shelvingFk.uppercase() == myListInventory[positionShelvingChecking].shelvingFk.uppercase() && item.isChecked == null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import androidx.lifecycle.map
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import es.verdnatura.MobileApplication
|
import es.verdnatura.MobileApplication
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
|
import es.verdnatura.domain.userCases.UserCases
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
|
@ -31,6 +32,7 @@ import retrofit2.Response
|
||||||
|
|
||||||
class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
|
private val userCase = UserCases(context)
|
||||||
private val _inventaryList by lazy { MutableLiveData<InventaryListVO>() }
|
private val _inventaryList by lazy { MutableLiveData<InventaryListVO>() }
|
||||||
val inventaryList: LiveData<InventaryListVO>
|
val inventaryList: LiveData<InventaryListVO>
|
||||||
get() = _inventaryList
|
get() = _inventaryList
|
||||||
|
@ -69,10 +71,10 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
val loadInventaryParkingList: LiveData<Event<InventoryParkingList>> =
|
val loadInventaryParkingList: LiveData<Event<InventoryParkingList>> =
|
||||||
_inventoryListParking.map { Event(it) }
|
_inventoryListParking.map { Event(it) }
|
||||||
|
|
||||||
private val _responseCode by lazy { MutableLiveData<String>() }
|
private val _responseCode by lazy { MutableLiveData<Int?>() }
|
||||||
val responseCode: LiveData<String>
|
val responseCode: LiveData<Int?>
|
||||||
get() = _responseCode
|
get() = _responseCode
|
||||||
val loadReponseCode: LiveData<Event<String>> = _responseCode.map { Event(it) }
|
val loadReponseCode: LiveData<Event<Int?>> = _responseCode.map { Event(it) }
|
||||||
|
|
||||||
//sergio para obtener comprador
|
//sergio para obtener comprador
|
||||||
fun itemShelvingBuyerGet() {
|
fun itemShelvingBuyerGet() {
|
||||||
|
@ -237,10 +239,11 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getIdFromCodeSalix(code: String) {
|
fun getIdFromCodeSalix(code: String) {
|
||||||
salix.barcodes_toitem(code).enqueue(object : SalixCallback<String?>(context) {
|
userCase.itemToBarCode(code,salix)
|
||||||
override fun onSuccess(response: Response<String?>) {
|
.enqueue(object : SalixCallback<Int?>(context) {
|
||||||
|
override fun onSuccess(response: Response<Int?>) {
|
||||||
_responseCode.value =
|
_responseCode.value =
|
||||||
response.body()!!.toString()
|
response.body()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -365,15 +365,15 @@ class EndSacadorFragment(
|
||||||
responseCode.observe(viewLifecycleOwner, Observer {
|
responseCode.observe(viewLifecycleOwner, Observer {
|
||||||
|
|
||||||
if (!goBack2) {
|
if (!goBack2) {
|
||||||
if (it.isError) {
|
if (it==null) {
|
||||||
customDialog.setTitle(getString(R.string.error))
|
customDialog.setTitle(getString(R.string.error))
|
||||||
.setDescription(it.errorMessage)
|
.setDescription(getString(R.string.itemNotValid))
|
||||||
.setKoButton(getString(R.string.close)) {
|
.setKoButton(getString(R.string.close)) {
|
||||||
scanRequest()
|
scanRequest()
|
||||||
customDialog.dismiss()
|
customDialog.dismiss()
|
||||||
}.show()
|
}.show()
|
||||||
} else {
|
} else {
|
||||||
if (checkItemScan(it.response)) {
|
if (checkItemScan(it.toString())) {
|
||||||
scanRequest()
|
scanRequest()
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
mpok?.start()
|
mpok?.start()
|
||||||
|
|
|
@ -4,9 +4,9 @@ import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.map
|
import androidx.lifecycle.map
|
||||||
import es.verdnatura.R
|
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
|
import es.verdnatura.domain.userCases.UserCases
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
|
@ -23,6 +23,7 @@ import retrofit2.Call
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
private val userCase = UserCases(context)
|
||||||
|
|
||||||
private val _salesList by lazy { MutableLiveData<List<PreSacadorItemVO>>() }
|
private val _salesList by lazy { MutableLiveData<List<PreSacadorItemVO>>() }
|
||||||
val salesList: LiveData<List<PreSacadorItemVO>>
|
val salesList: LiveData<List<PreSacadorItemVO>>
|
||||||
|
@ -52,8 +53,8 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
val placementSuppleyList: LiveData<PlacementSupplyListVO>
|
val placementSuppleyList: LiveData<PlacementSupplyListVO>
|
||||||
get() = _placementSuppleyList
|
get() = _placementSuppleyList
|
||||||
|
|
||||||
private val _responseCode by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _responseCode by lazy { MutableLiveData<Int?>() }
|
||||||
val responseCode: LiveData<ResponseItemVO>
|
val responseCode: LiveData<Int?>
|
||||||
get() = _responseCode
|
get() = _responseCode
|
||||||
|
|
||||||
private val _responseIncQuantity by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _responseIncQuantity by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
|
@ -204,46 +205,17 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
fun getIdFromCode(code: String) {
|
fun getIdFromCode(code: String) {
|
||||||
salix.barcodes_toitem(code).enqueue(object : SalixCallback<String?>(context) {
|
userCase.itemToBarCode(code, salix)
|
||||||
override fun onError(t: Throwable) {
|
.enqueue(object : SalixCallback<Int?>(context) {
|
||||||
_responseCode.value = ResponseItemVO(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSuccess(response: Response<String?>) {
|
override fun onSuccess(response: Response<Int?>) {
|
||||||
|
|
||||||
//sergio: espera item en el body
|
_responseCode.value = response.body()
|
||||||
if (response.body() == null) {
|
|
||||||
_responseCode.value = ResponseItemVO(
|
|
||||||
isError = true, errorMessage = context.getString(R.string.itemNotValid)
|
|
||||||
)
|
|
||||||
|
|
||||||
} else {
|
|
||||||
_responseCode.value =
|
|
||||||
ResponseItemVO(isError = false, response = response.body()!!.toString())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/* fun saleTrackingDel(saleFk: String) {
|
|
||||||
silex.saleTrackingDel(saleFk).enqueue(object : SilexCallback<Any>(context) {
|
|
||||||
override fun onError(t: Throwable) {
|
|
||||||
_response.value = ResponseItemVO(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSuccess(response: Response<Any>) {
|
|
||||||
|
|
||||||
_response.value = ResponseItemVO(isError = false, response = response.message())
|
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}*/
|
}
|
||||||
|
|
||||||
|
|
||||||
fun collectionIncreaseQuantity(
|
fun collectionIncreaseQuantity(
|
||||||
saleFk: Int, quantity: Int
|
saleFk: Int, quantity: Int
|
||||||
|
|
|
@ -543,9 +543,7 @@ class UbicadorFragmentNew: BaseFragment<FragmentUbicadorBinding, UbicadorViewMod
|
||||||
}
|
}
|
||||||
loadResponseCode.observe(viewLifecycleOwner) { event ->
|
loadResponseCode.observe(viewLifecycleOwner) { event ->
|
||||||
event.getContentIfNotHandled().notNull {
|
event.getContentIfNotHandled().notNull {
|
||||||
//not always is true
|
checkUbications(it.toLong())
|
||||||
val response = it as? Long
|
|
||||||
if (response!=null)checkUbications(response)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import androidx.lifecycle.map
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
|
import es.verdnatura.domain.userCases.UserCases
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
|
@ -26,6 +27,7 @@ import retrofit2.Call
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
private val userCase = UserCases(context)
|
||||||
|
|
||||||
private val _shelvingList by lazy { MutableLiveData<ItemUbicadorListVO>() }
|
private val _shelvingList by lazy { MutableLiveData<ItemUbicadorListVO>() }
|
||||||
|
|
||||||
|
@ -61,11 +63,11 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
val loadReubicationList: LiveData<Event<ReubicationList>> = _reubicationList.map { Event(it) }
|
val loadReubicationList: LiveData<Event<ReubicationList>> = _reubicationList.map { Event(it) }
|
||||||
|
|
||||||
private val _responseCode by lazy { MutableLiveData<Any?>() }
|
private val _responseCode by lazy { MutableLiveData<Int?>() }
|
||||||
val responseCode: LiveData<Any?>
|
val responseCode: LiveData<Int?>
|
||||||
get() = _responseCode
|
get() = _responseCode
|
||||||
|
|
||||||
val loadResponseCode: LiveData<Event<Any?>> = _responseCode.map { Event(it) }
|
val loadResponseCode: LiveData<Event<Int?>> = _responseCode.map { Event(it) }
|
||||||
|
|
||||||
private val _responseAddList by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _responseAddList by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
val responseAddList: LiveData<ResponseItemVO> = _responseAddList
|
val responseAddList: LiveData<ResponseItemVO> = _responseAddList
|
||||||
|
@ -401,9 +403,11 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getIdFromCode(code: String) {
|
fun getIdFromCode(code: String) {
|
||||||
salix.barcodes_toitem(code).enqueue(object : SalixCallback<String?>(context) {
|
userCase.itemToBarCode(code,salix)
|
||||||
|
//salix.barcodes_toitem(code)
|
||||||
|
.enqueue(object : SalixCallback<Int?>(context) {
|
||||||
|
|
||||||
override fun onSuccess(response: Response<String?>) {
|
override fun onSuccess(response: Response<Int?>) {
|
||||||
|
|
||||||
_responseCode.value = response.body()
|
_responseCode.value = response.body()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue