diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 00000000..76fa549c --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index c79f8105..39a6c5ed 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -181,9 +181,9 @@ - + - + diff --git a/app/build.gradle b/app/build.gradle index b8d262fb..967cc682 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,13 +14,10 @@ android { applicationId "es.verdnatura" minSdkVersion 21 targetSdkVersion 30 - versionCode 116 - versionName "8.3" //versionCode 116: versionCode 116: cambios finales en return, diseño grafico... - //versionName "8.2" //versionCode 115: icons - //versionName "8.2" //versionCode 114 : TEST DISSENY GRAFIC SOLUCIONAT COLORS - //versionName "8.2" //versionCode 113 : TEST DISSENY GAFIC - //versionName "8.2" //versionCode 112 : desmarcar, previa update quantity dels carros, afegir P, etc.., impressores - //versionName "8.1" //versionCode 111 de proves . Instal.lat a Ismael y Juan + versionCode 117 + versionName "8.4Beta" //versionCode 117: return i workerAppTester + //versionName "8.3" //versionCode 116: versionCode 116: cambios finales en return, diseño grafico... + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json index 6c8aaf10..db082180 100644 --- a/app/release/output-metadata.json +++ b/app/release/output-metadata.json @@ -11,8 +11,8 @@ "type": "SINGLE", "filters": [], "attributes": [], - "versionCode": 116, - "versionName": "8.3", + "versionCode": 117, + "versionName": "8.4Beta", "outputFile": "app-release.apk" } ], diff --git a/app/release/vn-picking.apk b/app/release/vn-pickingBeta.apk similarity index 55% rename from app/release/vn-picking.apk rename to app/release/vn-pickingBeta.apk index fffefead..7580bb6c 100644 Binary files a/app/release/vn-picking.apk and b/app/release/vn-pickingBeta.apk differ diff --git a/app/src/main/java/es/verdnatura/domain/ApiSalixUtils.kt b/app/src/main/java/es/verdnatura/domain/ApiSalixUtils.kt index 41601483..5d409d21 100644 --- a/app/src/main/java/es/verdnatura/domain/ApiSalixUtils.kt +++ b/app/src/main/java/es/verdnatura/domain/ApiSalixUtils.kt @@ -6,7 +6,7 @@ import retrofit2.converter.gson.GsonConverterFactory class ApiSalixUtils { companion object { //const val BASE_URL:String = "http://192.168.1.155:9009/" - // const val BASE_URL: String = "https://test-salix.verdnatura.es/api/" + // const val BASE_URL: String = "https://test-salix.verdnatura.es/api/" const val BASE_URL: String = "https://salix.verdnatura.es/api/" fun getApiService(): SalixService { val salixRetrofit = Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory( diff --git a/app/src/main/java/es/verdnatura/domain/GetInventaryUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetInventaryUserCase.kt index fd43a140..5c105507 100644 --- a/app/src/main/java/es/verdnatura/domain/GetInventaryUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetInventaryUserCase.kt @@ -66,7 +66,7 @@ class GetInventaryUserCase(context: Context) : RestClient(context) { password: String, itemFk: String, warehouseFk: String - ): Call { + ): Call { val params: ArrayList = ArrayList() params.add(itemFk) params.add(warehouseFk) diff --git a/app/src/main/java/es/verdnatura/domain/GetItemCardUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetItemCardUserCase.kt index 9363b9b5..ad20ff04 100644 --- a/app/src/main/java/es/verdnatura/domain/GetItemCardUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetItemCardUserCase.kt @@ -81,14 +81,15 @@ class GetItemCardUserCase(context: Context) : RestClient(context) { warehouseFk: String, newVisible: String, isTrash: String - ): Call { + ): Call { val params: ArrayList = ArrayList() params.add(itemFk) params.add(warehouseFk) params.add(newVisible) params.add(isTrash) - //sergio: se modifica por CAU a itemTrash// Faltas también accede a itemStockUpdate ( falta comprobar porque no aparece nada más) + //sergio: se modifica por CAU a itemTrash// Faltas también accede a itemStockUpdate) + //return restClient!!.itemStockUpdate("json","1",usuario,password,"application/json",params = params) return restClient!!.itemTrash( "json", @@ -107,7 +108,7 @@ class GetItemCardUserCase(context: Context) : RestClient(context) { warehouseFk: String, newVisible: String, isTrash: String - ): Call { + ): Call { val params: ArrayList = ArrayList() params.add(itemFk) params.add(warehouseFk) @@ -123,7 +124,7 @@ class GetItemCardUserCase(context: Context) : RestClient(context) { ) } - fun itemPlacementSave( + /* fun itemPlacementSave( usuario: String, password: String, itemFk: String, @@ -142,7 +143,7 @@ class GetItemCardUserCase(context: Context) : RestClient(context) { "application/json", params = params ) - } + }*/ fun updateGrouping( usuario: String, @@ -185,7 +186,7 @@ class GetItemCardUserCase(context: Context) : RestClient(context) { params = params ) } - +/* fun updatePackingType( usuario: String, password: String, @@ -203,7 +204,7 @@ class GetItemCardUserCase(context: Context) : RestClient(context) { "application/json", params = params ) - } + }*/ fun updatePackingTypeSalix( token:String, @@ -224,7 +225,7 @@ class GetItemCardUserCase(context: Context) : RestClient(context) { password: String, itemFk: String, value: String - ): Call { + ): Call { val params: ArrayList = ArrayList() params.add(itemFk) params.add(value) @@ -264,7 +265,7 @@ class GetItemCardUserCase(context: Context) : RestClient(context) { itemFk: String, value: String, delete: String - ): Call { + ): Call { val params: ArrayList = ArrayList() params.add(value) params.add(itemFk) diff --git a/app/src/main/java/es/verdnatura/domain/GetPaletizadoresUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetPaletizadoresUserCase.kt index 34c9c7a1..087a0ecf 100644 --- a/app/src/main/java/es/verdnatura/domain/GetPaletizadoresUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetPaletizadoresUserCase.kt @@ -87,7 +87,7 @@ class GetPaletizadoresUserCase(context: Context) : RestClient(context) { password: String, vHour: String, vDescription: String - ): Call { + ): Call { val params: ArrayList = ArrayList() params.add(vHour) params.add(vDescription) @@ -143,7 +143,7 @@ class GetPaletizadoresUserCase(context: Context) : RestClient(context) { password: String, vPalletFk: String, vExpeditionFk: String - ): Call { + ): Call { val params: ArrayList = ArrayList() params.add(vPalletFk) params.add(vExpeditionFk) @@ -193,7 +193,7 @@ class GetPaletizadoresUserCase(context: Context) : RestClient(context) { ) } - fun expeditionPalletDel(usuario: String, password: String, vPalletFk: String): Call { + fun expeditionPalletDel(usuario: String, password: String, vPalletFk: String): Call { val params: ArrayList = ArrayList() params.add(vPalletFk) return restClient!!.expeditionPalletDel( @@ -223,7 +223,7 @@ class GetPaletizadoresUserCase(context: Context) : RestClient(context) { ) } - fun expeditionScanDel(usuario: String, password: String, vScanFk: String): Call { + fun expeditionScanDel(usuario: String, password: String, vScanFk: String): Call { val params: ArrayList = ArrayList() params.add(vScanFk) return restClient!!.expeditionScanDel( @@ -241,7 +241,7 @@ class GetPaletizadoresUserCase(context: Context) : RestClient(context) { password: String, vPalletFk: String, vSectorFk: String - ): Call { + ): Call { val params: ArrayList = ArrayList() params.add(vPalletFk) params.add(vSectorFk) diff --git a/app/src/main/java/es/verdnatura/domain/GetPreSacadorUseCase.kt b/app/src/main/java/es/verdnatura/domain/GetPreSacadorUseCase.kt index 1603c7d1..e1e0636a 100644 --- a/app/src/main/java/es/verdnatura/domain/GetPreSacadorUseCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetPreSacadorUseCase.kt @@ -48,7 +48,7 @@ class GetPreSacadorUseCase(context: Context) : RestClient(context) { password: String, id: String, quantity: String - ): Call { + ): Call { val params: ArrayList = ArrayList() params.add(id) params.add(quantity) diff --git a/app/src/main/java/es/verdnatura/domain/GetQualityUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetQualityUserCase.kt index 135c33ab..53536626 100644 --- a/app/src/main/java/es/verdnatura/domain/GetQualityUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetQualityUserCase.kt @@ -33,7 +33,7 @@ class GetQualityUserCase(context: Context) : RestClient(context) { password: String, vId: String, vStars: String - ): Call { + ): Call { val params: ArrayList = ArrayList() params.add(vId) params.add(vStars) diff --git a/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt index 0417e0f6..f0861187 100644 --- a/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt @@ -203,7 +203,7 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) { itemShelvingFk: String, saleFk: String, quantity: String - ): Call { + ): Call { val params: ArrayList = ArrayList() params.add(itemShelvingFk) params.add(saleFk) @@ -224,7 +224,7 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) { itemShelvingFk: String, itemPlacementSupplyFk: String, quantity: String - ): Call { + ): Call { val params: ArrayList = ArrayList() params.add(itemShelvingFk) params.add(itemPlacementSupplyFk) @@ -362,7 +362,7 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) { saleFk: String, quantity: String, originalQuantity: String - ): Call { + ): Call { val params: ArrayList = ArrayList() params.add(saleFk) params.add(quantity) @@ -378,7 +378,7 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) { type: String, warehouseFk: String, originalQuantity: String - ): Call { + ): Call { val params: ArrayList = ArrayList() params.add(saleFk) params.add(quantity) @@ -395,7 +395,7 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) { ) } - fun saleTrackingDel(usuario: String, password: String, saleFk: String): Call { + fun saleTrackingDel(usuario: String, password: String, saleFk: String): Call { val params: ArrayList = ArrayList() params.add(saleFk) return restClient!!.saleTrackingDel( @@ -484,7 +484,7 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) { password: String, saleFk: String, quantity: String - ): Call { + ): Call { val params: ArrayList = ArrayList() params.add(saleFk) params.add(quantity) @@ -522,7 +522,7 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) { vSaleFk: String, vUserFk: String, vTypeFk: String - ): Call { + ): Call { val params: ArrayList = ArrayList() params.add(vSaleFk) params.add(vUserFk) diff --git a/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt index 861c4471..ee255dd8 100644 --- a/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt @@ -32,7 +32,7 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) { packing: String, warehouse: String, grouping:String - ): Call { + ): Call { val params: ArrayList = ArrayList() params.add(shelving) params.add(item) @@ -63,7 +63,7 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) { itemShelvingFk: String, grouping:String - ): Call { + ): Call { val params: ArrayList = ArrayList() params.add(shelving) params.add(item) @@ -90,7 +90,7 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) { shelving: String, items: List, warehouse: String - ): Call { + ): Call { val params: ArrayList = ArrayList() params.add(shelving) params.add(items) @@ -110,7 +110,7 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) { password: String, priority: String, shelving: String - ): Call { + ): Call { val params: ArrayList = ArrayList() params.add(priority) params.add(shelving) @@ -136,7 +136,7 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) { return restClient!!.shelvingPark("json", "1", usuario, password, "application/json", params) } - fun saleParking_add( + /* fun saleParking_add( usuario: String, password: String, sales:List, @@ -146,14 +146,14 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) { params.add(sales) params.add(parking) return restClient!!.saleParking_add("json", "1", usuario, password, "application/json", params) - } + }*/ fun shelvingChange( usuario: String, password: String, origen: String, destino: String - ): Call { + ): Call { val params: ArrayList = ArrayList() params.add(origen) params.add(destino) @@ -167,7 +167,7 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) { ) } - fun clearShelvingList(usuario: String, password: String, shelvingFk: String): Call { + fun clearShelvingList(usuario: String, password: String, shelvingFk: String): Call { val params: ArrayList = ArrayList() params.add(shelvingFk) return restClient!!.clearShelvingList( @@ -185,7 +185,7 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) { password: String, itemFk: String, shelvingFk: String - ): Call { + ): Call { val params: ArrayList = ArrayList() params.add(itemFk) params.add(shelvingFk) @@ -199,7 +199,7 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) { ) } - fun itemShelvingDelete(usuario: String, password: String, itemFk: String): Call { + fun itemShelvingDelete(usuario: String, password: String, itemFk: String): Call { val params: ArrayList = ArrayList() params.add(itemFk) return restClient!!.itemShelvingDelete( diff --git a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt index b3feb20d..7d24fa18 100644 --- a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt +++ b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt @@ -1,5 +1,6 @@ package es.verdnatura.domain +//import es.verdnatura.presentation.view.feature.buscaritemall.model.ItemLocationAll import com.google.gson.JsonObject import es.verdnatura.presentation.view.feature.ajustes.model.Printers import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO @@ -7,11 +8,9 @@ import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType import es.verdnatura.presentation.view.feature.articulo.model.ItemProposal import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO -//import es.verdnatura.presentation.view.feature.buscaritemall.model.ItemLocationAll 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.SalesModified -import es.verdnatura.presentation.view.feature.collection.SalesModifiedList import es.verdnatura.presentation.view.feature.diadeventa.model.ItemShelvingSaleDate import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO @@ -145,7 +144,7 @@ interface VerdnaturaService { @Header("user") user: String, @Header("pass") pass: String, @Header("Content-Type") content_type: String, - @Body params:List + @Body params: List ): Call @@ -156,7 +155,7 @@ interface VerdnaturaService { @Header("user") user: String, @Header("pass") pass: String, @Header("Content-Type") content_type: String, - @Body params:List + @Body params: List ): Call @@ -214,7 +213,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call //SACADORES / CONTROLADORES ========================================================================> @POST("almacennew/collectionGet") //NO SALIX @@ -293,16 +292,16 @@ interface VerdnaturaService { ): Call - /* @POST("almacennew/collectionTicketGet")//REVISADA-ANULADA POT collection_getTickets - fun collectionTicketGet( - @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 - ): - Call*/ + /* @POST("almacennew/collectionTicketGet")//REVISADA-ANULADA POT collection_getTickets + fun collectionTicketGet( + @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 + ): + Call*/ @POST("almacennew/ticket_checkFullyControlled")//NO SALIX fun ticket_checkFullyControlled( @@ -360,16 +359,16 @@ interface VerdnaturaService { ): Call - /* @POST("almacennew/saleTracking_update")//REVISADA - fun saleTracking_update( - @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 - ): - Call*/ + /* @POST("almacennew/saleTracking_update")//REVISADA + fun saleTracking_update( + @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 + ): + Call*/ @POST("almacennew/itemPlacementSupplyAiming")//REVISADA fun itemPlacementSupplyAiming( @@ -391,7 +390,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call @POST("almacennew/itemShelvingPlacementSupplyAdd")//REVISADA fun itemShelvingPlacementSupplyAdd( @@ -402,7 +401,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call @POST("almacennew/collectionStickerPrint")//REVISADA fun collectionStickerPrint( @@ -449,17 +448,17 @@ interface VerdnaturaService { ): Call - /*sergio:modificada en el caso de que quiera utilizarse por item_Card - @POST("almacennew/itemGetAvailable")//REVISADA - fun itemGetAvailable( - @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 - ): - Call*/ + /*sergio:modificada en el caso de que quiera utilizarse por item_Card + @POST("almacennew/itemGetAvailable")//REVISADA + fun itemGetAvailable( + @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 + ): + Call*/ @POST("almacennew/collectionAddItem")//REVISADA fun collectionAddItem( @@ -481,7 +480,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call @POST("almacennew/collectionMissingTrash")//REVISADA fun collectionMissingTrash( @@ -492,7 +491,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call @POST("almacennew/saleTrackingDel")//REVISADA fun saleTrackingDel( @@ -503,7 +502,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call @POST("almacennew/itemShelving_updateFromSale")//REVISADA fun itemShelving_updateFromSale( @@ -559,7 +558,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call @POST("almacennew/saleMistakeAdd")//REVISADA fun saleMistakeAdd( @@ -570,7 +569,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call @POST("almacennew/workerMistake_Add")//REVISADA fun workerMistake_Add( @@ -612,7 +611,7 @@ interface VerdnaturaService { @Header("pass") pass: String, @Header("Content-Type") content_type: String, - ): + ): Call> @POST("almacennew/worker_getFromHasMistake")//REVISADA @@ -673,18 +672,18 @@ interface VerdnaturaService { ): Call> - /* @POST("almacennew/itemStockUpdate")//REVISADA - fun itemStockUpdate( - @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 - ): - Call*/ + /* @POST("almacennew/itemStockUpdate")//REVISADA + fun itemStockUpdate( + @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 + ): + Call*/ - @POST("almacennew/itemTrash")//REVISADA + @POST("almacennew/itemTrash")//REVISADA fun itemTrash( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -693,9 +692,9 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call - @POST("almacennew/item_placement_save")//REVISADA + /* @POST("almacennew/item_placement_save")//REVISADA fun itemPlacementSave( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -704,7 +703,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call*/ @POST("almacennew/buy_updateGrouping")//REVISADA fun updateGrouping( @@ -728,7 +727,7 @@ interface VerdnaturaService { ): Call - @POST("almacennew/update_ItemPackingType")//REVISADA + /* @POST("almacennew/update_ItemPackingType")//REVISADA fun updatePackingType( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -737,7 +736,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call*/ @POST("almacennew/itemSaveMin")//REVISADA fun itemSaveMin( @@ -748,7 +747,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call @POST("almacennew/item_saveReference")//REVISADA fun item_saveReference( @@ -758,7 +757,7 @@ interface VerdnaturaService { @Header("pass") pass: String, @Header("Content-Type") content_type: String, @Body params: List - ): + ): Call @POST("almacennew/barcodes_edit")//REVISADA @@ -770,7 +769,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call //BUSCAR ITEM ========================================================================> @POST("almacennew/getItemUbication")//REVISADA @@ -799,17 +798,17 @@ interface VerdnaturaService { //INVENTARIO ========================================================================> - /* @POST("almacennew/itemShelvingRadar")//REVISADA - fun itemShelvingRadar( - @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 - ): - Call> -*/ + /* @POST("almacennew/itemShelvingRadar")//REVISADA + fun itemShelvingRadar( + @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 + ): + Call> + */ @POST("almacennew/itemShelving_filterBuyer")//REVISADA fun itemShelvingRadarFilterBuyer( @Header("aplicacion") aplicacion: String, @@ -841,7 +840,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call //SHELVING PARKING ========================================================================> @POST("almacennew/shelvingParking_get")//REVISADA @@ -879,7 +878,6 @@ interface VerdnaturaService { Call - @POST("almacennew/workerMachinery_isRegistered")//REVISADA fun workerMachinery_isRegistered( @Header("aplicacion") aplicacion: String, @@ -957,7 +955,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call @POST("almacennew/itemShelvingMake")//REVISADA fun itemShelvingMake( @@ -968,7 +966,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call @POST("almacennew/itemShelvingMakeEdit")//REVISADA fun itemShelvingMakeEdit( @@ -979,7 +977,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call @POST("almacennew/itemShelvingMake_multi")//REVISADA fun itemShelvingMake_multi( @@ -990,9 +988,9 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call - @POST("almacennew/saleParking_add")//REVISADA + /* @POST("almacennew/saleParking_add")//REVISADA fun saleParking_add( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -1001,7 +999,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call*/ @POST("almacennew/shelvingPark")//REVISADA @@ -1024,7 +1022,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call @POST("almacennew/clearShelvingList")//REVISADA fun clearShelvingList( @@ -1035,7 +1033,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call @POST("almacennew/itemShelvingTransfer")//REVISADA fun itemShelvingTransfer( @@ -1046,7 +1044,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call @POST("almacennew/itemShelvingDelete")//REVISADA fun itemShelvingDelete( @@ -1057,7 +1055,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call //BUFFER ==============================================================================> @@ -1130,7 +1128,7 @@ interface VerdnaturaService { @Header("pass") pass: String, @Header("Content-Type") content_type: String, @Body params: List - ): + ): Call @POST("almacennew/itemShelving_getSaleDate")//REVISADA @@ -1141,7 +1139,7 @@ interface VerdnaturaService { @Header("pass") pass: String, @Header("Content-Type") content_type: String, @Body params: List - ): + ): Call> @POST("almacennew/itemShelvingLog_get")//REVISADA @@ -1152,7 +1150,7 @@ interface VerdnaturaService { @Header("pass") pass: String, @Header("Content-Type") content_type: String, @Body params: List - ): + ): Call> @POST("almacennew/shelvingLog_get")//REVISADA @@ -1163,7 +1161,7 @@ interface VerdnaturaService { @Header("pass") pass: String, @Header("Content-Type") content_type: String, @Body params: List - ): + ): Call> @POST("almacennew/itemShelving_updateSpam")//REVISADA @@ -1174,7 +1172,7 @@ interface VerdnaturaService { @Header("pass") pass: String, @Header("Content-Type") content_type: String, @Body params: List - ): + ): Call @@ -1197,7 +1195,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call @POST("almacennew/expeditionPalletList")//REVISADA fun expeditionPallet_List( @@ -1230,7 +1228,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call @POST("almacennew/checkRouteExpeditionScanPut")//REVISADA fun checkRouteExpeditionScanPut( @@ -1263,7 +1261,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call @POST("almacennew/expeditionScanList")//REVISADA fun expeditionScanList( @@ -1285,7 +1283,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call @POST("almacennew/expeditionPalletPrintSet")//REVISADA fun expeditionPalletPrintSet( @@ -1296,7 +1294,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call @POST("almacennew/expeditionState_addByPallet")//REVISADA fun expeditionState_addByPallet( @@ -1352,7 +1350,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call //SMARTTAGS ========================================================================> @POST("almacennew/workerShelving_add")//REVISADA diff --git a/app/src/main/java/es/verdnatura/presentation/common/ResponseItemVO.kt b/app/src/main/java/es/verdnatura/presentation/common/ResponseItemVO.kt index 65b8851f..158ee638 100644 --- a/app/src/main/java/es/verdnatura/presentation/common/ResponseItemVO.kt +++ b/app/src/main/java/es/verdnatura/presentation/common/ResponseItemVO.kt @@ -4,14 +4,14 @@ class ResponseItemVO( var response: String = "", var isError: Boolean = false, var errorMessage: String = "" - ) +) class ResponseItemMachineControl( var response: String = "", var isError: Boolean = false, var errorMessage: String = "", var type: String - ) +) class DataMessageSalix( var ticket: String = "", @@ -19,9 +19,9 @@ class DataMessageSalix( var quantity: String = "", var personSale: String = "" - ) +) class GeneralItem( - var code:String? = "", - var text:String? = "" -) \ No newline at end of file + var code: String? = "", + var text: String? = "" +) 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 a2ff9776..b708f726 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 @@ -43,7 +43,8 @@ class AjustesViewModel(context: Context) : BaseViewModel() { private val _printerList by lazy { MutableLiveData() } val printerList: LiveData - get() = _printerList + get + () = _printerList val loadSectorList = Transformations.map(_sectorList) {Event(it)} diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/model/AjustesItemVO.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/model/AjustesItemVO.kt index f1cf4b63..4303cc9f 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/model/AjustesItemVO.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/model/AjustesItemVO.kt @@ -1,7 +1,5 @@ package es.verdnatura.presentation.view.feature.ajustes.model -import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo - class AjustesItemVO ( var id: Int, var title: String = "", diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt index cd87c954..3aa0ea6d 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt @@ -633,8 +633,8 @@ class ItemCardFragment( user = user, password = password, newValue = value, - isTrash = "0", - "itemTrash" + isTrash = "0" + ) //changeOfflineValue(itemB,value, listBarcodes) showProgress() @@ -647,8 +647,8 @@ class ItemCardFragment( user = user, password = password, newValue = value, - isTrash = "1", - "itemTrash" + isTrash = "1" + ) //changeOfflineValue(itemB,value, listBarcodes) showProgress() @@ -667,8 +667,8 @@ class ItemCardFragment( user = user, password = password, newValue = (value.toInt() * -1).toString(), - isTrash = "0", - "itemTrash" + isTrash = "0" + ) } } catch (e: Exception) { @@ -748,11 +748,10 @@ class ItemCardFragment( password = password, value = code, delete = delete, - "itemBarcode_update") + ) } - // viewModel.barcodesEdit(itemFk = itemFk, user = user, password = password, value = code, delete = delete,"itemBarcode_update") - barcodeAdapter!!.notifyDataSetChanged() - //changeOfflineValue(item,"", listBarcodes) + barcodeAdapter!!.notifyDataSetChanged() + showProgress() } @@ -784,8 +783,7 @@ class ItemCardFragment( viewModel.updatePackingTypeSalix( getData(TOKEN), this.itemFk, - itemPackingType, - "item_updatePackingType" + itemPackingType )/*}else{ viewModel.updatePackingType( this.itemFk, diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardViewModel.kt index cc22f319..e6b62983 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardViewModel.kt @@ -13,13 +13,12 @@ import es.verdnatura.presentation.view.feature.articulo.model.* import retrofit2.Call import retrofit2.Callback import retrofit2.Response -import timber.log.Timber class ItemCardViewModel(context: Context) : BaseViewModel() { - private val getItemCardUserCase:GetItemCardUserCase = GetItemCardUserCase(context) - val version : String = "5.0.0" + private val getItemCardUserCase: GetItemCardUserCase = GetItemCardUserCase(context) + val version: String = "5.0.0" - private val _itemcard by lazy { MutableLiveData() } + private val _itemcard by lazy { MutableLiveData() } val itemcard: LiveData get() = _itemcard @@ -37,46 +36,92 @@ class ItemCardViewModel(context: Context) : BaseViewModel() { get() = _itemProposallist + fun getItemCard( + itemFk: String, + warehouseFk: String, + user: String, + password: String, + callFunction: String + ) { + getItemCardUserCase.getItemCard(user, password, itemFk, warehouseFk) + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _itemcard.value = ItemCardVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) - - fun getItemCard(itemFk:String,warehouseFk:String,user:String,password:String,callFunction:String) { - getItemCardUserCase.getItemCard(user,password,itemFk,warehouseFk).enqueue(object :Callback{ - override fun onFailure(call: Call, t: Throwable) { - _itemcard.value = ItemCardVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) - - } - - override fun onResponse(call: Call, response: Response) { - - // Timber.d("el nombre de la funcion es : "+nameofFunction({ } ))-->devuelve onResponse - Timber.d("el nombre de la funcion es : "+nameofFunction(this))//-->devuelve getItemCard - - if (response.body() != null){ - _itemcard.value = response.body()!! - }else{ - _itemcard.value = ItemCardVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) } - } - }) + override fun onResponse(call: Call, response: Response) { + + // Timber.d("el nombre de la funcion es : "+nameofFunction({ } ))-->devuelve onResponse + //Timber.d("el nombre de la funcion es : "+nameofFunction(this))//-->devuelve getItemCard + + if (response.body() != null) { + _itemcard.value = response.body()!! + } else { + _itemcard.value = ItemCardVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } + } + + }) } - 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>{ + 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> { override fun onFailure(call: Call>, t: Throwable) { - val listError:ArrayList = ArrayList() - listError.add(ItemProposal(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))) + val listError: ArrayList = ArrayList() + listError.add( + ItemProposal( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) + ) _itemProposallist.value = ItemProposalList(listError) } - override fun onResponse(call: Call>, response: Response>) { - if (response.body() != null){ - _itemProposallist.value = response.body()?.let { ItemProposalList(it) + override fun onResponse( + call: Call>, + response: Response> + ) { + if (response.body() != null) { + _itemProposallist.value = response.body()?.let { + ItemProposalList(it) } - }else{ - val listError:ArrayList = ArrayList() - listError.add(ItemProposal(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))) + } else { + val listError: ArrayList = ArrayList() + listError.add( + ItemProposal( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + ) _itemProposallist.value = ItemProposalList(listError) } @@ -86,22 +131,38 @@ class ItemCardViewModel(context: Context) : BaseViewModel() { } - fun getItemPackingType(user:String,password:String,callFunction:String) { - getItemCardUserCase.getItemPackingType(user,password).enqueue(object : - Callback>{ + fun getItemPackingType(user: String, password: String, callFunction: String) { + getItemCardUserCase.getItemPackingType(user, password).enqueue(object : + Callback> { override fun onFailure(call: Call>, t: Throwable) { - val listError:ArrayList = ArrayList() - listError.add(ItemPackingType(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))) + val listError: ArrayList = ArrayList() + listError.add( + ItemPackingType( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) + ) _itemspackinglist.value = ItemPackingTypeList(listError) - } + } - override fun onResponse(call: Call>, response: Response>) { - if (response.body() != null){ + override fun onResponse( + call: Call>, + response: Response> + ) { + if (response.body() != null) { _itemspackinglist.value = response.body()?.let { ItemPackingTypeList(it) } - }else{ - val listError:ArrayList = ArrayList() - listError.add(ItemPackingType(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))) + } else { + val listError: ArrayList = ArrayList() + listError.add( + ItemPackingType( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + ) _itemspackinglist.value = ItemPackingTypeList(listError) } } @@ -109,22 +170,38 @@ class ItemCardViewModel(context: Context) : BaseViewModel() { }) } - fun getItemPackingTypeSalix(token:String) { + fun getItemPackingTypeSalix(token: String) { getItemCardUserCase.getItemPackingTypeSalix(token).enqueue(object : - Callback>{ + Callback> { override fun onFailure(call: Call>, t: Throwable) { - val listError:ArrayList = ArrayList() - listError.add(ItemPackingType(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))) + val listError: ArrayList = ArrayList() + listError.add( + ItemPackingType( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) + ) _itemspackinglist.value = ItemPackingTypeList(listError) } - override fun onResponse(call: Call>, response: Response>) { - if (response.body() != null){ + override fun onResponse( + call: Call>, + response: Response> + ) { + if (response.body() != null) { _itemspackinglist.value = response.body()?.let { ItemPackingTypeList(it) } - }else{ - val listError:ArrayList = ArrayList() - listError.add(ItemPackingType(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))) + } else { + val listError: ArrayList = ArrayList() + listError.add( + ItemPackingType( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + ) _itemspackinglist.value = ItemPackingTypeList(listError) } } @@ -132,207 +209,332 @@ class ItemCardViewModel(context: Context) : BaseViewModel() { }) } - 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{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada $callFunction."+t.message!!) - } + /* 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{ + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada $callFunction."+t.message!!) + } - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada $callFunction") - }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) + override fun onResponse(call: Call, response: Response) { + if (response.body() == null){ + _response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada $callFunction") + }else{ + _response.value = ResponseItemVO(isError = false,response = response.message()!!) + } + + } + + }) + }*/ + + fun itemTrash( + itemFk: String, + warehouseFk: String, + user: String, + password: String, + newValue: String, + isTrash: String + ) { + getItemCardUserCase.itemTrash(user, password, itemFk, warehouseFk, newValue, isTrash) + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - } + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _response.value = + ResponseItemVO(isError = false, response = response.message()) + } - }) + } + + }) } - 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{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) - } + /* fun itemPlacementSave(itemFk:String,warehouseFk:String,user:String,password:String,value:String,callFunction:String){ + getItemCardUserCase.itemPlacementSave(user,password,itemFk,warehouseFk,value).enqueue(object : Callback{ + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)) + } - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) + override fun onResponse(call: Call, response: Response) { + if (response.body() == null){ + _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) + }else{ + _response.value = ResponseItemVO(isError = false,response = response.body()!!) + } + + } + + }) + }*/ + + fun updateGrouping( + itemFk: String, + user: String, + password: String, + value: String, + warehouseFk: String, + callFunction: String + ) { + getItemCardUserCase.updateGrouping(user, password, itemFk, value, warehouseFk) + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - } + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful()) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _response.value = + ResponseItemVO(isError = false, response = "Actualizado grouping") + } - }) + } + + }) } - fun itemPlacementSave(itemFk:String,warehouseFk:String,user:String,password:String,value:String,callFunction:String){ - getItemCardUserCase.itemPlacementSave(user,password,itemFk,warehouseFk,value).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)) - } - - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) + fun updatePacking( + itemFk: String, + user: String, + password: String, + value: String, + warehouseFk: String, + callFunction: String + ) { + getItemCardUserCase.updatePacking(user, password, itemFk, value, warehouseFk) + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - } + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _response.value = + ResponseItemVO(isError = false, response = "Actualizado packing") + } - }) - } - - fun updateGrouping(itemFk:String,user:String,password:String,value:String,warehouseFk: String,callFunction:String){ - getItemCardUserCase.updateGrouping(user,password,itemFk,value,warehouseFk).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) - } - - override fun onResponse(call: Call, response: Response) { - if (!response.isSuccessful()){ - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _response.value = ResponseItemVO(isError = false,response = "Actualizado grouping") } - } - - }) - } - - fun updatePacking(itemFk:String,user:String,password:String,value:String,warehouseFk: String,callFunction:String){ - getItemCardUserCase.updatePacking(user,password,itemFk,value,warehouseFk).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) - } - - override fun onResponse(call: Call, response: Response) { - if (!response.isSuccessful){ - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _response.value = ResponseItemVO(isError = false,response = "Actualizado packing") - } - - } - - }) + }) } //sergio ver como solucionar el tema del "Finish" - fun updatePackingType(itemFk:String,user:String,password:String,itemPackingType:String,callFunction:String){ - getItemCardUserCase.updatePackingType(user,password,itemFk,itemPackingType).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) - } + /* fun updatePackingType(itemFk:String,user:String,password:String,itemPackingType:String,callFunction:String){ + getItemCardUserCase.updatePackingType(user,password,itemFk,itemPackingType).enqueue(object : Callback{ + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) + } - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - //if (response.body()=="Finish"){ - // //Log.i("VERDNATURA:","Fisnih encontrado")} - _response.value = ResponseItemVO(isError = false,response = response.body()!!.toString()) + override fun onResponse(call: Call, response: Response) { + if (response.body() == null){ + _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) + }else{ + //if (response.body()=="Finish"){ + // //Log.i("VERDNATURA:","Fisnih encontrado")} + _response.value = ResponseItemVO(isError = false,response = response.body()!!.toString()) + } + + } + + }) + }*/ + fun updatePackingTypeSalix(token: String, itemFk: String, itemPackingType: String) { + getItemCardUserCase.updatePackingTypeSalix(token, itemFk, itemPackingType) + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - } + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _response.value = + ResponseItemVO(isError = false, response = response.body()!!.toString()) + } - }) - } - fun updatePackingTypeSalix(token:String,itemFk:String,itemPackingType:String,callFunction:String){ - getItemCardUserCase.updatePackingTypeSalix(token,itemFk,itemPackingType).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) - } - - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - //if (response.body()=="Finish"){ - // //Log.i("VERDNATURA:","Fisnih encontrado")} - _response.value = ResponseItemVO(isError = false,response = response.body()!!.toString()) } - } - - }) - } - fun itemSaveMin(itemFk:String,user:String,password:String,value:String,callFunction:String){ - getItemCardUserCase.itemSaveMin(user,password,itemFk,value).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) - } - - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) - } - - } - - }) + }) } - fun item_saveReference(itemFk:String,user:String,password:String,value:String,callFunction:String){ - getItemCardUserCase.item_saveReference(user,password,itemFk,value).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) - } - - override fun onResponse(call: Call, response: Response) { - - if (!response.isSuccessful){ - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _response.value = ResponseItemVO(isError = false) + fun itemSaveMin( + itemFk: String, + user: String, + password: String, + value: String, + callFunction: String + ) { + getItemCardUserCase.itemSaveMin(user, password, itemFk, value) + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - } + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _response.value = + ResponseItemVO(isError = false, response = response.message()) + } - }) + } + + }) } - 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{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) - } - - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) + fun item_saveReference( + itemFk: String, + user: String, + password: String, + value: String, + callFunction: String + ) { + getItemCardUserCase.item_saveReference(user, password, itemFk, value) + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - } + override fun onResponse(call: Call, response: Response) { - }) + if (!response.isSuccessful) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _response.value = ResponseItemVO(isError = false) + } + + } + + }) + } + + fun barcodesEdit( + itemFk: String, + user: String, + password: String, + value: String, + delete: String + ) { + getItemCardUserCase.barcodes_edit(user, password, itemFk, value, delete) + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) + } + + override fun onResponse(call: Call, response: Response) { + if (response.isSuccessful) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _response.value = + ResponseItemVO(isError = false, response = response.message()) + } + + } + + }) } - fun barcodesEditSalix(token:String,itemFk:String,barCodeValue:String){ - getItemCardUserCase.barcodes_editSalix(token,itemFk,barCodeValue).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) - } - - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _response.value = ResponseItemVO(isError = false,response = response.message()!!) + fun barcodesEditSalix(token: String, itemFk: String, barCodeValue: String) { + getItemCardUserCase.barcodes_editSalix(token, itemFk, barCodeValue) + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - } + override fun onResponse(call: Call, response: Response) { + if (response.body() == null) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _response.value = + ResponseItemVO(isError = false, response = response.message()!!) + } - }) + } + + }) } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityViewModel.kt index 7cb37ba6..dfe89e08 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityViewModel.kt @@ -54,17 +54,17 @@ class QaualityViewModel(context: Context) : BaseViewModel() { } fun itemShelvingStarsUpdate(usuario:String,password:String, vId: String,vStars: String) { - getQualityUserCase.itemShelvingStarsUpdate(usuario,password,vId,vStars).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelving_StarsUpdate."+t.message!!) + getQualityUserCase.itemShelvingStarsUpdate(usuario,password,vId,vStars).enqueue(object : Callback{ + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) } - override fun onResponse(call: Call, response: Response) { + override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelving_StarsUpdate") + if (!response.isSuccessful()){ + _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) + _response.value = ResponseItemVO(isError = false,response = response.message()) } } }) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/claim/fragment/ClaimFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/claim/fragment/ClaimFragment.kt index 1c854515..1b31e342 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/claim/fragment/ClaimFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/claim/fragment/ClaimFragment.kt @@ -1,7 +1,6 @@ package es.verdnatura.presentation.view.feature.claim.fragment -import android.view.View import android.view.View.GONE import android.view.View.VISIBLE import android.view.inputmethod.EditorInfo @@ -16,7 +15,6 @@ import es.verdnatura.presentation.common.OnGeneralItemRowClickListener import es.verdnatura.presentation.common.hideKeyboard import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialogList -import es.verdnatura.presentation.view.feature.smarttag.model.SmartTag class ClaimFragment( var entryPoint: String = "" @@ -33,7 +31,6 @@ class ClaimFragment( private var claimAdapter: GeneralAdapter? = null - companion object { fun newInstance(entryPoint: String) = ClaimFragment(entryPoint) } @@ -64,32 +61,32 @@ class ClaimFragment( binding.mainToolbar.toolbarTitle.text = entryPoint } -private fun setAdapter(){ - claimAdapter = GeneralAdapter(listClaims, object : OnGeneralItemRowClickListener { - override fun OnGeneralItemRowClickListener(item: GeneralItem) { + private fun setAdapter() { + claimAdapter = GeneralAdapter(listClaims, object : OnGeneralItemRowClickListener { - } - }) - customDialogList.getRecyclerView().adapter = claimAdapter - customDialogList.getRecyclerView().layoutManager = - LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) -} + override fun OnGeneralItemRowClickListener(item: GeneralItem) { + + } + }) + customDialogList.getRecyclerView().adapter = claimAdapter + customDialogList.getRecyclerView().layoutManager = + LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) + } private fun itemShelving_addByClaim(shelvingOrSmarttag: String) { binding.splashProgress.visibility = VISIBLE - viewModel.itemShelving_addByClaim(getData(USER),getData(PASSWORD),listClaims.first().toString(),shelvingOrSmarttag) - customDialogList.dismiss() + viewModel.itemShelving_addByClaim( + getData(USER), + getData(PASSWORD), + listClaims.first().toString(), + shelvingOrSmarttag + ) + customDialogList.dismiss() } - private fun hideKeyboards() { - try { - requireActivity().hideKeyboard() - } catch (e: Exception) { - } - } private fun setEvents() { @@ -117,10 +114,16 @@ private fun setAdapter(){ listClaims.clear() claimAdapter!!.notifyDataSetChanged() showInputClaim() - ma.messageWithSound(it.errorMessage,true,false) + ma.messageWithSound(it.errorMessage, true, false) } else { customDialogList.dismiss() - ma.messageWithSound("Reclamación ${listClaims.first().code} guardada con matrícula ${listClaims.get(1).code}",false,true) + ma.messageWithSound( + "Reclamación ${listClaims.first().code} guardada con matrícula ${ + listClaims.get( + 1 + ).code + }", false, true + ) listClaims.clear() claimAdapter!!.notifyDataSetChanged() showInputClaim() @@ -160,16 +163,13 @@ private fun setAdapter(){ } - private fun add_item(itemScaned:String){ - var nameClaim: String + private fun add_item(itemScaned: String) { - nameClaim = - getTextScaned(listClaims.size + 1) + itemScaned + val nameClaim: String = getTextScaned(listClaims.size + 1) + itemScaned customDialogList.setTitle(getTextToPosition(listClaims.size + 1)) listClaims.add(GeneralItem(itemScaned, nameClaim)) claimAdapter!!.notifyDataSetChanged() - //customDialogList.setValue("") } @@ -180,8 +180,8 @@ private fun setAdapter(){ ma.hideKeyboard(customDialogList.getEditText()) - customDialogList.dismiss() - requireActivity().onBackPressed() + customDialogList.dismiss() + requireActivity().onBackPressed() }.setValue("").show() @@ -191,12 +191,12 @@ private fun setAdapter(){ customDialogList.getEditText().setOnEditorActionListener { v, actionId, event -> if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) { - if (!customDialogList.getValue().isNullOrEmpty()) { + if (!customDialogList.getValue().isEmpty()) { - //listClaims.add(GeneralItem(customDialogList.getValue(),customDialogList.getValue())) + //listClaims.add(GeneralItem(customDialogList.getValue(),customDialogList.getValue())) add_item(customDialogList.getValue()) - if (listClaims.size >1) { + if (listClaims.size > 1) { itemShelving_addByClaim(customDialogList.getValue().uppercase()) } @@ -209,7 +209,7 @@ private fun setAdapter(){ false } - hideKeyboard() + hideKeyboard() } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapter.kt index 899d1d30..9cf75e4b 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapter.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapter.kt @@ -399,7 +399,10 @@ class SaleAdapter( ) } - "CELESTE" -> itemView.setBackgroundColor(0xFF5b85F5.toInt()) + "CELESTE" ->if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(0xFF5b85F5.toInt(), BlendMode.SRC_ATOP) + } "ROSA" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { 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 8e637b74..deb2cb3a 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 @@ -113,7 +113,6 @@ class CollectionFragment( mpok = MediaPlayer.create((activity as MainActivity), R.raw.ok) - if ((collection.collectionFk != null) && type.equals(CONTROLADOR)) { //sergio: comprueba si viene de la pantalla de controlador @@ -685,8 +684,7 @@ class CollectionFragment( viewModel.saleTrackingDel( getData(USER), getData(PASSWORD), - saleFk = sales[positionUnmarked].saleFk, - "saleTracking_del" + saleFk = sales[positionUnmarked].saleFk ) goBack = false @@ -740,8 +738,8 @@ class CollectionFragment( message=message+"\r\n" } - Log.d("VERDNATURA::","Persona a enviar "+collection.tickets.get(0).salesPersonFk) - Log.d("VERDNATURA::","El message a enviar "+message) + //Log.d("VERDNATURA::","Persona a enviar "+collection.tickets.get(0).salesPersonFk) + //Log.d("VERDNATURA::","El message a enviar "+message) viewModel.sendChekingPresence( token = getData(TOKEN), workerId = collection.tickets.get(0).salesPersonFk, @@ -797,7 +795,7 @@ class CollectionFragment( viewModel.sendChekingPresence( token = getData(TOKEN), - workerId = salePerson, + workerId = "19294", message = message, "sendChekingPresence" ) } @@ -1572,8 +1570,8 @@ class CollectionFragment( getData(PASSWORD), itemShelvingFk = itemShelvingFk, saleFk = sales[storedPosition].saleFk, - quantity = if (quantity != "0") quantity else customDialogList.getValue(), - callFunction = "itemShelvingSaleSupplyAdd" + quantity = if (quantity != "0") quantity else customDialogList.getValue() + ) @@ -2085,8 +2083,7 @@ class CollectionFragment( getData(PASSWORD), saleFk = sales[position].saleFk, quantity = totalQuantity.toString(), - originalQuantity = sales[position].quantity, - "saleMove" + originalQuantity = sales[position].quantity ) /* sales[position].quantity = quantity @@ -2506,8 +2503,7 @@ class CollectionFragment( password = getData(PASSWORD), vSaleFk = mistakeSale?.saleFk!!, vUserFk = mistakeSale?.workerFk!!, - vTypeFk = it.id, "saleMistake_Add" - ) + vTypeFk = it.id) "Causa del error registrado".toast(requireContext()) customDialogList.dismiss() } 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 dcec13f8..3585e51e 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 @@ -1,14 +1,14 @@ 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 com.google.gson.JsonObject import es.verdnatura.domain.GetLoginUserCase import es.verdnatura.domain.GetSacadorControladorUserCase import es.verdnatura.domain.GetUbicadorUserCase -import es.verdnatura.presentation.base.* +import es.verdnatura.presentation.base.BaseViewModel +import es.verdnatura.presentation.base.getMessageFromAllResponse +import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.view.feature.collection.ItemVO import es.verdnatura.presentation.view.feature.collection.SalesModified @@ -20,8 +20,7 @@ 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" @@ -119,7 +118,8 @@ class CollectionViewModel(context: Context) : BaseViewModel() collectionFk: String, sectorFk: String, type: String, - callFunction:String){ + callFunction: String + ) { getSacadorControladorUserCase.collectionTicketGet( usuario, password, @@ -127,38 +127,35 @@ class CollectionViewModel(context: Context) : BaseViewModel() sectorFk, "0", type - ).enqueue(object : - Callback - { - override fun onFailure(call: Call, t: Throwable) - { + ).enqueue(object : + Callback { + override fun onFailure(call: Call, t: Throwable) { _collectionTicketList.value = CollectionVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) - ) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } override fun onResponse( call: Call, response: Response - ) - { - if (response.body() != null) - { + ) { + if (response.body() != null) { _collectionTicketList.value = response.body()?.let { it.map() } - } else - { + } else { _collectionTicketList.value = CollectionVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) } } }) } - - fun saleTrackingReplace( usuario: String, password: String, @@ -166,8 +163,8 @@ class CollectionViewModel(context: Context) : BaseViewModel() vOriginalQuantity: String, vStateFk: String, vIsChecked: String, - vBuyFk: String,callFunction:String) - { + vBuyFk: String, callFunction: String + ) { getSacadorControladorUserCase.saleTrackingReplace( usuario, password, @@ -176,25 +173,24 @@ class CollectionViewModel(context: Context) : BaseViewModel() vStateFk, vIsChecked, vBuyFk - ).enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { + ).enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { _response.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) - ) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) - { - if (response.body() == null) - { + override fun onResponse(call: Call, response: Response) { + if (response.body() == null) { _response.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - } else - { + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { _response.value = ResponseItemVO(isError = false, response = response.body()!!) } } @@ -206,46 +202,44 @@ class CollectionViewModel(context: Context) : BaseViewModel() password: String, shelvingFk: String, quantity: String, - itemFk: String,callFunction:String) - { + itemFk: String, callFunction: String + ) { getSacadorControladorUserCase.itemPlacementSupplyAiming( usuario, password, shelvingFk, quantity, itemFk - ).enqueue(object : - Callback> - { - override fun onFailure(call: Call>, t: Throwable) - { + ).enqueue(object : + Callback> { + override fun onFailure(call: Call>, t: Throwable) { val listError: ArrayList = ArrayList() listError.add( PlacementSupplyVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) - ) - ) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) + ) _placementSuppleyList.value = PlacementSupplyListVO(listError) } override fun onResponse( call: Call>, response: Response> - ) - { - if (response.body() != null) - { + ) { + if (response.body() != null) { _placementSuppleyList.value = response.body()?.let { PlacementSupplyListVO(it) } - } else - { + } else { val listError: ArrayList = ArrayList() listError.add( PlacementSupplyVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) - ) - ) + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + ) _placementSuppleyList.value = PlacementSupplyListVO(listError) } } @@ -257,36 +251,33 @@ class CollectionViewModel(context: Context) : BaseViewModel() password: String, itemShelvingFk: String, saleFk: String, - quantity: String,callFunction:String - ) - { + quantity: String + ) { getSacadorControladorUserCase.itemShelvingSaleSupplyAdd( usuario, password, itemShelvingFk, saleFk, quantity - ).enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { + ).enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { _response.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) - ) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) - { - if (response.body() == null) - { + override fun onResponse(call: Call, response: Response) { + if (response.body() == null) { _response.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) - ) - } else - { - _response.value = ResponseItemVO(isError = false, response = response.body()!!) + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _response.value = ResponseItemVO(isError = false, response = response.message()) } } }) @@ -296,32 +287,33 @@ class CollectionViewModel(context: Context) : BaseViewModel() usuario: String, password: String, collectionFk: String, - sectorFk: String,callFunction:String) - - { + sectorFk: String, callFunction: String + ) { getSacadorControladorUserCase.collectionStickerPrint( usuario, password, collectionFk, sectorFk - ).enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { - _responsePrint.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) + ).enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _responsePrint.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) - { - if (!response.isSuccessful) - { + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful) { _responsePrint.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) - ) - } else - { - _responsePrint.value = ResponseItemVO(isError = false, response = response.message()) + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _responsePrint.value = + ResponseItemVO(isError = false, response = response.message()) } } }) @@ -333,66 +325,67 @@ class CollectionViewModel(context: Context) : BaseViewModel() password: String, ticketFk: String, usedShelves: String, - callFunction:String) - - { + callFunction: String + ) { getSacadorControladorUserCase.ticketCollection_setUsedShelves( usuario, password, ticketFk, usedShelves - ).enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { - _responseUsedShelves.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) + ).enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _responseUsedShelves.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) - { - if (!response.isSuccessful) - { + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful) { _responseUsedShelves.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) ) - } else - { + } else { _responseUsedShelves.value = ResponseItemVO(isError = false) } } }) } + fun item_updatePackingShelve( usuario: String, password: String, vSelf: String, vPacking: String, - callFunction:String) - - { + callFunction: String + ) { getSacadorControladorUserCase.item_updatePackingShelve( usuario, password, vSelf, vPacking - ).enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { - _responseItem_updatePackingShelve.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) + ).enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _responseItem_updatePackingShelve.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) - { - if (!response.isSuccessful) - { - _responseItem_updatePackingShelve.value = ResponseItemVO( + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful) { + _responseItem_updatePackingShelve.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) ) - } else - { + } else { _responseItem_updatePackingShelve.value = ResponseItemVO(isError = false) } } @@ -404,30 +397,30 @@ class CollectionViewModel(context: Context) : BaseViewModel() usuario: String, password: String, saleGroupFk: String, - callFunction:String) - - { + callFunction: String + ) { getSacadorControladorUserCase.saleTracking_add( usuario, password, saleGroupFk - ).enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { - _responseSaleGroup.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) + ).enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _responseSaleGroup.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) - { - if (!response.isSuccessful) - { + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful) { _responseSaleGroup.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) ) - } else - { + } else { _responseSaleGroup.value = ResponseItemVO(isError = false) } } @@ -440,9 +433,8 @@ class CollectionViewModel(context: Context) : BaseViewModel() itemFk: String, quantityFk: String, ticketFk: String, - warehouseFk: String,callFunction:String) - - { + warehouseFk: String, callFunction: String + ) { getSacadorControladorUserCase.collectionAddItem( usuario, password, @@ -450,40 +442,41 @@ class CollectionViewModel(context: Context) : BaseViewModel() quantityFk, ticketFk, warehouseFk - ).enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { + ).enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { _responseNew.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) - ) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) - { + override fun onResponse(call: Call, response: Response) { - if (!response.isSuccessful){ - _responseNew.value = ResponseItemVO( - isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _responseNew.value = - ResponseItemVO(isError = false, response = response.body()!!) - } - - - /* if (response.body() == null) - { + if (!response.isSuccessful) { _responseNew.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) - ) - } else - { + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { _responseNew.value = ResponseItemVO(isError = false, response = response.body()!!) - }*/ + } + + + /* if (response.body() == null) + { + _responseNew.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) + ) + } else + { + _responseNew.value = + ResponseItemVO(isError = false, response = response.body()!!) + }*/ } }) } @@ -493,36 +486,35 @@ class CollectionViewModel(context: Context) : BaseViewModel() password: String, saleFk: String, quantity: String, - originalQuantity: String,callFunction:String) - - { + originalQuantity: String + ) { getSacadorControladorUserCase.saleMove( usuario, password, saleFk, quantity, originalQuantity - ).enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { + ).enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { _responseSaleMove.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) - ) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) - { - if (response.body() == null) - { + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful) { _responseSaleMove.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) - } else - { - _responseSaleMove.value = ResponseItemVO(isError = false, response = response.body()!!) + } else { + _responseSaleMove.value = + ResponseItemVO(isError = false, response = response.message()) } } }) @@ -535,9 +527,8 @@ class CollectionViewModel(context: Context) : BaseViewModel() quantity: String, type: String, warehouseFk: String, - originalQuantity: String,callFunction:String - ) - { + originalQuantity: String, callFunction: String + ) { getSacadorControladorUserCase.collectionMissingTrash( usuario, password, @@ -546,85 +537,89 @@ class CollectionViewModel(context: Context) : BaseViewModel() type, warehouseFk, originalQuantity - ).enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { + ).enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { _responseMissingTrash.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) - ) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) - { - if (response.body() == null) - { + override fun onResponse(call: Call, response: Response) { + if (response.body() == null) { _responseMissingTrash.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) - ) - } else - { - _responseMissingTrash.value = ResponseItemVO(isError = false, response = response.body()!!) + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _responseMissingTrash.value = + ResponseItemVO(isError = false, response = response.message()) } } }) } - fun saleTrackingDel(usuario: String, password: String, saleFk: String,callFunction:String) - { + fun saleTrackingDel(usuario: String, password: String, saleFk: String) { getSacadorControladorUserCase.saleTrackingDel(usuario, password, saleFk) - .enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { _responseDel.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) - ) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) - { - if (response.body() == null) - { + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful) { _responseDel.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) - ) - } else - { + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { _responseDel.value = - ResponseItemVO(isError = false, response = response.body()!!) + ResponseItemVO(isError = false, response = response.message()) } } }) } - fun itemShelving_updateFromSale(usuario: String, password: String, itemShelvingFk: String,visible:String,callFunction:String) - { - getSacadorControladorUserCase.itemShelving_updateFromSale(usuario, password, itemShelvingFk, visible) - .enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { + fun itemShelving_updateFromSale( + usuario: String, + password: String, + itemShelvingFk: String, + visible: String, + callFunction: String + ) { + getSacadorControladorUserCase.itemShelving_updateFromSale( + usuario, + password, + itemShelvingFk, + visible + ) + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { _responseItemShelvingUpdate.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) ) } - override fun onResponse(call: Call, response: Response) - { - if (!response.isSuccessful ) - { + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful) { _responseItemShelvingUpdate.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) ) - } else - { + } else { _responseItemShelvingUpdate.value = ResponseItemVO(isError = false, response = response.message()!!) } @@ -632,30 +627,33 @@ class CollectionViewModel(context: Context) : BaseViewModel() }) } - fun parking(usuario: String, password: String, ticketFk: String, parking: String,callFunction:String) - { + fun parking( + usuario: String, + password: String, + ticketFk: String, + parking: String, + callFunction: String + ) { getUbicadorUserCase.shelvingPark(usuario, password, ticketFk, parking) - .enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { _response.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) - ) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) - { + override fun onResponse(call: Call, response: Response) { - if (response.body() == null) - { + if (response.body() == null) { _response.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) - ) - } else - { + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { _response.value = ResponseItemVO(isError = false, response = response.body()!!) } @@ -667,30 +665,27 @@ class CollectionViewModel(context: Context) : BaseViewModel() usuario: String, password: String, ticketFk: String, - state: String,callFunction:String - ) - { + state: String, callFunction: String + ) { getSacadorControladorUserCase.ticket_setState(usuario, password, ticketFk, state) - .enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { _response.value = ResponseItemVO( isError = true, - errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!) - ) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) - { - if (!response.isSuccessful) - { + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful) { _response.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) - ) - } else - { + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { _response.value = ResponseItemVO(isError = false, response = "Cambiado estado") } @@ -702,114 +697,84 @@ class CollectionViewModel(context: Context) : BaseViewModel() usuario: String, password: String, ticketFk: String, - ) - { + ) { getSacadorControladorUserCase.get_salesModifiedFromTicket(usuario, password, ticketFk) - .enqueue(object : Callback> - { + .enqueue(object : Callback> { - override fun onResponse(call: Call>, response: Response>) - { + override fun onResponse( + call: Call>, + response: Response> + ) { - if (response.body() != null) - { + if (response.body() != null) { _salesModifiedList.value = response.body()?.let { SalesModifiedList(it) } - } else - { + } else { val listError: ArrayList = ArrayList() listError.add( SalesModified( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) ) ) _salesModifiedList.value = SalesModifiedList(listError) } - /* if (!response.isSuccessful) - { - _response.value = ResponseItemVO( - isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) - ) - } else - { - _response.value = - ResponseItemVO(isError = false, response = "Obtenidos registros") - }*/ + /* if (!response.isSuccessful) + { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) + ) + } else + { + _response.value = + ResponseItemVO(isError = false, response = "Obtenidos registros") + }*/ } override fun onFailure(call: Call>, t: Throwable) { - val listError: ArrayList = ArrayList() - listError.add( - SalesModified( - isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) + val listError: ArrayList = ArrayList() + listError.add( + SalesModified( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + t.message!! ) ) - _salesModifiedList.value = SalesModifiedList(listError) + ) + _salesModifiedList.value = SalesModifiedList(listError) } }) } - - fun getIdFromCode(usuario: String, password: String, code: String,callFunction:String) - { + fun getIdFromCode(usuario: String, password: String, code: String, callFunction: String) { getSacadorControladorUserCase.getIdFromCode(usuario, password, code) - .enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { _responseCode.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) - ) - } - - override fun onResponse(call: Call, response: Response) - { - if (response.body() == null) - { - _responseCode.value = ResponseItemVO( - isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) - ) - } else - { - _responseCode.value = - ResponseItemVO(isError = false, response = response.body()!!) - } - } - }) - } - - fun getIdFromCodeSalix(token: String, code: String) - { - getSacadorControladorUserCase.getIdFromCodeSalix(token, code) - .enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { - _responseCode.value = ResponseItemVO( - isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) ) } - override fun onResponse(call: Call, response: Response) - { - if (response.body() == null) - { + override fun onResponse(call: Call, response: Response) { + if (response.body() == null) { _responseCode.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) ) - } else - { + } else { _responseCode.value = ResponseItemVO(isError = false, response = response.body()!!) } @@ -817,7 +782,34 @@ class CollectionViewModel(context: Context) : BaseViewModel() }) } - fun collectionIncreaseQuantity( + fun getIdFromCodeSalix(token: String, code: String) { + getSacadorControladorUserCase.getIdFromCodeSalix(token, code) + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _responseCode.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) + } + + override fun onResponse(call: Call, response: Response) { + if (response.body() == null) { + _responseCode.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _responseCode.value = + ResponseItemVO(isError = false, response = response.body()!!) + } + } + }) + } + +/* fun collectionIncreaseQuantity( usuario: String, password: String, saleFk: String, @@ -856,80 +848,78 @@ class CollectionViewModel(context: Context) : BaseViewModel() } } }) - } + }*/ fun collectionIncreaseQuantitySalix( token: String, saleFk: String, - quantity: String,callFunction:String - ) - { + quantity: String, callFunction: String + ) { getSacadorControladorUserCase.collectionIncreaseQuantitySalix( token, saleFk, quantity - ).enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { + ).enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { _responseIncQuantity.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) ) } - override fun onResponse(call: Call, response: Response) - { + override fun onResponse(call: Call, response: Response) { - if (!response.isSuccessful) - { + if (!response.isSuccessful) { _responseIncQuantity.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) ) - } else - { + } else { _responseIncQuantity.value = ResponseItemVO(isError = false, response = response.message().toString()) } } }) } - fun sendChekingPresence(token: String, workerId: String, message: String,calledFunction:String) - { - try - { - getLoginUserCase.sendChekingPresence(token, workerId.toInt(), message) - .enqueue(object : Callback - { - override fun onResponse(call: Call, response: Response) - { - if (!response.isSuccessful || response.message()=="false") - { + fun sendChekingPresence( + token: String, + workerId: String, + message: String, + calledFunction: String + ) { + try { + getLoginUserCase.sendChekingPresence(token, workerId.toInt(), message) + .enqueue(object : Callback { + override fun onResponse(call: Call, response: Response) { + + if (!response.isSuccessful || response.message() == "false") { _responseSalixMessage.value = ResponseItemVO( isError = true, errorMessage = "Error al enviar mensaje rocket." + getMessageFromAllResponse( - nameofFunction(this),response.message() - )) - //Log.i("Salix","Mensaje enviado a salix") + nameofFunction(this), response.message() + ) + ) } } - override fun onFailure(call: Call, t: Throwable) - { + override fun onFailure(call: Call, t: Throwable) { _responseSalixMessage.value = ResponseItemVO( isError = true, errorMessage = "Error al enviar mensaje rocket." + getMessageFromAllResponse( - nameofFunction(this),t.message!!)) + nameofFunction(this), t.message!! + ) + ) //Log.i("Salix Error",""+t.message) } }) - } catch (e: Exception) - { + } catch (e: Exception) { } } @@ -939,48 +929,42 @@ class CollectionViewModel(context: Context) : BaseViewModel() password: String, vSaleFk: String, vUserFk: String, - vTypeFk: String,callFunction:String - ) - { + vTypeFk: String + ) { getSacadorControladorUserCase.saleMistakeAdd(usuario, password, vSaleFk, vUserFk, vTypeFk) .enqueue(object : - Callback - { - override fun onFailure(call: Call, t: Throwable) - { + Callback { + override fun onFailure(call: Call, t: Throwable) { _response.value = ResponseItemVO( isError = true, - errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!) - ) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } override fun onResponse( - call: Call, - response: Response - ) - { - if (response.body() == null) - { + call: Call, + response: Response + ) { + if (response.body() == null) { _response.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) - ) - } else - { + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { _response.value = - ResponseItemVO(isError = false, response = response.body()!!) + ResponseItemVO(isError = false, response = response.message()) } } }) } - fun mistakeType(usuario: String, password: String) - { + fun mistakeType(usuario: String, password: String) { getSacadorControladorUserCase.mistakeType(usuario, password) - .enqueue(object : Callback> - { - override fun onFailure(call: Call>, t: Throwable) - { + .enqueue(object : Callback> { + override fun onFailure(call: Call>, t: Throwable) { val listError: ArrayList = ArrayList() listError.add(MistakeTypeVO("0", "")) _mistakeList.value = MistakeTypeListVO(listError) @@ -989,13 +973,10 @@ class CollectionViewModel(context: Context) : BaseViewModel() override fun onResponse( call: Call>, response: Response> - ) - { - if (response.body() != null) - { + ) { + if (response.body() != null) { _mistakeList.value = response.body()?.let { MistakeTypeListVO(it) } - } else - { + } else { val listError: ArrayList = ArrayList() listError.add(MistakeTypeVO("0", "")) _mistakeList.value = MistakeTypeListVO(listError) @@ -1006,147 +987,136 @@ class CollectionViewModel(context: Context) : BaseViewModel() } - fun sip_getExtension( usuario: String, password: String, workerId: String, - callFunction:String - ) - { + callFunction: String + ) { getSacadorControladorUserCase.sip_getExtension( usuario, password, workerId ).enqueue(object : - Callback - { - override fun onFailure(call: Call, t: Throwable) - { + Callback { + override fun onFailure(call: Call, t: Throwable) { _responseGetExtensionFromUserId.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) ) } override fun onResponse( call: Call, response: Response - ) - { + ) { - if (response.body() != "false") - { + if (response.body() != "false") { _responseGetExtensionFromUserId.value = ResponseItemVO( isError = false, response = response.body()!!, errorMessage = "" ) - }else{ + } else { _responseGetExtensionFromUserId.value = ResponseItemVO( isError = true, response = response.body()!!, - errorMessage = "No se puede realizar la llamada. El usuario no tiene la extensión configurada. Solicítelo a informática.") + errorMessage = "No se puede realizar la llamada. El usuario no tiene la extensión configurada. Solicítelo a informática." + ) } } }) } + fun sip_getExtensionSalix( - token:String, + token: String, workerId: String, - callFunction:String - ) - { + callFunction: String + ) { getSacadorControladorUserCase.sip_getExtensionSalix( token, workerId ).enqueue(object : - Callback - { - override fun onFailure(call: Call, t: Throwable) - { + Callback { + override fun onFailure(call: Call, t: Throwable) { _responseGetExtensionFromUserId.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) ) } override fun onResponse( call: Call, response: Response - ) - { + ) { // No se ajusta ya que la response is Successful pero el valor retornado es un error y por lo tanto response.body nulo y tira error - /* if (response.isSuccessful ){ - _responseGetExtensionFromUserId.value = ResponseItemVO( - isError = false, - response = JSONObject(response.body()!!.toString()).get("extension").toString(), - errorMessage = "") - }else{ - _responseGetExtensionFromUserId.value = ResponseItemVO( - isError = true, - response = response.message()!!, - errorMessage = "No se puede realizar la llamada. El usuario no tiene la extensión configurada. Solicítelo a informática.") + /* if (response.isSuccessful ){ + _responseGetExtensionFromUserId.value = ResponseItemVO( + isError = false, + response = JSONObject(response.body()!!.toString()).get("extension").toString(), + errorMessage = "") + }else{ + _responseGetExtensionFromUserId.value = ResponseItemVO( + isError = true, + response = response.message()!!, + errorMessage = "No se puede realizar la llamada. El usuario no tiene la extensión configurada. Solicítelo a informática.") - }*/ - if (response.body() != null) - { + }*/ + if (response.body() != null) { _responseGetExtensionFromUserId.value = ResponseItemVO( isError = false, - response = JSONObject(response.body()!!.toString()).get("extension").toString(), + response = JSONObject(response.body()!!.toString()).get("extension") + .toString(), errorMessage = "" ) // Se prueba el call como JSONOBJECT pero no da resultado porque el sevidor puede devolver un null directamente y salta error MAlformed // Se deja Any para obtener cualquier tipo de objeto y si no es nulo se parsea a Json - // Per al cas que el CAll siga Any enlloc de JsonObject: + // Per al cas que el CAll siga Any enlloc de JsonObject: //var answerError=(JSONObject(response.body().toString()).get("extension").toString()) //var messageFromError = answerError.get("extension").toString() //Log.d("VERDNATURA::","Message ext"+messageFromError) - }else{ + } else { _responseGetExtensionFromUserId.value = ResponseItemVO( isError = true, response = response.message()!!, - errorMessage = "No se puede realizar la llamada. El usuario no tiene la extensión configurada. Solicítelo a informática.") + errorMessage = "No se puede realizar la llamada. El usuario no tiene la extensión configurada. Solicítelo a informática." + ) } } }) } + fun ticket_checkFullyControlled( usuario: String, password: String, - collectionFk: String,callFunction:String - ) - { + collectionFk: String, callFunction: String + ) { getSacadorControladorUserCase.ticket_checkFullyControlled( usuario, password, collectionFk - ).enqueue(object : - Callback - { - override fun onFailure(call: Call, t: Throwable) - { + ).enqueue(object : + Callback { + override fun onFailure(call: Call, t: Throwable) { _responsecheckfully.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) - ) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } override fun onResponse( call: Call, response: Response - ) - { + ) { - if (response.body() != "false") - { + if (response.body() != "false") { //sergio: _responsecheckfully.value = ResponseItemVO( isError = false, response = response.body()!!, errorMessage = "" - ) + ) } } }) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasFragment.kt index a5d6d2e8..1d4eaca8 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasFragment.kt @@ -13,20 +13,20 @@ import es.verdnatura.R import es.verdnatura.databinding.FragmentFaltasBinding import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.common.* -import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialogInput import es.verdnatura.presentation.view.feature.faltas.adapter.FaltasAdapter import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO -import es.verdnatura.presentation.view.feature.main.activity.MainActivity -class FaltasFragment : BaseFragment(FaltasViewModel::class) { +class FaltasFragment : + BaseFragment(FaltasViewModel::class) { - private var adapter : FaltasAdapter? = null + private var adapter: FaltasAdapter? = null private lateinit var customDialogInput: CustomDialogInput - private var listInvetory:ArrayList = ArrayList() - private var listInvetoryAux:ArrayList = ArrayList() - // private lateinit var customDialog: CustomDialog + private var listInvetory: ArrayList = ArrayList() + private var listInvetoryAux: ArrayList = ArrayList() + + // private lateinit var customDialog: CustomDialog private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null private var reload = false private var hideLoad = true @@ -44,30 +44,30 @@ class FaltasFragment : BaseFragment(Falt override fun onCreate(savedInstanceState: Bundle?) { - viewModel.getFaltas(getData(USER),getData(PASSWORD),getData(WAREHOUSEFK)) + viewModel.getFaltas(getData(USER), getData(PASSWORD), getData(WAREHOUSEFK)) super.onCreate(savedInstanceState) } override fun init() { binding.splashProgress.visibility = View.VISIBLE - ma.hideBottomNavigation(View.GONE) + ma.hideBottomNavigation(View.GONE) binding.mainToolbar.toolbarTitle.text = getString(R.string.faultsReview) setToolBar() customDialogInput = CustomDialogInput(requireContext()) - // customDialog = CustomDialog(requireContext()) + // customDialog = CustomDialog(requireContext()) setEvents() - if (reload){ + if (reload) { reload = false hideLoad = false binding.splashProgress.visibility = View.VISIBLE - viewModel.getFaltas(getData(USER),getData(PASSWORD),getData(WAREHOUSEFK)) + viewModel.getFaltas(getData(USER), getData(PASSWORD), getData(WAREHOUSEFK)) } super.init() } - private fun setToolBar(){ + private fun setToolBar() { val listIcons: ArrayList = ArrayList() val iconReload = ImageView(context) @@ -78,26 +78,28 @@ class FaltasFragment : BaseFragment(Falt } listIcons.add(iconReload) - binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons,object: OnOptionsSelectedListener { - override fun onOptionsItemSelected(item: Drawable) { - if (item == iconReload.drawable){ - binding.splashProgress.visibility = View.VISIBLE - viewModel.getFaltas(getData(USER),getData(PASSWORD),getData(WAREHOUSEFK)) + binding.mainToolbar.toolbarIcons.adapter = + ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener { + override fun onOptionsItemSelected(item: Drawable) { + if (item == iconReload.drawable) { + binding.splashProgress.visibility = View.VISIBLE + viewModel.getFaltas(getData(USER), getData(PASSWORD), getData(WAREHOUSEFK)) + } } - } - }) - binding.mainToolbar.toolbarIcons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) + }) + binding.mainToolbar.toolbarIcons.layoutManager = + LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) } - private fun setEvents(){ + private fun setEvents() { binding.mainToolbar.backButton.setOnClickListener { requireActivity().onBackPressed() } binding.filterItemFk.setOnKeyListener { v, keyCode, event -> - if (binding.filterItemFk.text.toString().isNullOrEmpty()){ - if (listInvetory.size != listInvetoryAux.size){ + if (binding.filterItemFk.text.toString().isNullOrEmpty()) { + if (listInvetory.size != listInvetoryAux.size) { listInvetory.removeAll(listInvetoryAux) listInvetoryAux.forEach { listInvetory.add(it) @@ -105,10 +107,10 @@ class FaltasFragment : BaseFragment(Falt } - }else{ + } else { listInvetory.removeAll(listInvetoryAux) listInvetoryAux.forEach { - if (it.itemFk.contains(binding.filterItemFk.text.toString(),true)){ + if (it.itemFk.contains(binding.filterItemFk.text.toString(), true)) { listInvetory.add(it) } } @@ -121,35 +123,54 @@ class FaltasFragment : BaseFragment(Falt } override fun observeViewModel() { - with(viewModel){ + with(viewModel) { faltasList.observe(viewLifecycleOwner, Observer { - if (hideLoad){ - binding.splashProgress.visibility = View.GONE - }else{ - hideLoad = true - } - listInvetory = ArrayList() - listInvetoryAux = ArrayList() - it.list.forEach { - listInvetory.add(it) - listInvetoryAux.add(it) - } + if (hideLoad) { + binding.splashProgress.visibility = View.GONE + } else { + hideLoad = true + } + listInvetory = ArrayList() + listInvetoryAux = ArrayList() + it.list.forEach { + listInvetory.add(it) + listInvetoryAux.add(it) + } - 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,getData(WAREHOUSEFK),getData(USER),getData(PASSWORD),customDialogInput.getValue(),"0","temTrash") + 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, + getData(WAREHOUSEFK), + getData(USER), + getData(PASSWORD), + customDialogInput.getValue(), + "0" + + ) changeOfflineValue(item) customDialogInput.dismiss() - }.setKoButton("Cancelar"){ - customDialogInput.dismiss() - }.setValue("0").show() + }.setKoButton("Cancelar") { + customDialogInput.dismiss() + }.setValue("0").show() - customDialogInput.getEditText().requestFocus() - customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event -> + customDialogInput.getEditText().requestFocus() + 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,getData(WAREHOUSEFK),getData(USER),getData(PASSWORD),customDialogInput.getValue(),"0","temTrash") + if (!customDialogInput.getValue().isNullOrEmpty()) { + viewModel.itemStockUpdate( + item.itemFk, + getData(WAREHOUSEFK), + getData(USER), + getData(PASSWORD), + customDialogInput.getValue(), + "0" + + ) changeOfflineValue(item) } customDialogInput.setValue("") @@ -160,32 +181,36 @@ class FaltasFragment : BaseFragment(Falt false } - } - },object: OnFaltasReviewClickListener{ - override fun onFaltasReviewClickListener(item: ItemFaltasVO) { - viewModel.faultsReview_isChecked(getData(USER),getData(PASSWORD),item.itemFk,getData(WAREHOUSEFK),"faultsReview_isChecked") - changeOfflineValue(item) - } + } + }, object : OnFaltasReviewClickListener { + override fun onFaltasReviewClickListener(item: ItemFaltasVO) { + viewModel.faultsReview_isChecked( + getData(USER), + getData(PASSWORD), + item.itemFk, + getData(WAREHOUSEFK), + "faultsReview_isChecked" + ) + changeOfflineValue(item) + } - },pasillerosItemClickListener!!) - binding.locationRecyclerview.adapter = adapter - binding.locationRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) + }, pasillerosItemClickListener!!) + binding.locationRecyclerview.adapter = adapter + binding.locationRecyclerview.layoutManager = + LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) }) response.observe(viewLifecycleOwner, Observer { - if (it.isError){ - ma.messageWithSound(it.errorMessage,it.isError,false) - /* customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ - customDialog.dismiss() - }.show()*/ + if (it.isError) { + ma.messageWithSound(it.errorMessage, it.isError, false) } }) } } - private fun changeOfflineValue(item: ItemFaltasVO){ + private fun changeOfflineValue(item: ItemFaltasVO) { var i = 0 var position = 0 listInvetory.forEach { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasViewModel.kt index 5846966d..b7971d5a 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasViewModel.kt @@ -61,18 +61,18 @@ class FaltasViewModel(context: Context) : BaseViewModel() { }) } - fun itemStockUpdate(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String,callFunction:String){ + fun itemStockUpdate(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String){ getItemCardUserCase.itemStockUpdate(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : - Callback { - override fun onFailure(call: Call, t: Throwable) { + Callback { + override fun onFailure(call: Call, t: Throwable) { _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) } - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ + override fun onResponse(call: Call, response: Response) { + if (response.isSuccessful()){ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) + _response.value = ResponseItemVO(isError = false,response = response.message()) } } @@ -82,15 +82,15 @@ class FaltasViewModel(context: Context) : BaseViewModel() { fun faultsReview_isChecked(user:String,password:String,itemFk:String,warehouseFk:String,callFunction:String){ getInventaryUserCase.faultsReview_isChecked(user,password,itemFk,warehouseFk).enqueue(object : - Callback { - override fun onFailure(call: Call, t: Throwable) { + Callback { + override fun onFailure(call: Call, t: Throwable) { _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) } - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful){ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) + _response.value = ResponseItemVO(isError = false,response = response.message()) } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryFragment.kt index 3e112288..fbfae438 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryFragment.kt @@ -214,7 +214,7 @@ class InventaryFragment : BaseFragment{ @@ -170,24 +170,24 @@ 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,callFunction:String){ + fun itemTrash(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String){ - getItemCardUserCase.itemTrash(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : Callback{ + getItemCardUserCase.itemTrash(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { + override fun onFailure(call: Call, t: Throwable) { _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) } - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful){ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) + _response.value = ResponseItemVO(isError = false,response = response.message()) } } 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 a7a581c4..b1f2328b 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 @@ -131,8 +131,9 @@ class LoginFragment : BaseFragment(LoginVi val openURL = Intent(Intent.ACTION_VIEW) openURL.data = // sergio REdmine Tarea #3730 - Uri.parse("https://app.verdnatura.es/bin/vn-picking.apk") - // Uri.parse(it.url) + //Uri.parse("https://app.verdnatura.es/bin/vn-picking.apk") + Uri.parse(it.url) + //Log.d("VERDNATURA::","Datos"+ openURL.data) startActivity(openURL) } @@ -383,7 +384,8 @@ class LoginFragment : BaseFragment(LoginVi viewModel.checkVersion( user = binding.edittextUsername.text.toString(), password = binding.edittextPassword.text.toString(), - nameApp = "warehouse", "getVersion" + nameApp = "warehouse", "getVersion", + ) } 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 9cb6c365..b119ee92 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 @@ -290,7 +290,7 @@ class LoginViewModel(context: Context) : BaseViewModel() it.appname, it.version, it.IsVersionCritical, - //it.url, + it.url, isError = false, errorMessage = "" ) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/login/model/LoginItemVO.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/login/model/LoginItemVO.kt index 84dfc43f..194d635f 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/login/model/LoginItemVO.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/login/model/LoginItemVO.kt @@ -37,7 +37,7 @@ class versionApp( val appname: String = "", val version: String = "", var IsVersionCritical: Int = 0, - // var url: String="", + var url: String="", var isError: Boolean = false, var errorMessage: String = "" ) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt index 6a805e71..7c0df8d5 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt @@ -488,7 +488,7 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL "Flejado buffer" -> { addFragmentOnTop(BufferFragment.newInstance(item.title)) } - /*sergio:pruebas*/ + "Pre Control" -> { addFragmentOnTop(PreControladorFragment.newInstance()) } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailFragment.kt index 8e8866dd..074cbfa0 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailFragment.kt @@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment import android.content.Context import android.graphics.drawable.Drawable +import android.util.Log import android.view.View import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager @@ -101,7 +102,7 @@ class ExpeditionPalletDetailFragment( }else if(item == iconBorrar){ binding.splashProgress.visibility = View.VISIBLE viewModel.expeditionPalletDel(getData(USER), - getData(PASSWORD),itemPallet!!.Pallet,"expeditionPallet_Del") + getData(PASSWORD),itemPallet!!.Pallet) }else if(item == iconPrint){ binding.splashProgress.visibility = View.VISIBLE @@ -154,6 +155,7 @@ class ExpeditionPalletDetailFragment( }else{ binding.splashProgress.visibility=View.VISIBLE + Log.d("VERDNATURA::","Cambiando estado a paletizado") viewModel.expeditionState_addByPallet( getData(USER),getData(PASSWORD),itemPallet!!.Pallet,"PALLETIZED","expeditionState_addByPallet") } 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 263df4ad..d884051f 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 @@ -59,16 +59,16 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel() { }) } - fun expeditionPalletDel(usuario:String,password:String,vPalletFk:String,callFunction:String){ - getPaletizadoresUserCase.expeditionPalletDel(usuario,password,vPalletFk).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { + fun expeditionPalletDel(usuario:String,password:String,vPalletFk:String){ + getPaletizadoresUserCase.expeditionPalletDel(usuario,password,vPalletFk).enqueue(object : Callback{ + override fun onFailure(call: Call, t: Throwable) { _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) } - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ + override fun onResponse(call: Call, response: Response) { + if (response.isSuccessful){ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) + _response.value = ResponseItemVO(isError = false,response = response.message()) } } }) @@ -80,15 +80,15 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel() { vPalletFk: String, vSectorFk: String,callFunction:String){ - getPaletizadoresUserCase.expeditionPalletPrintSet(usuario,password,vPalletFk,vSectorFk).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { + getPaletizadoresUserCase.expeditionPalletPrintSet(usuario,password,vPalletFk,vSectorFk).enqueue(object : Callback{ + override fun onFailure(call: Call, t: Throwable) { _responsePrintPallet.value = ResponseItemVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)) } - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful){ _responsePrintPallet.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) }else{ - _responsePrintPallet.value = ResponseItemVO(isError = false,response = response.body()!!) + _responsePrintPallet.value = ResponseItemVO(isError = false,response = response.message()) } } }) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletFragment.kt index 02255b1f..587d60c4 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletFragment.kt @@ -131,9 +131,7 @@ class ExpeditionPalletFragment( response.observe(viewLifecycleOwner, Observer { if (it.isError){ ma.messageWithSound(it.errorMessage,true,false) - /* customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ - customDialog.dismiss() - }.show()*/ + } }) @@ -228,7 +226,7 @@ class ExpeditionPalletFragment( listExpeditions.add(0,BarcodeVO(code = customDialogList.getValue())) customDialogList.setDescription("Total: "+listExpeditions.size) viewModel.expeditionScanPut(getData(USER), - getData(PASSWORD),it.list.get(0).palletFk,customDialogList.getValue(),"expeditionScan_Put") + getData(PASSWORD),it.list.get(0).palletFk,customDialogList.getValue()) ////Log.i("VERDNATURA:"," palletizando ${it.list.get(0).palletFk} expedi: ${customDialogList.getValue()}") viewModel.checkRouteExpeditionScanPut(getData(USER), getData(PASSWORD),it.list.get(0).palletFk,customDialogList.getValue(),"expedition_checkRoute") diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletViewModel.kt index 68b715b2..06eea511 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletViewModel.kt @@ -92,16 +92,16 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() { }) } - fun expeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String,callFunction:String){ - getPaletizadoresUserCase.expeditionScanPut(usuario,password,vPalletFk,vExpeditionFk).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { + fun expeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String){ + getPaletizadoresUserCase.expeditionScanPut(usuario,password,vPalletFk,vExpeditionFk).enqueue(object : Callback{ + override fun onFailure(call: Call, t: Throwable) { _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) } - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful){ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) + _response.value = ResponseItemVO(isError = false,response = 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 7fb13bcf..53b781dc 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 @@ -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.getMessageFromAllResponse +import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.common.Event import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionScanList @@ -35,7 +37,6 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel() { val responseDeleteScan: LiveData get() = _responseDeleteScan -//sergio:añadido para llamada nueva checkexpeditionScan private val _responseCheckexpeditionScanPut by lazy { MutableLiveData() } val responseCheckexpeditionScanPut: LiveData get() = _responseCheckexpeditionScanPut @@ -91,15 +92,17 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel() { } fun expeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String){ - getPaletizadoresUserCase.expeditionScanPut(usuario,password,vPalletFk,vExpeditionFk).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada expeditionScan_Put."+t.message!!) + getPaletizadoresUserCase.expeditionScanPut(usuario,password,vPalletFk,vExpeditionFk).enqueue(object : Callback{ + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse( + nameofFunction(this),t.message!!) + ) } - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada expeditionScan_Put") + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful){ + _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()!!)) }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) + _response.value = ResponseItemVO(isError = false,response = response.message()) } } @@ -125,15 +128,15 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel() { fun expeditionScanDel(usuario:String,password:String,vScanFk:String){ - getPaletizadoresUserCase.expeditionScanDel(usuario,password,vScanFk).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { + getPaletizadoresUserCase.expeditionScanDel(usuario,password,vScanFk).enqueue(object : Callback{ + override fun onFailure(call: Call, t: Throwable) { _responseDeleteScan.value = ResponseItemVO(isError = true,errorMessage = "Error al llamar expeditionScan_Del."+t.message!!) } - override fun onResponse(call: Call, response: Response) { + override fun onResponse(call: Call, response: Response) { if (response.body() == null){ _responseDeleteScan.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada expeditionScan_Del") }else{ - _responseDeleteScan.value = ResponseItemVO(isError = false,response = response.body()!!) + _responseDeleteScan.value = ResponseItemVO(isError = false,response = response.message()) } } }) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionTruckListFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionTruckListFragment.kt index e61f0a7c..90b78cb4 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionTruckListFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionTruckListFragment.kt @@ -115,7 +115,7 @@ class ExpeditionTruckListFragment : BaseFragment{ - override fun onFailure(call: Call, t: Throwable) { + fun expeditionTruckAdd(usuario:String,password:String,vHour:String,vDescription:String){ + getPaletizadoresUserCase.expeditionTruckAdd(usuario,password,vHour,vDescription).enqueue(object : Callback{ + override fun onFailure(call: Call, t: Throwable) { _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) } - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful){ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) + _response.value = ResponseItemVO(isError = false,response = response.message()) } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/parkingSale/fragment/ParkingViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/parkingSale/fragment/ParkingViewModel.kt index 24c513c0..dbd27513 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/parkingSale/fragment/ParkingViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/parkingSale/fragment/ParkingViewModel.kt @@ -63,7 +63,7 @@ class ParkingSaleViewModel(context: Context) : BaseViewModel() { } }) } - fun saleParking_add(usuario: String, password: String, sales:List,parking: String,callFunction:String) + /* fun saleParking_add(usuario: String, password: String, sales:List,parking: String,callFunction:String) { getUbicadorUserCase.saleParking_add(usuario, password, sales, parking) .enqueue(object : Callback @@ -91,6 +91,6 @@ class ParkingSaleViewModel(context: Context) : BaseViewModel() { } } }) - } + }*/ } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt index def75bf0..39b98df2 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt @@ -189,7 +189,7 @@ class PasilleroViewModel : BaseViewModel() { PasillerosItemVO( 30, R.drawable.pallet_shipping_selected, - "Paletizar", R.string.PalletMake,"Permite escanear pallet para incorporarlo al sistema" + "Paletizar", R.string.scanPallet,"Permite escanear pallet para incorporarlo al sistema" ) ) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt index ff36f4dc..969cd7f4 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt @@ -574,7 +574,7 @@ class EndSacadorFragment( ) } else { - binding.mainToolbar.toolbarTitle.text = ticket + if (ticket.isNullOrBlank()){binding.mainToolbar.toolbarTitle.text = collection.collectionFk} sales = ArrayList() salesList.forEach { @@ -657,7 +657,8 @@ class EndSacadorFragment( if (it.saldo == it.picked) totalMark += 1 } - binding.mainToolbar.toolbarTitle.text = ticket + if (ticket.isNullOrBlank()){binding.mainToolbar.toolbarTitle.text = collection.collectionFk} + binding.mainToolbar.toolbarSubtitle.text = "" + totalMark + "/" + sales.size if (totalMark == sales.size) { "Ticket completo".toast(this.context, Toast.LENGTH_SHORT) @@ -1002,7 +1003,7 @@ class EndSacadorFragment( password = getData(PASSWORD), itemShelvingFk = itemShelvingFk, saleFk = sales[storedPosition].idMovimiento, - quantity = customDialogList.getValue(), callFunction = "itemShelvingSaleSupplyAdd" + quantity = customDialogList.getValue() ) } catch (e: Exception) { @@ -1139,7 +1140,8 @@ class EndSacadorFragment( //OTROS private fun setToolBar() { - binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE + binding.mainToolbar.toolbarSubtitle.visibility = VISIBLE + binding.mainToolbar.toolbarTitle.text=collection.collectionFk val listIcons: ArrayList = ArrayList() @@ -1195,35 +1197,6 @@ class EndSacadorFragment( requireActivity().hideKeyboard() } - /* private fun parkingTicket(ticket: String, parking: String) { - - var saleParkingList: MutableList = arrayListOf() - - if (!sales.isNullOrEmpty()) - sales.forEach { - Log.d("VERNATURA::", "el id es " + it.id + " y el idmovimiento" + it.idMovimiento) - if (it.id.equals(ticket)) { - if ((it.picked == it.quantity)) { - saleParkingList.add(it.idMovimiento) - } - } - } - - if (!saleParkingList.isNullOrEmpty()) { - binding.splashProgress.visibility = VISIBLE - viewModel.saleParking_add( - usuario = user, - password = password, - sales = saleParkingList, - parking = parking, - "saleParking_add" - ) - } else { - "No se han encontrado líneas de venta a aparcar para ese ticket".toast(requireContext()) - } - - }*/ - companion object { fun newInstance(collection: CollectionVO?, entrypoint: String) = EndSacadorFragment( @@ -1409,7 +1382,7 @@ class EndSacadorFragment( password = getData(PASSWORD), saleFk = sales[position].idMovimiento, quantity = totalQuantity.toString(), - originalQuantity = sales[position].quantity.toString(), "saleMove" + originalQuantity = sales[position].quantity.toString() ) Log.d("VERDNATURA::", "responseSaleMove enviando") /* diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorFragment.kt index 749acaa9..570cb5f3 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorFragment.kt @@ -803,7 +803,7 @@ class PreSacadorFragment : password = getData(PASSWORD), itemShelvingFk = itemShelvingFk, saleFk = sales[storedPosition].idMovimiento, - quantity = customDialogList.getValue(), callFunction = "itemShelvingSaleSupplyAdd" + quantity = customDialogList.getValue() ) } catch (e: Exception) { @@ -994,34 +994,6 @@ class PreSacadorFragment : requireActivity().hideKeyboard() } - /* private fun parkingTicket(ticket: String, parking: String) { - - var saleParkingList: MutableList = arrayListOf() - - if (!sales.isNullOrEmpty()) - sales.forEach { - Log.d("VERNATURA::", "el id es " + it.id + " y el idmovimiento" + it.idMovimiento) - if (it.id.equals(ticket)) { - if ((it.picked == it.quantity)) { - saleParkingList.add(it.idMovimiento) - } - } - } - - if (!saleParkingList.isNullOrEmpty()) { - binding.splashProgress.visibility = VISIBLE - viewModel.saleParking_add( - usuario = user, - password = password, - sales = saleParkingList, - parking = parking, - "saleParking_add" - ) - } else { - "No se han encontrado líneas de venta a aparcar para ese ticket".toast(requireContext()) - } - - }*/ companion object { @@ -1200,7 +1172,7 @@ class PreSacadorFragment : password = getData(PASSWORD), saleFk = sales[position].idMovimiento, quantity = totalQuantity.toString(), - originalQuantity = sales[position].quantity.toString(), "saleMove" + originalQuantity = sales[position].quantity.toString() ) /* try { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorViewModel.kt index 308c5f64..e21340ce 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorViewModel.kt @@ -9,7 +9,9 @@ import es.verdnatura.domain.GetLoginUserCase import es.verdnatura.domain.GetPreSacadorUseCase import es.verdnatura.domain.GetSacadorControladorUserCase import es.verdnatura.domain.GetUbicadorUserCase -import es.verdnatura.presentation.base.* +import es.verdnatura.presentation.base.BaseViewModel +import es.verdnatura.presentation.base.getMessageFromAllResponse +import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO import es.verdnatura.presentation.view.feature.sacador.mapper.toDateFormat @@ -21,8 +23,7 @@ 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) @@ -102,30 +103,24 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() get() = _responseSaleupdateIsChecked - fun ticketToPrePrepare(usuario: String, password: String, ticketFk: String, sectorFk: String) - { + fun ticketToPrePrepare(usuario: String, password: String, ticketFk: String, sectorFk: String) { getPreSacadorUseCase.ticketToPrePrepare(usuario, password, ticketFk, sectorFk) .enqueue(object : - Callback> - { - override fun onFailure(call: Call>, t: Throwable) - { - d("VERDNATURA::","ha fallado") + Callback> { + override fun onFailure(call: Call>, t: Throwable) { + //d("VERDNATURA::", "ha fallado") _salesList.value = listOf() } override fun onResponse( call: Call>, response: Response> - ) - { - if (response.body() != null) - { - d("VERDNATURA::","entra con lineas") + ) { + if (response.body() != null) { + //d("VERDNATURA::", "entra con lineas") _salesList.value = response.body()?.let { it } - } else - { - d("VERDNATURA::","ES NULO") + } else { + // d("VERDNATURA::", "ES NULO") _salesList.value = listOf() } } @@ -136,63 +131,64 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() usuario: String, password: String, collectionFk: String, - sectorFk: String,callFunction:String - ) - { + sectorFk: String, callFunction: String + ) { getSacadorControladorUserCase.collectionStickerPrint( usuario, password, collectionFk, sectorFk - ).enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { + ).enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { _response.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) - ) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) - { - if (response.body() == null) - { + override fun onResponse(call: Call, response: Response) { + if (response.body() == null) { _response.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) - ) - } else - { - _response.value = ResponseItemVO(isError = false, response = response.message()!!) + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _response.value = + ResponseItemVO(isError = false, response = response.message()!!) } } }) } - fun parking(usuario: String, password: String, ticketFk: String, parking: String,callFunction:String) - { + fun parking( + usuario: String, + password: String, + ticketFk: String, + parking: String, + callFunction: String + ) { getUbicadorUserCase.shelvingPark(usuario, password, ticketFk, parking) - .enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { _response.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) - ) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) - { - if (response.body() == null) - { + override fun onResponse(call: Call, response: Response) { + if (response.body() == null) { _response.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) - ) - } else - { + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { _response.value = ResponseItemVO(isError = false, response = response.body()!!) } @@ -201,77 +197,79 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() } - fun saleParking_add(usuario: String, password: String, sales:List,parking: String,callFunction:String) - { - getUbicadorUserCase.saleParking_add(usuario, password, sales, parking) - .enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { - _responseParkingAdd.value = ResponseItemVO( - isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) - ) - } + /* fun saleParking_add(usuario: String, password: String, sales:List,parking: String,callFunction:String) + { + getUbicadorUserCase.saleParking_add(usuario, password, sales, parking) + .enqueue(object : Callback + { + override fun onFailure(call: Call, t: Throwable) + { + _responseParkingAdd.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) + ) + } - override fun onResponse(call: Call, response: Response) - { - if (response.body() == null) - { - _responseParkingAdd.value = ResponseItemVO( - isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) - ) - } else - { - _responseParkingAdd.value = - ResponseItemVO(isError = false, response = response.body()!!) - } - } - }) - } + override fun onResponse(call: Call, response: Response) + { + if (response.body() == null) + { + _responseParkingAdd.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) + ) + } else + { + _responseParkingAdd.value = + ResponseItemVO(isError = false, response = response.body()!!) + } + } + }) + }*/ fun itemPlacementSupplyAiming( usuario: String, password: String, shelvingFk: String, quantity: String, - itemFk: String,callFunction:String - ) - { + itemFk: String, callFunction: String + ) { getSacadorControladorUserCase.itemPlacementSupplyAiming( usuario, password, shelvingFk, quantity, itemFk - ).enqueue(object : - Callback> - { - override fun onFailure(call: Call>, t: Throwable) - { + ).enqueue(object : + Callback> { + override fun onFailure(call: Call>, t: Throwable) { val listError: ArrayList = ArrayList() - listError.add(PlacementSupplyVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))) + listError.add( + PlacementSupplyVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) + ) _placementSuppleyList.value = PlacementSupplyListVO(listError) } override fun onResponse( call: Call>, response: Response> - ) - { - if (response.body() != null) - { + ) { + if (response.body() != null) { _placementSuppleyList.value = response.body()?.let { PlacementSupplyListVO(it) } - } else - { + } else { val listError: ArrayList = ArrayList() listError.add( PlacementSupplyVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) - ) - ) + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + ) _placementSuppleyList.value = PlacementSupplyListVO(listError) } } @@ -283,33 +281,34 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() password: String, itemShelvingFk: String, saleFk: String, - quantity: String,callFunction:String - ) - { + quantity: String + ) { getSacadorControladorUserCase.itemShelvingSaleSupplyAdd( usuario, password, itemShelvingFk, saleFk, quantity - ).enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { - _responseItemShelvingSaleSupplyAdd.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) + ).enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _responseItemShelvingSaleSupplyAdd.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) - { - if (response.body() == null) - { + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful()) { _responseItemShelvingSaleSupplyAdd.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) - ) - } else - { - _responseItemShelvingSaleSupplyAdd.value = ResponseItemVO(isError = false, response = response.body()!!) + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _responseItemShelvingSaleSupplyAdd.value = + ResponseItemVO(isError = false, response = response.message()) } } }) @@ -322,9 +321,8 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() vOriginalQuantity: String, vStateFk: String, vIsChecked: String, - vBuyFk: String,callFunction: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{ @@ -336,55 +334,51 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() vStateFk, vIsChecked, vBuyFk - ).enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { + ).enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { _response.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) ) } - override fun onResponse(call: Call, response: Response) - { - if (response.body() == null) - { + override fun onResponse(call: Call, response: Response) { + if (response.body() == null) { _response.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) ) - } else - { + } else { _response.value = ResponseItemVO(isError = false, response = response.body()!!) } } }) } - fun getIdFromCode(usuario: String, password: String, code: String,callFunction:String) - { + fun getIdFromCode(usuario: String, password: String, code: String, callFunction: String) { getSacadorControladorUserCase.getIdFromCode(usuario, password, code) - .enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { _responseCode.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) - ) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) - { - if (response.body() == null) - { + override fun onResponse(call: Call, response: Response) { + if (response.body() == null) { _responseCode.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) - } else - { + } else { _responseCode.value = ResponseItemVO(isError = false, response = response.body()!!) } @@ -392,29 +386,28 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() }) } - fun saleTrackingDel(usuario: String, password: String, saleFk: String,callFunction:String){ + fun saleTrackingDel(usuario: String, password: String, saleFk: String, callFunction: String) { getSacadorControladorUserCase.saleTrackingDel(usuario, password, saleFk) - .enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { _response.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) - ) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) - { - if (response.body() == null) - { + override fun onResponse(call: Call, response: Response) { + if (response.body() == null) { _response.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - } else - { + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { _response.value = - ResponseItemVO(isError = false, response = response.body()!!) + ResponseItemVO(isError = false, response = response.message()) } } }) @@ -425,34 +418,34 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() password: String, saleFk: String, quantity: String, - originalQuantity: String,callFunction:String) - { + originalQuantity: String + ) { getSacadorControladorUserCase.saleMove( usuario, password, saleFk, quantity, originalQuantity - ).enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { + ).enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { _responseSaleMove.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) - ) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) - { - if (response.body() == null) - { + override fun onResponse(call: Call, response: Response) { + if (!!response.isSuccessful) { _responseSaleMove.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - } else - { - _responseSaleMove.value = ResponseItemVO(isError = false, response = response.body()!!) + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _responseSaleMove.value = + ResponseItemVO(isError = false, response = response.message()) } } }) @@ -465,8 +458,8 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() quantity: String, type: String, warehouseFk: String, - originalQuantity: String,callFunction:String) - { + originalQuantity: String, callFunction: String + ) { getSacadorControladorUserCase.collectionMissingTrash( usuario, password, @@ -475,26 +468,26 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() type, warehouseFk, originalQuantity - ).enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { + ).enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { _responseMissingTrash.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) - ) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) - { - if (response.body() == null) - { + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful) { _responseMissingTrash.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - } else - { - _responseMissingTrash.value = ResponseItemVO(isError = false, response = response.body()!!) + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _responseMissingTrash.value = + ResponseItemVO(isError = false, response = response.message()) } } }) @@ -504,34 +497,33 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() usuario: String, password: String, saleFk: String, - quantity: String,callFunction:String) - { + quantity: String, callFunction: String + ) { getSacadorControladorUserCase.collectionIncreaseQuantity( usuario, password, saleFk, quantity - ).enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { + ).enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { _responseIncQuantity.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) - ) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) - { - if (response.body() == null) - { + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful) { _responseIncQuantity.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - } else - { + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { _responseIncQuantity.value = - ResponseItemVO(isError = false, response = response.body()!!) + ResponseItemVO(isError = false, response = response.message()) } } }) @@ -542,51 +534,51 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() workerId: String, message: String, calledFunction: String - ) - { - try - { + ) { + try { getLoginUserCase.sendChekingPresence(token, workerId.toInt(), message) - .enqueue(object : Callback - { - override fun onResponse(call: Call, response: Response) - { - if (!response.isSuccessful ||response.message()=="false") - { + .enqueue(object : Callback { + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful || response.message() == "false") { _responseSalixMessage.value = ResponseItemVO( isError = true, errorMessage = "Error al enviar mensaje rocket." + getMessageFromAllResponse( - nameofFunction(this),response.message() - ) - ) + nameofFunction(this), response.message() + ) + ) //Log.i("Salix","Mensaje enviado a salix") } } - override fun onFailure(call: Call, t: Throwable) - { - _responseSalixMessage.value = ResponseItemVO( + override fun onFailure(call: Call, t: Throwable) { + _responseSalixMessage.value = ResponseItemVO( isError = true, errorMessage = "Error al enviar mensaje rocket." + getMessageFromAllResponse( - nameofFunction(this),t.message!!)) + nameofFunction(this), t.message!! + ) + ) } }) - } catch (e: Exception) - { - Log.d("VERDNATURA","error "+e.message) + } catch (e: Exception) { + Log.d("VERDNATURA", "error " + e.message) } } - fun sectorCollection_get(usuario: String, password: String,callFunction:String){ + fun sectorCollection_get(usuario: String, password: String, callFunction: String) { getPreSacadorUseCase.sectorCollection_get(usuario, password).enqueue(object : Callback> { override fun onFailure(call: Call>, t: Throwable) { val listError: ArrayList = ArrayList() - listError.add(CollectionVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))) + listError.add( + CollectionVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) + ) _collectionList.value = CollectionListVO(listError) } @@ -603,7 +595,10 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() listError.add( CollectionVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) ) ) _collectionList.value = CollectionListVO(listError) @@ -614,13 +609,24 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() }) } - fun sectorCollection_new(usuario: String, password: String, sectorFk: String,callFunction:String){ + fun sectorCollection_new( + usuario: String, + password: String, + sectorFk: String, + callFunction: String + ) { getPreSacadorUseCase.sectorCollection_new(usuario, password, sectorFk).enqueue( object : Callback { override fun onFailure(call: Call, t: Throwable) { _responseNew.value = - ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) + ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + t.message!! + ) + ) } @@ -630,23 +636,25 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() response: Response ) { - if (!response.isSuccessful){ - _responseNew.value=ResponseItemVO( + if (!response.isSuccessful) { + _responseNew.value = ResponseItemVO( isError = true, errorMessage = "Error en la llamada al añadir colección." + getMessageFromAllResponse( - nameofFunction(this),response.message() - )) - }else{ - _responseNew.value=ResponseItemVO( + nameofFunction(this), response.message() + ) + ) + } else { + _responseNew.value = ResponseItemVO( isError = false, errorMessage = "" + getMessageFromAllResponse( - nameofFunction(this),response.message() - )) + nameofFunction(this), response.message() + ) + ) } - //Log.i("Salix","Mensaje enviado a salix") + //Log.i("Salix","Mensaje enviado a salix") /*if (response.body() != null) { @@ -664,43 +672,64 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() }) } - fun sectorCollection_getSale(usuario: String, password: String, sectorCollectionFK:String,vSectorFk:String) - { - getPreSacadorUseCase.sectorCollection_getSale(usuario, password, sectorCollectionFK,vSectorFk) + fun sectorCollection_getSale( + usuario: String, + password: String, + sectorCollectionFK: String, + vSectorFk: String + ) { + getPreSacadorUseCase.sectorCollection_getSale( + usuario, + password, + sectorCollectionFK, + vSectorFk + ) .enqueue(object : - Callback> - { - override fun onFailure(call: Call>, t: Throwable) - { - d("VERDNATURA::","ha fallado") + Callback> { + override fun onFailure(call: Call>, t: Throwable) { + d("VERDNATURA::", "ha fallado") _salesList.value = listOf() } override fun onResponse( call: Call>, response: Response> - ) - { - if (response.body() != null) - { - d("VERDNATURA::","entra con lineas") + ) { + if (response.body() != null) { + d("VERDNATURA::", "entra con lineas") _salesList.value = response.body()?.let { it } - } else - { - d("VERDNATURA::","ES NULO") + } else { + d("VERDNATURA::", "ES NULO") _salesList.value = listOf() } } }) } - fun sectorCollectionSaleGroup_add(usuario: String, password: String, vSaleGroupFk: String,vSectorCollectionFk:String,callFunction:String){ - getPreSacadorUseCase.sectorCollectionSaleGroup_add(usuario, password, vSaleGroupFk,vSectorCollectionFk).enqueue( + fun sectorCollectionSaleGroup_add( + usuario: String, + password: String, + vSaleGroupFk: String, + vSectorCollectionFk: String, + callFunction: String + ) { + getPreSacadorUseCase.sectorCollectionSaleGroup_add( + usuario, + password, + vSaleGroupFk, + vSectorCollectionFk + ).enqueue( object : Callback { override fun onFailure(call: Call, t: Throwable) { _response.value = - ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) + ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + t.message!! + ) + ) } @@ -710,18 +739,20 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() response: Response ) { - if (!response.isSuccessful){ - _responseSaleGroupAdd.value=ResponseItemVO( + if (!response.isSuccessful) { + _responseSaleGroupAdd.value = ResponseItemVO( isError = true, errorMessage = "Error al añadir ticket a la colección." + getMessageFromAllResponse( - nameofFunction(this),response.message() - )) - }else{ - _responseSaleGroupAdd.value=ResponseItemVO( + nameofFunction(this), response.message() + ) + ) + } else { + _responseSaleGroupAdd.value = ResponseItemVO( isError = false, errorMessage = "" + getMessageFromAllResponse( - nameofFunction(this),response.message() - )) + nameofFunction(this), response.message() + ) + ) } @@ -730,13 +761,24 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() }) } - fun saleTracking_addPrevOK(usuario: String, password: String, vSectorCollectionFk:String,callFunction:String){ - getPreSacadorUseCase.saleTracking_addPrevOK(usuario, password,vSectorCollectionFk).enqueue( + fun saleTracking_addPrevOK( + usuario: String, + password: String, + vSectorCollectionFk: String, + callFunction: String + ) { + getPreSacadorUseCase.saleTracking_addPrevOK(usuario, password, vSectorCollectionFk).enqueue( object : Callback { override fun onFailure(call: Call, t: Throwable) { _responseSaleAddPrevOK.value = - ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) + ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + t.message!! + ) + ) } @@ -746,19 +788,21 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() response: Response ) { - if (!response.isSuccessful){ - _responseSaleAddPrevOK.value=ResponseItemVO( + if (!response.isSuccessful) { + _responseSaleAddPrevOK.value = ResponseItemVO( isError = true, errorMessage = "Error al cambiar el estado a la colección de previa." + getMessageFromAllResponse( - nameofFunction(this),response.message() - )) - }else{ - _responseSaleAddPrevOK.value=ResponseItemVO( + nameofFunction(this), response.message() + ) + ) + } else { + _responseSaleAddPrevOK.value = ResponseItemVO( isError = false, errorMessage = "" + getMessageFromAllResponse( - nameofFunction(this),response.message() - )) + nameofFunction(this), response.message() + ) + ) } @@ -767,67 +811,90 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() }) } - fun saleTracking_updateIsChecked(usuario: String, password: String, vSaleFk:String,vIsChecked:String,callFunction:String){ - getPreSacadorUseCase.saleTracking_updateIsChecked(usuario, password,vSaleFk,vIsChecked).enqueue( - object : - Callback { + fun saleTracking_updateIsChecked( + usuario: String, + password: String, + vSaleFk: String, + vIsChecked: String, + callFunction: String + ) { + getPreSacadorUseCase.saleTracking_updateIsChecked(usuario, password, vSaleFk, vIsChecked) + .enqueue( + object : + Callback { + override fun onFailure(call: Call, t: Throwable) { + _responseSaleupdateIsChecked.value = + ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + t.message!! + ) + ) + + + } + + override fun onResponse( + call: Call, + response: Response + ) { + + if (!response.isSuccessful) { + _responseSaleupdateIsChecked.value = ResponseItemVO( + isError = true, + errorMessage = "Error al cambiar el estado a la colección de previa." + getMessageFromAllResponse( + nameofFunction(this), response.message() + ) + ) + } else { + _responseSaleupdateIsChecked.value = ResponseItemVO( + isError = false, + errorMessage = "" + + getMessageFromAllResponse( + nameofFunction(this), response.message() + ) + ) + + } + + + } + }) + } + + + fun itemShelving_updateFromSale( + usuario: String, + password: String, + saleFk: String, + visible: String, + callFunction: String + ) { + getSacadorControladorUserCase.itemShelving_updateFromSale( + usuario, + password, + saleFk, + visible + ) + .enqueue(object : Callback { override fun onFailure(call: Call, t: Throwable) { - _responseSaleupdateIsChecked.value = - ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) - - - } - - override fun onResponse( - call: Call, - response: Response - ) { - - if (!response.isSuccessful){ - _responseSaleupdateIsChecked.value=ResponseItemVO( - isError = true, - errorMessage = "Error al cambiar el estado a la colección de previa." + getMessageFromAllResponse( - nameofFunction(this),response.message() - )) - }else{ - _responseSaleupdateIsChecked.value=ResponseItemVO( - isError = false, - errorMessage = "" - + getMessageFromAllResponse( - nameofFunction(this),response.message() - )) - - } - - - } - }) - } - - - fun itemShelving_updateFromSale(usuario: String, password: String, saleFk: String,visible:String,callFunction:String) - { - getSacadorControladorUserCase.itemShelving_updateFromSale(usuario, password, saleFk, visible) - .enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { _responseItemShelvingUpdate.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) ) } - override fun onResponse(call: Call, response: Response) - { - if (!response.isSuccessful ) - { + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful) { _responseItemShelvingUpdate.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) ) - } else - { + } else { _responseItemShelvingUpdate.value = ResponseItemVO(isError = false, response = response.message()!!) } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/fragment/ReposicionFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/fragment/ReposicionFragment.kt index 20d39434..8c008be6 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/fragment/ReposicionFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/fragment/ReposicionFragment.kt @@ -31,7 +31,8 @@ import es.verdnatura.presentation.view.feature.sacador.model.SaleVO class ReposicionFragment : BaseFragment( - ReposicionViewModel::class){ + ReposicionViewModel::class +) { private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null @@ -39,23 +40,23 @@ class ReposicionFragment : BaseFragment = ArrayList() + private var sales: ArrayList = ArrayList() - private var lm : LinearLayoutManager? = null + private var lm: LinearLayoutManager? = null private var saleAdapter: ReposicionAdapter? = null var mperror: MediaPlayer? = null var mpok: MediaPlayer? = null - private var storedBackPosition : Int = 0 - private var storedShelvingPosition:Int = 0 + private var storedBackPosition: Int = 0 + private var storedShelvingPosition: Int = 0 private var storedPosition: Int = 0 - private var listPlacementSupply:ArrayList = ArrayList() - private var itemShelvingFkStored : String = "" - private var placementSupplyAdapter : BarcodeAdapter? = null + private var listPlacementSupply: ArrayList = ArrayList() + private var itemShelvingFkStored: String = "" + private var placementSupplyAdapter: BarcodeAdapter? = null - private var goBack:Boolean = false - private var goBack2:Boolean = false + private var goBack: Boolean = false + private var goBack2: Boolean = false companion object { fun newInstance() = ReposicionFragment() @@ -72,7 +73,7 @@ class ReposicionFragment : BaseFragment 0){ - viewModel.itemPlacementSupplyCloseOrder(usuario = getData(USER),password = getData(PASSWORD),id = sales[0].id,quantity = sales[0].quantity.toString(),"itemPlacementSupplyCloseOrder") + if (sales.count() > 0) { + viewModel.itemPlacementSupplyCloseOrder( + usuario = getData(USER), + password = getData(PASSWORD), + id = sales[0].id, + quantity = sales[0].quantity.toString() + ) } customDialog.dismiss() }.show() - } //ESCANER ========= @@ -127,11 +138,11 @@ class ReposicionFragment : BaseFragment if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { - if (!binding.scanInput.text.toString().isNullOrEmpty()){ + if (!binding.scanInput.text.toString().isNullOrEmpty()) { - if (sales.count() > 0 && sales[0].saldo == 0){ + if (sales.count() > 0 && sales[0].saldo == 0) { "Pedido completado".toast(requireContext()) - }else{ + } else { findSale(binding.scanInput.text.toString()) } @@ -150,18 +161,23 @@ class ReposicionFragment : BaseFragment){ + private fun createSaleList(salesList: List) { binding.splashProgress.visibility = View.GONE - if (salesList.isNullOrEmpty()){ - customDialog.setTitle("Reposición").setDescription("No existen pedidos para reponer").setKoButton("Cancelar"){ - if (sales.count()>0){ - sales.clear() - saleAdapter!!.notifyDataSetChanged() - } - customDialog.dismiss() - }.show() + if (salesList.isNullOrEmpty()) { + customDialog.setTitle("Reposición").setDescription("No existen pedidos para reponer") + .setKoButton("Cancelar") { + if (sales.count() > 0) { + sales.clear() + saleAdapter!!.notifyDataSetChanged() + } + customDialog.dismiss() + }.show() binding.scanInput.visibility = View.GONE binding.btnCancelar.visibility = View.GONE - }else if(salesList.count() > 0 && salesList[0].saldo == 0){ + } else if (salesList.count() > 0 && salesList[0].saldo == 0) { "Pedido completado".toast(requireContext()) binding.scanInput.visibility = View.GONE binding.btnCancelar.visibility = View.GONE - }else{ + } else { binding.scanInput.visibility = View.VISIBLE binding.btnCancelar.visibility = View.VISIBLE @@ -239,7 +257,7 @@ class ReposicionFragment : BaseFragment @@ -261,24 +279,24 @@ class ReposicionFragment : BaseFragment if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { - if (customDialogList.getValueTwo().isNotEmpty()){ - if (checkItemScan(customDialogList.getValueTwo())){ + if (customDialogList.getValueTwo().isNotEmpty()) { + if (checkItemScan(customDialogList.getValueTwo())) { onQuantityOfShelvingSelected(itemShelvingFk) mpok?.start() customDialogList.dismiss() - }else{ + } else { itemShelvingFkStored = itemShelvingFk binding.splashProgress.visibility = View.VISIBLE viewModel.getIdFromCode( - usuario = getData(USER), + usuario = getData(USER), password = getData(PASSWORD), - code = customDialogList.getValueTwo(),"barcodeToItem" + code = customDialogList.getValueTwo(), "barcodeToItem" ) customDialogList.dismiss() } - }else{ + } else { "Escanea item para validar".toast(requireContext()) } scanRequest() @@ -426,46 +449,52 @@ class ReposicionFragment : BaseFragment = ArrayList() @@ -489,52 +518,59 @@ class ReposicionFragment : BaseFragment pasillerosItemClickListener?.onPasillerosItemClickListener( + PasillerosItemVO(title = "Parking"), + "" + ) + } - when (item){ - iconParking.drawable->pasillerosItemClickListener?.onPasillerosItemClickListener(PasillerosItemVO(title = "Parking"),"") } - - } - }) - binding.mainToolbar.toolbarIcons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) + }) + binding.mainToolbar.toolbarIcons.layoutManager = + LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) } - private fun scanRequest(){ + private fun scanRequest() { binding.scanInput.requestFocus() hideKeyboards() } - private fun checkItemScan(valueToCheck:String):Boolean{ + private fun checkItemScan(valueToCheck: String): Boolean { val saleToCheck = sales[storedPosition] return saleToCheck.itemFk == valueToCheck } - private fun showErrorMessage(text:String){ - customDialog.setTitle("Error al marcar la linea").setDescription(text).setKoButton("Cerrar"){ - customDialog.dismiss() - }.show() + private fun showErrorMessage(text: String) { + customDialog.setTitle("Error al marcar la linea").setDescription(text) + .setKoButton("Cerrar") { + customDialog.dismiss() + }.show() } - private fun showScanner(index:Int, sale:PreSacadorItemVO){ - customDialogInput.setTitle(""+sale.itemFk).setDescription("Escanea el carro para el item seleccionado").setOkButton("Aceptar"){ + private fun showScanner(index: Int, sale: PreSacadorItemVO) { + customDialogInput.setTitle("" + sale.itemFk) + .setDescription("Escanea el carro para el item seleccionado").setOkButton("Aceptar") { if (!customDialogInput.getValue().isNullOrEmpty()) { - findSale(customDialogInput.getValue(),index) + findSale(customDialogInput.getValue(), index) } customDialogInput.setValue("") scanRequest() customDialogInput.dismiss() hideKeyboards() - }.setKoButton("Cancelar"){ + }.setKoButton("Cancelar") { customDialogInput.dismiss() }.setValue("").show() customDialogInput.getEditText().requestFocus() customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event -> if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { if (!customDialogInput.getValue().isNullOrEmpty()) { - findSale(customDialogInput.getValue(),index) + findSale(customDialogInput.getValue(), index) } customDialogInput.setValue("") scanRequest() @@ -548,31 +584,32 @@ class ReposicionFragment : BaseFragment>() } val salesList: LiveData> @@ -43,111 +44,211 @@ class ReposicionViewModel(context: Context) : BaseViewModel() { val responseCode: LiveData get() = _responseCode - fun itemPlacementSupplyGetOrder(usuario:String,password:String,sectorFk:String,callFunction:String){ - getPreSacadorUseCase.itemPlacementSupplyGetOrder(usuario,password,sectorFk).enqueue(object : - Callback> { - override fun onFailure(call: Call>, t: Throwable) { - _salesList.value = listOf() - } - override fun onResponse( - call: Call>, - response: Response> - ) { - if (response.body() != null){ - _salesList.value = response.body()?.let { it } - }else{ + fun itemPlacementSupplyGetOrder( + usuario: String, + password: String, + sectorFk: String, + callFunction: String + ) { + getPreSacadorUseCase.itemPlacementSupplyGetOrder(usuario, password, sectorFk) + .enqueue(object : + Callback> { + override fun onFailure(call: Call>, t: Throwable) { _salesList.value = listOf() } - } - }) - } - fun parking(usuario: String,password: String,ticketFk: String,parking:String,callFunction:String){ - getUbicadorUserCase.shelvingPark(usuario,password,ticketFk,parking).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) - } - - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) + override fun onResponse( + call: Call>, + response: Response> + ) { + if (response.body() != null) { + _salesList.value = response.body()?.let { it } + } else { + _salesList.value = listOf() + } } - } - }) + }) } - fun itemPlacementSupplyAiming(usuario:String,password:String,shelvingFk:String,quantity:String,itemFk:String,callFunction:String){ - getSacadorControladorUserCase.itemPlacementSupplyAiming(usuario,password,shelvingFk,quantity,itemFk).enqueue(object : + fun parking( + usuario: String, + password: String, + ticketFk: String, + parking: String, + callFunction: String + ) { + getUbicadorUserCase.shelvingPark(usuario, password, ticketFk, parking) + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) + } + + override fun onResponse(call: Call, response: Response) { + if (response.body() == null) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _response.value = + ResponseItemVO(isError = false, response = response.body()!!) + } + } + }) + } + + fun itemPlacementSupplyAiming( + usuario: String, + password: String, + shelvingFk: String, + quantity: String, + itemFk: String, + callFunction: String + ) { + getSacadorControladorUserCase.itemPlacementSupplyAiming( + usuario, + password, + shelvingFk, + quantity, + itemFk + ).enqueue(object : Callback> { override fun onFailure(call: Call>, t: Throwable) { - val listError:ArrayList = ArrayList() - listError.add(PlacementSupplyVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))) + val listError: ArrayList = ArrayList() + listError.add( + PlacementSupplyVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) + ) _placementSuppleyList.value = PlacementSupplyListVO(listError) } + override fun onResponse( call: Call>, response: Response> ) { - if (response.body() != null){ + if (response.body() != null) { _placementSuppleyList.value = response.body()?.let { PlacementSupplyListVO(it) } - }else{ - val listError:ArrayList = ArrayList() - listError.add(PlacementSupplyVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))) + } else { + val listError: ArrayList = ArrayList() + listError.add( + PlacementSupplyVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + ) _placementSuppleyList.value = PlacementSupplyListVO(listError) } } }) } - fun getIdFromCode(usuario:String,password:String,code: String,callFunction:String){ - getSacadorControladorUserCase.getIdFromCode(usuario,password,code).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _responseCode.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) + fun getIdFromCode(usuario: String, password: String, code: String, callFunction: String) { + getSacadorControladorUserCase.getIdFromCode(usuario, password, code) + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _responseCode.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) + } + + override fun onResponse(call: Call, response: Response) { + if (response.body() == null) { + _responseCode.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _responseCode.value = + ResponseItemVO(isError = false, response = response.body()!!) + } + } + }) + } + + + fun itemShelvingPlacementSupplyAdd( + usuario: String, + password: String, + itemShelvingFk: String, + itemPlacementSupplyFk: String, + quantity: String, + callFunction: String + ) { + getSacadorControladorUserCase.itemShelvingPlacementSupplyAdd( + usuario, + password, + itemShelvingFk, + itemPlacementSupplyFk, + quantity + ).enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _responseCode.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _responseCode.value = ResponseItemVO(isError = false,response = response.body()!!) + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _response.value = ResponseItemVO(isError = false, response = response.message()) } } }) } - - fun itemShelvingPlacementSupplyAdd(usuario:String,password:String,itemShelvingFk:String,itemPlacementSupplyFk:String,quantity:String,callFunction:String){ - getSacadorControladorUserCase.itemShelvingPlacementSupplyAdd(usuario,password,itemShelvingFk,itemPlacementSupplyFk,quantity).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) - } - - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) + fun itemPlacementSupplyCloseOrder( + usuario: String, + password: String, + id: String, + quantity: String + ) { + getPreSacadorUseCase.itemPlacementSupplyCloseOrder(usuario, password, id, quantity) + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _responseClose.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - } - }) - } - fun itemPlacementSupplyCloseOrder(usuario:String,password:String,id:String,quantity:String,callFunction:String){ - getPreSacadorUseCase.itemPlacementSupplyCloseOrder(usuario,password,id,quantity).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _responseClose.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) - } - - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _responseClose.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _responseClose.value = ResponseItemVO(isError = false,response = response.body()!!) + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful()) { + _responseClose.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _responseClose.value = + ResponseItemVO(isError = false, response = response.message()) + } } - } - }) + }) } } \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorFragment.kt index 8056693a..9f6c1f27 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorFragment.kt @@ -19,6 +19,7 @@ import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.feature.sacador.adapter.CollectionAdapter import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO import es.verdnatura.presentation.view.feature.smarttag.sacador.fragment.AssociateSmartTagsFragment +import java.lang.Boolean.TRUE class SacadorFragment : @@ -31,6 +32,7 @@ class SacadorFragment : private var collectionsList: ArrayList = ArrayList() private var adapter: CollectionAdapter? = null private var resultTagMode:String? = "" + private var getCollections=false companion object { @@ -48,17 +50,19 @@ class SacadorFragment : override fun init() { customDialog = CustomDialog(requireContext()) - binding.splashProgress.visibility = View.VISIBLE + binding.splashProgress.visibility = View.GONE binding.splashProgressTwo.visibility = View.GONE binding.mainToolbar.toolbarTitle.text = getString(R.string.getcollection) setToolBar() setEvents() - + // viewModel.smartTagInsertTicket("568672") /*var working_in_test=false //sergio: Ok en app if (!working_in_test) {*/ - viewModel.collectionGetSalix(token = getData(TOKEN)) + if (getCollections){ + viewModel.collectionGetSalix(token = getData(TOKEN)) + } /* }else{ viewModel.collectionGet( getData(USER), getData(PASSWORD),"collection_get") @@ -73,13 +77,17 @@ class SacadorFragment : override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - // Use the Kotlin extension in the fragment-ktx artifact setFragmentResultListener("requestKey") { requestKey, bundle -> val result = bundle.getString("tagMode") resultTagMode=result Log.d("VERDNATURA::","el result es "+result) + if (result.equals("complete")){ + getCollections=TRUE + } + if (result.equals("complete") && getData(TAGSTYPE).equals("SmartTags")) { + Log.d("VERDNATURA::","Entramos a collectionNew_SMARTGS"+result) viewModel.collection_new_smarttag(getData(USER), getData(PASSWORD), getData(SECTORFK), getData(WAGON), getData(TAGSTYPE),"collection_new_wagon") @@ -98,10 +106,6 @@ class SacadorFragment : val listIcons: ArrayList = ArrayList() - /*val iconAdd: Drawable = - resources.getDrawable(R.drawable.ic_add_black_24dp, resources.newTheme()) - val iconVehicleIn: Drawable = resources.getDrawable(R.drawable.car, resources.newTheme())*/ - val iconAdd = ImageView(context) iconAdd.setImageResource(R.drawable.ic_add_black_24dp) val iconVehicleIn = ImageView(context) @@ -228,6 +232,8 @@ class SacadorFragment : } else { ma.messageWithSound(it.errorMessage,false,false) + Log.d("VERDNATURA::","La colec es "+it.response) + viewModel.smartTagInsertTicket(it.response) goBack = false} }) @@ -240,6 +246,7 @@ class SacadorFragment : } else { ma.messageWithSound(it.errorMessage,false,false) + viewModel.collectionGetSalix(getData(TOKEN)) } goBack = false} }) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorViewModel.kt index 4d32eddc..5e1e863c 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorViewModel.kt @@ -160,7 +160,8 @@ class SacadorViewModel(context: Context) : BaseViewModel() { object : Callback { override fun onFailure(call: Call, t: Throwable) { - _responseCollectionSmarttag.value = + // _response.value= + _responseCollectionSmarttag.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) @@ -171,11 +172,14 @@ class SacadorViewModel(context: Context) : BaseViewModel() { response: Response ) { if (response.body() != null) { - _responseCollectionSmarttag.value = + + Log.d("VERDNATURA::","LA coleccion de collectionNew_SMARTGS es "+response.body()) + _responseCollectionSmarttag.value = ResponseItemVO(isError = false, response = response.body()!!) } else { - _responseCollectionSmarttag.value = ResponseItemVO( + _responseCollectionSmarttag.value = + ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) ) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/transferencia/fragment/TransferenciaViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/transferencia/fragment/TransferenciaViewModel.kt index e59ce455..51222d94 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/transferencia/fragment/TransferenciaViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/transferencia/fragment/TransferenciaViewModel.kt @@ -20,15 +20,15 @@ class TransferenciaViewModel(context: Context) : BaseViewModel() { fun itemShelvingTransfer(usuario:String,password:String,itemFk:String,shelvingFk:String){ getUbicadorUserCase.itemShelvingTransfer(usuario,password,itemFk,shelvingFk).enqueue(object : - Callback { - override fun onFailure(call: Call, t: Throwable) { + Callback { + override fun onFailure(call: Call, t: Throwable) { _response.value = ResponseItemVO(isError = true,errorMessage ="Error en llamada itemShelvingTransfer."+t.message!!) } - override fun onResponse(call: Call, response: Response) { + override fun onResponse(call: Call, response: Response) { if (response.body() == null){ _response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelvingTransfer") }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) + _response.value = ResponseItemVO(isError = false,response = response.message()!!) } } }) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemFragment.kt index 31d013a7..995bfa12 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemFragment.kt @@ -104,9 +104,6 @@ class AutomaticAddItemFragment( binding.splashProgress.visibility = View.GONE if (it.isError){ ma.messageWithSound(it.errorMessage,true,false) - /*customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ - customDialog.dismiss() - }.show()*/ }else{ requireActivity().onBackPressed() } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemViewModel.kt index fa754da5..580d5eba 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemViewModel.kt @@ -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.getMessageFromAllResponse +import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.common.ResponseItemVO import retrofit2.Call import retrofit2.Callback @@ -21,16 +23,18 @@ class AutomaticAddItemViewModel (context: Context): BaseViewModel() { fun itemShelvingMake_multi(usuario:String,password:String,shelving:String,items:List,warehouse:String){ getUbicadorUserCase.itemShelvingMake_multi(usuario,password,shelving,items,warehouse).enqueue(object : - Callback { - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage ="Error al guardar items itemShelvingMake."+t.message!!) + Callback { + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse( + nameofFunction(this),t.message!!) + ) } - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelvingMake multiple") + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful){ + _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()!!)) }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) + _response.value = ResponseItemVO(isError = false,response = response.message()!!) } } 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 9cd218df..96e47352 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 @@ -1,7 +1,6 @@ package es.verdnatura.presentation.view.feature.ubicador.fragment import android.content.Context -import android.content.SharedPreferences import android.graphics.drawable.Drawable import android.media.MediaPlayer import android.os.Build @@ -73,7 +72,7 @@ class UbicadorFragment( if (!shelvingFk.isNullOrEmpty()) { binding.splashProgress.visibility = View.VISIBLE binding.mainToolbar.toolbarTitle.text = shelvingFk - viewModel.itemShelvingList( getData(USER), getData(PASSWORD), shelvingFk, "itemShelvingList") + viewModel.itemShelvingList(getData(USER), getData(PASSWORD), shelvingFk) } super.init() } @@ -99,7 +98,7 @@ class UbicadorFragment( if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { iconReload.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp) - iconAdd.tooltipText = "Añade item al carro" + iconAdd.tooltipText = "Añade item al carro" } listIcons.add(iconAdd) listIcons.add(iconReload) @@ -114,8 +113,7 @@ class UbicadorFragment( viewModel.itemShelvingList( getData(USER), getData(PASSWORD), - shelvingFk, - "itemShelvingList" + shelvingFk ) } } @@ -148,8 +146,7 @@ class UbicadorFragment( viewModel.itemShelvingList( getData(USER), getData(PASSWORD), - binding.editMatricula.text.toString(), - "itemShelvingList" + binding.editMatricula.text.toString() ) } @@ -168,8 +165,7 @@ class UbicadorFragment( getData(USER), getData(PASSWORD), binding.editPrioridad.text.toString(), - shelvingFk, - "shelvingPriority_update" + shelvingFk ) } @@ -246,8 +242,7 @@ class UbicadorFragment( getData(USER), getData(PASSWORD), shelvingFk, - customDialogInput.getValue(), - "shelvingChange" + customDialogInput.getValue() ) shelvingFk = customDialogInput.getValue() binding.mainToolbar.toolbarTitle.text = @@ -267,8 +262,7 @@ class UbicadorFragment( getData(USER), getData(PASSWORD), shelvingFk, - customDialogInput.getValue(), - "shelvingChange" + customDialogInput.getValue() ) shelvingFk = customDialogInput.getValue() binding.mainToolbar.toolbarTitle.text = @@ -285,19 +279,21 @@ class UbicadorFragment( binding.deleteImg.setOnClickListener { customDialog.setTitle("Vaciar carro") .setDescription("Esta operación no se puede rectificar.").setOkButton("Vaciar") { - viewModel.clearShelvingList(getData(USER), - getData(PASSWORD), shelvingFk, "clearShelvingList") - listItems.forEach { - it.stickers = "0" - it.visible = "0" - } - if (adapter != null) { - adapter!!.notifyDataSetChanged() - } - customDialog.dismiss() - }.setKoButton("Cancelar") { - customDialog.dismiss() - }.show() + viewModel.clearShelvingList( + getData(USER), + getData(PASSWORD), shelvingFk + ) + listItems.forEach { + it.stickers = "0" + it.visible = "0" + } + if (adapter != null) { + adapter!!.notifyDataSetChanged() + } + customDialog.dismiss() + }.setKoButton("Cancelar") { + customDialog.dismiss() + }.show() } @@ -306,14 +302,16 @@ class UbicadorFragment( private fun setTooltips() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - binding.editImg.tooltipText="Permite cambiar la matrícula al carro" - binding.deleteImg.tooltipText="Borra todos los items del carro" - binding.editPrioridad.tooltipText="Cambia la prioridad de los items del carro. Cuanto más alta antes cogerán los sacadores." - binding.parkingImg.tooltipText="Permite aparcar el carro" - binding.automaticImg.tooltipText="Permite añadir items al carro de manera continuada. No uno a uno" + binding.editImg.tooltipText = "Permite cambiar la matrícula al carro" + binding.deleteImg.tooltipText = "Borra todos los items del carro" + binding.editPrioridad.tooltipText = + "Cambia la prioridad de los items del carro. Cuanto más alta antes cogerán los sacadores." + binding.parkingImg.tooltipText = "Permite aparcar el carro" + binding.automaticImg.tooltipText = + "Permite añadir items al carro de manera continuada. No uno a uno" } - } + } override fun observeViewModel() { with(viewModel) { @@ -376,39 +374,44 @@ class UbicadorFragment( response.observe(viewLifecycleOwner, Observer { - if (it.isError) { - ma.messageWithSound(it.errorMessage,it.isError,false) + if (it.isError) { + ma.messageWithSound(it.errorMessage, it.isError, false) - /* mperror!!.start() - customDialog.setTitle("Error").setDescription(it.errorMessage) - .setOkButton("Cerrar") { - customDialog.dismiss() - }.show()*/ + /* mperror!!.start() + customDialog.setTitle("Error").setDescription(it.errorMessage) + .setOkButton("Cerrar") { + customDialog.dismiss() + }.show()*/ } }) responsepriority.observe(viewLifecycleOwner, Observer { ma.messageWithSound( - if (it.isError) it.errorMessage else{it.response},it.isError,true) + if (it.isError) it.errorMessage else { + it.response + }, it.isError, true + ) - /* if (it.isError) { - mperror!!.start() - customDialog.setTitle("Error").setDescription(it.errorMessage) - .setOkButton("Cerrar") { - customDialog.dismiss() - }.show() - } else { - (it.response).toast(requireContext()) - }*/ + /* if (it.isError) { + mperror!!.start() + customDialog.setTitle("Error").setDescription(it.errorMessage) + .setOkButton("Cerrar") { + customDialog.dismiss() + }.show() + } else { + (it.response).toast(requireContext()) + }*/ }) responseMake.observe(viewLifecycleOwner, Observer { if (!shelvingFk.isNullOrEmpty()) { binding.splashProgress.visibility = View.VISIBLE binding.mainToolbar.toolbarTitle.text = shelvingFk - viewModel.itemShelvingList(getData(USER), - getData(PASSWORD), shelvingFk, "itemShelvingList") + viewModel.itemShelvingList( + getData(USER), + getData(PASSWORD), shelvingFk + ) } }) } @@ -442,8 +445,8 @@ class UbicadorFragment( customDialogUbicador.getGroupingValue() ) }.setKoButton("Cerrar") { - customDialogUbicador.dismiss() - }.show() + customDialogUbicador.dismiss() + }.show() customDialogUbicador.getEditItem().requestFocus() ma.hideKeyboard(customDialogUbicador.getEditItem()) @@ -576,7 +579,6 @@ class UbicadorFragment( getData(WAREHOUSEFK), "1", itemShelvingFk, - "itemShelvingMakeEdit", groupingPack ) changeOfflineValue( @@ -609,7 +611,6 @@ class UbicadorFragment( getData(WAREHOUSEFK), "1", itemShelvingFk, - "itemShelvingMakeEdit", groupingPack ) changeOfflineValue( @@ -679,8 +680,7 @@ class UbicadorFragment( getData(USER), getData(PASSWORD), item.id, - customDialogInput.getValue(), - "itemShelvingTransfer" + customDialogInput.getValue() ) listItems.remove(item) adapter!!.notifyDataSetChanged() @@ -691,8 +691,8 @@ class UbicadorFragment( }.setKoButton("Cancelar") { - customDialogInput.dismiss() - }.show() + customDialogInput.dismiss() + }.show() customDialogInput.getEditText().requestFocus() ma.hideKeyboard(customDialogInput.getEditText()) customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event -> @@ -701,8 +701,7 @@ class UbicadorFragment( getData(USER), getData(PASSWORD), item.id, - customDialogInput.getValue(), - "itemShelvingTransfer" + customDialogInput.getValue() ) listItems.remove(item) adapter!!.notifyDataSetChanged() @@ -713,22 +712,24 @@ class UbicadorFragment( } customDialogTwoButtons.dismiss() }.setOkButtonTwo("Eliminar") { - customDialog.setTitle("Confirmar") - .setDescription("Confirmas eliminar el artículo: " + item.item + "?") - .setOkButton("Eliminar") { - listItems.remove(item) - adapter!!.notifyDataSetChanged() - viewModel.itemShelvingDelete(getData(USER), - getData(PASSWORD), item.id, "itemShelvingDelete") - customDialogTwoButtons.dismiss() - customDialog.dismiss() - }.setKoButton("Cancelar") { - customDialog.dismiss() + customDialog.setTitle("Confirmar") + .setDescription("Confirmas eliminar el artículo: " + item.item + "?") + .setOkButton("Eliminar") { + listItems.remove(item) + adapter!!.notifyDataSetChanged() + viewModel.itemShelvingDelete( + getData(USER), + getData(PASSWORD), item.id + ) + customDialogTwoButtons.dismiss() + customDialog.dismiss() + }.setKoButton("Cancelar") { + customDialog.dismiss() + customDialogTwoButtons.dismiss() + }.show() + + }.setKoButton("Cancelar") { customDialogTwoButtons.dismiss() }.show() - - }.setKoButton("Cancelar") { - customDialogTwoButtons.dismiss() - }.show() } } \ No newline at end of file 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 73108ead..e41ae6f6 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 @@ -41,68 +41,131 @@ class UbicadorViewModel(context: Context) : BaseViewModel() { val loadShelvingList = Transformations.map(_shelvingList) { Event(it) } - fun itemShelvingList(usuario:String,password:String,vShelvingFk:String,callFunction:String){ - getUbicadorUserCase.itemShelvingList(usuario,password,vShelvingFk.uppercase()).enqueue(object : - Callback> { - override fun onFailure(call: Call>, t: Throwable) { - val listError:ArrayList = ArrayList() - listError.add(ItemUbicadorVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))) - _shelvingList.value = ItemUbicadorListVO(listError) - } - - override fun onResponse( - call: Call>, - response: Response> - ) { - if (response.body() != null){ - _shelvingList.value = response.body()?.let { ItemUbicadorListVO(it) } - }else{ - val listError:ArrayList = ArrayList() - listError.add(ItemUbicadorVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))) + fun itemShelvingList( + usuario: String, + password: String, + vShelvingFk: String + ) { + getUbicadorUserCase.itemShelvingList(usuario, password, vShelvingFk.uppercase()) + .enqueue(object : + Callback> { + override fun onFailure(call: Call>, t: Throwable) { + val listError: ArrayList = ArrayList() + listError.add( + ItemUbicadorVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + t.message!! + ) + ) + ) _shelvingList.value = ItemUbicadorListVO(listError) } - } - }) + override fun onResponse( + call: Call>, + response: Response> + ) { + if (response.body() != null) { + _shelvingList.value = response.body()?.let { ItemUbicadorListVO(it) } + } else { + val listError: ArrayList = ArrayList() + listError.add( + ItemUbicadorVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + ) + _shelvingList.value = ItemUbicadorListVO(listError) + } + } + + }) } - fun shelvingPriorityUpdate(usuario:String,password:String,priority:String,shelving:String,callFunction:String){ - getUbicadorUserCase.shelvingPriorityUpdate(usuario,password,priority,shelving).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _responsepriority.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) - } + fun shelvingPriorityUpdate( + usuario: String, + password: String, + priority: String, + shelving: String - override fun onResponse(call: Call, response: Response) { + ) { + getUbicadorUserCase.shelvingPriorityUpdate(usuario, password, priority, shelving) + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _responsepriority.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) + } - if (!response.isSuccessful){ - _responsepriority.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _responsepriority.value = ResponseItemVO(isError = false,response = "Prioridad modificada") - } + override fun onResponse(call: Call, response: Response) { - /*if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) - }*/ + if (!response.isSuccessful) { + _responsepriority.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _responsepriority.value = + ResponseItemVO(isError = false, response = "Prioridad modificada") + } - } + } - }) + }) } - fun itemShelvingMake(usuario:String,password:String,shelving:String,item:String,deep:String,quantity:String,packing:String,warehouse:String,level:String,callFunction:String,grouping: String){ - getUbicadorUserCase.itemShelvingMake(usuario,password,shelving,item,quantity,packing,warehouse,grouping).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) + fun itemShelvingMake( + usuario: String, + password: String, + shelving: String, + item: String, + deep: String, + quantity: String, + packing: String, + warehouse: String, + level: String, + callFunction: String, + grouping: String + ) { + getUbicadorUserCase.itemShelvingMake( + usuario, + password, + shelving, + item, + quantity, + packing, + warehouse, + grouping + ).enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _responseMake.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _responseMake.value = ResponseItemVO(isError = false,response = response.body()!!) + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful) { + _responseMake.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _responseMake.value = + ResponseItemVO(isError = false, response = response.message()!!) } } @@ -110,17 +173,51 @@ 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,callFunction:String,grouping:String){ - getUbicadorUserCase.itemShelvingMakeEdit(usuario,password,shelving,item,deep,quantity,packing,warehouse,level,itemShelvingFk,grouping).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) + fun itemShelvingMakeEdit( + usuario: String, + password: String, + shelving: String, + item: String, + deep: String, + quantity: String, + packing: String, + warehouse: String, + level: String, + itemShelvingFk: String, + grouping: String + ) { + getUbicadorUserCase.itemShelvingMakeEdit( + usuario, + password, + shelving, + item, + deep, + quantity, + packing, + warehouse, + level, + itemShelvingFk, + grouping + ).enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _responseMake.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _responseMake.value = ResponseItemVO(isError = false,response = response.body()!!) + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful) { + _responseMake.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _responseMake.value = + ResponseItemVO(isError = false, response = response.message()!!) } } @@ -128,79 +225,161 @@ class UbicadorViewModel(context: Context) : BaseViewModel() { }) } - fun shelvingPark(usuario:String,password:String,shelving:String,parking:String,callFunction:String){ - getUbicadorUserCase.shelvingPark(usuario,password,shelving,parking).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) - } - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) + fun shelvingPark( + usuario: String, + password: String, + shelving: String, + parking: String, + callFunction: String + ) { + getUbicadorUserCase.shelvingPark(usuario, password, shelving, parking) + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - } - }) + + override fun onResponse(call: Call, response: Response) { + if (response.body() == null) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _response.value = + ResponseItemVO(isError = false, response = response.body()!!) + } + } + }) } - fun shelvingChange(usuario:String,password:String,origen:String,destino:String,callFunction:String){ - getUbicadorUserCase.shelvingChange(usuario,password,origen,destino).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) - } - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) + fun shelvingChange( + usuario: String, + password: String, + origen: String, + destino: String + ) { + getUbicadorUserCase.shelvingChange(usuario, password, origen, destino) + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - } - }) + + override fun onResponse(call: Call, response: Response) { + if (response.body() == null) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _response.value = + ResponseItemVO(isError = false, response = response.message()!!) + } + } + }) } - fun clearShelvingList(usuario:String,password:String,shelvingFk:String,callFunction:String){ - getUbicadorUserCase.clearShelvingList(usuario,password,shelvingFk).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) - } - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) + fun clearShelvingList( + usuario: String, + password: String, + shelvingFk: String + + ) { + getUbicadorUserCase.clearShelvingList(usuario, password, shelvingFk) + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - } - }) + + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _response.value = + ResponseItemVO(isError = false, response = response.message()) + } + } + }) } - fun itemShelvingTransfer(usuario:String,password:String,itemFk:String,shelvingFk:String,callFunction:String){ - getUbicadorUserCase.itemShelvingTransfer(usuario,password,itemFk,shelvingFk).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) - } - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) + fun itemShelvingTransfer( + usuario: String, + password: String, + itemFk: String, + shelvingFk: String + + ) { + getUbicadorUserCase.itemShelvingTransfer(usuario, password, itemFk, shelvingFk) + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - } - }) + + override fun onResponse(call: Call, response: Response) { + if (response.body() == null) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _response.value = + ResponseItemVO(isError = false, response = response.message()!!) + } + } + }) } - fun itemShelvingDelete(usuario:String,password:String,itemFk:String,callFunction:String){ - getUbicadorUserCase.itemShelvingDelete(usuario,password,itemFk).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) - } - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) + fun itemShelvingDelete(usuario: String, password: String, itemFk: String) { + getUbicadorUserCase.itemShelvingDelete(usuario, password, itemFk) + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) } - } - }) + + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _response.value = + ResponseItemVO(isError = false, response = response.message()) + } + } + }) } } diff --git a/app/src/main/res/layout/fragment_pre_sacador.xml b/app/src/main/res/layout/fragment_pre_sacador.xml index 9b412623..20606d49 100644 --- a/app/src/main/res/layout/fragment_pre_sacador.xml +++ b/app/src/main/res/layout/fragment_pre_sacador.xml @@ -12,20 +12,19 @@ + app:layout_constraintTop_toTopOf="@+id/main_toolbar"/> @@ -33,6 +32,7 @@ android:id="@+id/collection_swipe" android:layout_width="0dp" android:layout_height="0dp" + android:layout_marginTop="5dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/layout/fragment_shelvinglog.xml b/app/src/main/res/layout/fragment_shelvinglog.xml index 78f0c25d..86876b5e 100644 --- a/app/src/main/res/layout/fragment_shelvinglog.xml +++ b/app/src/main/res/layout/fragment_shelvinglog.xml @@ -35,9 +35,9 @@ @@ -250,7 +250,7 @@ android:paddingRight="10dp" android:text="@{sale.quantity}" android:textColor="@color/verdnatura_white" - android:textSize="@dimen/body2" + android:textSize="@dimen/body1" android:textStyle="bold" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index d0c2405d..c510aa97 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -163,4 +163,5 @@ Selecciona impresora Ubicación de reclamación Reclamaciones + Escáner paletizar diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index bf6ecb21..3e1aaadd 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -135,6 +135,7 @@ Expedtion state Buffer Management Pallet make + Scan pallet Buffer empty Buffer fill Buffer Acumulate