From e4f5cc6786b5a7d5238f62c8100b0287b4ebde3a Mon Sep 17 00:00:00 2001 From: Sergio De la torre Date: Mon, 30 Oct 2023 07:45:36 +0100 Subject: [PATCH] Refactor formato campos refs #6061 --- .idea/workspace.xml | 92 ++++--------------- .../java/es/verdnatura/domain/SalixService.kt | 23 +++-- .../es/verdnatura/domain/VerdnaturaService.kt | 47 +++++----- .../presentation/common/SalixBackItems.kt | 6 ++ .../ajustes/fragment/AjustesViewModel.kt | 16 ++-- .../collection/fragment/CollectionFragment.kt | 15 --- .../fragment/CollectionFragmentPicker.kt | 16 +--- .../fragment/CollectionViewModel.kt | 12 +-- .../fragment/ControlVehiculoViewModel.kt | 4 - .../feature/delivery/model/ClientTicket.kt | 3 +- .../inventario/fragment/InventaryViewModel.kt | 23 ++--- .../feature/login/fragment/LoginFragment.kt | 9 +- .../feature/login/fragment/LoginViewModel.kt | 18 ++-- .../ExpeditionPalletDetailViewModel.kt | 9 +- .../fragment/ExpeditionScanViewModel.kt | 6 +- .../feature/sacador/model/TicketItemVO.kt | 2 +- .../ubicador/fragment/UbicadorFragment.kt | 7 +- .../ubicador/fragment/UbicadorViewModel.kt | 44 ++++++--- .../adapter/WorkermistakeAdapter.kt | 76 ++++++--------- .../fragment/WorkermistakeFragment.kt | 2 - .../res/layout/item_workermistake_row.xml | 7 +- app/src/main/res/values-es/strings.xml | 2 + app/src/main/res/values-fr/strings.xml | 2 + app/src/main/res/values-pt/strings.xml | 2 + app/src/main/res/values/strings.xml | 2 + 25 files changed, 182 insertions(+), 263 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d9622d09..9b9884f5 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -128,89 +128,35 @@ - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - + - - + - - - - - - - - - - - + + - - - - - - - - - + + - - - - - - - - - - - - - + + + @@ -565,13 +511,6 @@ @@ -1041,7 +987,7 @@ file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt - 548 + 546 diff --git a/app/src/main/java/es/verdnatura/domain/SalixService.kt b/app/src/main/java/es/verdnatura/domain/SalixService.kt index 99c9bc74..43ef5550 100644 --- a/app/src/main/java/es/verdnatura/domain/SalixService.kt +++ b/app/src/main/java/es/verdnatura/domain/SalixService.kt @@ -1,8 +1,10 @@ package es.verdnatura.domain +import com.google.gson.JsonObject import es.verdnatura.presentation.common.itemBarCodeSalix import es.verdnatura.presentation.common.packingSiteSalix import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO +import es.verdnatura.presentation.view.feature.ajustes.model.Train import es.verdnatura.presentation.view.feature.articulo.model.AddressLoses import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO @@ -149,10 +151,10 @@ interface SalixService { @Query("filter") filter: String = """{"fields": {"id": true,"name": true},"where": {"hasToMistake": true}}""" ): Call> - @GET("Workers") + @GET("Workers/findOne?") fun worker_idF11Allowed( @Query("filter") filter: String - ): Call> + ): Call @DELETE("ExpeditionPallets/{id}") fun expeditionPalletDel( @@ -312,7 +314,8 @@ interface SalixService { @PATCH("ItemShelvings/{id}") fun itemShelvingUpdate( - @Path("id") id: Number, @Body params: Any + @Path("id") id: Number, + @Body params: Any ): Call @POST("ItemShelvings/update") @@ -326,7 +329,7 @@ interface SalixService { fun ticketCollectionUpdate( @Query("where") filter: Any,//revisar si con Any vale, update generalmente pongo json (ejemplo: itemShelvingReset) @Body params: Any - ): Call + ): Call @POST("ItemShelvingSales/itemShelvingSaleSetQuantity") fun itemShelvingsConfirmRerserved( @@ -368,7 +371,7 @@ interface SalixService { @POST("ExpeditionMistakes") fun expeditionMistakesAdd( - expeditionMistake: ExpeditionMistakeSalix + @Body expeditionMistake: ExpeditionMistakeSalix ): Call @POST("ExpeditionStates/addExpeditionState") @@ -378,9 +381,13 @@ interface SalixService { @POST("WorkerMistakes") fun workerMistakesAdd( - workerMistake: WorkerMistakeSalix + @Body workerMistake: WorkerMistakeSalix ): Call + @GET("WorkerMistakeTypes") + fun workerMistakesTypes( + ): Call> + @POST("SaleMistakes") fun saleMistakeAdd( @Body saleMistakeSalix: SaleMistakeSalix @@ -390,6 +397,10 @@ interface SalixService { fun getMistakeTypes( ): Call> + @GET("Train") + fun getTrain( + ): Call> + } interface SalixServiceSend { diff --git a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt index 3b42847f..e35958f3 100644 --- a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt +++ b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt @@ -23,11 +23,8 @@ import es.verdnatura.presentation.view.feature.paletizador.model.* import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO import es.verdnatura.presentation.view.feature.reubication.model.Reubication import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO -import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO -import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake -import es.verdnatura.presentation.view.feature.workermistake.model.MistakeType import es.verdnatura.presentation.view.feature.workermistake.model.WorkerFromMistake import retrofit2.Call import retrofit2.http.Body @@ -45,12 +42,14 @@ interface VerdnaturaService { ): Call +/* @POST("almacennew/deviceLog_add")//REVISADA fun deviceLog_add( @Body vararg params: Any ): Call +*/ @POST("/security/getVersion")//REVISADA @@ -164,7 +163,7 @@ interface VerdnaturaService { ): Call - @POST("almacennew/operator_getTrain")//NO SALIX + @POST("almacennew/operator_getTrain")//NO SALIX fun operator_getTrain( ): Call @@ -308,30 +307,30 @@ interface VerdnaturaService { ): Call> - @POST("almacennew/barcodeToItem")//REVISADA +/* @POST("almacennew/barcodeToItem")//REVISADA fun getIdFromCode( @Body vararg params: Any ): - Call + Call*/ - @POST("almacennew/saleMistakeAdd")//REVISADA + /* @POST("almacennew/saleMistakeAdd")//REVISADA fun saleMistakeAdd( @Body vararg params: Any ): - Call + Call*/ - @POST("almacennew/workerMistake_Add")//A BORRAR + /* @POST("almacennew/workerMistake_Add")//A BORRAR fun workerMistake_Add( @Body vararg params: Any ): - Call + Call*/ - @POST("almacennew/expeditionMistake_add")// A BORRAR + /* @POST("almacennew/expeditionMistake_add")// A BORRAR fun expeditionMistake_add( @Body vararg params: Any ): - Call + Call*/ @GET("almacennew/itemShelving_inventory")//REVISADA fun itemShelving_inventory( @@ -339,26 +338,26 @@ interface VerdnaturaService { ): Call - @POST("almacennew/mistakeType")//REVISADA +/* @POST("almacennew/mistakeType")//REVISADA fun mistakeType( ): - Call> + Call>*/ - @POST("almacennew/workerMistakeType_get")//A BORRAR + /* @POST("almacennew/workerMistakeType_get")//A BORRAR fun workerMistakeType_get( ): - Call> + Call>*/ - @POST("almacennew/expeditionMistakeType_get")//A BORRAR + /* @POST("almacennew/expeditionMistakeType_get")//A BORRAR fun expeditionMistakeType_get( ): - Call> + Call>*/ - @POST("almacennew/department_getHasMistake")//A BORRAR + /* @POST("almacennew/department_getHasMistake")//A BORRAR fun department_getHasMistake( ): - Call> + Call>*/ @POST("almacennew/worker_getFromHasMistake")//REVISADA fun worker_getFromHasMistake( @@ -417,12 +416,12 @@ interface VerdnaturaService { Call - @POST("almacennew/item_saveStems")//A BORRAR + /* @POST("almacennew/item_saveStems")//A BORRAR fun item_saveStems( @Body vararg params: Any ): - Call + Call*/ @POST("almacennew/item_saveReference")//A BORRAR fun item_saveReference( @@ -472,11 +471,11 @@ interface VerdnaturaService { ): Call - @POST("almacennew/deviceProduction_getnameDevice")//REVISADA +/* @POST("almacennew/deviceProduction_getnameDevice")//REVISADA fun deviceProduction_getnameDevice( @Body vararg params: Any ): - Call + Call*/ @POST("almacennew/deviceProductionUser_getWorker")//REVISADA fun deviceProductionUser_getWorker( diff --git a/app/src/main/java/es/verdnatura/presentation/common/SalixBackItems.kt b/app/src/main/java/es/verdnatura/presentation/common/SalixBackItems.kt index 303b29c0..f847aeb1 100644 --- a/app/src/main/java/es/verdnatura/presentation/common/SalixBackItems.kt +++ b/app/src/main/java/es/verdnatura/presentation/common/SalixBackItems.kt @@ -16,6 +16,12 @@ data class ItemShelvingSaleSalix( var quantity:Int, var isItemShelvingSaleEmpty:Boolean? ) +data class ItemShelvingSalix( + var visible:Int, + var packing:Int, + var grouping:Int? + +) data class ItemDiscardSalix( var itemFk :Int, diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesViewModel.kt index a7110576..ae186975 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesViewModel.kt @@ -7,6 +7,8 @@ import android.view.View.VISIBLE import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.Transformations +import com.google.gson.JsonObject +import es.verdnatura.MobileApplication import es.verdnatura.R import es.verdnatura.domain.SalixCallback import es.verdnatura.domain.SilexCallback @@ -295,6 +297,8 @@ class AjustesViewModel(val context: Context) : BaseViewModel(context) { } fun train_get() { + //Tarea 5134 + //salix.getTrain() silex.train_get().enqueue(object : SilexCallback>(context) { override fun onError(t: Throwable) { @@ -427,11 +431,8 @@ class AjustesViewModel(val context: Context) : BaseViewModel(context) { } fun worker_isF11Allowed() { - //Hi ha que canviar front, torna [] si no troba i [{"isF11Allowed":true}] si troba el usuario - //salix.worker_idF11Allowed( """{"where":{"id":${(context as MobileApplication).userId},"isF11Allowed":false},"fields":{"isF11Allowed":true}}""") - - silex.worker_isF11Allowed() - .enqueue(object : SilexCallback(context) { + salix.worker_idF11Allowed( """{"where":{"id":${(context as MobileApplication).userId}},"fields":{"isF11Allowed":true}}""") + .enqueue(object : SalixCallback(context) { override fun onError(t: Throwable) { _workerAllowedResponse.value = ResponseItemVO( @@ -440,9 +441,10 @@ class AjustesViewModel(val context: Context) : BaseViewModel(context) { ) } - override fun onSuccess(response: Response) { + override fun onSuccess(response: Response) { + //val isF11Allowed = (response.body())!!.get("isF11Allowed") ?: true _workerAllowedResponse.value = ResponseItemVO( - response = response.body().toString(), + response = response.body()!!.entrySet().first().value.toString(), isError = false, ) } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt index 9197ad63..5c9f6908 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt @@ -1769,13 +1769,6 @@ class CollectionFragment( viewModel.getIdFromCodeSalix( code = customDialogList.getValueTwo(), ) - /* } else { - viewModel.getIdFromCode( - usuario = getData(USER), - password = getData(PASSWORD), - code = customDialogList.getValueTwo(), "barcodeToItem" - ) - }*/ customDialogList.dismiss() } @@ -1862,14 +1855,6 @@ class CollectionFragment( viewModel.getIdFromCodeSalix( code = customDialogList.getValueTwo() ) -/* - } else { - viewModel.getIdFromCode( - getData(USER), - getData(PASSWORD), - code = customDialogList.getValueTwo(), "barcodeToItem" - ) - }*/ customDialogList.dismiss() scanRequest() } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPicker.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPicker.kt index a8fac39b..823196b0 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPicker.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPicker.kt @@ -1815,13 +1815,6 @@ import org.json.JSONObject viewModel.getIdFromCodeSalix( code = customDialogList.getValueTwo(), ) - /* } else { - viewModel.getIdFromCode( - usuario = getData(USER), - password = getData(PASSWORD), - code = customDialogList.getValueTwo(), "barcodeToItem" - ) - }*/ customDialogList.dismiss() } @@ -1908,14 +1901,7 @@ import org.json.JSONObject viewModel.getIdFromCodeSalix( code = customDialogList.getValueTwo() ) -/* - } else { - viewModel.getIdFromCode( - getData(USER), - getData(PASSWORD), - code = customDialogList.getValueTwo(), "barcodeToItem" - ) - }*/ + customDialogList.dismiss() scanRequest() } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionViewModel.kt index 44897cb3..c57b7c23 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionViewModel.kt @@ -546,11 +546,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) { ticketFk: Int, usedShelves: Int ) { - //salix.ticketCollectionUpdate("""where={"ticketFk":$ticketFk}""", hashMapOf("usedShelves" to usedShelves)) - silex.ticketCollection_setUsedShelves( - ticketFk, - usedShelves - ).enqueue(object : SilexCallback(context) { + salix.ticketCollectionUpdate("""where={"ticketFk":$ticketFk}""", hashMapOf("usedShelves" to usedShelves)) + .enqueue(object : SilexCallback(context) { override fun onError(t: Throwable) { _responseUsedShelves.value = ResponseItemVO( @@ -944,7 +941,6 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) { ) { salix.saleMistakeAdd(SaleMistakeSalix(userFk=(context as MobileApplication).userId!!, saleFk = saleFk,typeFk = typeFk)) - //silex.saleMistakeAdd(saleFk, typeFk, typeFk) .enqueue(object : SilexCallback(context) { override fun onError(t: Throwable) { @@ -965,8 +961,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) { fun mistakeType() { //Tarea 5134 - // salix.getMistakeTypes() - silex.mistakeType() + salix.getMistakeTypes() + //silex.mistakeType() .enqueue(object : SilexCallback>(context) { override fun onError(t: Throwable) { val listError: ArrayList = ArrayList() diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoViewModel.kt index 22475d0e..32b219c6 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoViewModel.kt @@ -136,10 +136,6 @@ class ControlVehiculoViewModel(val context: Context) : BaseViewModel(context) { fun deviceProduction_getnameDevice(android_id: String) { - /* silex.deviceProduction_getnameDevice( - android_id - )*/ - salix.deviceProductionsGetName( Gson().toJson( Filter( diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/model/ClientTicket.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/model/ClientTicket.kt index 4b880dd2..5229fe94 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/model/ClientTicket.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/model/ClientTicket.kt @@ -35,7 +35,8 @@ data class ClientTicket( @TypeConverters(MapTypeConverter::class) var tickets: MutableList, //Tarea 5996, falta mostrar o no si no es null var cmrFk: Int? = null, - var route:Long? = null + var route:Long? = null, + var email:String? = null ) : Serializable data class MyLocation( diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryViewModel.kt index 0c19936d..b6bbb0ac 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryViewModel.kt @@ -5,6 +5,7 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.Transformations import com.google.gson.JsonObject +import es.verdnatura.MobileApplication import es.verdnatura.R import es.verdnatura.domain.SalixCallback import es.verdnatura.domain.SilexCallback @@ -20,8 +21,10 @@ import es.verdnatura.presentation.view.feature.inventario.model.InventoryParking import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO import es.verdnatura.presentation.view.feature.inventario.model.ItemInventoryParking import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake +import es.verdnatura.presentation.view.feature.workermistake.model.ExpeditionMistakeSalix import es.verdnatura.presentation.view.feature.workermistake.model.MistakeType import es.verdnatura.presentation.view.feature.workermistake.model.WorkerFromMistake +import es.verdnatura.presentation.view.feature.workermistake.model.WorkerMistakeSalix import es.verdnatura.presentation.view.feature.workermistake.model.departmentMistakeList import es.verdnatura.presentation.view.feature.workermistake.model.workerFromMistakeList import es.verdnatura.presentation.view.feature.workermistake.model.workerMistakeTypeList @@ -77,8 +80,6 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) { //sergio para obtener comprador fun itemShelvingBuyerGet() { - //Tarea 6141 - // salix.getCollectionSalix() salix.getBuyers().enqueue(object : SilexCallback>(context) { override fun onError(t: Throwable) { @@ -308,8 +309,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) { fun workerMistakeType_get() { //Tarea 5134 - //salix.getWorkerMistakeTypes() - silex.workerMistakeType_get() + salix.workerMistakesTypes() .enqueue(object : SilexCallback>(context) { override fun onError(t: Throwable) { val listError: ArrayList = ArrayList() @@ -356,8 +356,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) { vTypeFk: String ) { //Tarea 5134 - //salix.workerMistakesAdd(WorkerMistakeSalix(vUserFk,vTypeFk)) - silex.workerMistake_Add(vUserFk, vTypeFk) + salix.workerMistakesAdd(WorkerMistakeSalix(vUserFk,vTypeFk)) .enqueue(object : SilexCallback(context) { override fun onError(t: Throwable) { @@ -382,13 +381,12 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) { fun expeditionMistake_add( vExpeditionFk: Int, vTypeFk: String, - // userId:Int= (context as MobileApplication).userId!! ) { //Tarea 5134 - //salix.expeditionMistakesAdd(ExpeditionMistakeSalix(expeditionFk = vExpeditionFk, typeFk = vTypeFk, workerFk = (context as MobileApplication).userId!!) - silex.expeditionMistake_add(vExpeditionFk, vTypeFk) + salix.expeditionMistakesAdd( + ExpeditionMistakeSalix(expeditionFk = vExpeditionFk, typeFk = vTypeFk, workerFk = (context as MobileApplication).userId!!)) .enqueue(object : - SilexCallback(context) { + SalixCallback(context) { override fun onError(t: Throwable) { _responseAddMistake.value = ResponseItemVO( isError = true, @@ -616,9 +614,8 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) { fun expeditionMistakeType_get() { // Tarea 5134 pasar a salix - //salix.getExpeditionMistakeTypes() - silex.expeditionMistakeType_get() - .enqueue(object : SilexCallback>(context) { + salix.getExpeditionMistakeTypes() + .enqueue(object : SalixCallback>(context) { override fun onError(t: Throwable) { val listError: ArrayList = ArrayList() listError.add( diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt index 6909029a..2593dbf4 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt @@ -328,15 +328,12 @@ class LoginFragment(var imageUri: Uri?) : } else { //sergio: se añade el log - viewModel.getCurrentUserData() + viewModel.getCurrentUserData( getString(R.string.logAppName), + getInfoVersionNameApp(), + getData(ANDROID_ID)) viewModel.worker_getSector() viewModel.worker_getPrinter() //viewModel.operator_getDataSalix("{\"where\": {\"workerFk\":${getDataInt(USERFK)}}}") - deviceLog_add( - getString(R.string.logAppName), - getInfoVersionNameApp(), - getData(ANDROID_ID) - ) if (binding.switchRemember.isChecked) { saveRemember(true) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt index 4a150c9b..84654653 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt @@ -180,33 +180,31 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) { }) } - fun getCurrentUserData() { + fun getCurrentUserData(appName: String, versionApp: String, android_id: String, serialnumber: String? =null) { salix.getCurrentUserData().enqueue(object : SilexCallback(context) { override fun onSuccess(response: Response) { app.userName = response.body()?.let { it.nickname } app.userId = response.body()?.let { it.id } + deviceLog_addSalix(app = appName, versionApp= versionApp,android_id= android_id, userFk = app.userId!!, serialnumber = serialnumber) } - }) } - fun deviceLog_add( - app: String, versionApp: String, android_id: String +/* fun deviceLog_add( + app: String, versionApp: String, android_id: String, userFk :Int ) { //Tarea 4815 - // salix.deviceLogInsert(DeviceLogSalix(androidId = android_id,userFk,nameApp= app,versionApp= versionApp)) - silex.deviceLog_add(app, versionApp, android_id) - .enqueue(object : SilexCallback(context) { + salix.deviceLogInsert(DeviceLogSalix(android_id = android_id,nameApp= app,versionApp= versionApp, serialNumber = null, userFk = userFk)) + .enqueue(object : SilexCallback(context) { override fun onSuccess(response: Response) { } - }) - } + }*/ fun deviceLog_addSalix( - app: String, versionApp: String, android_id: String, userFk: Int, serialnumber: String + app: String, versionApp: String, android_id: String, userFk: Int, serialnumber: String? ) { //Tarea 4815 diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailViewModel.kt index cb4faeeb..1cdc9975 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailViewModel.kt @@ -4,6 +4,7 @@ import android.content.Context import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.Transformations +import es.verdnatura.domain.SalixCallback import es.verdnatura.domain.SilexCallback import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.getMessageFromAllResponse @@ -12,8 +13,6 @@ import es.verdnatura.presentation.common.Event import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletViewListVO import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletViewVO -import retrofit2.Call -import retrofit2.Callback import retrofit2.Response class ExpeditionPalletDetailViewModel(var context: Context) : BaseViewModel(context) { @@ -70,8 +69,8 @@ class ExpeditionPalletDetailViewModel(var context: Context) : BaseViewModel(cont fun expeditionPalletDel(vPalletFk: Int) { //Tarea 5134 - //salix.expeditionPalletDel(vPalletFk).enqueue(object : SalixCallback(context) { - silex.expeditionPalletDel(vPalletFk).enqueue(object : SilexCallback(context) { + salix.expeditionPalletDel(vPalletFk).enqueue(object : SalixCallback(context) { + //silex.expeditionPalletDel(vPalletFk).enqueue(object : SilexCallback(context) { override fun onError(t: Throwable) { _response.value = ResponseItemVO( isError = true, @@ -81,7 +80,7 @@ class ExpeditionPalletDetailViewModel(var context: Context) : BaseViewModel(cont override fun onSuccess(response: Response) { _response.value = ResponseItemVO( - isError = true, + isError = false, errorMessage = getMessageFromAllResponse( nameofFunction(this), response.message() diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanViewModel.kt index 2217fad6..2ab4f909 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanViewModel.kt @@ -14,8 +14,6 @@ import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionS import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionScanVO import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanList import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanVO -import retrofit2.Call -import retrofit2.Callback import retrofit2.Response class ExpeditionScanViewModel(val context: Context) : BaseViewModel(context) { @@ -179,8 +177,8 @@ class ExpeditionScanViewModel(val context: Context) : BaseViewModel(context) { fun expeditionScanDel( vScanFk: Int) { - //Tarea 5134 - //salix.expeditionScanDel(vScanFk).enqueue(object : SalixCallback (context){ + //Tarea 5134 // no se cambia hasta que se suba test→master 11-17-23 + //salix.expeditionScanDel(vScanFk).enqueue(object : SalixCallback(context){ silex.expeditionScanDel(vScanFk) .enqueue(object : SilexCallback (context){ override fun onError(t: Throwable) { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/model/TicketItemVO.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/model/TicketItemVO.kt index 40a5c304..404a0f77 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/model/TicketItemVO.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/model/TicketItemVO.kt @@ -5,7 +5,7 @@ package es.verdnatura.presentation.view.feature.sacador.model class CollectionTicket( var collectionFk: Int, - var created: String = "", + var created: String? = null, var ticketTotalCount: Int = 0, var tickets: MutableList = mutableListOf(), var isError: Boolean = false, diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt index b6261886..4a410f6f 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt @@ -359,9 +359,8 @@ class UbicadorFragment( binding.editImg.setOnClickListener { customDialogInput.setTitle(getString(R.string.changeShelving)).setValue("") .setOkButton(getString(R.string.save)) { - viewModel.shelvingChange( - shelvingFk, - customDialogInput.getValue() + viewModel.shelvingChangeSalix( + shelvingFk,customDialogInput.getValue() ) shelvingFk = customDialogInput.getValue() binding.mainToolbar.toolbarTitle.text = @@ -379,7 +378,7 @@ class UbicadorFragment( customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event -> if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { - viewModel.shelvingChange( + viewModel.shelvingChangeSalix( shelvingFk, customDialogInput.getValue() ) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt index becbbb9c..59375428 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt @@ -12,6 +12,7 @@ import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.common.Event +import es.verdnatura.presentation.common.ItemShelvingSalix import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.view.feature.reubication.model.Reubication import es.verdnatura.presentation.view.feature.reubication.model.ReubicationList @@ -191,16 +192,11 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) { grouping: Int? ) { - /* salix.itemShelvingUpdate( - params = , - id = , - ).enqueue(object : SalixCallback(context) {*/ - silex.itemShelvingMakeEdit( - quantity, - packing, - itemShelvingFk, - grouping - ).enqueue(object : SilexCallback(context) { + salix.itemShelvingUpdate( + params = ItemShelvingSalix(visible = quantity, packing = packing, grouping = grouping), + id = itemShelvingFk, + ).enqueue(object : SalixCallback(context) { + override fun onError(t: Throwable) { _responseMake.value = ResponseItemVO( isError = true, @@ -380,7 +376,6 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) { ) { - // silex.clearShelvingList(shelvingFk) salix.itemShelvingsUpdate( id = JsonObject().apply { addProperty("shelvingFk", shelvingFk) }, hashMapOf("visible" to 0) @@ -400,6 +395,31 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) { }) } + fun shelvingChangeSalix( + shelvingFkIn: String, + shelvingFkOut:String + + ) { + + salix.itemShelvingsUpdate( + id = JsonObject().apply { addProperty("shelvingFk", shelvingFkIn) }, + hashMapOf("shelvingFk" to shelvingFkOut) + ) + .enqueue(object : SalixCallback(context) { + override fun onError(t: Throwable) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) + } + + override fun onSuccess(response: Response) { + _response.value = + ResponseItemVO(isError = false, response = response.message()) + } + }) + } + fun itemShelvingTransfer( itemFk: Int, shelvingFk: String @@ -424,8 +444,6 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) { fun itemShelvingDelete(itemFk: Int) { salix.itemShelvingsDelete(itemFk) .enqueue(object : SalixCallback(context) { - /*silex.itemShelvingDelete(itemFk) - .enqueue(object : SilexCallback(context) {*/ override fun onError(t: Throwable) { _response.value = ResponseItemVO( diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/workermistake/adapter/WorkermistakeAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/workermistake/adapter/WorkermistakeAdapter.kt index 188cd877..8689899e 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/workermistake/adapter/WorkermistakeAdapter.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/workermistake/adapter/WorkermistakeAdapter.kt @@ -3,69 +3,47 @@ package es.verdnatura.presentation.view.feature.workermistake.adapter import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import androidx.core.content.ContentProviderCompat.requireContext import androidx.recyclerview.widget.RecyclerView -import es.verdnatura.databinding.ItemInventaryRowBinding import es.verdnatura.databinding.ItemWorkermistakeRowBinding -import es.verdnatura.domain.toast -import es.verdnatura.presentation.common.OnInvetoryNichoClickListener -import es.verdnatura.presentation.common.OnPasillerosItemClickListener import es.verdnatura.presentation.common.onMistakeWorkerClickListener -import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO -import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO import es.verdnatura.presentation.view.feature.workermistake.model.WorkerFromMistake -import timber.log.Timber.d -class WorkermistakeAdapter ( +class WorkermistakeAdapter( private val items: List, private val onMistakeWorkerClickListener: onMistakeWorkerClickListener - //private val onPasillerosItemClickListener: OnPasillerosItemClickListener*/ - ): RecyclerView.Adapter () { + //private val onPasillerosItemClickListener: OnPasillerosItemClickListener*/ +) : RecyclerView.Adapter() { - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder { - return ItemHolder( - ItemWorkermistakeRowBinding.inflate(LayoutInflater.from(parent.context),parent,false) - ) - } + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder { + return ItemHolder( + ItemWorkermistakeRowBinding.inflate(LayoutInflater.from(parent.context), parent, false) + ) + } - override fun getItemCount() =items.size + override fun getItemCount() = items.size - override fun onBindViewHolder(holder: ItemHolder, position: Int) { - holder.bind(items[position]) - } + override fun onBindViewHolder(holder: ItemHolder, position: Int) { + holder.bind(items[position]) + } - inner class ItemHolder( - val binding: ItemWorkermistakeRowBinding - ) : RecyclerView.ViewHolder(binding.root){ - private val res = binding.root.context.resources - fun bind(item: WorkerFromMistake) { - binding.apply { - this.item = item + inner class ItemHolder( + val binding: ItemWorkermistakeRowBinding + ) : RecyclerView.ViewHolder(binding.root) { + private val res = binding.root.context.resources + fun bind(item: WorkerFromMistake) { + binding.apply { + this.item = item - itemFirstname.visibility = View.VISIBLE - itemLastname.visibility = View.VISIBLE - } - /* itemNicho.setOnClickListener { - onInvetoryNichoClickListener.onInvetoryNichoClickListener(item) - } - itemFk.setOnClickListener { - onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = "Consultar artículo"),item.itemFk) - } - itemUp.setOnClickListener { - onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = "Buscar item"),item.itemFk) - } - itemDown.setOnClickListener { - onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = "Buscar item"),item.itemFk) - }*/ - - binding.imageErrorMessage.setOnClickListener { - d("test_imageError") - onMistakeWorkerClickListener.onMistakeWorkerClickListener(item) - //false - } - } + itemFirstname.visibility = View.VISIBLE + itemLastname.visibility = View.VISIBLE } + binding.imageErrorMessage.setOnClickListener { + onMistakeWorkerClickListener.onMistakeWorkerClickListener(item) + } + } + } + } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/workermistake/fragment/WorkermistakeFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/workermistake/fragment/WorkermistakeFragment.kt index 102c7616..c54cadf4 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/workermistake/fragment/WorkermistakeFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/workermistake/fragment/WorkermistakeFragment.kt @@ -38,8 +38,6 @@ class WorkermistakeFragment( private lateinit var customDialog: CustomDialog private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null private var layoutManager: LinearLayoutManager? = null - - // private var firstVisiblePosition = 0 private lateinit var customDialogList: CustomDialogList private var listMistakes: ArrayList = ArrayList() private var listMistakesAdapter: BarcodeAdapter? = null diff --git a/app/src/main/res/layout/item_workermistake_row.xml b/app/src/main/res/layout/item_workermistake_row.xml index 29465aa4..787ad6b8 100644 --- a/app/src/main/res/layout/item_workermistake_row.xml +++ b/app/src/main/res/layout/item_workermistake_row.xml @@ -46,18 +46,19 @@ Permite escanear expediciones del consignatario seleccionado La etiqueta escaenada no es válida Matrícula ya revisada + Accede al menú de presacador y precontrol + Previa diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 7f945485..cb7753b0 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -667,5 +667,7 @@ Permet de scanner les expéditions du consignataire sélectionné La etiqueta escaenada no es válida Matrícula ya revisada + Accede al menú de presacador y precontrol + Previa diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 39991ce7..12fd7965 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -667,5 +667,7 @@ Permite escanear expedições do consignatário selecionado La etiqueta escaenada no es válida Matrícula ya revisada + Accede al menú de presacador y precontrol + Previa diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d5bde082..892c26f9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -666,5 +666,7 @@ Allows scanning shipments of the selected consignee La etiqueta escaenada no es válida Matrícula ya revisada + Accede al menú de presacador y precontrol + Previa