Versión 6.1.9 añadido función error para llamadas web, getSaleDay y teclado numérico

This commit is contained in:
Sergio De la torre 2021-10-28 11:18:22 +02:00
parent cf72038ee4
commit 4c0223d4af
86 changed files with 2791 additions and 935 deletions

View File

@ -23,9 +23,12 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/car_control.xml" value="0.22407407407407406" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/circleshape.xml" value="0.11979166666666667" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/component_progress.xml" value="0.11979166666666667" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/crane.xml" value="0.23802083333333332" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/day_of_sale.xml" value="0.184375" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/delete.xml" value="0.19166666666666668" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/face_man_outline.xml" value="0.22708333333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/filter_outline.xml" value="0.22239583333333332" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/human_dolly.xml" value="0.2111111111111111" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_add_black_24dp.xml" value="0.22708333333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_arrow_back_black_24dp.xml" value="0.22708333333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_arrow_drop_down_black_24dp.xml" value="0.22708333333333333" />
@ -84,8 +87,10 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_inventary.xml" value="0.11271529888551166" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_inventary_old.xml" value="0.22604166666666667" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_item_card.xml" value="0.16666666666666666" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_itemdayofsale_card.xml" value="0.1693840579710145" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_itemexpeditionstate_card.xml" value="0.22" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_itemproposal.xml" value="0.22" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_itemshelvingdayofsale.xml" value="0.3333333333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_login.xml" value="0.22" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_paletizador_menu.xml" value="0.13829787234042554" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_parking.xml" value="0.5" />
@ -100,11 +105,14 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_article_row.xml" value="0.4466666666666667" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_card_row.xml" value="0.2269021739130435" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_expeditionstate_row.xml" value="0.23489583333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_historicovehiculo_row.xml" value="0.18795289855072464" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_inventary_row.xml" value="0.22604166666666667" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_itemshelvingdayofsale_row.xml" value="0.18206521739130435" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_location_row.xml" value="0.16875" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_pasilleros_main_menu.xml" value="0.13829787234042554" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_proposal_row.xml" value="0.22604166666666667" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_reposicion.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_shelvingdayofsale_row.xml" value="0.2375" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_smarttag_row.xml" value="0.20153985507246377" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_worker_image.xml" value="0.23177083333333334" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/toolbar.xml" value="0.15353260869565216" />

View File

@ -14,8 +14,9 @@ android {
applicationId "es.verdnatura"
minSdkVersion 21
targetSdkVersion 29
versionCode 74
versionName "6.1.8.5" //VERSION CODE 74 . Modificado itemtrash, deprecated preferenceManager, quitados ;,puesto menu general al controlador
versionCode 76
versionName "6.1.9" //Sin subir, Modificado y añadido mensajes de error, añadido opcion Dia de venta y su parking, teclado numerico para controlador
// versionName "6.1.8.5" VERSION CODE 75 // 23-10-2021//VERSION CODE 74-75 .Pantalla "Dia de venta y parking" Modificado itemtrash, deprecated preferenceManager, quitados ;,puesto menu general al controlador
//versionName "6.1.8.4.1" //VERSION CODE 73 . Modificar itemtrash
//versionName "6.1.8.4" //VERSION CODE 72 . Se añade ExpedtionScan para el Sorter, y modificion llamadas itemtrash y collectionGetTicket.
//versionName "6.1.8.3.1"//(VERSION CODE 71) Se añade ViewModel.collectionGet cuando se hace un collectionNew y un refresco de adapter

Binary file not shown.

View File

@ -11,7 +11,7 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 74,
"versionCode": 75,
"versionName": "6.1.8.5",
"outputFile": "app-release.apk"
}

BIN
app/release/vn-picking.apk Normal file

Binary file not shown.

View File

@ -10,6 +10,7 @@ import es.verdnatura.presentation.view.feature.calidad.fragment.QaualityViewMode
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionViewModel
import es.verdnatura.presentation.view.feature.controlador.fragment.ControladorViewModel
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoViewModel
import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleViewModel
import es.verdnatura.presentation.view.feature.faltas.fragment.FaltasViewModel
import es.verdnatura.presentation.view.feature.historico.fragment.HistoricoViewModel
import es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoViewModel
@ -41,6 +42,10 @@ val viewModelModule = module {
viewModel {
PasilleroViewModel(androidContext())
}
//Pasilleros Dia de venta
viewModel {
DayOfSaleViewModel(androidContext())
}
// Pasilleros / Item Card
viewModel {

View File

@ -0,0 +1,63 @@
package es.verdnatura.domain
import android.content.Context
import com.google.gson.JsonObject
import es.verdnatura.presentation.view.feature.diadeventa.model.ItemShelvingSaleDate
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
import retrofit2.Call
class GetDayOfSaleUSerCase(context: Context) : RestClient(context) {
fun itemShelving_updateSpam(usuario: String, password: String,vShelvingFK:String): Call<Boolean> {
val params: ArrayList<String> = ArrayList()
params.add(vShelvingFK)
return restClient!!.itemShelving_updateSpam("json", "1", usuario, password, "application/json",params=params)
}
/* fun itemShelving_getSaleDateOld(
usuario: String,
password: String,
expeditionFk: String
): Call<JsonObject> {
val params: ArrayList<String> = ArrayList()
params.add(expeditionFk)
return restClient!!.itemShelving_getSaleDate(
"json",
"1",
usuario,
password,
"application/json",
params = params
)
}*/
fun itemShelving_getSaleDate(
usuario: String,
password: String,
vShelvingFk: String
): Call<List<ItemShelvingSaleDate>> {
val params: ArrayList<String> = ArrayList()
params.add(vShelvingFk)
return restClient!!.itemShelving_getSaleDate(
"json",
"1",
usuario,
password,
"application/json",
params
)
}
fun shelvingPark(
usuario: String,
password: String,
shelving: String,
parking: String
): Call<String> {
val params: ArrayList<String> = ArrayList()
params.add(shelving)
params.add(parking)
return restClient!!.shelvingPark("json", "1", usuario, password, "application/json", params)
}
}

View File

@ -10,6 +10,7 @@ import es.verdnatura.presentation.view.feature.buscaritemall.model.ItemLocationA
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
import es.verdnatura.presentation.view.feature.calidad.model.ItemBuyerVO
import es.verdnatura.presentation.view.feature.collection.ItemVO
import es.verdnatura.presentation.view.feature.diadeventa.model.ItemShelvingSaleDate
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoVO
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
@ -834,6 +835,44 @@ interface VerdnaturaService {
):
Call<JsonObject>
//DIA DE VENTA
@POST("almacennew/itemShelving_getSaleDateOld")//REVISADA
fun itemShelving_getSaleDateOld(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String,
@Body params: List<String>
):
Call<JsonObject>
@POST("almacennew/itemShelving_getSaleDate")//REVISADA
fun itemShelving_getSaleDate(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String,
@Body params: List<String>
):
Call<List<ItemShelvingSaleDate>>
@POST("almacennew/itemShelving_updateSpam")//REVISADA
fun itemShelving_updateSpam(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String,
@Body params: List<String>
):
Call<Boolean>
@POST("almacennew/expeditionTruckList")//REVISADA
fun expeditionTruckList(
@Header("aplicacion") aplicacion: String,

View File

@ -2,5 +2,71 @@ package es.verdnatura.presentation.base
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.ViewModel
import org.json.JSONObject
abstract class BaseViewModel : ViewModel(), LifecycleObserver
fun nameofFunction(function: Any): String
{
return function.javaClass.enclosingMethod!!.name
}
fun getMessageFromResponse(ResponseMessage: String): String
{
return try
{
val answerError = JSONObject(ResponseMessage)
answerError.get("Message").toString()
} catch (e: Exception)
{
ResponseMessage
}
}
fun getMessageError(callFunction: String): String
{
return when (callFunction)
{
"collection_getTickets" -> "No hay tickets para sacar. Llamada $callFunction."
"collection_new_wagon" -> "No hay tickets para sacar. Llamada $callFunction."
else ->
{
"Error en la llamada $callFunction."
}
}
}
fun getMessageFromAllResponse(callFunction: String, ResponseMessage: String): String
{
var messageFromError: String
var returnMessage: String
try
{
val answerError = JSONObject(ResponseMessage)
messageFromError = answerError.get("Message").toString()
} catch (e: Exception)
{
messageFromError = ResponseMessage
}
// if (messageFromError.isEmpty()) {
//sergio:para personalizar los mensajes de respuesta según la llamada.
when (callFunction)
{
"collection_getTickets" -> returnMessage ="No hay tickets para sacar. Llamada $callFunction."
else ->
{
returnMessage = "Llamada $callFunction."
}
}
//}
return "$messageFromError.$returnMessage"
}

View File

@ -160,8 +160,8 @@ class ItemCardFragment(
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
this.itemFk = itemFk
splash_progress.visibility = View.VISIBLE
viewModel.getItemCard(itemFk,warehouseFk,user,password)
viewModel.getItemPackingType(user,password)
viewModel.getItemCard(itemFk,warehouseFk,user,password,"item_card")
viewModel.getItemPackingType(user,password,"get_ItemPackingType")
}
override fun observeViewModel() {
@ -383,10 +383,10 @@ class ItemCardFragment(
// "itemStockUpdate" -> prepareItemStockUpdate(item,value)
"itemStockUpdateAdd" -> prepareItemStockUpdate2(item,value)
"itemStockUpdateRemove" -> prepareItemStockUpdate2(item,value)
"itemPlacementSave" -> viewModel.itemPlacementSave(itemFk = itemFk, warehouseFk = warehouseFk, user = user, password = password, value = value)
"updateGrouping" -> viewModel.updateGrouping(itemFk = itemFk, user = user, password = password, value = value,warehouseFk = warehouseFk)
"updatePacking" -> viewModel.updatePacking(itemFk = itemFk, user = user, password = password, value = value,warehouseFk = warehouseFk)
"itemSaveMin" -> viewModel.itemSaveMin(itemFk = itemFk, user = user, password = password, value = value)
"itemPlacementSave" -> viewModel.itemPlacementSave(itemFk = itemFk, warehouseFk = warehouseFk, user = user, password = password, value = value,"itemPlacementSave")
"updateGrouping" -> viewModel.updateGrouping(itemFk = itemFk, user = user, password = password, value = value,warehouseFk = warehouseFk,"buy_updateGrouping")
"updatePacking" -> viewModel.updatePacking(itemFk = itemFk, user = user, password = password, value = value,warehouseFk = warehouseFk,"buy_updateGrouping")
"itemSaveMin" -> viewModel.itemSaveMin(itemFk = itemFk, user = user, password = password, value = value,"itemSaveMin")
}
if(item.action != "itemStockUpdate")
@ -456,13 +456,13 @@ class ItemCardFragment(
if (itemB.action == "itemStockUpdateRemove") {
customDialogTwo.setTitle(itemB.title!!).setDescription("Indica la causa de eliminar stock:").setOkButton("Falta"){
viewModel.itemTrash(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "0")
viewModel.itemTrash(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "0","itemTrash")
//changeOfflineValue(itemB,value, listBarcodes)
showProgress()
customDialogTwo.dismiss()
}.setOkButtonTwo("Basura"){
viewModel.itemTrash(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "1")
viewModel.itemTrash(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "1","itemTrash")
//changeOfflineValue(itemB,value, listBarcodes)
showProgress()
customDialogTwo.dismiss()
@ -474,7 +474,7 @@ class ItemCardFragment(
}else{
//changeOfflineValue(itemB,value, listBarcodes)
showProgress()
viewModel.itemTrash(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = (value.toInt() * -1).toString(),isTrash = "0")
viewModel.itemTrash(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = (value.toInt() * -1).toString(),isTrash = "0","itemTrash")
}
}catch (e:Exception){
itemcard_layout.visibility = View.GONE
@ -534,7 +534,7 @@ class ItemCardFragment(
}else{
listBarcodes.add(BarcodeVO(code))
}
viewModel.barcodesEdit(itemFk = itemFk, user = user, password = password, value = code, delete = delete)
viewModel.barcodesEdit(itemFk = itemFk, user = user, password = password, value = code, delete = delete,"itemBarcode_update")
barcodeAdapter!!.notifyDataSetChanged()
//changeOfflineValue(item,"", listBarcodes)
showProgress()
@ -558,7 +558,7 @@ class ItemCardFragment(
private fun updateItemPackingType(itemPackingType:String) {
splash_progress.visibility = View.VISIBLE
viewModel.updatePackingType(this.itemFk,user,password,itemPackingType)
viewModel.updatePackingType(this.itemFk,user,password,itemPackingType,"item_updatePackingType")
}
}

View File

@ -7,6 +7,8 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetItemCardUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.articulo.model.*
import retrofit2.Call
@ -39,28 +41,28 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
fun getItemCard(itemFk:String,warehouseFk:String,user:String,password:String) {
fun getItemCard(itemFk:String,warehouseFk:String,user:String,password:String,callFunction:String) {
getItemCardUserCase.getItemCard(user,password,itemFk,warehouseFk).enqueue(object :Callback<ItemCardVO>{
override fun onFailure(call: Call<ItemCardVO>, t: Throwable) {
_itemcard.value = ItemCardVO(isError = true,errorMessage = "Error al OBTENER "+itemFk+ " Respuesta:"+t.message!!)
_itemcard.value = ItemCardVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<ItemCardVO>, response: Response<ItemCardVO>) {
if (response.body() != null){
_itemcard.value = response.body()!!
}else{
_itemcard.value = ItemCardVO(isError = true,errorMessage = "Error al llamar a vn.itemCard")
_itemcard.value = ItemCardVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}
}
})
}
fun item_getSimilar(itemFk:String, warehouseFk: String, vShipped: String, vIsShowedByType:String, user:String, password:String) {
fun item_getSimilar(itemFk:String, warehouseFk: String, vShipped: String, vIsShowedByType:String, user:String, password:String,callFunction:String) {
getItemCardUserCase.item_getSimilar(user,password,itemFk,warehouseFk,vShipped,vIsShowedByType).enqueue(object :Callback<List<ItemProposal>>{
override fun onFailure(call: Call<List<ItemProposal>>, t: Throwable) {
val listError:ArrayList<ItemProposal> = ArrayList()
listError.add(ItemProposal(isError = true,errorMessage = t.message!!))
listError.add(ItemProposal(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
_itemProposallist.value = ItemProposalList(listError)
}
@ -71,7 +73,7 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
}else{
val listError:ArrayList<ItemProposal> = ArrayList()
listError.add(ItemProposal(isError = true,errorMessage = "Error en la llamada de getItemPackingType"))
listError.add(ItemProposal(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
_itemProposallist.value = ItemProposalList(listError)
}
@ -81,12 +83,12 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
}
fun getItemPackingType(user:String,password:String) {
fun getItemPackingType(user:String,password:String,callFunction:String) {
getItemCardUserCase.getItemPackingType(user,password).enqueue(object :
Callback<List<ItemPackingType>>{
override fun onFailure(call: Call<List<ItemPackingType>>, t: Throwable) {
val listError:ArrayList<ItemPackingType> = ArrayList()
listError.add(ItemPackingType(isError = true,errorMessage = t.message!!))
listError.add(ItemPackingType(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
_itemspackinglist.value = ItemPackingTypeList(listError)
}
@ -96,7 +98,7 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
}else{
val listError:ArrayList<ItemPackingType> = ArrayList()
listError.add(ItemPackingType(isError = true,errorMessage = "Error en la llamada de getItemPackingType"))
listError.add(ItemPackingType(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
_itemspackinglist.value = ItemPackingTypeList(listError)
}
}
@ -106,15 +108,15 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
fun itemStockUpdate(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String){
fun itemStockUpdate(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String,callFunction:String){
getItemCardUserCase.itemStockUpdate(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar STOCK "+itemFk+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada $callFunction."+t.message!!)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemStockUpdate")
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada $callFunction")
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -124,15 +126,15 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
})
}
fun itemTrash(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String){
fun itemTrash(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String,callFunction:String){
getItemCardUserCase.itemTrash(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar STOCK "+itemFk+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemTrash")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -142,15 +144,15 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
})
}
fun itemPlacementSave(itemFk:String,warehouseFk:String,user:String,password:String,value:String){
fun itemPlacementSave(itemFk:String,warehouseFk:String,user:String,password:String,value:String,callFunction:String){
getItemCardUserCase.itemPlacementSave(user,password,itemFk,warehouseFk,value).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage ="Error al guardar NICHO "+itemFk+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemPlacementSave")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -160,15 +162,15 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
})
}
fun updateGrouping(itemFk:String,user:String,password:String,value:String,warehouseFk: String){
fun updateGrouping(itemFk:String,user:String,password:String,value:String,warehouseFk: String,callFunction:String){
getItemCardUserCase.updateGrouping(user,password,itemFk,value,warehouseFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar GROUPING "+itemFk+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada updateGrouping")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -178,15 +180,15 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
})
}
fun updatePacking(itemFk:String,user:String,password:String,value:String,warehouseFk: String){
fun updatePacking(itemFk:String,user:String,password:String,value:String,warehouseFk: String,callFunction:String){
getItemCardUserCase.updatePacking(user,password,itemFk,value,warehouseFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar PACKING "+itemFk+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada updatePacking")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -197,15 +199,15 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
}
//sergio ver como solucionar el tema del "Finish"
fun updatePackingType(itemFk:String,user:String,password:String,itemPackingType:String){
fun updatePackingType(itemFk:String,user:String,password:String,itemPackingType:String,callFunction:String){
getItemCardUserCase.updatePackingType(user,password,itemFk,itemPackingType).enqueue(object : Callback<Boolean>{
override fun onFailure(call: Call<Boolean>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar PackingType "+itemFk+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<Boolean>, response: Response<Boolean>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada updatePackingType")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
//if (response.body()=="Finish"){
// //Log.i("VERDNATURA:","Fisnih encontrado")}
@ -217,15 +219,15 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
})
}
fun itemSaveMin(itemFk:String,user:String,password:String,value:String){
fun itemSaveMin(itemFk:String,user:String,password:String,value:String,callFunction:String){
getItemCardUserCase.itemSaveMin(user,password,itemFk,value).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar MIN "+itemFk+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada updatePacking")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -235,15 +237,15 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
})
}
fun barcodesEdit(itemFk:String,user:String,password:String,value:String,delete:String){
fun barcodesEdit(itemFk:String,user:String,password:String,value:String,delete:String,callFunction:String){
getItemCardUserCase.barcodes_edit(user,password,itemFk,value,delete).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar BARCODES "+itemFk+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemBarcode_update")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}

View File

@ -83,7 +83,7 @@ class ItemProposalFragment(
vShipped = currentDay(),
vIsShowedByType = "TRUE",
user = user,
password = password
password = password,"item_getSimilar"
)
super.onCreate(savedInstanceState)
}
@ -137,7 +137,7 @@ class ItemProposalFragment(
vShipped = currentDay(),
user = user,
password = password
)
,callFunction = "item_getSimilar")
}
if (item == iconFilter) {
@ -172,8 +172,8 @@ class ItemProposalFragment(
vIsShowedByType = filter,
vShipped = currentDay(),
user = user,
password = password
)
password = password ,
callFunction = "item_getSimilar")
}
}

View File

@ -90,16 +90,16 @@ class BufferFragment(
splash_progress.visibility = View.VISIBLE
if (entryPoint.equals("Vaciado buffer")){
viewModel.buffer_setTypeByName(user,password,scan_input.text.toString(),"UNLOADING")
viewModel.buffer_setTypeByName(user,password,scan_input.text.toString(),"UNLOADING","buffer_setTypeByName")
}
if (entryPoint.equals("Llenado buffer")){
viewModel.buffer_setTypeByName(user,password,scan_input.text.toString(),"LOADING")
viewModel.buffer_setTypeByName(user,password,scan_input.text.toString(),"LOADING","buffer_setTypeByName")
}
if (entryPoint.equals("Acumulación buffer")){
viewModel.buffer_setTypeByName(user,password,scan_input.text.toString(),"ACCUMULATION")
viewModel.buffer_setTypeByName(user,password,scan_input.text.toString(),"ACCUMULATION","buffer_setTypeByName")
}
if (entryPoint.equals("Desactivado buffer")){
viewModel.buffer_setTypeByName(user,password,scan_input.text.toString(),"DISABLED")
viewModel.buffer_setTypeByName(user,password,scan_input.text.toString(),"DISABLED","buffer_setTypeByName")
}
}

View File

@ -6,6 +6,8 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.ResponseItemVO
import retrofit2.Call
import retrofit2.Callback
@ -26,7 +28,7 @@ class BufferFragmentViewModel(context: Context) : BaseViewModel() {
get() = _bufferresponse
fun buffer_setTypeByName(user: String, password: String, vBufferFk: String, vType: String) {
fun buffer_setTypeByName(user: String, password: String, vBufferFk: String, vType: String,callFunction:String){
GetPaletizadoresUserCase.buffer_setTypeByName(user, password, vBufferFk, vType)
.enqueue(object : Callback<Boolean> {
override fun onFailure(call: Call<Boolean>, t: Throwable) {
@ -34,15 +36,14 @@ class BufferFragmentViewModel(context: Context) : BaseViewModel() {
_itembuffertype.value = ResponseItemVO(
isError = true,
errorMessage = "Error al realizar operación con buffer.Respuesta:" + t.message!!
)
errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<Boolean>, response: Response<Boolean>) {
// Log.i("VERDNATURA:", "la respuesta es ${response.body()!!}")
if (response.body() != null && response.body() == true) {
// _bufferresponse.value = response.body()!!
_itembuffertype.value = ResponseItemVO(
isError = false,
errorMessage = ""
@ -52,8 +53,8 @@ class BufferFragmentViewModel(context: Context) : BaseViewModel() {
//_bufferresponse.value = false
_itembuffertype.value = ResponseItemVO(
isError = true,
errorMessage = "Error al realizar operación con buffer."
)
errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}
}

View File

@ -78,7 +78,7 @@ class BuscarItemFragment(
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
this.itemFk = itemFk
splash_progress.visibility = View.VISIBLE
viewModel.getLocations(user,password,itemFk)
viewModel.getLocations(user,password,itemFk,"getItemUbication")
}
override fun observeViewModel() {

View File

@ -6,6 +6,8 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetBuscarItemUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
import es.verdnatura.presentation.view.feature.buscaritem.model.LocationListVO
@ -25,11 +27,11 @@ class BuscarItemViewModel(context: Context) : BaseViewModel() {
val loadLocationList = Transformations.map(_locationList) { Event(it) }
fun getLocations(user:String,password:String,itemFk:String){
fun getLocations(user:String,password:String,itemFk:String,callFunction:String){
getBuscarItemUserCase.searchItemsUbicador(user,password,itemFk).enqueue(object : Callback<List<ItemLocationVO>> {
override fun onFailure(call: Call<List<ItemLocationVO>>, t: Throwable) {
val listError:ArrayList<ItemLocationVO> = ArrayList()
listError.add(ItemLocationVO(isError = true,errorMessage = t.message!!))
listError.add(ItemLocationVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
_locationList.value = LocationListVO(listError)
}
@ -41,7 +43,7 @@ class BuscarItemViewModel(context: Context) : BaseViewModel() {
_locationList.value = response.body()?.let { LocationListVO(it) }
}else{
val listError:ArrayList<ItemLocationVO> = ArrayList()
listError.add(ItemLocationVO(isError = true,errorMessage = "Error en la llamada de searchItemsUbicador"))
listError.add(ItemLocationVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
_locationList.value = LocationListVO(listError)
}
}

View File

@ -113,7 +113,7 @@ class BuscarItemAllFragment(
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
this.itemFk = itemFk
splash_progress.visibility = View.VISIBLE
viewModel.getLocationsAll(user,password,itemFk)
viewModel.getLocationsAll(user,password,itemFk,"getItemUbication")
}
override fun observeViewModel() {

View File

@ -6,6 +6,8 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetBuscarItemAllUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.view.feature.buscaritemall.model.ItemLocationAll
import es.verdnatura.presentation.view.feature.buscaritemall.model.LocationListAll
@ -26,11 +28,11 @@ class BuscarItemAllViewModel(context: Context) : BaseViewModel() {
val loadLocationListAll = Transformations.map(_locationListAll) { Event(it) }
fun getLocationsAll(user:String,password:String,itemFk:String){
fun getLocationsAll(user:String,password:String,itemFk:String,callFunction:String){
getBuscarItemAllUserCase.searchItemsUbicadorAll(user,password,itemFk).enqueue(object : Callback<List<ItemLocationAll>> {
override fun onFailure(call: Call<List<ItemLocationAll>>, t: Throwable) {
val listError:ArrayList<ItemLocationAll> = ArrayList()
listError.add(ItemLocationAll(isError = true,errorMessage = t.message!!))
listError.add(ItemLocationAll(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
_locationListAll.value = LocationListAll(listError)
}
@ -42,7 +44,7 @@ class BuscarItemAllViewModel(context: Context) : BaseViewModel() {
_locationListAll.value = response.body()?.let { LocationListAll(it) }
}else{
val listError:ArrayList<ItemLocationAll> = ArrayList()
listError.add(ItemLocationAll(isError = true,errorMessage = "Error en la llamada de searchItemsUbicadorAll"))
listError.add(ItemLocationAll(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
_locationListAll.value = LocationListAll(listError)
}
}

View File

@ -54,7 +54,7 @@ class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(Buyer
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,1).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
viewModel.itemShelvingBuyerGet(user = user,password = password)
viewModel.itemShelvingBuyerGet(user = user,password = password,"itemShelving_BuyerGet")
super.onCreate(savedInstanceState)
}
@ -76,7 +76,7 @@ class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(Buyer
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload){
splash_progress.visibility = View.VISIBLE
viewModel.itemShelvingBuyerGet(user = user,password = password)
viewModel.itemShelvingBuyerGet(user = user,password = password,"itemShelving_BuyerGet")
}
}

View File

@ -5,6 +5,8 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetQualityUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.view.feature.calidad.model.BuyerListVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
import es.verdnatura.presentation.view.feature.inventario.model.InventaryListVO
@ -21,12 +23,12 @@ class BuyersViewModel(context: Context) : BaseViewModel() {
val buyersList: LiveData<BuyerListVO>
get() = _buyersList
fun itemShelvingBuyerGet(user:String,password:String){
fun itemShelvingBuyerGet(user:String,password:String,callFunction:String){
getQualityUserCase.itemShelvingBuyerGet(user,password).enqueue(object :
Callback<List<BuyerVO>> {
override fun onFailure(call: Call<List<BuyerVO>>, t: Throwable) {
val listError:ArrayList<BuyerVO> = ArrayList()
listError.add(BuyerVO(isError = true,errorMessage = t.message!!))
listError.add(BuyerVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
_buyersList.value = BuyerListVO(listError)
}
@ -38,7 +40,7 @@ class BuyersViewModel(context: Context) : BaseViewModel() {
_buyersList.value = response.body()?.let { BuyerListVO(it) }
}else{
val listError:ArrayList<BuyerVO> = ArrayList()
listError.add(BuyerVO(isError = true,errorMessage = "Error en la llamada de itemShelving_buyerGet"))
listError.add(BuyerVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,response.message())))
_buyersList.value = BuyerListVO(listError)
}
}

View File

@ -61,7 +61,7 @@ class QaualityFragment(
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,1).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
viewModel.itemShelvingBuyerTask(user = user,password = password,userFk = userFk)
viewModel.itemShelvingBuyerTask(user = user,password = password,userFk = userFk,"itemShelving_BuyerTask")
super.onCreate(savedInstanceState)
}
@ -89,7 +89,7 @@ class QaualityFragment(
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload){
splash_progress.visibility = View.VISIBLE
viewModel.itemShelvingBuyerTask(user = user,password = password,userFk = userFk)
viewModel.itemShelvingBuyerTask(user = user,password = password,userFk = userFk,"itemShelving_BuyerTask")
}
}
})
@ -131,7 +131,7 @@ class QaualityFragment(
})
response.observe(viewLifecycleOwner, Observer {
viewModel.itemShelvingBuyerTask(user = user,password = password,userFk = userFk)
viewModel.itemShelvingBuyerTask(user = user,password = password,userFk = userFk,"itemShelving_BuyerTask")
})
}
}

View File

@ -5,6 +5,8 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetQualityUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerListVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
@ -28,12 +30,12 @@ class QaualityViewModel(context: Context) : BaseViewModel() {
get() = _response
fun itemShelvingBuyerTask(user:String,password:String,userFk:String){
fun itemShelvingBuyerTask(user:String,password:String,userFk:String,callFunction:String){
getQualityUserCase.itemShelvingBuyerTask(user,password,userFk).enqueue(object :
Callback<List<ItemBuyerVO>> {
override fun onFailure(call: Call<List<ItemBuyerVO>>, t: Throwable) {
val listError:ArrayList<ItemBuyerVO> = ArrayList()
listError.add(ItemBuyerVO(isError = true,errorMessage = t.message!!))
listError.add(ItemBuyerVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
_buyersList.value = ItemBuyerListVO(listError)
}
@ -45,7 +47,7 @@ class QaualityViewModel(context: Context) : BaseViewModel() {
_buyersList.value = response.body()?.let { ItemBuyerListVO(it) }
}else{
val listError:ArrayList<ItemBuyerVO> = ArrayList()
listError.add(ItemBuyerVO(isError = true,errorMessage = "Error en la llamada de itemShelvingBuyerTask"))
listError.add(ItemBuyerVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
_buyersList.value = ItemBuyerListVO(listError)
}
}
@ -56,12 +58,13 @@ class QaualityViewModel(context: Context) : BaseViewModel() {
fun itemShelvingStarsUpdate(usuario:String,password:String, vId: String,vStars: String) {
getQualityUserCase.itemShelvingStarsUpdate(usuario,password,vId,vStars).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelving_StarsUpdate."+t.message!!)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelvingStarsUpdate")
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelving_StarsUpdate")
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}

View File

@ -7,6 +7,7 @@ import android.graphics.drawable.Drawable
import android.media.MediaPlayer
import android.os.Bundle
import android.speech.SpeechRecognizer
import android.text.InputType
import android.util.Log
import android.view.View
import android.view.inputmethod.EditorInfo
@ -120,12 +121,12 @@ class CollectionFragment(
if ((collection.collectionFk != null) && type.equals(CONTROLADOR)) {
//sergio: comprueba si viene de la pantalla de controlador
viewModel.ticketOrCollection_checkFullyControlled(user, password, collection.collectionFk)
viewModel.ticketOrCollection_checkFullyControlled(user, password, collection.collectionFk,"ticketOrCollection_checkFullyControlled")
workerFkFromTicket=collection.tickets.get(0).sales.get(0).workerFk
}
if (collection.tickets.isEmpty()) {
viewModel.collectionTicketGet(user, password, collection.collectionFk, sectorFk, type)
viewModel.collectionTicketGet(user, password, collection.collectionFk, sectorFk, type,"collection_getTickets")
}
@ -237,6 +238,9 @@ class CollectionFragment(
}
//ESCANER =========
hideKeyboards()
if (type.equals(CONTROLADOR)){
scan_input.inputType= InputType.TYPE_CLASS_NUMBER
}
scan_input.requestFocus()
scan_input.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {//ID=0 ACTION_NEXT ID=5 ACTION_UNESPECEFIED)
@ -265,7 +269,7 @@ class CollectionFragment(
collection.collectionFk,
sectorFk,
type
)
,"collection_getTickets")
collection_swipe.isRefreshing = false
}
}
@ -335,7 +339,7 @@ class CollectionFragment(
collection.collectionFk,
sectorFk,
type
)
,"collection_getTickets")
// //Log.i("VERDNATURA:","La collection es ${collection.collectionFk}")
}
@ -401,7 +405,7 @@ class CollectionFragment(
}
.setKoButton("Revisar"){
splash_progress.visibility=View.VISIBLE
viewModel.collectionTicketGet(user, password, it.response, sectorFk, type)
viewModel.collectionTicketGet(user, password, it.response, sectorFk, type,"collection_getTickets")
customDialog.dismiss()
}
customDialog.show()
@ -411,6 +415,16 @@ class CollectionFragment(
}
})
responseSalixMessage.observe(viewLifecycleOwner, Observer{
if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Aceptar") {
customDialog.dismiss()
}.show()
}
})
}
}
@ -618,7 +632,8 @@ class CollectionFragment(
usuario = user,
password = password,
ticketFk = tickets[0],
parking = txtscan
parking = txtscan,
"shelvingPark"
)
}
Timber.i("La coleccion es "+tickets[0])
@ -661,7 +676,8 @@ class CollectionFragment(
usuario = user,
password = password,
ticketFk = tickets[0],
parking = txtscan
parking = txtscan,
"shelvingPark"
)
}
if (mpok != null) mpok!!.start()
@ -672,10 +688,10 @@ class CollectionFragment(
storedBackPosition = 0
if (type != PRECHECKER) {
viewModel.collectionTicketGet(user, password, txtscan, sectorFk, type)
viewModel.collectionTicketGet(user, password, txtscan, sectorFk, type,"collection_getTickets")
if (type.equals(CONTROLADOR)) {
viewModel.ticketOrCollection_checkFullyControlled(user, password, txtscan)
viewModel.ticketOrCollection_checkFullyControlled(user, password, txtscan,"ticketOrCollection_checkFullyControlled")
}
} else {
splash_progress.visibility = View.GONE
@ -732,7 +748,8 @@ class CollectionFragment(
usuario = user,
password = password,
ticketFk = it,
parking = txtscan
parking = txtscan,
"shelvingPark"
)
}
if (mpok != null) mpok!!.start()
@ -807,7 +824,8 @@ class CollectionFragment(
vIsChecked = if (type == SACADOR) sales[position].isPrepared else if (type == CONTROLADOR) sales[position].isControlled else "1",
vOriginalQuantity = sales[position].pickedQuantity,
vStateFk = type,//type.toString(),
vBuyFk = originalItemScan
vBuyFk = originalItemScan,
callFunction = "saleTrackingReplace"
)
//Log.i("VERDNATURA:","POSICION $position y el vStateFk $type")
//Log.i("VERDNATURA:","vIscheked es ${if(type == CONTROLADOR) sales[position].isControlled else "1"}")
@ -829,7 +847,8 @@ class CollectionFragment(
viewModel.saleTrackingDel(
usuario = user,
password = password,
saleFk = sales[position].saleFk
saleFk = sales[position].saleFk,
"saleTracking_del"
)
}
setTotalLines()
@ -860,7 +879,8 @@ class CollectionFragment(
password = password,
itemFk = sales[position].itemFk,
quantity = quantityGet,
shelvingFk = sales[position].placements[shelvingPosition].shelving
shelvingFk = sales[position].placements[shelvingPosition].shelving,
callFunction = "itemPlacementSupplyAiming"
)
}
@ -916,7 +936,7 @@ class CollectionFragment(
viewModel.getIdFromCode(
usuario = user,
password = password,
code = customDialogList.getValueTwo()
code = customDialogList.getValueTwo(),"barcodeToItem"
)
customDialogList.dismiss()
}
@ -982,7 +1002,7 @@ class CollectionFragment(
viewModel.getIdFromCode(
usuario = user,
password = password,
code = customDialogList.getValueTwo()
code = customDialogList.getValueTwo(),"barcodeToItem"
)
customDialogList.dismiss()
scanRequest()
@ -1043,7 +1063,7 @@ class CollectionFragment(
if (quantityPicked<quantityTotal)
{
// Log.i("VERDNATURA::","Lanzamos collection para que refresque adaptador y ordene")
viewModel.collectionTicketGet(user, password, collection.collectionFk, sectorFk, type)
viewModel.collectionTicketGet(user, password, collection.collectionFk, sectorFk, type,"collection_getTickets")
}
}
@ -1087,7 +1107,8 @@ class CollectionFragment(
password = password,
itemShelvingFk = itemShelvingFk,
saleFk = sales[storedPosition].saleFk,
quantity = if (quantity != "0") quantity else customDialogList.getValue()
quantity = if (quantity != "0") quantity else customDialogList.getValue(),
callFunction = "itemShelvingSaleSupplyAdd"
)
} catch (e: Exception) {
@ -1123,7 +1144,8 @@ class CollectionFragment(
usuario = user,
password = password,
collectionFk = collection.collectionFk,
sectorFk = sectorFk
sectorFk = sectorFk,
"collectionStickerPrint"
)
@ -1155,7 +1177,8 @@ class CollectionFragment(
itemFk = customDialogList.getValue(),
ticketFk = ticketSelected,
quantityFk = customDialogList.getValueTwo(),
warehouseFk = warehouseFk
warehouseFk = warehouseFk,
callFunction="collection_addItem"
)
scanRequest()
customDialogList.dismiss()
@ -1198,7 +1221,8 @@ class CollectionFragment(
itemFk = customDialogList.getValue(),
ticketFk = ticketSelected,
quantityFk = customDialogList.getValueTwo(),
warehouseFk = warehouseFk
warehouseFk = warehouseFk,
callFunction = "collection_addItem"
)
scanRequest()
customDialogList.dismiss()
@ -1246,7 +1270,8 @@ class CollectionFragment(
usuario = user,
password = password,
itemFk = customDialogInput.getValue(),
warehouseFk = warehouseFk
warehouseFk = warehouseFk,
"item_GetVisibleAvailable"
)
scanRequest()
customDialogInput.dismiss()
@ -1269,7 +1294,7 @@ class CollectionFragment(
password = password,
itemFk = customDialogInput.getValue(),
warehouseFk = warehouseFk
)
,"item_GetVisibleAvailable")
}
customDialogInput.setValue("")
scanRequest()
@ -1383,7 +1408,8 @@ class CollectionFragment(
password = password,
saleFk = sales[position].saleFk,
quantity = totalQuantity.toString(),
originalQuantity = sales[position].quantity
originalQuantity = sales[position].quantity,
"saleMove"
)
//sales[position].originalQuantity = quantity
sales[position].quantity = quantity
@ -1401,7 +1427,7 @@ class CollectionFragment(
viewModel.sendChekingPresence(
token = token,
workerId = sales[position].salePersonFk,
message = message
message = message,"sendChekingPresence"
)
}
@ -1419,7 +1445,8 @@ class CollectionFragment(
quantity = totalQuantity.toString(),
warehouseFk = warehouseFk,
type = "FALSE",
originalQuantity = quantity
originalQuantity = quantity,
callFunction = "saleMistake_Add"
)
//sales[position].originalQuantity = quantity
sales[position].quantity = quantity
@ -1436,7 +1463,7 @@ class CollectionFragment(
viewModel.sendChekingPresence(
token = token,
workerId = sales[position].salePersonFk,
message = message
message = message,"sendChekingPresence"
)
}
@ -1453,7 +1480,8 @@ class CollectionFragment(
quantity = totalQuantity.toString(),
warehouseFk = warehouseFk,
type = "TRUE",
originalQuantity = quantity
originalQuantity = quantity,
callFunction = "collectionMissingTrash",
)
//sales[position].originalQuantity = quantity
sales[position].quantity = quantity
@ -1471,7 +1499,7 @@ class CollectionFragment(
viewModel.sendChekingPresence(
token = token,
workerId = sales[position].salePersonFk,
message = message
message = message,"sendChekingPresence"
)
}
@ -1489,7 +1517,8 @@ class CollectionFragment(
warehouseFk = warehouseFk,
type = "reject",
originalQuantity = quantity
)
,callFunction = "collectionMissingTrash")
//sales[position].originalQuantity = quantity
sales[position].quantity = quantity
//sales[position].startQuantity = quantity
@ -1505,7 +1534,7 @@ class CollectionFragment(
viewModel.sendChekingPresence(
token = token,
workerId = sales[position].salePersonFk,
message = message
message = message,"sendChekingPresence"
)
}
@ -1514,7 +1543,7 @@ class CollectionFragment(
usuario = user,
password = password,
saleFk = sales[position].saleFk,
quantity = quantity
quantity = quantity,"collection_increaseQuantity"
)
try {
//val quantityPicked = (quantity.toInt() - sales[position].quantity.toInt()).toString()
@ -1535,7 +1564,7 @@ class CollectionFragment(
viewModel.sendChekingPresence(
token = token,
workerId = sales[position].salePersonFk,
message = message
message = message,"sendChekingPresence"
)
}
@ -1547,7 +1576,7 @@ class CollectionFragment(
usuario = user,
password = password,
collectionFk = it,
state = CHECKED
state = CHECKED,"collection_updateState"
)
}
} else if (type == SACADOR) {
@ -1556,7 +1585,7 @@ class CollectionFragment(
usuario = user,
password = password,
collectionFk = it,
state = PREPARED
state = PREPARED,"collection_updateState"
)
}
@ -1570,7 +1599,7 @@ class CollectionFragment(
usuario = user,
password = password,
collectionFk = it,
state = ON_CHECKING
state = ON_CHECKING,"collection_updateState"
)
}
} else if (type == SACADOR) {
@ -1579,7 +1608,7 @@ class CollectionFragment(
usuario = user,
password = password,
collectionFk = it,
state = ON_PREPARATION
state = ON_PREPARATION,"collection_updateState"
)
}
}
@ -1649,7 +1678,7 @@ class CollectionFragment(
password = password,
vSaleFk = mistakeSale?.saleFk!!,
vUserFk = mistakeSale?.workerFk!!,
vTypeFk = it.id
vTypeFk = it.id,"saleMistake_Add"
)
"Causa del error registrado".toast(requireContext())
customDialogList.dismiss()

View File

@ -1,13 +1,15 @@
package es.verdnatura.presentation.view.feature.collection.fragment
import android.content.Context
import android.util.Log
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetLoginUserCase
import es.verdnatura.domain.GetSacadorControladorUserCase
import es.verdnatura.domain.GetUbicadorUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.getMessageFromResponse
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.collection.ItemVO
import es.verdnatura.presentation.view.feature.collection.mapper.map
@ -16,11 +18,13 @@ import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
class CollectionViewModel(context: Context) : BaseViewModel() {
class CollectionViewModel(context: Context) : BaseViewModel()
{
val emptyMessage = "La colección no tiene tickets"
private val getSacadorControladorUserCase: GetSacadorControladorUserCase = GetSacadorControladorUserCase(context)
private val getSacadorControladorUserCase: GetSacadorControladorUserCase =
GetSacadorControladorUserCase(context)
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context)
private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase(context)
@ -36,12 +40,10 @@ class CollectionViewModel(context: Context) : BaseViewModel() {
val response: LiveData<ResponseItemVO>
get() = _response
private val _responsecheckfully by lazy { MutableLiveData<ResponseItemVO>() }
val responsecheckfully: LiveData<ResponseItemVO>
get() = _responsecheckfully
private val _responseNew by lazy { MutableLiveData<ResponseItemVO>() }
val responseNew: LiveData<ResponseItemVO>
get() = _responseNew
@ -58,285 +60,628 @@ class CollectionViewModel(context: Context) : BaseViewModel() {
val mistakeList: LiveData<MistakeTypeListVO>
get() = _mistakeList
private val _responseSalixMessage by lazy { MutableLiveData<ResponseItemVO>() }
val responseSalixMessage: LiveData<ResponseItemVO>
get() = _responseSalixMessage
private val _item by lazy { MutableLiveData<ItemVO>() }
val item: LiveData<ItemVO>
get() = _item
fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String,type:String){
getSacadorControladorUserCase.collectionTicketGet(usuario,password,collectionFk,sectorFk,"0",type).enqueue(object :
Callback<CollectionVO> {
override fun onFailure(call: Call<CollectionVO>, t: Throwable) {
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = t.message!!)
fun collectionTicketGet(
usuario: String,
password: String,
collectionFk: String,
sectorFk: String,
type: String,
callFunction:String){
getSacadorControladorUserCase.collectionTicketGet(
usuario,
password,
collectionFk,
sectorFk,
"0",
type
).enqueue(object :
Callback<CollectionVO>
{
override fun onFailure(call: Call<CollectionVO>, t: Throwable)
{
_collectionTicketList.value = CollectionVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
override fun onResponse(
call: Call<CollectionVO>,
response: Response<CollectionVO>
) {
if (response.body() != null){
)
{
if (response.body() != null)
{
_collectionTicketList.value = response.body()?.let { it.map() }
}else{
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = "Error en la llamada de collection_get")
} else
{
_collectionTicketList.value = CollectionVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}
}
})
}
fun saleTrackingReplace(usuario:String,password:String,saleFk:String,vOriginalQuantity:String,vStateFk:String,vIsChecked:String,vBuyFk:String){
getSacadorControladorUserCase.saleTrackingReplace(usuario,password,saleFk,vOriginalQuantity,vStateFk,vIsChecked,vBuyFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
fun saleTrackingReplace(
usuario: String,
password: String,
saleFk: String,
vOriginalQuantity: String,
vStateFk: String,
vIsChecked: String,
vBuyFk: String,callFunction:String)
{
getSacadorControladorUserCase.saleTrackingReplace(
usuario,
password,
saleFk,
vOriginalQuantity,
vStateFk,
vIsChecked,
vBuyFk
).enqueue(object : Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada saleTracking_Replace")
}else{
override fun onResponse(call: Call<String>, response: Response<String>)
{
if (response.body() == null)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message()))
} else
{
_response.value = ResponseItemVO(isError = false, response = response.body()!!)
}
}
})
}
fun itemPlacementSupplyAiming(usuario:String,password:String,shelvingFk:String,quantity:String,itemFk:String){
getSacadorControladorUserCase.itemPlacementSupplyAiming(usuario,password,shelvingFk,quantity,itemFk).enqueue(object :
Callback<List<PlacementSupplyVO>> {
override fun onFailure(call: Call<List<PlacementSupplyVO>>, t: Throwable) {
fun itemPlacementSupplyAiming(
usuario: String,
password: String,
shelvingFk: String,
quantity: String,
itemFk: String,callFunction:String)
{
getSacadorControladorUserCase.itemPlacementSupplyAiming(
usuario,
password,
shelvingFk,
quantity,
itemFk
).enqueue(object :
Callback<List<PlacementSupplyVO>>
{
override fun onFailure(call: Call<List<PlacementSupplyVO>>, t: Throwable)
{
val listError: ArrayList<PlacementSupplyVO> = ArrayList()
listError.add(PlacementSupplyVO(isError = true,errorMessage = t.message!!))
listError.add(
PlacementSupplyVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
)
_placementSuppleyList.value = PlacementSupplyListVO(listError)
}
override fun onResponse(
call: Call<List<PlacementSupplyVO>>,
response: Response<List<PlacementSupplyVO>>
) {
if (response.body() != null){
)
{
if (response.body() != null)
{
_placementSuppleyList.value = response.body()?.let { PlacementSupplyListVO(it) }
}else{
} else
{
val listError: ArrayList<PlacementSupplyVO> = ArrayList()
listError.add(PlacementSupplyVO(isError = true,errorMessage = "Error en la llamada de itemPlacementSupplyAiming"))
listError.add(
PlacementSupplyVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
)
_placementSuppleyList.value = PlacementSupplyListVO(listError)
}
}
})
}
fun itemShelvingSaleSupplyAdd(usuario:String,password:String,itemShelvingFk:String,saleFk:String,quantity:String){
getSacadorControladorUserCase.itemShelvingSaleSupplyAdd(usuario,password,itemShelvingFk,saleFk,quantity).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
fun itemShelvingSaleSupplyAdd(
usuario: String,
password: String,
itemShelvingFk: String,
saleFk: String,
quantity: String,callFunction:String
)
{
getSacadorControladorUserCase.itemShelvingSaleSupplyAdd(
usuario,
password,
itemShelvingFk,
saleFk,
quantity
).enqueue(object : Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelvingSaleSupplyAdd")
}else{
override fun onResponse(call: Call<String>, response: Response<String>)
{
if (response.body() == null)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
} else
{
_response.value = ResponseItemVO(isError = false, response = response.body()!!)
}
}
})
}
fun collectionStickerPrint(usuario:String,password:String,collectionFk: String,sectorFk: String){
getSacadorControladorUserCase.collectionStickerPrint(usuario,password,collectionFk,sectorFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
fun collectionStickerPrint(
usuario: String,
password: String,
collectionFk: String,
sectorFk: String,callFunction:String)
{
getSacadorControladorUserCase.collectionStickerPrint(
usuario,
password,
collectionFk,
sectorFk
).enqueue(object : Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_response.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada collectionStickerPrint")
}else{
override fun onResponse(call: Call<String>, response: Response<String>)
{
if (response.body() == null)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
} else
{
_response.value = ResponseItemVO(isError = false, response = response.body()!!)
}
}
})
}
fun itemGetAvailable(usuario:String,password:String,itemFk: String,warehouseFk: String){
getSacadorControladorUserCase.itemGetAvailable(usuario,password,itemFk,warehouseFk).enqueue(object : Callback<ItemVO>{
override fun onFailure(call: Call<ItemVO>, t: Throwable) {
_item.value = ItemVO(isError = true,errorMessage = ""+t.message!!)
fun itemGetAvailable(usuario: String, password: String, itemFk: String, warehouseFk: String,callFunction:String)
{
getSacadorControladorUserCase.itemGetAvailable(usuario, password, itemFk, warehouseFk)
.enqueue(object : Callback<ItemVO>
{
override fun onFailure(call: Call<ItemVO>, t: Throwable)
{
_item.value = ItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
override fun onResponse(call: Call<ItemVO>, response: Response<ItemVO>) {
if (response.body() == null){
_item.value = ItemVO(isError = true,errorMessage = "Error en la llamada item_GetVisibleAvailable")
}else{
override fun onResponse(call: Call<ItemVO>, response: Response<ItemVO>)
{
if (response.body() == null)
{
_item.value = ItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
} else
{
_item.value = response.body()
}
}
})
}
fun collectionAddItem(usuario:String,password:String,itemFk: String,quantityFk: String,ticketFk: String,warehouseFk: String){
getSacadorControladorUserCase.collectionAddItem(usuario,password,itemFk,quantityFk,ticketFk,warehouseFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_responseNew.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
fun collectionAddItem(
usuario: String,
password: String,
itemFk: String,
quantityFk: String,
ticketFk: String,
warehouseFk: String,callFunction:String)
{
getSacadorControladorUserCase.collectionAddItem(
usuario,
password,
itemFk,
quantityFk,
ticketFk,
warehouseFk
).enqueue(object : Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_responseNew.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_responseNew.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada collectionAddItem")
}else{
_responseNew.value = ResponseItemVO(isError = false,response = response.body()!!)
override fun onResponse(call: Call<String>, response: Response<String>)
{
if (response.body() == null)
{
_responseNew.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
} else
{
_responseNew.value =
ResponseItemVO(isError = false, response = response.body()!!)
}
}
})
}
fun saleMove(usuario:String,password:String,saleFk: String,quantity: String,originalQuantity : String){
getSacadorControladorUserCase.saleMove(usuario,password,saleFk,quantity,originalQuantity).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
fun saleMove(
usuario: String,
password: String,
saleFk: String,
quantity: String,
originalQuantity: String,callFunction:String)
{
getSacadorControladorUserCase.saleMove(
usuario,
password,
saleFk,
quantity,
originalQuantity
).enqueue(object : Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada saleMove")
}else{
override fun onResponse(call: Call<String>, response: Response<String>)
{
if (response.body() == null)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message()))
} else
{
_response.value = ResponseItemVO(isError = false, response = response.body()!!)
}
}
})
}
fun collectionMissingTrash(usuario:String,password:String,saleFk: String,quantity: String,type:String,warehouseFk:String,originalQuantity: String){
getSacadorControladorUserCase.collectionMissingTrash(usuario,password,saleFk,quantity,type,warehouseFk,originalQuantity).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
fun collectionMissingTrash(
usuario: String,
password: String,
saleFk: String,
quantity: String,
type: String,
warehouseFk: String,
originalQuantity: String,callFunction:String
)
{
getSacadorControladorUserCase.collectionMissingTrash(
usuario,
password,
saleFk,
quantity,
type,
warehouseFk,
originalQuantity
).enqueue(object : Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada collectionMissingTrash")
}else{
override fun onResponse(call: Call<String>, response: Response<String>)
{
if (response.body() == null)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
} else
{
_response.value = ResponseItemVO(isError = false, response = response.body()!!)
}
}
})
}
fun saleTrackingDel(usuario:String,password:String,saleFk: String){
getSacadorControladorUserCase.saleTrackingDel(usuario,password,saleFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
fun saleTrackingDel(usuario: String, password: String, saleFk: String,callFunction:String)
{
getSacadorControladorUserCase.saleTrackingDel(usuario, password, saleFk)
.enqueue(object : Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada collectionMissingTrash")
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
override fun onResponse(call: Call<String>, response: Response<String>)
{
if (response.body() == null)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
} else
{
_response.value =
ResponseItemVO(isError = false, response = response.body()!!)
}
}
})
}
fun parking(usuario: String,password: String,ticketFk: String,parking:String){
getUbicadorUserCase.shelvingPark(usuario,password,ticketFk,parking).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
fun parking(usuario: String, password: String, ticketFk: String, parking: String,callFunction:String)
{
getUbicadorUserCase.shelvingPark(usuario, password, ticketFk, parking)
.enqueue(object : Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada shelvingPark")
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
override fun onResponse(call: Call<String>, response: Response<String>)
{
if (response.body() == null)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
} else
{
_response.value =
ResponseItemVO(isError = false, response = response.body()!!)
}
}
})
}
fun collectionUpdateState(usuario:String,password:String,collectionFk: String,state : String){
getSacadorControladorUserCase.collectionUpdateState(usuario,password,collectionFk,state).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
fun collectionUpdateState(
usuario: String,
password: String,
collectionFk: String,
state: String,callFunction:String
)
{
getSacadorControladorUserCase.collectionUpdateState(usuario, password, collectionFk, state)
.enqueue(object : Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage =getMessageFromAllResponse(callFunction,t.message!!)
)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada collectionUpdateState")
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
override fun onResponse(call: Call<String>, response: Response<String>)
{
if (response.body() == null)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
} else
{
_response.value =
ResponseItemVO(isError = false, response = response.body()!!)
}
}
})
}
fun getIdFromCode(usuario:String,password:String,code: String){
getSacadorControladorUserCase.getIdFromCode(usuario,password,code).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_responseCode.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
fun getIdFromCode(usuario: String, password: String, code: String,callFunction:String)
{
getSacadorControladorUserCase.getIdFromCode(usuario, password, code)
.enqueue(object : Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_responseCode.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_responseCode.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada barcodeToItem")
}else{
_responseCode.value = ResponseItemVO(isError = false,response = response.body()!!)
override fun onResponse(call: Call<String>, response: Response<String>)
{
if (response.body() == null)
{
_responseCode.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
} else
{
_responseCode.value =
ResponseItemVO(isError = false, response = response.body()!!)
}
}
})
}
fun collectionIncreaseQuantity(usuario:String,password:String,saleFk: String,quantity: String){
getSacadorControladorUserCase.collectionIncreaseQuantity(usuario,password,saleFk,quantity).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_responseIncQuantity.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
fun collectionIncreaseQuantity(
usuario: String,
password: String,
saleFk: String,
quantity: String,callFunction:String
)
{
getSacadorControladorUserCase.collectionIncreaseQuantity(
usuario,
password,
saleFk,
quantity,
).enqueue(object : Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_responseIncQuantity.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_responseIncQuantity.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada collectionIncreaseQuantity")
}else{
_responseIncQuantity.value = ResponseItemVO(isError = false,response = response.body()!!)
override fun onResponse(call: Call<String>, response: Response<String>)
{
if (response.body() == null)
{
_responseIncQuantity.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
} else
{
_responseIncQuantity.value =
ResponseItemVO(isError = false, response = response.body()!!)
}
}
})
}
fun sendChekingPresence(token:String,workerId:String,message:String){
try{
getLoginUserCase.sendChekingPresence(token,workerId.toInt(),message).enqueue(object : Callback<Boolean>{
override fun onResponse(call: Call<Boolean>, response: Response<Boolean>) {
Log.i("Salix","Mensaje enviado a salix")
fun sendChekingPresence(token: String, workerId: String, message: String,calledFunction:String)
{
try
{
getLoginUserCase.sendChekingPresence(token, workerId.toInt(), message)
.enqueue(object : Callback<Boolean>
{
override fun onResponse(call: Call<Boolean>, response: Response<Boolean>)
{
if (!response.isSuccessful)
{
_responseSalixMessage.value = ResponseItemVO(
isError = true,
errorMessage = "Error en la llamada $calledFunction al enviar mensaje rocket." + getMessageFromResponse(
response.message()
))
//Log.i("Salix","Mensaje enviado a salix")
}
override fun onFailure(call: Call<Boolean>, t: Throwable) {
Log.i("Salix Error",""+t.message)
}
override fun onFailure(call: Call<Boolean>, t: Throwable)
{
//Log.i("Salix Error",""+t.message)
}
})
}catch (e:Exception){}
} catch (e: Exception)
{
}
}
fun saleMistakeAdd(usuario:String,password:String,vSaleFk: String, vUserFk: String, vTypeFk: String){
getSacadorControladorUserCase.saleMistakeAdd(usuario,password,vSaleFk,vUserFk,vTypeFk).enqueue(object :
Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
fun saleMistakeAdd(
usuario: String,
password: String,
vSaleFk: String,
vUserFk: String,
vTypeFk: String,callFunction:String
)
{
getSacadorControladorUserCase.saleMistakeAdd(usuario, password, vSaleFk, vUserFk, vTypeFk)
.enqueue(object :
Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage =getMessageFromAllResponse(callFunction,t.message!!)
)
}
override fun onResponse(
call: Call<String>,
response: Response<String>
) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada saleMistakeAdd")
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
)
{
if (response.body() == null)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
} else
{
_response.value =
ResponseItemVO(isError = false, response = response.body()!!)
}
}
})
}
fun mistakeType(usuario:String,password:String){
getSacadorControladorUserCase.mistakeType(usuario,password).enqueue(object : Callback<List<MistakeTypeVO>>{
override fun onFailure(call: Call<List<MistakeTypeVO>>, t: Throwable) {
fun mistakeType(usuario: String, password: String)
{
getSacadorControladorUserCase.mistakeType(usuario, password)
.enqueue(object : Callback<List<MistakeTypeVO>>
{
override fun onFailure(call: Call<List<MistakeTypeVO>>, t: Throwable)
{
val listError: ArrayList<MistakeTypeVO> = ArrayList()
listError.add(MistakeTypeVO("0", ""))
_mistakeList.value = MistakeTypeListVO(listError)
@ -345,10 +690,13 @@ class CollectionViewModel(context: Context) : BaseViewModel() {
override fun onResponse(
call: Call<List<MistakeTypeVO>>,
response: Response<List<MistakeTypeVO>>
) {
if (response.body() != null){
)
{
if (response.body() != null)
{
_mistakeList.value = response.body()?.let { MistakeTypeListVO(it) }
}else{
} else
{
val listError: ArrayList<MistakeTypeVO> = ArrayList()
listError.add(MistakeTypeVO("0", ""))
_mistakeList.value = MistakeTypeListVO(listError)
@ -357,24 +705,45 @@ class CollectionViewModel(context: Context) : BaseViewModel() {
})
}
fun ticketOrCollection_checkFullyControlled(usuario:String,password:String,collectionFk:String){
getSacadorControladorUserCase.ticketOrCollection_checkFullyControlled(usuario,password,collectionFk).enqueue(object :
Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
_responsecheckfully.value = ResponseItemVO(isError = true, errorMessage = "" + t.message!!)
fun ticketOrCollection_checkFullyControlled(
usuario: String,
password: String,
collectionFk: String,callFunction:String
)
{
getSacadorControladorUserCase.ticketOrCollection_checkFullyControlled(
usuario,
password,
collectionFk
).enqueue(object :
Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_responsecheckfully.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
override fun onResponse(
call: Call<String?>,
response: Response<String>
) {
)
{
if (response.body() != "false"){
if (response.body() != "false")
{
//sergio:
_responsecheckfully.value = ResponseItemVO(isError = false, response = response.body()!!,errorMessage = "")
_responsecheckfully.value = ResponseItemVO(
isError = false,
response = response.body()!!,
errorMessage = ""
)
}
}
})
}
}

View File

@ -85,7 +85,7 @@ class ControladorFragment : BaseFragment<FragmentControladorBinding,ControladorV
sectorFk = sectorFk,
collectionFk = scan_input.text.toString(),
type = type
)
,callFunction = "collection_getTickets")
// viewModel.ticket_checkControlled(user,password,scan_input.text.toString())
}
scan_input.setText("")

View File

@ -5,6 +5,8 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetSacadorControladorUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.collection.mapper.map
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
@ -25,11 +27,11 @@ class ControladorViewModel(context: Context) : BaseViewModel() {
get() = _collectionTicketList
fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String,type:String){
fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String,type:String,callFunction:String){
getSacadorControladorUserCase.collectionTicketGet(usuario,password,collectionFk,sectorFk,"0",type).enqueue(object :
Callback<CollectionVO> {
override fun onFailure(call: Call<CollectionVO>, t: Throwable) {
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = t.message!!)
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(
call: Call<CollectionVO>,
@ -41,7 +43,7 @@ class ControladorViewModel(context: Context) : BaseViewModel() {
}else{
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = "No hay tickets para sacar")
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}
}
})

View File

@ -201,7 +201,7 @@ class ControlVehiculoFragment(
if (!goBack) {
splash_progress.visibility = VISIBLE
viewModel.workerMachinery_isRegistered(user, password)
viewModel.workerMachinery_isRegistered(user, password,"workerMachinery_isRegistered")
}
}
@ -214,10 +214,10 @@ class ControlVehiculoFragment(
)
} else if (direction.equals("IN")) {
splash_progress.visibility = VISIBLE
viewModel.machineWorker_add(user, password, plateNumber)
viewModel.machineWorker_add(user, password, plateNumber,"machineWorker_add")
} else if (direction.equals("OUT")) {
viewModel.machineWorker_update(user, password, plateNumber)
viewModel.machineWorker_update(user, password, plateNumber,"machineWorker_update")
} else if (direction.equals("")) {
(activity as MainActivity).openFragmentPickers()

View File

@ -67,9 +67,9 @@ class ControlVehiculoUsuarioFragment(
if (userFk.equals(vUserFK)) {
splash_progress.visibility = VISIBLE
viewModel.machine_getWorkerPlate(user, password)
viewModel.deviceProduction_getnameDevice(user, password, android_id)
viewModel.deviceProductionUser_getWorker(user, password, android_id)
viewModel.machine_getWorkerPlate(user, password,"machine_getWorkerPlate")
viewModel.deviceProduction_getnameDevice(user, password, android_id,"deviceProduction_getnameDevice")
viewModel.deviceProductionUser_getWorker(user, password, android_id,"deviceProductionUser_getWorker")
} else {
userFk = vUserFK
@ -80,7 +80,7 @@ class ControlVehiculoUsuarioFragment(
}
user_image.loadUrl("https://salix.verdnatura.es/api/Images/user/160x160/$userFk/download?access_token=$token")
viewModel.machine_getWorkerPlate(user, password)
viewModel.machine_getWorkerPlate(user, password,"machine_getWorkerPlate")
name_vehiclecontrol.text = user
registered_vehiclecontrol.text = ""
deviceName.text = ""

View File

@ -6,6 +6,8 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetVehicleControlTimeUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.ResponseItemMachineControl
import es.verdnatura.presentation.common.ResponseItemVO
@ -33,14 +35,14 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
fun machineWorker_add(
usuario: String,
password: String,
PlateNumber: String
PlateNumber: String,callFunction:String
) {
getVehicleControlTimeUserCase.machineWorker_add(usuario, password, PlateNumber)
.enqueue(object : Callback<Boolean> {
override fun onFailure(call: Call<Boolean>, t: Throwable) {
_responseinsert.value = ResponseItemVO(
isError = true,
errorMessage = "Error en la llamada de registro de vehículo"
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
@ -48,13 +50,13 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
if (response.body() == null || response.body().toString() == "false") {
_responseinsert.value = ResponseItemVO(
isError = true,
errorMessage = "Error en la llamada. Escanea matrícula de nuevo"
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
} else {
//_response.value = ResponseItemVO(isError = false,response = response.body()!!)
_responseinsert.value =
ResponseItemVO(isError = false, response = response.body()!!.toString())
//Log.i("VERDNATURA:","Respuesta call vehicle_insert ${response.body()}")
}
}
@ -65,14 +67,14 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
fun machineWorker_update(
usuario: String,
password: String,
PlateNumber: String
PlateNumber: String,callFunction:String
) {
getVehicleControlTimeUserCase.machineWorker_update(usuario, password, PlateNumber)
.enqueue(object : Callback<Boolean> {
override fun onFailure(call: Call<Boolean>, t: Throwable) {
_responseinsert.value = ResponseItemVO(
isError = true,
errorMessage = "Error en la llamada de registro de vehículo"
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
@ -80,7 +82,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
if (response.body() == null || response.body().toString() == "false") {
_responseinsert.value = ResponseItemVO(
isError = true,
errorMessage = "Error en la llamada. Escanea matrícula de nuevo"
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
} else {
//_response.value = ResponseItemVO(isError = false,response = response.body()!!)
@ -94,7 +96,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
})
}
fun workerMachinery_isRegistered(usuario: String, password: String) {
fun workerMachinery_isRegistered(usuario: String, password: String,callFunction:String) {
getVehicleControlTimeUserCase.workerMachinery_isRegistered(
usuario,
password
@ -102,7 +104,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
override fun onFailure(call: Call<String>, t: Throwable) {
_responsecontrol.value = ResponseItemVO(
isError = true,
errorMessage = "Error al comprobar el control vehículo"
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
@ -110,7 +112,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
if (response.body() == null) {
_responsecontrol.value = ResponseItemVO(
isError = true,
errorMessage = "Error al comprobar control vehículo"
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
} else {
_responsecontrol.value =
@ -124,7 +126,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
fun deviceProduction_getnameDevice(usuario: String, password: String, android_id: String) {
fun deviceProduction_getnameDevice(usuario: String, password: String, android_id: String,callFunction:String) {
getVehicleControlTimeUserCase.deviceProduction_getnameDevice(
usuario,
password,
@ -134,7 +136,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
// Log.i("VERDNATURA::","${t.message}")
_responsemachine.value = ResponseItemMachineControl(
isError = true,
errorMessage = "Error al comprobar el nombre del dispositivo",
errorMessage = getMessageFromAllResponse(callFunction,t.message!!),
type = ""
)
}
@ -161,7 +163,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
})
}
fun deviceProductionUser_getWorker(usuario: String, password: String, userFk: String) {
fun deviceProductionUser_getWorker(usuario: String, password: String, userFk: String,callFunction:String) {
getVehicleControlTimeUserCase.deviceProductionUser_getWorker(
usuario,
password,
@ -170,7 +172,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
override fun onFailure(call: Call<String>, t: Throwable) {
_responsemachine.value = ResponseItemMachineControl(
isError = true,
errorMessage = "Error al comprobar usuario del dispositivo",
errorMessage = getMessageFromAllResponse(callFunction,t.message!!),
type = ""
)
}
@ -198,7 +200,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
fun machine_getWorkerPlate(usuario: String, password: String) {
fun machine_getWorkerPlate(usuario: String, password: String,callFunction:String) {
getVehicleControlTimeUserCase.machine_getWorkerPlate(
usuario,
password
@ -208,7 +210,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
_responsemachine.value = ResponseItemMachineControl(
isError = true,
errorMessage = " Error al comprobar el trabajador si ha cogido el vehículo",
errorMessage = getMessageFromAllResponse(callFunction,t.message!!),
type = ""
)
}

View File

@ -0,0 +1,51 @@
package es.verdnatura.presentation.view.feature.diadeventa.adapter
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.R
import es.verdnatura.databinding.ItemShelvingdayofsaleRowBinding
import es.verdnatura.presentation.view.feature.diadeventa.model.ItemShelvingSaleDate
import java.text.SimpleDateFormat
import java.util.*
class DayOfSaleAdapter (
private val items: List<ItemShelvingSaleDate>
): RecyclerView.Adapter<DayOfSaleAdapter.ItemHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
return ItemHolder(
ItemShelvingdayofsaleRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
)
}
override fun getItemCount() =items.size
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
holder.bind(items[position])
}
inner class ItemHolder(
val binding: ItemShelvingdayofsaleRowBinding
) : RecyclerView.ViewHolder(binding.root){
private val res = binding.root.context.resources
fun bind(item: ItemShelvingSaleDate) {
binding.apply {
this.item = item
val sdf = SimpleDateFormat("yyyy-MM-dd")
val currentDate = sdf.format(Date())
if (currentDate == item.dated){
saledate.setBackgroundColor(
ContextCompat.getColor(historicoDate.context,
R.color.verdnatura_pumpkin_orange))
}else{
saledate.setBackgroundColor(
ContextCompat.getColor(historicoDate.context,
R.color.verdnatura_black_5))
}
}
}
}
}

View File

@ -0,0 +1,247 @@
package es.verdnatura.presentation.view.feature.diadeventa.fragment
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.view.View
import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentItemdayofsaleCardBinding
import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogList
import es.verdnatura.presentation.view.feature.diadeventa.adapter.DayOfSaleAdapter
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionStateRow
import es.verdnatura.presentation.view.feature.paletizador.model.itemExpedetionState
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.buyers_fragment.*
import kotlinx.android.synthetic.main.fragment_historicovehiculo.*
import kotlinx.android.synthetic.main.fragment_item_card.*
import kotlinx.android.synthetic.main.fragment_item_card.edit_itemFk
import kotlinx.android.synthetic.main.fragment_item_card.splash_progress
import kotlinx.android.synthetic.main.fragment_itemexpeditionstate_card.*
import kotlinx.android.synthetic.main.fragment_itemshelvingdayofsale.*
import kotlinx.android.synthetic.main.fragment_parking.*
import kotlinx.android.synthetic.main.toolbar.*
class DayOfSaleFragment(
var entryPoint: String = ""
) : BaseFragment<FragmentItemdayofsaleCardBinding, DayOfSaleViewModel>(DayOfSaleViewModel::class) {
private lateinit var customDialogList: CustomDialogList
private var user = ""
private var password = ""
private var warehouseFk = ""
private var adapter: DayOfSaleAdapter? = null
private var listItemsRow: ArrayList<ItemExpeditionStateRow> = ArrayList()
private var itemScan = ""
companion object {
fun newInstance(entryPoint: String) = DayOfSaleFragment(entryPoint)
}
private lateinit var customDialog: CustomDialog
override fun getLayoutId(): Int = R.layout.fragment_itemdayofsale_card
override fun init() {
customDialog = CustomDialog(requireContext())
customDialogList = CustomDialogList(requireContext())
setEvents()
setToolBar(getString(R.string.dayofSale))
super.init()
}
private fun setToolBar(title: String) {
toolbar_title.text = title
val listIcons: ArrayList<Drawable> = ArrayList()
val iconParking: Drawable =
resources.getDrawable(R.drawable.ic_local_parking_black_24dp, resources.newTheme())
listIcons.add(iconParking)
toolbar_icons.adapter = ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconParking) {
showParking()
}
}
})
toolbar_icons.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
private fun setEvents() {
edit_itemFk.requestFocus()
edit_itemFk.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!edit_itemFk.text.toString().isNullOrEmpty()) {
getItemsSaleDate(edit_itemFk.text.toString())
itemScan = edit_itemFk.text.toString()
}
edit_itemFk.setText("")
(activity as MainActivity).hideKeyboard(edit_itemFk)
return@setOnEditorActionListener true
}
false
}
backButton.setOnClickListener {
requireActivity().onBackPressed()
}
}
private fun getItemsSaleDate(vShelvingFK: String) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString()
password = prefs.getString(PASSWORD, "").toString()
warehouseFk = prefs.getInt(WAREHOUSEFK, 1).toString()
splash_progress.visibility = View.VISIBLE
viewModel.itemShelving_getSaleDate(user, password,vShelvingFK,"itemShelving_getSaleDate")
}
override fun observeViewModel() {
with(viewModel) {
loadItemShelvingSaleDateList.observe(viewLifecycleOwner, Observer{ event ->
event.getContentIfNotHandled().notNull {
splash_progress.visibility = View.GONE
adapter = DayOfSaleAdapter(it.list)
itemexpeditionstate_recyclerview.adapter = adapter
itemexpeditionstate_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
// navigateToToday(it)
if (it.list.isEmpty()){
customDialog.setTitle("Sin resultados")
.setDescription("No se ha podido obtener datos de la etiqueta escaneada. ")
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
}else{
if (it.list.get(0).isError){
customDialog.setTitle("Error")
.setDescription(it.list.get(0).errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
}
}
}
})
response.observe(viewLifecycleOwner, Observer {
if (it.isError){
splash_progress.visibility = View.GONE
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()
}else{
customDialog.setTitle("Información").setDescription("Parking ok").setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
}
})
}
}
/* private fun setItemExpeditionState(itemInfo: itemExpedetionState) {
setToolBar(getString(R.string.wagon) +":"+ itemScan)
listItemsRow = ArrayList()
for (i in itemInfo.list) {
listItemsRow.add(
ItemExpeditionStateRow(
title = i.key,
value = i.value.replace(".0",""),
isEditable = false
)
)
}
itemexpeditionstate_recyclerview.adapter = adapter
itemexpeditionstate_recyclerview.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
}*/
private fun showParking() {
customDialogList.setTitle("Escanea el parking")
.setOkButton("Cerrar") {
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
customDialogList.dismiss()
}.setValue("").show()
customDialogList.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
customDialogList.getEditText().setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) {
if (customDialogList.getValue().isNotEmpty()) {
parking(customDialogList.getValue())
}
customDialogList.setValue("")
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
return@setOnEditorActionListener true
}
false
}
}
fun parking(parking:String){
viewModel.parking(
usuario = user,
password = password,
parking = parking,
scanItem = itemScan,
callFunction="shelvingPark")
customDialogList.dismiss()
}
}

View File

@ -0,0 +1,188 @@
package es.verdnatura.presentation.view.feature.diadeventa.fragment
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetDayOfSaleUSerCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.getMessageFromResponse
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.diadeventa.model.ItemShelvingSaleDate
import es.verdnatura.presentation.view.feature.diadeventa.model.ItemShelvingSaleDateList
import es.verdnatura.presentation.view.feature.paletizador.model.itemExpedetionState
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import timber.log.Timber.i
class DayOfSaleViewModel(context: Context) : BaseViewModel() {
private val GetDayOfSaleUSerCase: GetDayOfSaleUSerCase =
GetDayOfSaleUSerCase(context)
/* private val _itemexpedition by lazy { MutableLiveData<itemExpedetionState>() }
val itemexpedition: LiveData<itemExpedetionState>
get() = _itemexpedition*/
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
val response: LiveData<ResponseItemVO>
get() = _response
private val _itemShelvingSaleDateList by lazy { MutableLiveData<ItemShelvingSaleDateList>() }
val itemShelvingSaleDateList: LiveData<ItemShelvingSaleDateList>
get() = _itemShelvingSaleDateList
//val loadHistoricoVehiculoList = Transformations.map(_itemShelvingSaleDateList) { Event(it) }
val loadItemShelvingSaleDateList = Transformations.map(_itemShelvingSaleDateList) { Event(it) }
fun itemShelving_getSaleDate(usuario:String,password:String,vShelvingFK: String,callFunction:String){
GetDayOfSaleUSerCase.itemShelving_getSaleDate(usuario,password,vShelvingFK).enqueue(object :
Callback<List<ItemShelvingSaleDate>> {
override fun onFailure(call: Call<List<ItemShelvingSaleDate>>, t: Throwable) {
val listError:ArrayList<ItemShelvingSaleDate> = ArrayList()
listError.add(ItemShelvingSaleDate(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
_itemShelvingSaleDateList.value = ItemShelvingSaleDateList(listError)
}
override fun onResponse(
call: Call<List<ItemShelvingSaleDate>>,
response: Response<List<ItemShelvingSaleDate>>
) {
if (!response.isSuccessful){
}
if (response.body() != null){
i("crea la lista "+response.body())
_itemShelvingSaleDateList.value = response.body()?.let { ItemShelvingSaleDateList(it)
}
i("finalizada la lista ${response.body()}")
}else{
if (!response.isSuccessful){
val listError:ArrayList<ItemShelvingSaleDate> = ArrayList()
listError.add(ItemShelvingSaleDate(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
_itemShelvingSaleDateList.value = ItemShelvingSaleDateList(listError) }
}
}
})
}
/*fun itemShelving_getSaleDateOld(expeditionFk: String, user: String, password: String) {
GetDayOfSaleUSerCase.itemShelving_getSaleDate(user, password, expeditionFk)
.enqueue(object : Callback<JsonObject> {
override fun onFailure(call: Call<JsonObject>, t: Throwable) {
var listProperties: MutableList<itemsExpeditionDynamics> = mutableListOf()
_itemexpedition.value = itemExpedetionState(
isError = true,
errorMessage = "Error en la llamada itemShelving_getSaleDate " + expeditionFk + " Respuesta:" + t.message!!, list= listProperties
)
}
override fun onResponse(call: Call<JsonObject>, response: Response<JsonObject>) {
var listProperties: MutableList<itemsExpeditionDynamics> = mutableListOf()
if (response.body() != null) {
listProperties=getListFromJSON(response.body()!!.asJsonObject)
_itemexpedition.value = itemExpedetionState(
isError = false,
errorMessage = "Error al obtener el estado de la expedición",list = listProperties)
} else {
_itemexpedition.value = itemExpedetionState(
isError = true,
errorMessage = "Error en la llamada itemShelving_getSaleDate",list = listProperties
)
}
}
})
}*/
/* fun getListFromJSON(json: JsonObject): MutableList<itemsExpeditionDynamics> {
val gson = Gson()
var list = mutableListOf<itemsExpeditionDynamics>()
var expeditionState: Map<String, Any> = gson.fromJson(json, object : TypeToken<Map<String, Any>>() {}.type)
expeditionState.forEach {
list.add(itemsExpeditionDynamics(key=it.key,value=it.value.toString()))
}
return list
}*/
/* fun itemShelving_updateSpam(user: String, password: String,vShelvingFK:String){
GetDayOfSaleUSerCase.itemShelving_updateSpam(user,password,vShelvingFK).enqueue(object : Callback<Boolean>{
override fun onFailure(call: Call<Boolean>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelving_updateSpam."+t.message!!)
}
override fun onResponse(call: Call<Boolean>, response: Response<Boolean>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelving_updateSpam")
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!.toString())
}
}
})
}*/
fun parking(usuario: String,password: String,scanItem: String,parking:String,callFunction:String){
GetDayOfSaleUSerCase.shelvingPark(usuario,password,scanItem,parking).enqueue(object :
Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
if (response.body() == "Finish")
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
else
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}
}
})
}
}

View File

@ -0,0 +1,21 @@
package es.verdnatura.presentation.view.feature.diadeventa.model
class ItemShelvingSaleDate (
var itemFk:String = "",
var longName:String = "",
var dated:String = "",
var amount:String = "",
var stock:String = "",
var isError:Boolean = false,
var errorMessage:String = ""
)
class ItemShelvingSaleDateList(
var list:List<ItemShelvingSaleDate> = listOf()
)

View File

@ -144,7 +144,7 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
adapter = FaltasAdapter(listInvetory,object: OnFaltasNichoClickListener {
override fun onFaltasNichoClickListener(item: ItemFaltasVO) {
customDialogInput.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){
viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0")
viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0","temTrash")
changeOfflineValue(item)
customDialogInput.dismiss()
}.setKoButton("Cancelar"){
@ -155,7 +155,7 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
if (!customDialogInput.getValue().isNullOrEmpty()){
viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0")
viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0","temTrash")
changeOfflineValue(item)
}
customDialogInput.setValue("")
@ -169,7 +169,7 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
}
},object: OnFaltasReviewClickListener{
override fun onFaltasReviewClickListener(item: ItemFaltasVO) {
viewModel.faultsReview_isChecked(user,password,item.itemFk,warehouseFk)
viewModel.faultsReview_isChecked(user,password,item.itemFk,warehouseFk,"faultsReview_isChecked")
changeOfflineValue(item)
}

View File

@ -7,6 +7,8 @@ import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetInventaryUserCase
import es.verdnatura.domain.GetItemCardUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasListVO
@ -39,7 +41,7 @@ class FaltasViewModel(context: Context) : BaseViewModel() {
Callback<List<ItemFaltasVO>> {
override fun onFailure(call: Call<List<ItemFaltasVO>>, t: Throwable) {
val listError:ArrayList<ItemFaltasVO> = ArrayList()
listError.add(ItemFaltasVO(isError = true,errorMessage = t.message!!))
listError.add(ItemFaltasVO(isError = true,errorMessage ="Error en la llamada faultsReview."+ t.message!!))
_faltasList.value = ItemFaltasListVO(listError)
}
@ -51,7 +53,7 @@ class FaltasViewModel(context: Context) : BaseViewModel() {
_faltasList.value = response.body()?.let { ItemFaltasListVO(it) }
}else{
val listError:ArrayList<ItemFaltasVO> = ArrayList()
listError.add(ItemFaltasVO(isError = true,errorMessage = "Error en la llamada de faultsReview"))
listError.add(ItemFaltasVO(isError = true,errorMessage = "Error en la llamada faultsReview"))
_faltasList.value = ItemFaltasListVO(listError)
}
}
@ -59,16 +61,16 @@ class FaltasViewModel(context: Context) : BaseViewModel() {
})
}
fun itemStockUpdate(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String){
fun itemStockUpdate(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String,callFunction:String){
getItemCardUserCase.itemStockUpdate(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object :
Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar STOCK "+itemFk+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemStockUpdate")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -78,15 +80,15 @@ class FaltasViewModel(context: Context) : BaseViewModel() {
})
}
fun faultsReview_isChecked(user:String,password:String,itemFk:String,warehouseFk:String){
fun faultsReview_isChecked(user:String,password:String,itemFk:String,warehouseFk:String,callFunction:String){
getInventaryUserCase.faultsReview_isChecked(user,password,itemFk,warehouseFk).enqueue(object :
Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error faultsReview_isChecked "+itemFk+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada faultsReview_isChecked")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}

View File

@ -68,7 +68,7 @@ class HistoricoFragment(
customDialog = CustomDialog(requireContext())
requireActivity().main_bottom_navigation.visibility = View.GONE
filter = "all"
viewModel.itemDiary(user, password, itemFk, warehouseFk)
viewModel.itemDiary(user, password, itemFk, warehouseFk,"itemDiary")
toolbar_title.text = getString(R.string.itemdiary) + ":" + itemFk
setToolBar()
setEvents()
@ -161,7 +161,7 @@ class HistoricoFragment(
private fun viewModelwithFilter(keyfilter: String) {
filter = keyfilter
viewModel.itemDiary(user, password, itemFk, warehouseFk)
viewModel.itemDiary(user, password, itemFk, warehouseFk,"itemDiary")
}
private fun setEvents() {
@ -249,8 +249,6 @@ class HistoricoFragment(
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
listHistoryAux.addAll(listHistoric)
// //Log.i("VERDNATURA:","el total de aux es ${listHistoryAux.size}")
////Log.i("VERDNATURA:","el total de histor es ${listHistoric.size}")
}

View File

@ -6,6 +6,8 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetItemCardUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoListVO
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoVO
@ -26,12 +28,12 @@ class HistoricoViewModel(context: Context) : BaseViewModel() {
val loadHistoricoList = Transformations.map(_historicoList) { Event(it) }
fun itemDiary(usuario:String,password:String,itemFk:String,vWarehouseFk:String){
fun itemDiary(usuario:String,password:String,itemFk:String,vWarehouseFk:String,callFunction:String){
getItemCardUserCase.itemDiary(usuario,password,itemFk,vWarehouseFk).enqueue(object :
Callback<List<ItemHistoricoVO>> {
override fun onFailure(call: Call<List<ItemHistoricoVO>>, t: Throwable) {
val listError:ArrayList<ItemHistoricoVO> = ArrayList()
listError.add(ItemHistoricoVO(isError = true,errorMessage = t.message!!))
listError.add(ItemHistoricoVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
_historicoList.value = ItemHistoricoListVO(listError)
}
@ -43,7 +45,7 @@ class HistoricoViewModel(context: Context) : BaseViewModel() {
_historicoList.value = response.body()?.let { ItemHistoricoListVO(it) }
}else{
val listError:ArrayList<ItemHistoricoVO> = ArrayList()
listError.add(ItemHistoricoVO(isError = true,errorMessage = "Error en la llamada de shelvingParking_get"))
listError.add(ItemHistoricoVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
_historicoList.value = ItemHistoricoListVO(listError)
}
}

View File

@ -62,7 +62,7 @@ class HistoricoVehiculoFragment (
////Log.i("VERDNATURA:","la matricula es $numberPlate")
//sergio: revisar entrypoint
viewModel.machineWorker_getHistorical(user,password,numberPlate)
viewModel.machineWorker_getHistorical(user,password,numberPlate,"machineWorker_getHistorical")
toolbar_title.text = getString(R.string.vehiclediary)
setEvents()
super.init()

View File

@ -4,15 +4,17 @@ import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetItemCardUserCase
import es.verdnatura.domain.GetVehicleControlTimeUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculoList
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import timber.log.Timber.i
class HistoricoVehiculoViewModel (context: Context) : BaseViewModel() {
private val GetVehicleControlTimeUserCase: GetVehicleControlTimeUserCase = GetVehicleControlTimeUserCase(context)
@ -26,12 +28,12 @@ class HistoricoVehiculoViewModel (context: Context) : BaseViewModel() {
val loadHistoricoVehiculoList = Transformations.map(_historicovehiculoList) { Event(it) }
fun machineWorker_getHistorical(usuario:String,password:String,plateNumber:String){
fun machineWorker_getHistorical(usuario:String,password:String,plateNumber:String,callFunction:String){
GetVehicleControlTimeUserCase.machineWorker_getHistorical(usuario,password,plateNumber).enqueue(object :
Callback<List<ItemHistoricoVehiculo>> {
override fun onFailure(call: Call<List<ItemHistoricoVehiculo>>, t: Throwable) {
val listError:ArrayList<ItemHistoricoVehiculo> = ArrayList()
listError.add(ItemHistoricoVehiculo(isError = true,errorMessage = t.message!!))
listError.add(ItemHistoricoVehiculo(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
_historicovehiculoList.value = ItemHistoricoVehiculoList(listError)
}
@ -40,10 +42,11 @@ class HistoricoVehiculoViewModel (context: Context) : BaseViewModel() {
response: Response<List<ItemHistoricoVehiculo>>
) {
if (response.body() != null){
i("El response es "+response.body())
_historicovehiculoList.value = response.body()?.let { ItemHistoricoVehiculoList(it) }
}else{
val listError:ArrayList<ItemHistoricoVehiculo> = ArrayList()
listError.add(ItemHistoricoVehiculo(isError = true,errorMessage = "Error en la llamada de historico vehículo"))
listError.add(ItemHistoricoVehiculo(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
_historicovehiculoList.value = ItemHistoricoVehiculoList(listError)
}
}

View File

@ -76,7 +76,7 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
warehouseFk = prefs!!.getInt(WAREHOUSEFK,1).toString()
//sergio. se quita para subir version.A la espera de como será el inventario
viewModel.itemShelvingBuyerGet(user = user,password = password)
viewModel.itemShelvingBuyerGet(user = user,password = password,"itemShelvingBuyerGet")
super.onCreate(savedInstanceState)
}
@ -88,7 +88,7 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
buyerId=prefs!!.getString(BUYERID,"").toString()
////Log.i("VERDNATURA:","el sector es $warehouseFk")
////Log.i("VERDNATURA:","el sbuyerid es $buyerId")
viewModel.getInventory(user,password,buyerId,warehouseFk)
viewModel.getInventory(user,password,buyerId,warehouseFk,"itemShelving_filterBuyer")
filter_buyer.setOnClickListener{
//SimpleSearchDialogCompat(context,getString(R.string.compradores),getString(R.string.escribirparteNombre),null,initData(),
SimpleSearchDialogCompat(context,getString(R.string.compradores),getString(R.string.escribirparteNombre),null,items,
@ -99,7 +99,7 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
saveBuyer(nombre.getBuyerNickname())
saveBuyerId(nombre.getBuyerId())
buyerId=nombre.getBuyerId()
viewModel.getInventory(user,password,nombre.getBuyerId(),warehouseFk)
viewModel.getInventory(user,password,nombre.getBuyerId(),warehouseFk,"itemShelving_filterBuyer")
splash_progress.visibility = View.VISIBLE
baseSearchDialogCompat.dismiss()
}).show()
@ -118,7 +118,7 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
reload = false
splash_progress.visibility = View.VISIBLE
hideLoad = false
viewModel.getInventory(user,password,buyerId,warehouseFk)
viewModel.getInventory(user,password,buyerId,warehouseFk,"itemShelving_filterBuyer")
}
@ -139,7 +139,7 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
splash_progress.visibility = View.VISIBLE
firstVisiblePosition = layoutManager?.findFirstVisibleItemPosition() ?: 0
// sergio.
viewModel.getInventory(user,password,buyerId,warehouseFk)
viewModel.getInventory(user,password,buyerId,warehouseFk,"itemShelving_filterBuyer")
//viewModel.getInventory(user,password,prefs!!.getInt(SECTORFK,1).toString())
}
@ -227,7 +227,7 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
//sergio: cambiado customdialogInput pòr customdialog 6.1.4
customDialog.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){
//customDialogInput.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){
viewModel.itemTrash(item.itemFk,warehouseFk,user,password,item.nicho,"0")
viewModel.itemTrash(item.itemFk,warehouseFk,user,password,item.nicho,"0","itemTrash")
//viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,"0","0")
// viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0")
changeOfflineValue(item)

View File

@ -7,12 +7,15 @@ import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetInventaryUserCase
import es.verdnatura.domain.GetItemCardUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerListVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
import es.verdnatura.presentation.view.feature.inventario.model.InventaryListVO
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import es.verdnatura.presentation.view.feature.login.model.errorMessage
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
@ -38,12 +41,12 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
//sergio para obtener comprador
fun itemShelvingBuyerGet(user:String,password:String){
fun itemShelvingBuyerGet(user:String,password:String,callFunction:String){
getInventaryUserCase.itemShelvingBuyerGet(user,password).enqueue(object :
Callback<List<BuyerVO>> {
override fun onFailure(call: Call<List<BuyerVO>>, t: Throwable) {
val listError:ArrayList<BuyerVO> = ArrayList()
listError.add(BuyerVO(isError = true,errorMessage = t.message!!))
listError.add(BuyerVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
_buyersList.value = BuyerListVO(listError)
}
@ -55,7 +58,8 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
_buyersList.value = response.body()?.let { BuyerListVO(it) }
}else{
val listError:ArrayList<BuyerVO> = ArrayList()
listError.add(BuyerVO(isError = true,errorMessage = "Error en la llamada de itemShelving_buyerGet"))
listError.add(BuyerVO(isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())))
_buyersList.value = BuyerListVO(listError)
}
}
@ -94,13 +98,13 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
})
}*/
fun getInventory(user:String,password:String,buyerFk:String,warehouseFk: String){
fun getInventory(user:String,password:String,buyerFk:String,warehouseFk: String,callFunction:String){
// getInventaryUserCase.itemShelvingRadar(user,password,buyerFk).enqueue(object :
getInventaryUserCase.itemShelvingRadarFilterBuyer(user,password,buyerFk,warehouseFk).enqueue(object :
Callback<List<ItemInventaryVO>> {
override fun onFailure(call: Call<List<ItemInventaryVO>>, t: Throwable) {
val listError:ArrayList<ItemInventaryVO> = ArrayList()
listError.add(ItemInventaryVO(isError = true,errorMessage = t.message!!))
listError.add(ItemInventaryVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!)))
_inventaryList.value = InventaryListVO(listError)
}
@ -112,7 +116,7 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
_inventaryList.value = response.body()?.let { InventaryListVO(it) }
}else{
val listError:ArrayList<ItemInventaryVO> = ArrayList()
listError.add(ItemInventaryVO(isError = true,errorMessage = "Error en la llamada de itemShelvingRadar"))
listError.add(ItemInventaryVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
_inventaryList.value = InventaryListVO(listError)
}
@ -146,19 +150,19 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
}
//sergio: se modifica por CAU a itemTrash
fun itemTrash(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String){
fun itemTrash(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String,callFunction:String){
getItemCardUserCase.itemTrash(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar STOCK "+itemFk+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemStockUpdate")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}

View File

@ -28,6 +28,7 @@ class LoginActivity : BaseActivity<ActivityLoginBinding>() {
//goToMain()
//goToMain()
addFragment(LoginFragment.newInstance(), R.id.main_frame_layout, LoginFragment.TAG)
}

View File

@ -57,7 +57,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
viewModel.device_checkLogin(
edittext_username.text.toString(),
edittext_password.text.toString(),
getANDROIDID()
getANDROIDID(),callFunction = "device_checkLogin"
)
})
@ -190,14 +190,15 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
//sergio: se añade el log
viewModel.worker_getId(
edittext_username.text.toString(),
edittext_password.text.toString()
edittext_password.text.toString(),
callFunction = "worker_getId"
)
deviceLog_add(
edittext_username.text.toString(),
edittext_password.text.toString(),
"warehouse",
getInfoVersionNameApp(),
getANDROIDID()
getANDROIDID(),"deviceLog_add"
)
splash_progress.visibility = View.INVISIBLE
@ -219,7 +220,8 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
splash_progress.visibility = View.VISIBLE
loginSalix(
user = edittext_username.text.toString(),
password = edittext_password.text.toString()
password = edittext_password.text.toString(),
callFunction = "login de Salix"
)
}
@ -231,7 +233,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
splash_progress.visibility = View.VISIBLE
loginSalix(
user = edittext_username.text.toString(),
password = edittext_password.text.toString()
password = edittext_password.text.toString(),"login de Salix"
)
}.show()
@ -283,7 +285,8 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
loginSalix(
user = edittext_username.text.toString(),
password = edittext_password.text.toString()
password = edittext_password.text.toString(),
callFunction = "login de Salix"
)
}
@ -408,7 +411,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
viewModel.checkVersion(
user = edittext_username.text.toString(),
password = edittext_password.text.toString(),
nameApp = "warehouse"
nameApp = "warehouse","getVersion"
)
}

View File

@ -4,19 +4,21 @@ import android.content.Context
import android.util.Log
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.google.gson.Gson
import com.google.gson.JsonObject
import com.google.gson.reflect.TypeToken
import es.verdnatura.domain.GetLoginUserCase
import es.verdnatura.domain.NodeJsService
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.*
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.login.model.*
import org.json.JSONObject
import es.verdnatura.presentation.view.feature.paletizador.model.itemsExpeditionDynamics
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import java.lang.Boolean.FALSE
import java.lang.Boolean.TRUE
class LoginViewModel(context: Context) : BaseViewModel() {
class LoginViewModel(context: Context) : BaseViewModel()
{
private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase(context)
@ -54,21 +56,28 @@ class LoginViewModel(context: Context) : BaseViewModel() {
get() = _nodejs
fun login(user: String, password: String, androiid: String) {
getLoginUserCase.login(user, password, androiid).enqueue(object : Callback<String> {
override fun onResponse(call: Call<String>, response: Response<String>) {
//sergio:anterior login
fun login(user: String, password: String, androiid: String)
{
getLoginUserCase.login(user, password, androiid).enqueue(object : Callback<String>
{
override fun onResponse(call: Call<String>, response: Response<String>)
{
var loginItemVO: LoginItemVO?
if (response.raw().code() == 555) {
if (response.raw().code() == 555)
{
var message = response.raw().message().toString()
if (message.contains("autorizado")) {
if (message.contains("autorizado"))
{
loginItemVO = LoginItemVO(
id = "0",
isError = true,
errorMessage = "Usuario no autorizado para este dispositivo"
)
} else {
} else
{
loginItemVO = LoginItemVO(
id = "0",
isError = true,
@ -76,9 +85,11 @@ class LoginViewModel(context: Context) : BaseViewModel() {
)
}
} else if (!response.body().isNullOrEmpty()) {
} else if (!response.body().isNullOrEmpty())
{
loginItemVO = response.body()?.let { LoginItemVO(id = it) }
} else {
} else
{
loginItemVO =
LoginItemVO(id = "0", isError = true, errorMessage = "Error desconocido")
}
@ -86,7 +97,8 @@ class LoginViewModel(context: Context) : BaseViewModel() {
_loginitem.value = loginItemVO!!
}
override fun onFailure(call: Call<String>, t: Throwable) {
override fun onFailure(call: Call<String>, t: Throwable)
{
val loginItemVO: LoginItemVO? =
LoginItemVO(id = "0", isError = true, errorMessage = t.message!!)
_loginitem.value = loginItemVO
@ -94,12 +106,16 @@ class LoginViewModel(context: Context) : BaseViewModel() {
})
}
fun loginSalix(user: String, password: String) {
getLoginUserCase.salixLogin(user, password).enqueue(object : Callback<LoginSalixVO> {
override fun onResponse(call: Call<LoginSalixVO>, response: Response<LoginSalixVO>) {
fun loginSalix(user: String, password: String,callFunction:String)
{
getLoginUserCase.salixLogin(user, password).enqueue(object : Callback<LoginSalixVO>
{
override fun onResponse(call: Call<LoginSalixVO>, response: Response<LoginSalixVO>)
{
var loginSalixVO: LoginSalixVO?
if (response.body() != null) {
if (response.body() != null)
{
loginSalixVO = response.body()?.token?.let {
LoginSalixVO(
user,
@ -109,46 +125,62 @@ class LoginViewModel(context: Context) : BaseViewModel() {
errorMessage = ""
)
}
} else {
} else
{
loginSalixVO = LoginSalixVO(
user,
password,
isError = true,
errorMessage = "Error al conectar con salix"
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
}
_loginsalixitem.value = loginSalixVO
}
override fun onFailure(call: Call<LoginSalixVO>, t: Throwable) {
override fun onFailure(call: Call<LoginSalixVO>, t: Throwable)
{
val loginSalixVO =
LoginSalixVO(user, password, "", isError = true, errorMessage = t.message!!)
LoginSalixVO(
user,
password,
"",
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
_loginsalixitem.value = loginSalixVO
}
})
}
fun device_checkLogin(user: String, password: String, android_id: String,callFunction:String)
{
//var name=nameofFunction(object{})
fun device_checkLogin(user: String, password: String, android_id: String) {
getLoginUserCase.device_checkLogin(user, password, android_id)
.enqueue(object : Callback<LoginDevice> {
override fun onResponse(call: Call<LoginDevice>, response: Response<LoginDevice>) {
.enqueue(object : Callback<LoginDevice>
{
override fun onResponse(call: Call<LoginDevice>, response: Response<LoginDevice>)
{
var loginDevice: LoginDevice?
if (response.raw().code() == 555) {
// var message = response.raw().message().toString()
/* Log.d("VERDNATIRA",response.message())
Log.d("VERDNATIRA",response.errorBody().toString())
Log.d("VERDNATIRA",response.toString())
Log.d("VERDNATIRA",response.raw().toString())*/
if (!response.isSuccessful)
{
loginDevice = LoginDevice(
isError = true,
errorMessage = "Usuario o contraseña incorrectos."
)
} else {
errorMessage = getMessageFromAllResponse(callFunction,response.message()))
if (response.body() != null) {
} else
{
if (response.body() != null)
{
loginDevice = response.body()?.let {
@ -160,33 +192,46 @@ class LoginViewModel(context: Context) : BaseViewModel() {
}
} else {
} else
{
loginDevice = LoginDevice(
isError = true,
errorMessage = "Error al intentar hacer login."
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
}
}
_logindevice.value = loginDevice
}
override fun onFailure(call: Call<LoginDevice>, t: Throwable) {
override fun onFailure(call: Call<LoginDevice>, t: Throwable)
{
val loginDevice =
LoginDevice("", "", isError = true, errorMessage = t.message!!)
LoginDevice(
"",
"",
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
_logindevice.value = loginDevice
}
})
}
fun worker_getId(user: String, password: String) {
fun worker_getId(user: String, password: String,callFunction: String)
{
getLoginUserCase.worker_getId(user, password)
.enqueue(object : Callback<String> {
override fun onResponse(call: Call<String>, response: Response<String>) {
.enqueue(object : Callback<String>
{
override fun onResponse(call: Call<String>, response: Response<String>)
{
var workerId: workerId?
if (response.body() != null) {
if (response.body() != null)
{
workerId = workerId(
response.body().toString(),
@ -194,51 +239,64 @@ class LoginViewModel(context: Context) : BaseViewModel() {
errorMessage = ""
)
} else {
} else
{
workerId = workerId(
isError = true,
errorMessage = "Error al intentar obtener el id."
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
}
_workerId.value = workerId
}
override fun onFailure(call: Call<String>, t: Throwable) {
override fun onFailure(call: Call<String>, t: Throwable)
{
val workerId =
workerId(isError = true, errorMessage = t.message!!)
workerId(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
_workerId.value = workerId
}
})
}
fun deviceLog_add(user: String, password: String, app: String, versionApp: String, android_id: String
) {
fun deviceLog_add(
user: String, password: String, app: String, versionApp: String, android_id: String,callFunction: String
)
{
getLoginUserCase.deviceLog_add(user, password, app, versionApp, android_id)
.enqueue(object : Callback<Void> {
override fun onResponse(call: Call<Void>, response: Response<Void>) {
.enqueue(object : Callback<Void>
{
override fun onResponse(call: Call<Void>, response: Response<Void>)
{
if (!response.isSuccessful) {
if (!response.isSuccessful)
{
messageError(response.message())
messageError(callFunction,response.message())
}
}
override fun onFailure(call: Call<Void>, t: Throwable) {
override fun onFailure(call: Call<Void>, t: Throwable)
{
messageError(t.message!!)
messageError(callFunction,t.message!!)
}
})
}
fun messageError(message: String) {
fun messageError(callFunction:String,message: String)
{
_devicelogresponse.value = ResponseItemVO(
isError = true,
errorMessage = "Error al realizar llamada a devicelog. Descripción del error:" + message
errorMessage = getMessageFromAllResponse(callFunction,message)
)
}
/*fun checkVersion_old(user:String,password:String,version:String){
@ -257,14 +315,18 @@ class LoginViewModel(context: Context) : BaseViewModel() {
})
}*/
//sergio:checkVersion new
fun checkVersion(user: String, password: String, nameApp: String) {
fun checkVersion(user: String, password: String, nameApp: String,callFunction: String)
{
getLoginUserCase.checkVersion(user, password, nameApp)
.enqueue(object : Callback<versionApp> {
override fun onResponse(call: Call<versionApp>, response: Response<versionApp>) {
.enqueue(object : Callback<versionApp>
{
override fun onResponse(call: Call<versionApp>, response: Response<versionApp>)
{
var versionApp: versionApp?
if (response.body() != null) {
if (response.body() != null)
{
versionApp = response.body()?.let {
@ -276,37 +338,48 @@ class LoginViewModel(context: Context) : BaseViewModel() {
errorMessage = ""
)
}
} else {
} else
{
versionApp = versionApp(
user,
password,
isError = true,
errorMessage = "Error al conectar."
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
}
_versionappitem.value = versionApp
}
override fun onFailure(call: Call<versionApp>, t: Throwable) {
override fun onFailure(call: Call<versionApp>, t: Throwable)
{
val versionApp =
versionApp(nameApp, "", isError = true, errorMessage = t.message!!)
versionApp(
nameApp,
"",
isError = true,
errorMessage =getMessageFromAllResponse(callFunction, t.message!!)
)
_versionappitem.value = versionApp
}
})
}
fun nodeJsTest(smarttag: String, wagon: String,shelving:String) {
fun nodeJsTest(smarttag: String, wagon: String, shelving: String)
{
getLoginUserCase.nodeJsTest(smarttag, wagon, shelving)
.enqueue(object : Callback<NodeJsService.SmartTagNode> {
override fun onResponse(call: Call<NodeJsService.SmartTagNode>, response: Response<NodeJsService.SmartTagNode>) {
.enqueue(object : Callback<NodeJsService.SmartTagNode>
{
override fun onResponse(
call: Call<NodeJsService.SmartTagNode>,
response: Response<NodeJsService.SmartTagNode>
)
{
var workerId: NodeJsService.SmartTagNode?
/* if (response.isSuccessful()){
Log.i("VERDNATURA::","OK")
}
@ -315,7 +388,8 @@ class LoginViewModel(context: Context) : BaseViewModel() {
}*/
if (response.body() != null) {
if (response.body() != null)
{
Log.i("VERDNATURA::", "el valor nodejs no es nulo ")
workerId = NodeJsService.SmartTagNode(
response.body().toString(),
@ -323,7 +397,8 @@ class LoginViewModel(context: Context) : BaseViewModel() {
errorMessage = ""
)
} else {
} else
{
workerId = NodeJsService.SmartTagNode(
isError = true,
errorMessage = "Error al llamar al servicio Node."
@ -334,7 +409,8 @@ class LoginViewModel(context: Context) : BaseViewModel() {
_nodejs.value = workerId
}
override fun onFailure(call: Call<NodeJsService.SmartTagNode>, t: Throwable) {
override fun onFailure(call: Call<NodeJsService.SmartTagNode>, t: Throwable)
{
val workerId =
NodeJsService.SmartTagNode(isError = true, errorMessage = t.message!!)
@ -346,6 +422,22 @@ class LoginViewModel(context: Context) : BaseViewModel() {
})
}
fun getListFromJSON(json: JsonObject): MutableList<itemsExpeditionDynamics>
{
val gson = Gson()
var list = mutableListOf<itemsExpeditionDynamics>()
// val mapType = object : TypeToken<Map<String, Any>>() {}.type
var expeditionState: Map<String, Any> =
gson.fromJson(json, object : TypeToken<Map<String, Any>>()
{}.type)
expeditionState.forEach {
list.add(itemsExpeditionDynamics(key = it.key, value = it.value.toString()))
}
return list
}
}

View File

@ -24,6 +24,7 @@ import es.verdnatura.presentation.view.feature.controlador.fragment.ControladorF
import es.verdnatura.presentation.view.feature.controlador.fragment.WebFragment
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoFragment
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoUsuarioFragment
import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleFragment
import es.verdnatura.presentation.view.feature.faltas.fragment.FaltasFragment
import es.verdnatura.presentation.view.feature.historico.fragment.HistoricoFragment
import es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoFragment
@ -316,6 +317,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
"Pre Sacador" -> {
addFragmentOnTop(PreSacadorFragment.newInstance())
}
"Día de venta" -> {
addFragmentOnTop(DayOfSaleFragment("diadeventa"))
}
"Ver Ticket" -> {
addFragmentOnTop(PreControladorFragment.newInstance())
}

View File

@ -81,7 +81,7 @@ class ExpeditionPalletDetailFragment(
toolbar_title.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino
setToolBar()
setEvents()
viewModel.expeditionPallet_List(user,password,itemPallet!!.Pallet)
viewModel.expeditionPallet_List(user,password,itemPallet!!.Pallet,"expeditionPallet_View")
super.init()
}
@ -113,17 +113,17 @@ class ExpeditionPalletDetailFragment(
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload){
splash_progress.visibility = View.VISIBLE
viewModel.expeditionPallet_List(user,password,itemPallet!!.Pallet)
viewModel.expeditionPallet_List(user,password,itemPallet!!.Pallet,"expeditionPallet_View")
}else if(item == iconEditar){
onPalletClickListener!!.onPalletClickListener(itemExpeditionTruckVO!!,itemPallet!!)
}else if(item == iconBorrar){
splash_progress.visibility = View.VISIBLE
viewModel.expeditionPalletDel(user,password,itemPallet!!.Pallet)
viewModel.expeditionPalletDel(user,password,itemPallet!!.Pallet,"expeditionPallet_Del")
}else if(item == iconPrint){
splash_progress.visibility = View.VISIBLE
(getString(R.string.Imprimiendo)+" por " +SectorDescription).toast(requireContext())
viewModel.expeditionPalletPrintSet(user,password,itemPallet!!.Pallet,sectorFk)
viewModel.expeditionPalletPrintSet(user,password,itemPallet!!.Pallet,sectorFk,"expeditionPallet_PrintSet")
}
}

View File

@ -6,6 +6,8 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletViewListVO
@ -25,12 +27,12 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel() {
val response: LiveData<ResponseItemVO>
get() = _response
fun expeditionPallet_List(usuario:String,password:String,vPalletFk:String){
fun expeditionPallet_List(usuario:String,password:String,vPalletFk:String,callFunction:String){
getPaletizadoresUserCase.expeditionPalletView(usuario,password,vPalletFk).enqueue(object :
Callback<List<ItemPalletViewVO>> {
override fun onFailure(call: Call<List<ItemPalletViewVO>>, t: Throwable) {
val listError:ArrayList<ItemPalletViewVO> = ArrayList()
listError.add(ItemPalletViewVO(isError = true,errorMessage = t.message!!))
listError.add(ItemPalletViewVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
_expeditionPalletList.value = ItemPalletViewListVO(listError)
}
@ -42,7 +44,7 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel() {
_expeditionPalletList.value = response.body()?.let { ItemPalletViewListVO(it) }
}else{
val listError:ArrayList<ItemPalletViewVO> = ArrayList()
listError.add(ItemPalletViewVO(isError = true,errorMessage = "Error en la llamada de expeditionPallet_View"))
listError.add(ItemPalletViewVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
_expeditionPalletList.value = ItemPalletViewListVO(listError)
}
}
@ -50,14 +52,14 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel() {
})
}
fun expeditionPalletDel(usuario:String,password:String,vPalletFk:String){
fun expeditionPalletDel(usuario:String,password:String,vPalletFk:String,callFunction:String){
getPaletizadoresUserCase.expeditionPalletDel(usuario,password,vPalletFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al borrar pallet "+vPalletFk+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada expeditionPallet_Del")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -69,15 +71,15 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel() {
usuario: String,
password: String,
vPalletFk: String,
vSectorFk: String
){
vSectorFk: String,callFunction:String){
getPaletizadoresUserCase.expeditionPalletPrintSet(usuario,password,vPalletFk,vSectorFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al imprimir pallet "+vPalletFk+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada expeditionPallet_PrintSet")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}

View File

@ -88,7 +88,7 @@ class ExpeditionPalletFragment(
toolbar_title.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino
setToolBar()
setEvents()
viewModel.expeditionPallet_List(user,password,itemExpeditionTruckVO!!.truckFk)
viewModel.expeditionPallet_List(user,password,itemExpeditionTruckVO!!.truckFk,"expeditionPallet_List")
////Log.i("VERDNATURA:","4-listamos listado de pallets para la expedicion")
super.init()
}
@ -110,7 +110,7 @@ class ExpeditionPalletFragment(
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload){
splash_progress.visibility = View.VISIBLE
viewModel.expeditionPallet_List(user,password,itemExpeditionTruckVO!!.truckFk)
viewModel.expeditionPallet_List(user,password,itemExpeditionTruckVO!!.truckFk,"expeditionPallet_List")
}else if(item == iconPlus){
expeditionScanAdd()
}
@ -182,7 +182,7 @@ class ExpeditionPalletFragment(
private fun expeditionScanAdd(){
splash_progress.visibility = View.VISIBLE
viewModel.expeditionScanAdd(usuario = user,password = password,vPalletFk = "0",vTruckFk = itemExpeditionTruckVO!!.truckFk)
viewModel.expeditionScanAdd(usuario = user,password = password,vPalletFk = "0",vTruckFk = itemExpeditionTruckVO!!.truckFk,"expeditionScan_Add")
}
private fun showScanExpeditions(it:ItemScanList){
@ -216,7 +216,7 @@ class ExpeditionPalletFragment(
}.setKoButton("Cerrar"){
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
splash_progress.visibility = View.VISIBLE
viewModel.expeditionPallet_List(user,password,itemExpeditionTruckVO!!.truckFk)
viewModel.expeditionPallet_List(user,password,itemExpeditionTruckVO!!.truckFk,"expeditionPallet_List")
listExpeditions = ArrayList()
customDialogList.dismiss()
}.setValue("").show()
@ -232,9 +232,9 @@ class ExpeditionPalletFragment(
if(customDialogList.getValue().length >= 7){
listExpeditions.add(0,BarcodeVO(code = customDialogList.getValue()))
customDialogList.setDescription("Total: "+listExpeditions.size)
viewModel.expeditionScanPut(user,password,it.list.get(0).palletFk,customDialogList.getValue())
viewModel.expeditionScanPut(user,password,it.list.get(0).palletFk,customDialogList.getValue(),"expeditionScan_Put")
////Log.i("VERDNATURA:"," palletizando ${it.list.get(0).palletFk} expedi: ${customDialogList.getValue()}")
viewModel.checkRouteExpeditionScanPut(user,password,it.list.get(0).palletFk,customDialogList.getValue())
viewModel.checkRouteExpeditionScanPut(user,password,it.list.get(0).palletFk,customDialogList.getValue(),"expedition_checkRoute")
}else{
if (mperror != null) mperror!!.start()
}

View File

@ -6,6 +6,8 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletListVO
@ -39,12 +41,12 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
fun expeditionPallet_List(usuario:String,password:String,vTruckFk:String){
fun expeditionPallet_List(usuario:String,password:String,vTruckFk:String,callFunction:String){
getPaletizadoresUserCase.expeditionPallet_List(usuario,password,vTruckFk).enqueue(object :
Callback<List<ItemPalletVO>> {
override fun onFailure(call: Call<List<ItemPalletVO>>, t: Throwable) {
val listError:ArrayList<ItemPalletVO> = ArrayList()
listError.add(ItemPalletVO(isError = true,errorMessage = t.message!!))
listError.add(ItemPalletVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
_expeditionPalletList.value = ItemPalletListVO(listError)
}
@ -56,7 +58,7 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
_expeditionPalletList.value = response.body()?.let { ItemPalletListVO(it) }
}else{
val listError:ArrayList<ItemPalletVO> = ArrayList()
listError.add(ItemPalletVO(isError = true,errorMessage = "Error en la llamada de expeditionTruck_List"))
listError.add(ItemPalletVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
_expeditionPalletList.value = ItemPalletListVO(listError)
}
}
@ -64,12 +66,12 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
})
}
fun expeditionScanAdd(usuario:String,password:String,vPalletFk:String,vTruckFk:String){
fun expeditionScanAdd(usuario:String,password:String,vPalletFk:String,vTruckFk:String,callFunction:String){
getPaletizadoresUserCase.expeditionScanAdd(usuario,password,vPalletFk,vTruckFk).enqueue(object :
Callback<List<ItemScanVO>> {
override fun onFailure(call: Call<List<ItemScanVO>>, t: Throwable) {
val listError:ArrayList<ItemScanVO> = ArrayList()
listError.add(ItemScanVO(isError = true,errorMessage = t.message!!))
listError.add(ItemScanVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
_scanList.value = ItemScanList(listError)
}
@ -81,7 +83,7 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
_scanList.value = response.body()?.let { ItemScanList(it) }
}else{
val listError:ArrayList<ItemScanVO> = ArrayList()
listError.add(ItemScanVO(isError = true,errorMessage = "Error en la llamada de expeditionTruck_List"))
listError.add(ItemScanVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
_scanList.value = ItemScanList(listError)
}
}
@ -89,14 +91,14 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
})
}
fun expeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String){
fun expeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String,callFunction:String){
getPaletizadoresUserCase.expeditionScanPut(usuario,password,vPalletFk,vExpeditionFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar expedition "+vExpeditionFk+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada expeditionScan_Put")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -104,17 +106,17 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
})
}
fun checkRouteExpeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String){
fun checkRouteExpeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String,callFunction:String){
getPaletizadoresUserCase.checkRouteExpeditionScanPut(usuario,password,vPalletFk,vExpeditionFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar expedition "+vExpeditionFk+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_responseCheckexpeditionScanPut.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada checkExpeditionScan_Put")
_responseCheckexpeditionScanPut.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_responseCheckexpeditionScanPut.value = ResponseItemVO(isError = false,response = response.body()!!)
////Log.i("VERDNATURA:","Resultado checkExpeditionScan ${_responseCheckexpeditionScanPut.value}")
}
}
})

View File

@ -75,7 +75,7 @@ class ExpeditionScanSorterFragment(
private fun expeditionscan(ExpeditionScan: String) {
splash_progress.visibility = VISIBLE
viewModel.expedition_scan(user, password, ExpeditionScan)
viewModel.expedition_scan(user, password, ExpeditionScan,"expedition_scan")
itemScaned = ExpeditionScan
}

View File

@ -5,6 +5,8 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.ResponseItemVO
import retrofit2.Call
import retrofit2.Callback
@ -19,11 +21,11 @@ class ExpeditionScanSorterViewModel(context: Context) : BaseViewModel() {
get() = _responsescan
fun expedition_scan(usuario:String,password:String,vExpeditionId:String){
fun expedition_scan(usuario:String,password:String,vExpeditionId:String,callFunction:String){
GetPaletizadoresUserCase.expedition_scan(usuario,password,vExpeditionId).enqueue(object : Callback<Void>{
override fun onFailure(call: Call<Void>, t: Throwable) {
_responsescan.value = messageError(t.message!!,"expedition_scan")
_responsescan.value = messageError(getMessageFromAllResponse(callFunction,t.message!!),"expedition_scan")
}
override fun onResponse(call: Call<Void>, response: Response<Void>) {
@ -42,7 +44,7 @@ class ExpeditionScanSorterViewModel(context: Context) : BaseViewModel() {
fun messageError(message: String,call: String ): ResponseItemVO {
return ResponseItemVO(
isError = true,
errorMessage = "Error al llamar a " + call + " . Descripción del error:" + message
errorMessage = "Error en la llamada expedition_scan " + call + " . Descripción del error:" + message
)
}

View File

@ -70,7 +70,7 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel() {
Callback<List<ItemScanVO>> {
override fun onFailure(call: Call<List<ItemScanVO>>, t: Throwable) {
val listError:ArrayList<ItemScanVO> = ArrayList()
listError.add(ItemScanVO(isError = true,errorMessage = t.message!!))
listError.add(ItemScanVO(isError = true,errorMessage ="Error en la llamada de expeditionScan_Add." + t.message!!))
_scanList.value = ItemScanList(listError)
}
@ -82,7 +82,7 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel() {
_scanList.value = response.body()?.let { ItemScanList(it) }
}else{
val listError:ArrayList<ItemScanVO> = ArrayList()
listError.add(ItemScanVO(isError = true,errorMessage = "Error en la llamada de expeditionTruck_List"))
listError.add(ItemScanVO(isError = true,errorMessage = "Error en la llamada de expeditionScan_Add"))
_scanList.value = ItemScanList(listError)
}
}
@ -93,7 +93,7 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel() {
fun expeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String){
getPaletizadoresUserCase.expeditionScanPut(usuario,password,vPalletFk,vExpeditionFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar expedition "+vExpeditionFk+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada expeditionScan_Put."+t.message!!)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
@ -109,11 +109,11 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel() {
fun checkRouteExpeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String){
getPaletizadoresUserCase.checkRouteExpeditionScanPut(usuario,password,vPalletFk,vExpeditionFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar expedition "+vExpeditionFk+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al lamar expedition_checkRoute "+vExpeditionFk+ " Respuesta:"+t.message!!)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_responseCheckexpeditionScanPut.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada checkExpeditionScan_Put")
_responseCheckexpeditionScanPut.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada expedition_checkRoute")
}else{
_responseCheckexpeditionScanPut.value = ResponseItemVO(isError = false,response = response.body()!!)
// ////Log.i("VERDNATURA:","Resultado checkExpeditionScan ${_responseCheckexpeditionScanPut.value}")
@ -127,7 +127,7 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel() {
fun expeditionScanDel(usuario:String,password:String,vScanFk:String){
getPaletizadoresUserCase.expeditionScanDel(usuario,password,vScanFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_responseDeleteScan.value = ResponseItemVO(isError = true,errorMessage = "Error al eliminar expedition "+vScanFk+ " Respuesta:"+t.message!!)
_responseDeleteScan.value = ResponseItemVO(isError = true,errorMessage = "Error al llamar expeditionScan_Del."+t.message!!)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){

View File

@ -26,6 +26,7 @@ import kotlinx.android.synthetic.main.fragment_item_card.itemcard_layout
import kotlinx.android.synthetic.main.fragment_item_card.splash_progress
import kotlinx.android.synthetic.main.fragment_itemexpeditionstate_card.*
import kotlinx.android.synthetic.main.toolbar.*
import timber.log.Timber.i
class ExpeditionStateFragment(
var entryPoint: String = ""
@ -98,7 +99,7 @@ class ExpeditionStateFragment(
warehouseFk = prefs.getInt(WAREHOUSEFK, 1).toString()
// this.itemFk = itemFk
splash_progress.visibility = View.VISIBLE
viewModel.expedition_getStateJSON(expeditionFk, user, password)
viewModel.expedition_getStateJSON(expeditionFk, user, password,"expedition_getState")
}
@ -123,6 +124,7 @@ class ExpeditionStateFragment(
setItemExpeditionState(it)
} else {
itemcard_layout.visibility = View.GONE
toolbar_title.text = "Estado de la expedición"

View File

@ -12,6 +12,8 @@ import com.google.gson.JsonObject
import com.google.gson.reflect.TypeToken
import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingTypeList
@ -94,7 +96,7 @@ class ExpeditionStateViewModel(context: Context) : BaseViewModel() {
})
}*/
fun expedition_getStateJSON(expeditionFk: String, user: String, password: String) {
fun expedition_getStateJSON(expeditionFk: String, user: String, password: String,callFunction:String){
GetPaletizadoresUserCase.expedition_getStateJSON(user, password, expeditionFk)
.enqueue(object : Callback<JsonObject> {
override fun onFailure(call: Call<JsonObject>, t: Throwable) {
@ -103,7 +105,7 @@ class ExpeditionStateViewModel(context: Context) : BaseViewModel() {
_itemexpedition.value = itemExpedetionState(
isError = true,
errorMessage = "Error al obtener " + expeditionFk + " Respuesta:" + t.message!!, list= listProperties
errorMessage = getMessageFromAllResponse(callFunction,t.message!!), list= listProperties
)
}
@ -115,40 +117,21 @@ class ExpeditionStateViewModel(context: Context) : BaseViewModel() {
if (response.body() != null) {
Log.i(
"VERDNATURA:",
"El resultado con JSONOBJECT es ${response.body()}"
)
//var list = getListFromJSON(response.body()!!.asJsonObject)
listProperties=getListFromJSON(response.body()!!.asJsonObject)
/* for (i in list) {
/* if (TextUtils.isDigitsOnly(i.value)){
(i.value.toInt())
println("Convertido" + i.key + i.value.toInt())
}else{println(i.key + i.value)}*/
println("esta en " + i.value.indexOf(".0"))
if (i.value.indexOf(".0")>-1){
println(java.lang.String.format(i.value,"%i"))
}
// println("Sin convertir :" + i.key + java.lang.String.format(i.value.replace(".0","")))
}*/
_itemexpedition.value = itemExpedetionState(
isError = false,
errorMessage = "Error al obtener el estado de la expedición",list = listProperties)
errorMessage = "",list = listProperties)
let {
Log.i(
"VERDNATURA:",
"El resultado con JSONOBJECT es ${it.toString()}"
)
}
} else {
_itemexpedition.value = itemExpedetionState(
isError = true,
errorMessage = "Error al obtener el estado de la expedición",list = listProperties
errorMessage = getMessageFromAllResponse(callFunction,response.message()),list = listProperties
)
}
}

View File

@ -69,7 +69,7 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
backButton.visibility = View.GONE
setToolBar()
////Log.i("VERDNATURA:","1-cargamos expediciones")
viewModel.expeditionTruckList(user,password)
viewModel.expeditionTruckList(user,password,"expeditionTruck_List")
super.init()
}
@ -88,7 +88,7 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload){
splash_progress.visibility = View.VISIBLE
viewModel.expeditionTruckList(user,password)
viewModel.expeditionTruckList(user,password,"expeditionTruck_List")
}else if(item == iconPlus){
addTruck()
}
@ -112,7 +112,7 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
event.getContentIfNotHandled().notNull {printExpeditionList(it) }
})
loadResponseExpeditionAdd.observe(viewLifecycleOwner, Observer { event ->
viewModel.expeditionTruckList(user,password)
viewModel.expeditionTruckList(user,password,"expeditionTruck_List")
})
}
}
@ -130,7 +130,7 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
customDialogHor.setTitle("Nuevo Camión").setOkButton("Guardar"){
(activity as MainActivity).hideKeyboard(customDialogHor.getDestinoEditText())
if (!customDialogHor.getDestinoValue().isNullOrEmpty() && !customDialogHor.getHoraValue().isNullOrEmpty()){
viewModel.expeditionTruckAdd(user,password,customDialogHor.getHoraValue(),customDialogHor.getDestinoValue())
viewModel.expeditionTruckAdd(user,password,customDialogHor.getHoraValue(),customDialogHor.getDestinoValue(),"expeditionTruck_Add")
splash_progress.visibility = View.VISIBLE
customDialogHor.dismiss()
}
@ -144,7 +144,7 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
customDialogHor.getDestinoEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
if (!customDialogHor.getDestinoValue().isNullOrEmpty() && !customDialogHor.getHoraValue().isNullOrEmpty()){
viewModel.expeditionTruckAdd(user,password,customDialogHor.getHoraValue(),customDialogHor.getDestinoValue())
viewModel.expeditionTruckAdd(user,password,customDialogHor.getHoraValue(),customDialogHor.getDestinoValue(),"expeditionTruck_Add")
splash_progress.visibility = View.VISIBLE
customDialogHor.dismiss()
}

View File

@ -6,6 +6,8 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckList
@ -27,12 +29,12 @@ class ExpeditionTruckListViewModel(context: Context) : BaseViewModel() {
fun expeditionTruckList(usuario:String,password:String){
fun expeditionTruckList(usuario:String,password:String,callFunction:String){
getPaletizadoresUserCase.expeditionTruckList(usuario,password).enqueue(object :
Callback<List<ItemExpeditionTruckVO>> {
override fun onFailure(call: Call<List<ItemExpeditionTruckVO>>, t: Throwable) {
val listError:ArrayList<ItemExpeditionTruckVO> = ArrayList()
listError.add(ItemExpeditionTruckVO(isError = true,errorMessage = t.message!!))
listError.add(ItemExpeditionTruckVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!)))
_expeditionTruckList.value = ItemExpeditionTruckList(listError)
}
@ -44,7 +46,7 @@ class ExpeditionTruckListViewModel(context: Context) : BaseViewModel() {
_expeditionTruckList.value = response.body()?.let { ItemExpeditionTruckList(it) }
}else{
val listError:ArrayList<ItemExpeditionTruckVO> = ArrayList()
listError.add(ItemExpeditionTruckVO(isError = true,errorMessage = "Error en la llamada de expeditionTruck_List"))
listError.add(ItemExpeditionTruckVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
_expeditionTruckList.value = ItemExpeditionTruckList(listError)
}
}
@ -52,15 +54,15 @@ class ExpeditionTruckListViewModel(context: Context) : BaseViewModel() {
})
}
fun expeditionTruckAdd(usuario:String,password:String,vHour:String,vDescription:String){
fun expeditionTruckAdd(usuario:String,password:String,vHour:String,vDescription:String,callFunction:String){
getPaletizadoresUserCase.expeditionTruckAdd(usuario,password,vHour,vDescription).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar CAMIÓN "+vDescription+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada expeditionTruckAdd")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}

View File

@ -121,7 +121,7 @@ class ParkingFragment : BaseFragment<FragmentParkingBinding,ParkingViewModel>(Pa
usuario = user,
password = password,
parking = txtScan,
scanItem = it.code!!
scanItem = it.code!!,callFunction = "shelvingPark"
)
}
}else{

View File

@ -5,6 +5,8 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetUbicadorUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.ResponseItemVO
import retrofit2.Call
import retrofit2.Callback
@ -29,22 +31,22 @@ class ParkingViewModel(context: Context) : BaseViewModel() {
}
fun parking(usuario: String,password: String,scanItem: String,parking:String){
fun parking(usuario: String,password: String,scanItem: String,parking:String,callFunction:String){
showProgressLoading()
getUbicadorUserCase.shelvingPark(usuario,password,scanItem,parking).enqueue(object :
Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada shelvingPark")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
if (response.body() == "Finish")
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
else
_response.value = ResponseItemVO(isError = true,errorMessage = "No existe el parking en la Base de Datos (shelvingPark)")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}
}
})

View File

@ -42,6 +42,13 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
)
)
_pasillerositem.add(
PasillerosItemVO(
41,
R.drawable.day_of_sale,
"Día de venta", R.string.dayofSale
)
)
_pasillerositem.add(
PasillerosItemVO(
22,

View File

@ -85,7 +85,7 @@ class PreControladorFragment: BaseFragment<FragmentControladorBinding,PreControl
password = password,
sectorFk = sectorFk,
collectionFk = scan_input.text.toString(),
type = type
type = type,callFunction = "collection_getTickets"
)
// //Log.i("VERDNATURA:","La collection es ${scan_input.text.toString()}")
}

View File

@ -5,6 +5,8 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.domain.GetPreControladorUserCase
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.view.feature.collection.mapper.map
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
import retrofit2.Call
@ -19,11 +21,11 @@ class PreControladorViewModel(context: Context) : BaseViewModel() {
val collectionTicketList: LiveData<CollectionVO>
get() = _collectionTicketList
fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String,type:String){
fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String,type:String,callFunction:String){
getPreControladorUserCase.collectionTicketGet(usuario,password,collectionFk,sectorFk,"0",type).enqueue(object :
Callback<CollectionVO> {
override fun onFailure(call: Call<CollectionVO>, t: Throwable) {
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = t.message!!)
_collectionTicketList.value = CollectionVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(
call: Call<CollectionVO>,
@ -32,7 +34,7 @@ class PreControladorViewModel(context: Context) : BaseViewModel() {
if (response.body() != null){
_collectionTicketList.value = response.body()?.let { it.map() }
}else{
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = "No hay tickets para sacar")
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}
}
})

View File

@ -161,6 +161,15 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
goBack = false
})
responseSalixMessage.observe(viewLifecycleOwner, Observer{
if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Aceptar") {
customDialog.dismiss()
}.show()
}
})
responseCode.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.GONE
if (!goBack2){
@ -370,7 +379,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
vStateFk = PRESACADOR,
//sergio: se añade originalItemScan para
vBuyFk = originalItemScan
vBuyFk = originalItemScan,callFunction = "saleTrackingReplace"
)
@ -391,7 +400,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
viewModel.saleTrackingDel(
usuario = user,
password = password,
saleFk = sales[position].idMovimiento
saleFk = sales[position].idMovimiento,"saleTracking_del"
)
setTotalLines()
scanRequest()
@ -420,7 +429,8 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
password = password,
itemFk = sales[position].itemFk,
quantity = quantityGet,
shelvingFk = sales[position].carros[shelvingPosition].shelving
shelvingFk = sales[position].carros[shelvingPosition].shelving,
callFunction = "itemPlacementSupplyAiming"
)
}
@ -460,7 +470,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
viewModel.getIdFromCode(
usuario = user,
password = password,
code = customDialogList.getValueTwo()
code = customDialogList.getValueTwo(),"barcodeToItem"
)
customDialogList.dismiss()
}
@ -503,7 +513,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
viewModel.getIdFromCode(
usuario = user,
password = password,
code = customDialogList.getValueTwo()
code = customDialogList.getValueTwo(),"barcodeToItem"
)
customDialogList.dismiss()
}
@ -549,7 +559,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
password = password,
itemShelvingFk = itemShelvingFk,
saleFk = sales[storedPosition].idMovimiento,
quantity = customDialogList.getValue()
quantity = customDialogList.getValue(),callFunction = "itemShelvingSaleSupplyAdd"
)
}catch (e:Exception){}
@ -606,7 +616,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
usuario = user,
password = password,
collectionFk = ticket,
sectorFk = sectorFk
sectorFk = sectorFk,"collectionSticker_print"
)
////Log.i("VERDNATURA:","La collection es $ticket, sectorFk $sectorFk, user $user i pass $password")
(getString(R.string.Imprimiendo) + " por " + SectorDescription).toast(requireContext())
@ -657,7 +667,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
usuario = user,
password = password,
ticketFk = ticket,
parking = parking
parking = parking,"shelvingPark"
)
////Log.i("VERDNATURA:","El usuario $user pass $password ticket $ticketFk y parking $parking")
@ -744,7 +754,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
password = password,
saleFk = sales[position].idMovimiento,
quantity = totalQuantity.toString(),
originalQuantity = sales[position].quantity.toString()
originalQuantity = sales[position].quantity.toString(),"saleMove"
)
//sales[position].originalQuantity = quantity
try{
@ -762,7 +772,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
//enviar mensaje a salix
val ticket = "[" + ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + ticketFk + "/summary)"
val message = "Se ha enviado a Split el articulo "+sales[position].itemFk+" del ticket "+ticket
viewModel.sendChekingPresence(token = token,workerId = sales[position].trabajador,message = message)
viewModel.sendChekingPresence(token = token,workerId = sales[position].trabajador,message = message, "sendChekingPresence")
}
@ -779,7 +789,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
quantity = totalQuantity.toString(),
warehouseFk = warehouseFk,
type = "FALSE",
originalQuantity = quantity
originalQuantity = quantity,callFunction = "collectionMissingTrash"
)
//sales[position].originalQuantity = quantity
try{
@ -796,7 +806,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
//enviar mensaje a salix
val ticket = "[" + ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + ticketFk + "/summary)"
val message = "Se ha enviado a Faltas la cantidad de "+ totalQuantity +" del articulo "+sales[position].itemFk+" ticket "+ticket
viewModel.sendChekingPresence(token = token,workerId = sales[position].trabajador,message = message)
viewModel.sendChekingPresence(token = token,workerId = sales[position].trabajador,message = message,"sendChekingPresence")
}
private fun missing(position: Int,quantity:String){
@ -811,7 +821,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
quantity = totalQuantity.toString(),
warehouseFk = warehouseFk,
type = "TRUE",
originalQuantity = quantity
originalQuantity = quantity,callFunction = "collectionMissingTrash"
)
//sales[position].originalQuantity = quantity
try{
@ -830,7 +840,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
//enviar mensaje a salix
val ticket = "[" + ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + ticketFk + "/summary)"
val message = "Se ha enviado a Basura "+ totalQuantity +" del articulo "+sales[position].itemFk+" ticket "+ticket
viewModel.sendChekingPresence(token = token,workerId = sales[position].trabajador,message = message)
viewModel.sendChekingPresence(token = token,workerId = sales[position].trabajador,message = message,"sendChekingPresence")
}
private fun reject(position: Int,quantity:String){
@ -845,13 +855,13 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
quantity = totalQuantity.toString(),
warehouseFk = warehouseFk,
type = "reject",
originalQuantity = quantity
originalQuantity = quantity,callFunction = "collectionMissingTrash"
)
//enviar mensaje a salix
val ticket = "[" + ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + ticketFk + "/summary)"
val message = "Se ha modificado la cantidad original "+sales[position].saldo+" del artículo "+sales[position].itemFk+" a nueva cantidad: "+ quantity +" del ticket "+ticket
viewModel.sendChekingPresence(token = token,workerId = sales[position].trabajador,message = message)
viewModel.sendChekingPresence(token = token,workerId = sales[position].trabajador,message = message,"sendChekingPresence")
try{
sales[position].saldo = quantity.toInt()
@ -872,14 +882,15 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
usuario = user,
password = password,
saleFk = sales[position].idMovimiento,
quantity = quantity
quantity = quantity,
callFunction = "collection_increaseQuantity"
)
try {
//enviar mensaje a salix
val ticket = "[" + ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + ticketFk + "/summary)"
val message = "Se ha modificado la cantidad original "+sales[position].saldo+" del artículo "+sales[position].itemFk+" a nueva cantidad: "+ quantity +" del ticket "+ticket
viewModel.sendChekingPresence(token = token,workerId = sales[position].trabajador,message = message)
viewModel.sendChekingPresence(token = token,workerId = sales[position].trabajador,message = message,"sendChekingPresence")
try{
sales[position].saldo = quantity.toInt()

View File

@ -9,6 +9,9 @@ import es.verdnatura.domain.GetPreSacadorUseCase
import es.verdnatura.domain.GetSacadorControladorUserCase
import es.verdnatura.domain.GetUbicadorUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.getMessageFromResponse
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO
@ -17,9 +20,11 @@ import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
class PreSacadorViewModel (context: Context): BaseViewModel() {
class PreSacadorViewModel(context: Context) : BaseViewModel()
{
private val getPreSacadorUseCase: GetPreSacadorUseCase = GetPreSacadorUseCase(context)
private val getSacadorControladorUserCase: GetSacadorControladorUserCase = GetSacadorControladorUserCase(context)
private val getSacadorControladorUserCase: GetSacadorControladorUserCase =
GetSacadorControladorUserCase(context)
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context)
private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase(context)
@ -43,208 +48,447 @@ class PreSacadorViewModel (context: Context): BaseViewModel() {
val responseIncQuantity: LiveData<ResponseItemVO>
get() = _responseIncQuantity
private val _responseSalixMessage by lazy { MutableLiveData<ResponseItemVO>() }
val responseSalixMessage: LiveData<ResponseItemVO>
get() = _responseSalixMessage
fun ticketToPrePrepare(usuario:String,password:String,ticketFk:String,sectorFk:String){
getPreSacadorUseCase.ticketToPrePrepare(usuario,password,ticketFk,sectorFk).enqueue(object :
Callback<List<PreSacadorItemVO>> {
override fun onFailure(call: Call<List<PreSacadorItemVO>>, t: Throwable) {
fun ticketToPrePrepare(usuario: String, password: String, ticketFk: String, sectorFk: String)
{
getPreSacadorUseCase.ticketToPrePrepare(usuario, password, ticketFk, sectorFk)
.enqueue(object :
Callback<List<PreSacadorItemVO>>
{
override fun onFailure(call: Call<List<PreSacadorItemVO>>, t: Throwable)
{
_salesList.value = listOf()
}
override fun onResponse(
call: Call<List<PreSacadorItemVO>>,
response: Response<List<PreSacadorItemVO>>
) {
if (response.body() != null){
)
{
if (response.body() != null)
{
_salesList.value = response.body()?.let { it }
}else{
} else
{
_salesList.value = listOf()
}
}
})
}
fun collectionStickerPrint(usuario:String,password:String,collectionFk: String,sectorFk: String){
getSacadorControladorUserCase.collectionStickerPrint(usuario,password,collectionFk,sectorFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
fun collectionStickerPrint(
usuario: String,
password: String,
collectionFk: String,
sectorFk: String,callFunction:String
)
{
getSacadorControladorUserCase.collectionStickerPrint(
usuario,
password,
collectionFk,
sectorFk
).enqueue(object : Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada collectionStickerPrint")
}else{
override fun onResponse(call: Call<String>, response: Response<String>)
{
if (response.body() == null)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
} else
{
_response.value = ResponseItemVO(isError = false, response = response.body()!!)
}
}
})
}
fun parking(usuario: String,password: String,ticketFk: String,parking:String){
getUbicadorUserCase.shelvingPark(usuario,password,ticketFk,parking).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
fun parking(usuario: String, password: String, ticketFk: String, parking: String,callFunction:String)
{
getUbicadorUserCase.shelvingPark(usuario, password, ticketFk, parking)
.enqueue(object : Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada shelvingPark")
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
override fun onResponse(call: Call<String>, response: Response<String>)
{
if (response.body() == null)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
} else
{
_response.value =
ResponseItemVO(isError = false, response = response.body()!!)
}
}
})
}
fun itemPlacementSupplyAiming(usuario:String,password:String,shelvingFk:String,quantity:String,itemFk:String){
getSacadorControladorUserCase.itemPlacementSupplyAiming(usuario,password,shelvingFk,quantity,itemFk).enqueue(object :
Callback<List<PlacementSupplyVO>> {
override fun onFailure(call: Call<List<PlacementSupplyVO>>, t: Throwable) {
fun itemPlacementSupplyAiming(
usuario: String,
password: String,
shelvingFk: String,
quantity: String,
itemFk: String,callFunction:String
)
{
getSacadorControladorUserCase.itemPlacementSupplyAiming(
usuario,
password,
shelvingFk,
quantity,
itemFk
).enqueue(object :
Callback<List<PlacementSupplyVO>>
{
override fun onFailure(call: Call<List<PlacementSupplyVO>>, t: Throwable)
{
val listError: ArrayList<PlacementSupplyVO> = ArrayList()
listError.add(PlacementSupplyVO(isError = true,errorMessage = t.message!!))
listError.add(PlacementSupplyVO(isError = true, errorMessage = getMessageFromAllResponse(callFunction,t.message!!)))
_placementSuppleyList.value = PlacementSupplyListVO(listError)
}
override fun onResponse(
call: Call<List<PlacementSupplyVO>>,
response: Response<List<PlacementSupplyVO>>
) {
if (response.body() != null){
)
{
if (response.body() != null)
{
_placementSuppleyList.value = response.body()?.let { PlacementSupplyListVO(it) }
}else{
} else
{
val listError: ArrayList<PlacementSupplyVO> = ArrayList()
listError.add(PlacementSupplyVO(isError = true,errorMessage = "Error en la llamada de itemPlacementSupplyAiming"))
listError.add(
PlacementSupplyVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
)
_placementSuppleyList.value = PlacementSupplyListVO(listError)
}
}
})
}
fun itemShelvingSaleSupplyAdd(usuario:String,password:String,itemShelvingFk:String,saleFk:String,quantity:String){
getSacadorControladorUserCase.itemShelvingSaleSupplyAdd(usuario,password,itemShelvingFk,saleFk,quantity).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
fun itemShelvingSaleSupplyAdd(
usuario: String,
password: String,
itemShelvingFk: String,
saleFk: String,
quantity: String,callFunction:String
)
{
getSacadorControladorUserCase.itemShelvingSaleSupplyAdd(
usuario,
password,
itemShelvingFk,
saleFk,
quantity
).enqueue(object : Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_response.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelvingSaleSupplyAdd")
}else{
override fun onResponse(call: Call<String>, response: Response<String>)
{
if (response.body() == null)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
} else
{
_response.value = ResponseItemVO(isError = false, response = response.body()!!)
}
}
})
}
fun saleTrackingReplace(usuario:String,password:String,saleFk:String,vOriginalQuantity:String,vStateFk:String,vIsChecked:String,vBuyFk:String){
fun saleTrackingReplace(
usuario: String,
password: String,
saleFk: String,
vOriginalQuantity: String,
vStateFk: String,
vIsChecked: String,
vBuyFk: String,callFunction:String
)
{
//Lo ultimo que se envia
//sergio: se quita el 0 que habia por defecto para la previa se añada el buyFk que sera el item escaneado.
//getSacadorControladorUserCase.saleTrackingReplace(usuario,password,saleFk,vOriginalQuantity,vStateFk,vIsChecked,"0").enqueue(object : Callback<String>{
getSacadorControladorUserCase.saleTrackingReplace(usuario,password,saleFk,vOriginalQuantity,vStateFk,vIsChecked,vBuyFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
getSacadorControladorUserCase.saleTrackingReplace(
usuario,
password,
saleFk,
vOriginalQuantity,
vStateFk,
vIsChecked,
vBuyFk
).enqueue(object : Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada saleTracking_Replace")
}else{
override fun onResponse(call: Call<String>, response: Response<String>)
{
if (response.body() == null)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
} else
{
_response.value = ResponseItemVO(isError = false, response = response.body()!!)
}
}
})
}
fun getIdFromCode(usuario:String,password:String,code: String){
getSacadorControladorUserCase.getIdFromCode(usuario,password,code).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_responseCode.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
fun getIdFromCode(usuario: String, password: String, code: String,callFunction:String)
{
getSacadorControladorUserCase.getIdFromCode(usuario, password, code)
.enqueue(object : Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_responseCode.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_responseCode.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada barcodeToItem")
}else{
_responseCode.value = ResponseItemVO(isError = false,response = response.body()!!)
override fun onResponse(call: Call<String>, response: Response<String>)
{
if (response.body() == null)
{
_responseCode.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message()))
} else
{
_responseCode.value =
ResponseItemVO(isError = false, response = response.body()!!)
}
}
})
}
fun saleTrackingDel(usuario:String,password:String,saleFk: String){
getSacadorControladorUserCase.saleTrackingDel(usuario,password,saleFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
fun saleTrackingDel(usuario: String, password: String, saleFk: String,callFunction:String){
getSacadorControladorUserCase.saleTrackingDel(usuario, password, saleFk)
.enqueue(object : Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada collectionMissingTrash")
}else{
override fun onResponse(call: Call<String>, response: Response<String>)
{
if (response.body() == null)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message()))
} else
{
_response.value =
ResponseItemVO(isError = false, response = response.body()!!)
}
}
})
}
fun saleMove(
usuario: String,
password: String,
saleFk: String,
quantity: String,
originalQuantity: String,callFunction:String)
{
getSacadorControladorUserCase.saleMove(
usuario,
password,
saleFk,
quantity,
originalQuantity
).enqueue(object : Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
override fun onResponse(call: Call<String>, response: Response<String>)
{
if (response.body() == null)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message()))
} else
{
_response.value = ResponseItemVO(isError = false, response = response.body()!!)
}
}
})
}
fun saleMove(usuario:String,password:String,saleFk: String,quantity: String,originalQuantity : String){
getSacadorControladorUserCase.saleMove(usuario,password,saleFk,quantity,originalQuantity).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
fun collectionMissingTrash(
usuario: String,
password: String,
saleFk: String,
quantity: String,
type: String,
warehouseFk: String,
originalQuantity: String,callFunction:String)
{
getSacadorControladorUserCase.collectionMissingTrash(
usuario,
password,
saleFk,
quantity,
type,
warehouseFk,
originalQuantity
).enqueue(object : Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada saleMove")
}else{
override fun onResponse(call: Call<String>, response: Response<String>)
{
if (response.body() == null)
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message()))
} else
{
_response.value = ResponseItemVO(isError = false, response = response.body()!!)
}
}
})
}
fun collectionMissingTrash(usuario:String,password:String,saleFk: String,quantity: String,type:String,warehouseFk:String,originalQuantity: String){
getSacadorControladorUserCase.collectionMissingTrash(usuario,password,saleFk,quantity,type,warehouseFk,originalQuantity).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
fun collectionIncreaseQuantity(
usuario: String,
password: String,
saleFk: String,
quantity: String,callFunction:String)
{
getSacadorControladorUserCase.collectionIncreaseQuantity(
usuario,
password,
saleFk,
quantity
).enqueue(object : Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_responseIncQuantity.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada collectionMissingTrash")
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
override fun onResponse(call: Call<String>, response: Response<String>)
{
if (response.body() == null)
{
_responseIncQuantity.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message()))
} else
{
_responseIncQuantity.value =
ResponseItemVO(isError = false, response = response.body()!!)
}
}
})
}
fun collectionIncreaseQuantity(usuario:String,password:String,saleFk: String,quantity: String){
getSacadorControladorUserCase.collectionIncreaseQuantity(usuario,password,saleFk,quantity).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_responseIncQuantity.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
fun sendChekingPresence(
token: String,
workerId: String,
message: String,
calledFunction: String
)
{
try
{
getLoginUserCase.sendChekingPresence(token, workerId.toInt(), message)
.enqueue(object : Callback<Boolean>
{
override fun onResponse(call: Call<Boolean>, response: Response<Boolean>)
{
if (!response.isSuccessful)
{
_responseSalixMessage.value = ResponseItemVO(
isError = true,
errorMessage = "Error en la llamada $calledFunction al enviar mensaje rocket." + getMessageFromResponse(
response.message()
)
)
//Log.i("Salix","Mensaje enviado a salix")
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_responseIncQuantity.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada collectionIncreaseQuantity")
}else{
_responseIncQuantity.value = ResponseItemVO(isError = false,response = response.body()!!)
}
}
})
}
fun sendChekingPresence(token:String,workerId:String,message:String){
try{
getLoginUserCase.sendChekingPresence(token,workerId.toInt(),message).enqueue(object : Callback<Boolean>{
override fun onResponse(call: Call<Boolean>, response: Response<Boolean>) {
Log.i("Salix","Mensaje enviado a salix")
}
override fun onFailure(call: Call<Boolean>, t: Throwable)
{
override fun onFailure(call: Call<Boolean>, t: Throwable) {
Log.i("Salix Error", "" + t.message)
}
})
}catch (e:Exception){}
} catch (e: Exception)
{
}
}
}

View File

@ -1,8 +1,15 @@
package es.verdnatura.presentation.view.feature.qr
import android.annotation.SuppressLint
import android.content.SharedPreferences
import android.graphics.Typeface
import android.inputmethodservice.Keyboard
import android.os.Bundle
import android.text.InputType
import android.util.Log
import android.view.KeyEvent
import android.view.KeyEvent.*
import android.view.View
import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer
@ -24,7 +31,6 @@ class QrFragment(
private var sectorFk = ""
private var warehouseFk = ""
private var goBack: Boolean = false
// private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
override fun getLayoutId(): Int = R.layout.fragment_qr
private lateinit var customDialog: CustomDialog
private var type = ""
@ -33,11 +39,6 @@ class QrFragment(
companion object {
fun newInstance(entryPoint: String) = QrFragment(entryPoint)
}
/*
override fun onAttach(context: Context) {
super.onAttach(context)
if (context is OnCollectionSelectedListener) onCollectionSelectedListener = context
}*/
override fun init() {
@ -69,6 +70,7 @@ class QrFragment(
super.onCreate(savedInstanceState)
}
private fun setEvents() {
backButton.setOnClickListener {
@ -77,11 +79,15 @@ class QrFragment(
scan_input.requestFocus()
scan_input.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
goBack = false
if (!scan_input.text.isNullOrEmpty()) {
splash_progress.visibility = View.VISIBLE
viewModel.qr_getCall(user, password, scan_input.text.toString())
viewModel.qr_getCall(user, password, scan_input.text.toString(),"qr_getCall")
itemscaned = scan_input.text.toString()
}
@ -91,6 +97,9 @@ class QrFragment(
return@setOnEditorActionListener true
}
//false
}

View File

@ -7,6 +7,8 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetQrReaderUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.ResponseItemVO
import retrofit2.Call
import retrofit2.Callback
@ -22,14 +24,14 @@ class QrFragmentViewModel(context: Context) : BaseViewModel() {
get() = _qrresponse
fun qr_getCall(user: String, password: String, vStatement: String) {
fun qr_getCall(user: String, password: String, vStatement: String,callFunction:String){
GetQrReaderUserCase.qr_getCall(user, password, vStatement)
.enqueue(object : Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
_qrresponse.value = ResponseItemVO(
isError = true,
errorMessage = "Error al realizar operación del Qr.Respuesta:" + t.message!!
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
)
}
@ -59,7 +61,7 @@ class QrFragmentViewModel(context: Context) : BaseViewModel() {
if (response.body() == null) {
_qrresponse.value = ResponseItemVO(
isError = true,
errorMessage = "Error en la llamada Qr"
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
}

View File

@ -116,7 +116,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
btn_obtener.setOnClickListener {
splash_progress.visibility = View.VISIBLE
viewModel.itemPlacementSupplyGetOrder(usuario = user,password = password,sectorFk = sectorFk)
viewModel.itemPlacementSupplyGetOrder(usuario = user,password = password,sectorFk = sectorFk,"itemPlacementSupplyGetOrder")
}
btn_cancelar.setOnClickListener {
@ -127,7 +127,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
}.setOkButton("Cerrar"){
splash_progress.visibility = View.VISIBLE
if (sales.count() > 0){
viewModel.itemPlacementSupplyCloseOrder(usuario = user,password = password,id = sales[0].id,quantity = sales[0].quantity.toString())
viewModel.itemPlacementSupplyCloseOrder(usuario = user,password = password,id = sales[0].id,quantity = sales[0].quantity.toString(),"itemPlacementSupplyCloseOrder")
}
customDialog.dismiss()
@ -165,7 +165,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
//LISTA =========
collection_swipe.setOnRefreshListener {
splash_progress.visibility = View.VISIBLE
viewModel.itemPlacementSupplyGetOrder(usuario = user,password = password,sectorFk = sectorFk)
viewModel.itemPlacementSupplyGetOrder(usuario = user,password = password,sectorFk = sectorFk,"itemPlacementSupplyGetOrder")
collection_swipe.isRefreshing = false
}
@ -352,7 +352,8 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
password = password,
itemFk = sales[position].itemFk,
quantity = quantityGet,
shelvingFk = sales[position].carros[shelvingPosition].shelving
shelvingFk = sales[position].carros[shelvingPosition].shelving,
callFunction = "itemPlacementSupplyAiming"
)
}
@ -387,7 +388,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
viewModel.getIdFromCode(
usuario = user,
password = password,
code = customDialogList.getValueTwo()
code = customDialogList.getValueTwo(),"barcodeToItem"
)
customDialogList.dismiss()
}
@ -425,7 +426,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
viewModel.getIdFromCode(
usuario = user,
password = password,
code = customDialogList.getValueTwo()
code = customDialogList.getValueTwo(),"barcodeToItem"
)
customDialogList.dismiss()
}
@ -471,7 +472,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
password = password,
itemShelvingFk = itemShelvingFk,
itemPlacementSupplyFk = sales[storedPosition].id,
quantity = customDialogList.getValue()
quantity = customDialogList.getValue(),"itemShelvingPlacementSupplyAdd"
)
}catch (e:Exception){}

View File

@ -7,6 +7,8 @@ import es.verdnatura.domain.GetPreSacadorUseCase
import es.verdnatura.domain.GetSacadorControladorUserCase
import es.verdnatura.domain.GetUbicadorUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO
@ -40,7 +42,7 @@ class ReposicionViewModel(context: Context) : BaseViewModel() {
val responseCode: LiveData<ResponseItemVO>
get() = _responseCode
fun itemPlacementSupplyGetOrder(usuario:String,password:String,sectorFk:String){
fun itemPlacementSupplyGetOrder(usuario:String,password:String,sectorFk:String,callFunction:String){
getPreSacadorUseCase.itemPlacementSupplyGetOrder(usuario,password,sectorFk).enqueue(object :
Callback<List<PreSacadorItemVO>> {
override fun onFailure(call: Call<List<PreSacadorItemVO>>, t: Throwable) {
@ -59,15 +61,15 @@ class ReposicionViewModel(context: Context) : BaseViewModel() {
})
}
fun parking(usuario: String,password: String,ticketFk: String,parking:String){
fun parking(usuario: String,password: String,ticketFk: String,parking:String,callFunction:String){
getUbicadorUserCase.shelvingPark(usuario,password,ticketFk,parking).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada shelvingPark")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -75,12 +77,12 @@ class ReposicionViewModel(context: Context) : BaseViewModel() {
})
}
fun itemPlacementSupplyAiming(usuario:String,password:String,shelvingFk:String,quantity:String,itemFk:String){
fun itemPlacementSupplyAiming(usuario:String,password:String,shelvingFk:String,quantity:String,itemFk:String,callFunction:String){
getSacadorControladorUserCase.itemPlacementSupplyAiming(usuario,password,shelvingFk,quantity,itemFk).enqueue(object :
Callback<List<PlacementSupplyVO>> {
override fun onFailure(call: Call<List<PlacementSupplyVO>>, t: Throwable) {
val listError:ArrayList<PlacementSupplyVO> = ArrayList()
listError.add(PlacementSupplyVO(isError = true,errorMessage = t.message!!))
listError.add(PlacementSupplyVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!)))
_placementSuppleyList.value = PlacementSupplyListVO(listError)
}
override fun onResponse(
@ -91,22 +93,22 @@ class ReposicionViewModel(context: Context) : BaseViewModel() {
_placementSuppleyList.value = response.body()?.let { PlacementSupplyListVO(it) }
}else{
val listError:ArrayList<PlacementSupplyVO> = ArrayList()
listError.add(PlacementSupplyVO(isError = true,errorMessage = "Error en la llamada de itemPlacementSupplyAiming"))
listError.add(PlacementSupplyVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
_placementSuppleyList.value = PlacementSupplyListVO(listError)
}
}
})
}
fun getIdFromCode(usuario:String,password:String,code: String){
fun getIdFromCode(usuario:String,password:String,code: String,callFunction:String){
getSacadorControladorUserCase.getIdFromCode(usuario,password,code).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_responseCode.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
_responseCode.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_responseCode.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada barcodeToItem")
_responseCode.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_responseCode.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -115,15 +117,15 @@ class ReposicionViewModel(context: Context) : BaseViewModel() {
}
fun itemShelvingPlacementSupplyAdd(usuario:String,password:String,itemShelvingFk:String,itemPlacementSupplyFk:String,quantity:String){
fun itemShelvingPlacementSupplyAdd(usuario:String,password:String,itemShelvingFk:String,itemPlacementSupplyFk:String,quantity:String,callFunction:String){
getSacadorControladorUserCase.itemShelvingPlacementSupplyAdd(usuario,password,itemShelvingFk,itemPlacementSupplyFk,quantity).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelvingPlacementSupplyAdd")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -131,15 +133,15 @@ class ReposicionViewModel(context: Context) : BaseViewModel() {
})
}
fun itemPlacementSupplyCloseOrder(usuario:String,password:String,id:String,quantity:String){
fun itemPlacementSupplyCloseOrder(usuario:String,password:String,id:String,quantity:String,callFunction:String){
getPreSacadorUseCase.itemPlacementSupplyCloseOrder(usuario,password,id,quantity).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_responseClose.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
_responseClose.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_responseClose.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemPlacementSupplyCloseOrder")
_responseClose.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_responseClose.value = ResponseItemVO(isError = false,response = response.body()!!)
}

View File

@ -85,7 +85,7 @@ class SacadorFragment :
toolbar_title.text = getString(R.string.getcollection)
setToolBar()
setEvents()
viewModel.collectionGet(user, password)
viewModel.collectionGet(user, password,"collection_get")
super.init()
}
@ -114,7 +114,7 @@ class SacadorFragment :
if (item == iconAdd) {
splash_progress.visibility = View.VISIBLE
//viewModel.collectionNew(user, password, sectorFk, wagons)
viewModel.collectionNew(user,password,sectorFk,wagons,getTagsType())
viewModel.collectionNew(user,password,sectorFk,wagons,getTagsType(),"collection_new_wagon")
//checkTagsMode()
}
@ -130,7 +130,7 @@ class SacadorFragment :
private fun setEvents() {
sacador_swipe.setOnRefreshListener {
viewModel.collectionGet(user, password)
viewModel.collectionGet(user, password,"collection_get")
sacador_swipe.isRefreshing = false
}
}
@ -143,11 +143,11 @@ class SacadorFragment :
if (getTagsType().equals("Stickers")) {
//viewModel.collectionNew(user, password, sectorFk, wagons, "Stickers")
viewModel.collectionNew(user, password, sectorFk, wagons)
viewModel.collectionNew(user, password, sectorFk, wagons,"collection_new_wagon")
} else {
// Log.i("VERDNATURA:", " el resultTagmode es ${resultTagMode}")
if (resultTagMode.equals("complete")) {
viewModel.collectionNew(user, password, sectorFk, wagons, getTagsType())
viewModel.collectionNew(user, password, sectorFk, wagons, getTagsType(),"collection_new_wagon")
} else {
requireActivity().addFragment(
AssociateSmartTagsFragment.newInstance(AssociateSmartTagsFragment.TAG),
@ -197,7 +197,7 @@ class SacadorFragment :
}
goBack = false
//sergio:para asegurarnos que aparece en pantalla. En mi movil personal y trabajo no hacia falta.
viewModel.collectionGet(user,password)
viewModel.collectionGet(user,password,"collection_get")
})
}
}

View File

@ -6,6 +6,8 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetSacadorControladorUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.collection.mapper.map
import es.verdnatura.presentation.view.feature.sacador.mapper.toDateFormat
@ -43,7 +45,7 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
collectionFk: String,
sectorFk: String,
print: String,
type:String
type:String,callFunction:String
){
getSacadorControladorUserCase.collectionTicketGet(
usuario,
@ -57,7 +59,7 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
override fun onFailure(call: Call<CollectionVO>, t: Throwable) {
_collectionTicketList.value = CollectionVO(
isError = true,
errorMessage = t.message!!
errorMessage =getMessageFromAllResponse(callFunction,t.message!!)
)
}
@ -70,21 +72,21 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
} else {
_collectionTicketList.value = CollectionVO(
isError = true,
errorMessage = "No hay tickets para sacar"
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
}
}
})
}
fun collectionNew(usuario: String, password: String, sectorFk: String, wagons: String){
fun collectionNew(usuario: String, password: String, sectorFk: String, wagons: String,callFunction:String){
getSacadorControladorUserCase.collectionNew(usuario, password, sectorFk, wagons).enqueue(
object :
Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value =
ResponseItemVO(isError = true, errorMessage = "" + t.message!!)
//////Log.i("VERDNATURA:",t.message.toString())
ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
@ -96,12 +98,10 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
_response.value =
ResponseItemVO(isError = false, response = response.body()!!)
} else {
// val error=response.message()
//Log.i("VERDNATURA:",""+ error)
_response.value = ResponseItemVO(
isError = true,
// errorMessage = "Error en la llamada collectionNew"
errorMessage = "No hay tickets para sacar"
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
}
@ -109,13 +109,13 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
})
}
fun collectionNew(usuario: String, password: String, sectorFk: String, wagons: String,tagtype:String){
fun collectionNew(usuario: String, password: String, sectorFk: String, wagons: String,tagtype:String,callFunction:String){
getSacadorControladorUserCase.collectionNew(usuario, password, sectorFk, wagons,tagtype).enqueue(
object :
Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value =
ResponseItemVO(isError = true, errorMessage = "" + t.message!!)
ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
@ -128,12 +128,10 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
_response.value =
ResponseItemVO(isError = false, response = response.body()!!)
} else {
// val error=response.message()
//Log.i("VERDNATURA:",""+ error)
_response.value = ResponseItemVO(
isError = true,
// errorMessage = "Error en la llamada collectionNew"
errorMessage = "No hay tickets para sacar"
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
}
@ -142,13 +140,13 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
}
fun collectionGet(usuario: String, password: String){
fun collectionGet(usuario: String, password: String,callFunction:String){
//////Log.i("VERDNATURA:","collectionGet para coger tickets")
getSacadorControladorUserCase.collectionGet(usuario, password).enqueue(object :
Callback<List<CollectionVO>> {
override fun onFailure(call: Call<List<CollectionVO>>, t: Throwable) {
val listError: ArrayList<CollectionVO> = ArrayList()
listError.add(CollectionVO(isError = true, errorMessage = t.message!!))
listError.add(CollectionVO(isError = true, errorMessage = getMessageFromAllResponse(callFunction,t.message!!)))
_collectionList.value = CollectionListVO(listError)
}
@ -165,7 +163,7 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
listError.add(
CollectionVO(
isError = true,
errorMessage = "Error en la llamada de collection_get"
errorMessage = getMessageFromAllResponse(callFunction,response.message())
)
)
_collectionList.value = CollectionListVO(listError)

View File

@ -67,7 +67,7 @@ class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, She
if (!shelvingText.text.toString().isNullOrEmpty()){
toolbar_title.text = shelvingText.text.toString()
splash_progress.visibility = View.VISIBLE
viewModel.shelvingParking_get(user,password,shelvingText.text.toString(),warehouseFk,dayrange.text.toString())
viewModel.shelvingParking_get(user,password,shelvingText.text.toString(),warehouseFk,dayrange.text.toString(),"shelvingParking_get")
}
shelvingText.setText("")
@ -86,7 +86,7 @@ class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, She
shelvingText.requestFocus()
toolbar_title.text = shelvingText.text.toString()
viewModel.shelvingParking_get(user,password,shelvingText.text.toString(),warehouseFk,dayrange.text.toString())
viewModel.shelvingParking_get(user,password,shelvingText.text.toString(),warehouseFk,dayrange.text.toString(),"shelvingParking_get")
shelvingText.setText("")
(activity as MainActivity).hideKeyboard(dayrange)
return@setOnEditorActionListener true

View File

@ -6,6 +6,8 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetShelvingParkingUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.view.feature.shelvingparking.model.ItemShelvingParkingListVO
import es.verdnatura.presentation.view.feature.shelvingparking.model.ItemShelvingParkingVO
@ -28,12 +30,12 @@ class ShelvingParkingViewModel(context: Context) : BaseViewModel() {
val loadShelvingList = Transformations.map(_shelvingList) { Event(it) }
fun shelvingParking_get(usuario:String,password:String,vShelvingFk:String,vWarehouseFk:String,vDayRange:String){
fun shelvingParking_get(usuario:String,password:String,vShelvingFk:String,vWarehouseFk:String,vDayRange:String,callFunction:String){
getShelvingParkingUserCase.shelvingParking_get(usuario,password,vShelvingFk.uppercase(),vWarehouseFk,vDayRange).enqueue(object :
Callback<List<ItemShelvingParkingVO>> {
override fun onFailure(call: Call<List<ItemShelvingParkingVO>>, t: Throwable) {
val listError:ArrayList<ItemShelvingParkingVO> = ArrayList()
listError.add(ItemShelvingParkingVO(isError = true,errorMessage = t.message!!))
listError.add(ItemShelvingParkingVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!)))
_shelvingList.value = ItemShelvingParkingListVO(listError)
}
@ -45,7 +47,7 @@ class ShelvingParkingViewModel(context: Context) : BaseViewModel() {
_shelvingList.value = response.body()?.let { ItemShelvingParkingListVO(it) }
}else{
val listError:ArrayList<ItemShelvingParkingVO> = ArrayList()
listError.add(ItemShelvingParkingVO(isError = true,errorMessage = "Error en la llamada de shelvingParking_get"))
listError.add(ItemShelvingParkingVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
_shelvingList.value = ItemShelvingParkingListVO(listError)
}
}

View File

@ -101,23 +101,7 @@ class SmartTagsViewModel(context: Context) : BaseViewModel() {
}
/* fun smartTag_nextLevel(usuario:String,password:String, vShelvingFk :String){
GetSmarttagsUserCase.smartTag_nextLevel(usuario,password,vShelvingFk ).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_responseadd.value = ResponseItemVO(isError = true,errorMessage = "Error al llamar a workerShelving_add")
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_responselevel.value = ResponseItemVO(isError = true,errorMessage = "Error al escanear matrícula o etiqueta")
}else{
_responselevel.value = ResponseItemVO(isError = false,response = response.body()!!)
}
}
})
}*/
}

View File

@ -22,7 +22,7 @@ class TransferenciaViewModel(context: Context) : BaseViewModel() {
getUbicadorUserCase.itemShelvingTransfer(usuario,password,itemFk,shelvingFk).enqueue(object :
Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage ="Error al guardar item: "+itemFk+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage ="Error en llamada itemShelvingTransfer."+t.message!!)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){

View File

@ -23,7 +23,7 @@ class AutomaticAddItemViewModel (context: Context): BaseViewModel() {
getUbicadorUserCase.itemShelvingMake_multi(usuario,password,shelving,items,deep,warehouse,level).enqueue(object :
Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage ="Error al guardar items. Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage ="Error al guardar items itemShelvingMake."+t.message!!)
}
override fun onResponse(call: Call<String>, response: Response<String>) {

View File

@ -84,7 +84,7 @@ class UbicadorFragment(
if (!shelvingFk.isNullOrEmpty()){
splash_progress.visibility = View.VISIBLE
toolbar_title.text = shelvingFk
viewModel.itemShelvingList(user,password,shelvingFk)
viewModel.itemShelvingList(user,password,shelvingFk,"itemShelvingList")
}
super.init()
}
@ -107,7 +107,7 @@ class UbicadorFragment(
showAddItem("","","","",false,ItemUbicadorVO())
}else if(item == iconReload){
splash_progress.visibility = View.VISIBLE
viewModel.itemShelvingList(user,password,shelvingFk)
viewModel.itemShelvingList(user,password,shelvingFk,"itemShelvingList")
}
}
@ -127,7 +127,7 @@ class UbicadorFragment(
toolbar_title.text = edit_matricula.text.toString()
shelvingFk = edit_matricula.text.toString()
splash_progress.visibility = View.VISIBLE
viewModel.itemShelvingList(user,password,edit_matricula.text.toString())
viewModel.itemShelvingList(user,password,edit_matricula.text.toString(),"itemShelvingList")
}
edit_matricula.setText("")
@ -141,7 +141,7 @@ class UbicadorFragment(
edit_prioridad.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!edit_prioridad.text.toString().isNullOrEmpty()){
viewModel.shelvingPriorityUpdate(user,password,edit_prioridad.text.toString(),shelvingFk)
viewModel.shelvingPriorityUpdate(user,password,edit_prioridad.text.toString(),shelvingFk,"shelvingPriority_update")
}
(activity as MainActivity).hideKeyboard(edit_prioridad)
@ -161,7 +161,7 @@ class UbicadorFragment(
parking_img.setOnClickListener {
customDialogInput.setTitle("Aparcar carro").setValue("").setOkButton("Aparcar"){
viewModel.shelvingPark(user,password,shelvingFk,customDialogInput.getValue())
viewModel.shelvingPark(user,password,shelvingFk,customDialogInput.getValue(),"shelvingPark")
parking = customDialogInput.getValue()
toolbar_title.text = shelvingFk.uppercase() + " P: "+parking + " E: "+etiquetas
if(mpok != null) mpok!!.start()
@ -175,7 +175,7 @@ class UbicadorFragment(
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
viewModel.shelvingPark(user,password,shelvingFk,customDialogInput.getValue())
viewModel.shelvingPark(user,password,shelvingFk,customDialogInput.getValue(),"shelvingPark")
customDialogInput.dismiss()
parking = customDialogInput.getValue()
if (toolbar_title != null && shelvingFk != null && parking != null && etiquetas != null){
@ -196,7 +196,7 @@ class UbicadorFragment(
edit_img.setOnClickListener {
customDialogInput.setTitle("Cambiar matrícula").setValue("").setOkButton("Guardar"){
viewModel.shelvingChange(user,password,shelvingFk,customDialogInput.getValue())
viewModel.shelvingChange(user,password,shelvingFk,customDialogInput.getValue(),"shelvingChange")
shelvingFk = customDialogInput.getValue()
toolbar_title.text = shelvingFk.uppercase() + " P: "+parking+ " E: "+etiquetas
if(mpok != null) mpok!!.start()
@ -210,7 +210,7 @@ class UbicadorFragment(
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
viewModel.shelvingChange(user,password,shelvingFk,customDialogInput.getValue())
viewModel.shelvingChange(user,password,shelvingFk,customDialogInput.getValue(),"shelvingChange")
shelvingFk = customDialogInput.getValue()
toolbar_title.text = shelvingFk.uppercase() + " P: "+parking+ " E: "+etiquetas
if(mpok != null) mpok!!.start()
@ -224,7 +224,7 @@ class UbicadorFragment(
delete_img.setOnClickListener {
customDialog.setTitle("Vaciar carro").setDescription("Esta operación no se puede rectificar.").setOkButton("Vaciar"){
viewModel.clearShelvingList(user,password,shelvingFk)
viewModel.clearShelvingList(user,password,shelvingFk,"clearShelvingList")
listItems.forEach {
it.stickers = "0"
it.visible = "0"
@ -294,7 +294,7 @@ class UbicadorFragment(
if (!shelvingFk.isNullOrEmpty()){
splash_progress.visibility = View.VISIBLE
toolbar_title.text = shelvingFk
viewModel.itemShelvingList(user,password,shelvingFk)
viewModel.itemShelvingList(user,password,shelvingFk,"itemShelvingList")
}
})
}
@ -346,7 +346,7 @@ class UbicadorFragment(
if (!packing.isNullOrEmpty()){
if (updatePacking == null){
if (!itemFk.isNullOrEmpty() && !visible.isNullOrEmpty()){
viewModel.itemShelvingMake(user,password,shelvingFk,itemFk,deep.toString(),visible,packing,warehouseFk,"1")
viewModel.itemShelvingMake(user,password,shelvingFk,itemFk,deep.toString(),visible,packing,warehouseFk,"1","itemShelvingMake")
changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible,packing = packing))
customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("")
customDialogUbicador.getEditItem().requestFocus()
@ -355,7 +355,7 @@ class UbicadorFragment(
}else if(!itemFk.isNullOrEmpty() && !etiquetas.isNullOrEmpty()){
val visible_calc = (etiquetas.toInt() * packing.toInt()).toString()
viewModel.itemShelvingMake(user,password,shelvingFk,itemFk,deep.toString(),visible_calc,packing,warehouseFk,"1")
viewModel.itemShelvingMake(user,password,shelvingFk,itemFk,deep.toString(),visible_calc,packing,warehouseFk,"1","itemShelvingMake")
changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible_calc,packing = packing,stickers = etiquetas))
customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("")
customDialogUbicador.getEditItem().requestFocus()
@ -367,7 +367,7 @@ class UbicadorFragment(
}
}else{
if (!itemFk.isNullOrEmpty() && !visible.isNullOrEmpty() && !updatePacking){
viewModel.itemShelvingMakeEdit(user,password,shelvingFk,itemFk,deep.toString(),visible,packing,warehouseFk,"1",itemShelvingFk)
viewModel.itemShelvingMakeEdit(user,password,shelvingFk,itemFk,deep.toString(),visible,packing,warehouseFk,"1",itemShelvingFk,"itemShelvingMakeEdit")
changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible,packing = packing))
customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("")
customDialogUbicador.getEditItem().requestFocus()
@ -379,7 +379,7 @@ class UbicadorFragment(
try{
visible_calc = (etiquetas.toInt() * packing.toInt()).toString()
}catch (e:Exception){}
viewModel.itemShelvingMakeEdit(user,password,shelvingFk,itemFk,deep.toString(),visible_calc,packing,warehouseFk,"1",itemShelvingFk)
viewModel.itemShelvingMakeEdit(user,password,shelvingFk,itemFk,deep.toString(),visible_calc,packing,warehouseFk,"1",itemShelvingFk,"itemShelvingMakeEdit")
changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible_calc,packing = packing,stickers = etiquetas))
customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("")
customDialogUbicador.getEditItem().requestFocus()
@ -399,14 +399,14 @@ class UbicadorFragment(
private fun editItem(itemFk:String,etiquetas:String,packing:String,visible:String){
if (!packing.isNullOrEmpty()){
if (!itemFk.isNullOrEmpty() && !visible.isNullOrEmpty()){
viewModel.itemShelvingMake(user,password,shelvingFk,itemFk,deep.toString(),visible,packing,warehouseFk,"1")
viewModel.itemShelvingMake(user,password,shelvingFk,itemFk,deep.toString(),visible,packing,warehouseFk,"1","itemShelvingMake")
changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible,packing = packing))
customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("")
customDialogUbicador.getEditItem().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem())
}else if(!itemFk.isNullOrEmpty() && !etiquetas.isNullOrEmpty()){
val visible_calc = (etiquetas.toInt() * packing.toInt()).toString()
viewModel.itemShelvingMake(user,password,shelvingFk,itemFk,deep.toString(),visible_calc,packing,warehouseFk,"1")
viewModel.itemShelvingMake(user,password,shelvingFk,itemFk,deep.toString(),visible_calc,packing,warehouseFk,"1","itemShelvingMake")
changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible_calc,packing = packing,stickers = etiquetas))
customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("")
customDialogUbicador.getEditItem().requestFocus()
@ -429,7 +429,7 @@ class UbicadorFragment(
customDialogTwoButtons.setTitle(item.item).setDescription("Selecciona una acción").setOkButton("Transferir"){
customDialogInput.setTitle("Nueva matrícula").setDescription("Introduce el destino para item: "+item.item).setValue("").setOkButton("Transferir"){
if (customDialogInput.getValue().isNotEmpty()){
viewModel.itemShelvingTransfer(user,password,item.id,customDialogInput.getValue())
viewModel.itemShelvingTransfer(user,password,item.id,customDialogInput.getValue(),"itemShelvingTransfer")
listItems.remove(item)
adapter!!.notifyDataSetChanged()
customDialogInput.dismiss()
@ -446,7 +446,7 @@ class UbicadorFragment(
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
viewModel.itemShelvingTransfer(user,password,item.id,customDialogInput.getValue())
viewModel.itemShelvingTransfer(user,password,item.id,customDialogInput.getValue(),"itemShelvingTransfer")
listItems.remove(item)
adapter!!.notifyDataSetChanged()
customDialogInput.dismiss()
@ -459,7 +459,7 @@ class UbicadorFragment(
customDialog.setTitle("Confirmar").setDescription("Confirmas eliminar el artículo: "+item.item+"?").setOkButton("Eliminar"){
listItems.remove(item)
adapter!!.notifyDataSetChanged()
viewModel.itemShelvingDelete(user,password,item.id)
viewModel.itemShelvingDelete(user,password,item.id,"itemShelvingDelete")
customDialogTwoButtons.dismiss()
customDialog.dismiss()
}.setKoButton("Cancelar"){

View File

@ -6,6 +6,8 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetUbicadorUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorListVO
@ -33,12 +35,12 @@ class UbicadorViewModel(context: Context) : BaseViewModel() {
val loadShelvingList = Transformations.map(_shelvingList) { Event(it) }
fun itemShelvingList(usuario:String,password:String,vShelvingFk:String){
fun itemShelvingList(usuario:String,password:String,vShelvingFk:String,callFunction:String){
getUbicadorUserCase.itemShelvingList(usuario,password,vShelvingFk.uppercase()).enqueue(object :
Callback<List<ItemUbicadorVO>> {
override fun onFailure(call: Call<List<ItemUbicadorVO>>, t: Throwable) {
val listError:ArrayList<ItemUbicadorVO> = ArrayList()
listError.add(ItemUbicadorVO(isError = true,errorMessage = t.message!!))
listError.add(ItemUbicadorVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
_shelvingList.value = ItemUbicadorListVO(listError)
}
@ -50,7 +52,7 @@ class UbicadorViewModel(context: Context) : BaseViewModel() {
_shelvingList.value = response.body()?.let { ItemUbicadorListVO(it) }
}else{
val listError:ArrayList<ItemUbicadorVO> = ArrayList()
listError.add(ItemUbicadorVO(isError = true,errorMessage = "Error en la llamada de itemShelvingList"))
listError.add(ItemUbicadorVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
_shelvingList.value = ItemUbicadorListVO(listError)
}
}
@ -58,15 +60,15 @@ class UbicadorViewModel(context: Context) : BaseViewModel() {
})
}
fun shelvingPriorityUpdate(usuario:String,password:String,priority:String,shelving:String){
fun shelvingPriorityUpdate(usuario:String,password:String,priority:String,shelving:String,callFunction:String){
getUbicadorUserCase.shelvingPriorityUpdate(usuario,password,priority,shelving).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada shelvingPriorityUpdate")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada shelvingPriorityUpdate")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -77,15 +79,15 @@ class UbicadorViewModel(context: Context) : BaseViewModel() {
}
fun itemShelvingMake(usuario:String,password:String,shelving:String,item:String,deep:String,quantity:String,packing:String,warehouse:String,level:String){
fun itemShelvingMake(usuario:String,password:String,shelving:String,item:String,deep:String,quantity:String,packing:String,warehouse:String,level:String,callFunction:String){
getUbicadorUserCase.itemShelvingMake(usuario,password,shelving,item,deep,quantity,packing,warehouse,level).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_responseMake.value = ResponseItemVO(isError = true,errorMessage ="Error al guardar item: "+item+ " Respuesta:"+t.message!!)
_responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_responseMake.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelvingMake")
_responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_responseMake.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -95,15 +97,15 @@ class UbicadorViewModel(context: Context) : BaseViewModel() {
})
}
fun itemShelvingMakeEdit(usuario:String,password:String,shelving:String,item:String,deep:String,quantity:String,packing:String,warehouse:String,level:String,itemShelvingFk:String){
fun itemShelvingMakeEdit(usuario:String,password:String,shelving:String,item:String,deep:String,quantity:String,packing:String,warehouse:String,level:String,itemShelvingFk:String,callFunction:String){
getUbicadorUserCase.itemShelvingMakeEdit(usuario,password,shelving,item,deep,quantity,packing,warehouse,level,itemShelvingFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_responseMake.value = ResponseItemVO(isError = true,errorMessage ="Error al guardar item: "+item+ " Respuesta:"+t.message!!)
_responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_responseMake.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelvingMakeEdit")
_responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_responseMake.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -113,14 +115,14 @@ class UbicadorViewModel(context: Context) : BaseViewModel() {
})
}
fun shelvingPark(usuario:String,password:String,shelving:String,parking:String){
fun shelvingPark(usuario:String,password:String,shelving:String,parking:String,callFunction:String){
getUbicadorUserCase.shelvingPark(usuario,password,shelving,parking).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage ="Error al guardar item: "+shelving+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada shelvingPark")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -128,14 +130,14 @@ class UbicadorViewModel(context: Context) : BaseViewModel() {
})
}
fun shelvingChange(usuario:String,password:String,origen:String,destino:String){
fun shelvingChange(usuario:String,password:String,origen:String,destino:String,callFunction:String){
getUbicadorUserCase.shelvingChange(usuario,password,origen,destino).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage ="Error al guardar item: "+origen+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada shelvingChange")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -143,14 +145,14 @@ class UbicadorViewModel(context: Context) : BaseViewModel() {
})
}
fun clearShelvingList(usuario:String,password:String,shelvingFk:String){
fun clearShelvingList(usuario:String,password:String,shelvingFk:String,callFunction:String){
getUbicadorUserCase.clearShelvingList(usuario,password,shelvingFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage ="Error al guardar item: "+shelvingFk+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada clearShelvingList")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -158,14 +160,14 @@ class UbicadorViewModel(context: Context) : BaseViewModel() {
})
}
fun itemShelvingTransfer(usuario:String,password:String,itemFk:String,shelvingFk:String){
fun itemShelvingTransfer(usuario:String,password:String,itemFk:String,shelvingFk:String,callFunction:String){
getUbicadorUserCase.itemShelvingTransfer(usuario,password,itemFk,shelvingFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage ="Error al guardar item: "+itemFk+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelvingTransfer")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -173,14 +175,14 @@ class UbicadorViewModel(context: Context) : BaseViewModel() {
})
}
fun itemShelvingDelete(usuario:String,password:String,itemFk:String){
fun itemShelvingDelete(usuario:String,password:String,itemFk:String,callFunction:String){
getUbicadorUserCase.itemShelvingDelete(usuario,password,itemFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage ="Error al guardar item: "+itemFk+ " Respuesta:"+t.message!!)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelvingDelete")
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}

View File

@ -0,0 +1,8 @@
<!-- drawable/point_of_sale.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#F7931E" android:pathData="M20,5C19.4,5 19,5.5 19,6.1V16C19,16.6 19.4,17 20,17.1C20.6,17.1 21,16.6 21,16V6.1C21,5.5 20.6,5 20,5M16.4,2H4.6C3.7,2 3,2.7 3,3.6V17.4C3,18.3 3.7,19 4.6,19H6V21C6,21.6 6.4,22 7,22H13C13.6,22 14,21.6 14,21V19H16.4C17.3,19 18,18.3 18,17.4V3.6C18,2.7 17.3,2 16.4,2M5,8H8V10H5V8M12,11V13H9V11H12M9,10V8H12V10H9M12,14V16H9V14H12M5,11H8V13H5V11M5,16V14H8V16H5M8,21H7V19H8V21M13,21H10V19H13V21M16,16H13V14H16V16M16,13H13V11H16V13M16,10H13V8H16V10M16,6H5V4H16V6Z" />
</vector>

View File

@ -24,7 +24,7 @@
android:layout_height="wrap_content"
android:backgroundTint="@android:color/white"
android:hint="@string/Escaner"
android:inputType="text"
android:inputType="textVisiblePassword"
android:lines="1"
android:maxLines="1"
android:textColor="@color/verdnatura_white"

View File

@ -29,7 +29,7 @@
android:layout_width="match_parent"
android:backgroundTint="@android:color/white"
android:hint="@string/Escaneaetiqueta"
android:inputType="text"
android:inputType="textVisiblePassword"
android:lines="1"
android:maxLines="1"
android:textColor="@color/verdnatura_white"

View File

@ -0,0 +1,166 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textinputlayout_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColorHint="@android:color/darker_gray"
android:layout_marginTop="@dimen/toolbar_height">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edit_itemFk"
style="@style/InputLineTextSearch"
android:layout_width="match_parent"
android:backgroundTint="@android:color/white"
android:hint="@string/Escaneaetiqueta"
android:inputType="text"
android:lines="1"
android:maxLines="1"
android:textColor="@color/verdnatura_white"
android:textColorHint="@android:color/darker_gray" />
</com.google.android.material.textfield.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="@dimen/layout_margin_min"
android:layout_marginBottom="@dimen/layout_margin_1"
android:paddingLeft="@dimen/layout_margin_min"
android:paddingRight="@dimen/layout_margin_min">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ItemFk"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="left"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Nombre"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="left"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Fecha"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Cantidad"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Stock"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
</LinearLayout>
<LinearLayout
android:id="@+id/itemcard_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical"
tools:ignore="ExtraText">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/itemexpeditionstate_recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:visibility="visible"
tools:listitem="@layout/item_expeditionstate_row" />
</RelativeLayout>>
</LinearLayout>
</LinearLayout>
</ScrollView>
<include
android:id="@+id/main_toolbar"
layout="@layout/toolbar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/splash_progress"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/verdnatura_black_8_alpha_6"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:gravity="center">
<com.airbnb.lottie.LottieAnimationView
android:layout_width="wrap_content"
android:layout_height="@dimen/verdnatura_logo_large_height"
app:lottie_autoPlay="true"
app:lottie_loop="true"
app:lottie_rawRes="@raw/orange_loading"
app:lottie_speed="2" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="viewModel"
type="es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:paddingTop="@dimen/toolbar_height">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="@dimen/layout_margin_min"
android:layout_marginBottom="@dimen/layout_margin_1"
android:paddingLeft="@dimen/layout_margin_min"
android:paddingRight="@dimen/layout_margin_min">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ItemFk"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="left"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="vDated"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="left"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="atShelving"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="balance"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/itemshelvingdayofsale_recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
tools:listitem="@layout/item_shelvingdayofsale_row"/>
</LinearLayout>
<include
android:id="@+id/main_toolbar"
layout="@layout/toolbar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/splash_progress"
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/verdnatura_black_8_alpha_6"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:gravity="center">
<com.airbnb.lottie.LottieAnimationView
android:layout_width="wrap_content"
android:layout_height="@dimen/verdnatura_logo_large_height"
app:lottie_autoPlay="true"
app:lottie_loop="true"
app:lottie_rawRes="@raw/orange_loading"
app:lottie_speed="2" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@ -30,7 +30,7 @@
android:layout_width="match_parent"
android:backgroundTint="@android:color/white"
android:hint="@string/Escaneaetiqueta"
android:inputType="text"
android:inputType="textVisiblePassword"
android:lines="1"
android:maxLines="1"
android:textColor="@color/verdnatura_white"

View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tool="http://schemas.android.com/tools">
<data>
<variable
name="item"
type="es.verdnatura.presentation.view.feature.diadeventa.model.ItemShelvingSaleDate" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/item_row_layout"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/verdnatura_black_5"
android:paddingLeft="@dimen/layout_margin_min"
android:paddingRight="@dimen/layout_margin_min"
android:paddingTop="@dimen/pasilleros_margin_main_menu"
android:paddingBottom="@dimen/pasilleros_margin_main_menu">
<TextView
android:id="@+id/historico_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{item.itemFk}"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:gravity="center"
android:layout_marginRight="@dimen/layout_margin_min"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{item.longName}"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
<TextView
android:id="@+id/saledate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{item.dated}"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{item.amount}"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{item.stock}"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/verdnatura_black_9"/>
</LinearLayout>
</layout>

View File

@ -147,4 +147,6 @@
<string name="producer">Productor</string>
<string name="controlticket">Controlar ticket</string>
<string name="ExpeditionScan">Escanear expedición</string>
<string name="dayofSale">Día de venta</string>
<string name="wagon">Carro</string>
</resources>

View File

@ -145,5 +145,7 @@
<string name="producer">Producer</string>
<string name="controlticket">Control ticket</string>
<string name="ExpeditionScan">Scan expedition</string>
<string name="dayofSale">Day of sale</string>
<string name="wagon">Wagon</string>
</resources>