feat itemToBarCode refs #7614
This commit is contained in:
parent
d1a3c5fde4
commit
e8a169e274
|
@ -1,15 +1,12 @@
|
|||
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)
|
||||
class GetItemFromBarcodeUseCase(private val salixService: SalixService) {
|
||||
fun execute(barcode: String): Call<Int?> {
|
||||
return salixService.barcodesToItem(barcode)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import androidx.lifecycle.MutableLiveData
|
|||
import androidx.lifecycle.map
|
||||
import es.verdnatura.domain.SalixCallback
|
||||
import es.verdnatura.domain.formatWithQuotes
|
||||
import es.verdnatura.domain.userCases.UserCases
|
||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.common.Event
|
||||
import es.verdnatura.presentation.common.ItemBarCodeSalix
|
||||
|
@ -25,7 +25,7 @@ import java.io.File
|
|||
|
||||
class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val userCase = UserCases(context)
|
||||
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
||||
|
||||
private val _itemCard by lazy { MutableLiveData<ItemCardVO>() }
|
||||
val itemCard: LiveData<ItemCardVO>
|
||||
|
@ -155,7 +155,7 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
|
||||
fun getIdFromCodeSalix(code: String) {
|
||||
userCase.itemToBarCode(code,salix)
|
||||
getItemFromBarcodeUseCase.execute (code)
|
||||
.enqueue(object : SalixCallback<Int?>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<Int?>) {
|
||||
|
|
|
@ -4,14 +4,13 @@ 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.domain.userCases.GetItemFromBarcodeUseCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import retrofit2.Response
|
||||
|
||||
class BoxPickingViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val userCase = UserCases(context)
|
||||
|
||||
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
||||
private val _isBoxPickingInPrintOut by lazy { MutableLiveData<Boolean>() }
|
||||
val isBoxPickingInPrintOut: LiveData<Boolean> = _isBoxPickingInPrintOut
|
||||
|
||||
|
@ -38,7 +37,7 @@ class BoxPickingViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
|
||||
fun isBoxPickingInPrintOut(expeditionFk: Long, barcode: String) {
|
||||
userCase.itemToBarCode(barcode, salix)
|
||||
getItemFromBarcodeUseCase.execute(barcode)
|
||||
.enqueue(object : SalixCallback<Int?>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<Int?>) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import es.verdnatura.MobileApplication
|
|||
import es.verdnatura.domain.SalixCallback
|
||||
import es.verdnatura.domain.formatWithQuotes
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.domain.userCases.UserCases
|
||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
|
@ -34,7 +34,7 @@ import es.verdnatura.presentation.view.feature.workermistake.model.SaleTrackingD
|
|||
import retrofit2.Response
|
||||
|
||||
class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||
private val userCase = UserCases(context)
|
||||
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
||||
private val contextApp = context
|
||||
|
||||
private val _responseState by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
|
@ -828,8 +828,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
|
||||
fun getIdFromCodeSalix(code: String) {
|
||||
userCase.itemToBarCode(code, salix)
|
||||
//salix.barcodes_toitem(code)
|
||||
getItemFromBarcodeUseCase.execute(code)
|
||||
.enqueue(object : SalixCallback<Int?>(context) {
|
||||
override fun onSuccess(response: Response<Int?>) {
|
||||
_responseCode.value = response.body()
|
||||
|
|
|
@ -7,7 +7,7 @@ import androidx.lifecycle.map
|
|||
import com.google.gson.JsonObject
|
||||
import es.verdnatura.MobileApplication
|
||||
import es.verdnatura.domain.SalixCallback
|
||||
import es.verdnatura.domain.userCases.UserCases
|
||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
|
@ -31,8 +31,7 @@ import es.verdnatura.presentation.view.feature.workermistake.model.WorkerMistake
|
|||
import retrofit2.Response
|
||||
|
||||
class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val userCase = UserCases(context)
|
||||
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
||||
private val _inventaryList by lazy { MutableLiveData<InventaryListVO>() }
|
||||
val inventaryList: LiveData<InventaryListVO>
|
||||
get() = _inventaryList
|
||||
|
@ -239,7 +238,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
|
||||
fun getIdFromCodeSalix(code: String) {
|
||||
userCase.itemToBarCode(code,salix)
|
||||
getItemFromBarcodeUseCase.execute(code)
|
||||
.enqueue(object : SalixCallback<Int?>(context) {
|
||||
override fun onSuccess(response: Response<Int?>) {
|
||||
_responseCode.value =
|
||||
|
|
|
@ -6,7 +6,7 @@ import androidx.lifecycle.MutableLiveData
|
|||
import androidx.lifecycle.map
|
||||
import es.verdnatura.domain.SalixCallback
|
||||
import es.verdnatura.domain.formatWithQuotes
|
||||
import es.verdnatura.domain.userCases.UserCases
|
||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
|
@ -23,7 +23,7 @@ import retrofit2.Call
|
|||
import retrofit2.Response
|
||||
|
||||
class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||
private val userCase = UserCases(context)
|
||||
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
||||
|
||||
private val _salesList by lazy { MutableLiveData<List<PreSacadorItemVO>>() }
|
||||
val salesList: LiveData<List<PreSacadorItemVO>>
|
||||
|
@ -205,7 +205,7 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}*/
|
||||
|
||||
fun getIdFromCode(code: String) {
|
||||
userCase.itemToBarCode(code, salix)
|
||||
getItemFromBarcodeUseCase.execute(code)
|
||||
.enqueue(object : SalixCallback<Int?>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<Int?>) {
|
||||
|
|
|
@ -7,7 +7,7 @@ import androidx.lifecycle.map
|
|||
import com.google.gson.JsonObject
|
||||
import es.verdnatura.domain.SalixCallback
|
||||
import es.verdnatura.domain.formatWithQuotes
|
||||
import es.verdnatura.domain.userCases.UserCases
|
||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
|
@ -27,7 +27,7 @@ import retrofit2.Call
|
|||
import retrofit2.Response
|
||||
|
||||
class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||
private val userCase = UserCases(context)
|
||||
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
||||
|
||||
private val _shelvingList by lazy { MutableLiveData<ItemUbicadorListVO>() }
|
||||
|
||||
|
@ -403,8 +403,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
|
||||
fun getIdFromCode(code: String) {
|
||||
userCase.itemToBarCode(code,salix)
|
||||
//salix.barcodes_toitem(code)
|
||||
getItemFromBarcodeUseCase.execute(code)
|
||||
.enqueue(object : SalixCallback<Int?>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<Int?>) {
|
||||
|
|
Loading…
Reference in New Issue