Version 8.4Beta, return "finish" y apptesters

This commit is contained in:
Sergio De la torre 2022-05-24 15:54:53 +02:00
parent 6db39eb1da
commit 03f825ad3e
58 changed files with 2422 additions and 1867 deletions

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\sergiodt\.android\avd\Pixel_3a_API_30_x86.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2022-05-20T11:37:38.376422500Z" />
</component>
</project>

View File

@ -181,9 +181,9 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_itemshelvinglog.xml" value="0.28169014084507044" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_itemshelvinglog.xml" value="0.28169014084507044" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_login.xml" value="0.22" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_login.xml" value="0.22" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_paletizador_menu.xml" value="0.13829787234042554" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_paletizador_menu.xml" value="0.13829787234042554" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_parking.xml" value="0.4161849710982659" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_parking.xml" value="0.16666666666666666" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_pasillero.xml" value="0.21" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_pasillero.xml" value="0.21" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_pre_sacador.xml" value="0.16666666666666666" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_pre_sacador.xml" value="0.3333333333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_qr.xml" value="0.19882246376811594" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_qr.xml" value="0.19882246376811594" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_sacador.xml" value="0.12952898550724637" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_sacador.xml" value="0.12952898550724637" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_sacador_associatesmarttag.xml" value="0.22" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_sacador_associatesmarttag.xml" value="0.22" />

View File

@ -14,13 +14,10 @@ android {
applicationId "es.verdnatura" applicationId "es.verdnatura"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 30 targetSdkVersion 30
versionCode 116 versionCode 117
versionName "8.3" //versionCode 116: versionCode 116: cambios finales en return, diseño grafico... versionName "8.4Beta" //versionCode 117: return i workerAppTester
//versionName "8.2" //versionCode 115: icons //versionName "8.3" //versionCode 116: versionCode 116: cambios finales en return, diseño grafico...
//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
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }

View File

@ -11,8 +11,8 @@
"type": "SINGLE", "type": "SINGLE",
"filters": [], "filters": [],
"attributes": [], "attributes": [],
"versionCode": 116, "versionCode": 117,
"versionName": "8.3", "versionName": "8.4Beta",
"outputFile": "app-release.apk" "outputFile": "app-release.apk"
} }
], ],

View File

@ -6,7 +6,7 @@ import retrofit2.converter.gson.GsonConverterFactory
class ApiSalixUtils { class ApiSalixUtils {
companion object { companion object {
//const val BASE_URL:String = "http://192.168.1.155:9009/" //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/" const val BASE_URL: String = "https://salix.verdnatura.es/api/"
fun getApiService(): SalixService { fun getApiService(): SalixService {
val salixRetrofit = Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory( val salixRetrofit = Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(

View File

@ -66,7 +66,7 @@ class GetInventaryUserCase(context: Context) : RestClient(context) {
password: String, password: String,
itemFk: String, itemFk: String,
warehouseFk: String warehouseFk: String
): Call<String> { ): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(itemFk) params.add(itemFk)
params.add(warehouseFk) params.add(warehouseFk)

View File

@ -81,14 +81,15 @@ class GetItemCardUserCase(context: Context) : RestClient(context) {
warehouseFk: String, warehouseFk: String,
newVisible: String, newVisible: String,
isTrash: String isTrash: String
): Call<String> { ): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(itemFk) params.add(itemFk)
params.add(warehouseFk) params.add(warehouseFk)
params.add(newVisible) params.add(newVisible)
params.add(isTrash) 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!!.itemStockUpdate("json","1",usuario,password,"application/json",params = params)
return restClient!!.itemTrash( return restClient!!.itemTrash(
"json", "json",
@ -107,7 +108,7 @@ class GetItemCardUserCase(context: Context) : RestClient(context) {
warehouseFk: String, warehouseFk: String,
newVisible: String, newVisible: String,
isTrash: String isTrash: String
): Call<String> { ): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(itemFk) params.add(itemFk)
params.add(warehouseFk) params.add(warehouseFk)
@ -123,7 +124,7 @@ class GetItemCardUserCase(context: Context) : RestClient(context) {
) )
} }
fun itemPlacementSave( /* fun itemPlacementSave(
usuario: String, usuario: String,
password: String, password: String,
itemFk: String, itemFk: String,
@ -142,7 +143,7 @@ class GetItemCardUserCase(context: Context) : RestClient(context) {
"application/json", "application/json",
params = params params = params
) )
} }*/
fun updateGrouping( fun updateGrouping(
usuario: String, usuario: String,
@ -185,7 +186,7 @@ class GetItemCardUserCase(context: Context) : RestClient(context) {
params = params params = params
) )
} }
/*
fun updatePackingType( fun updatePackingType(
usuario: String, usuario: String,
password: String, password: String,
@ -203,7 +204,7 @@ class GetItemCardUserCase(context: Context) : RestClient(context) {
"application/json", "application/json",
params = params params = params
) )
} }*/
fun updatePackingTypeSalix( fun updatePackingTypeSalix(
token:String, token:String,
@ -224,7 +225,7 @@ class GetItemCardUserCase(context: Context) : RestClient(context) {
password: String, password: String,
itemFk: String, itemFk: String,
value: String value: String
): Call<String> { ): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(itemFk) params.add(itemFk)
params.add(value) params.add(value)
@ -264,7 +265,7 @@ class GetItemCardUserCase(context: Context) : RestClient(context) {
itemFk: String, itemFk: String,
value: String, value: String,
delete: String delete: String
): Call<String> { ): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(value) params.add(value)
params.add(itemFk) params.add(itemFk)

View File

@ -87,7 +87,7 @@ class GetPaletizadoresUserCase(context: Context) : RestClient(context) {
password: String, password: String,
vHour: String, vHour: String,
vDescription: String vDescription: String
): Call<String> { ): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(vHour) params.add(vHour)
params.add(vDescription) params.add(vDescription)
@ -143,7 +143,7 @@ class GetPaletizadoresUserCase(context: Context) : RestClient(context) {
password: String, password: String,
vPalletFk: String, vPalletFk: String,
vExpeditionFk: String vExpeditionFk: String
): Call<String> { ): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(vPalletFk) params.add(vPalletFk)
params.add(vExpeditionFk) params.add(vExpeditionFk)
@ -193,7 +193,7 @@ class GetPaletizadoresUserCase(context: Context) : RestClient(context) {
) )
} }
fun expeditionPalletDel(usuario: String, password: String, vPalletFk: String): Call<String> { fun expeditionPalletDel(usuario: String, password: String, vPalletFk: String): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(vPalletFk) params.add(vPalletFk)
return restClient!!.expeditionPalletDel( return restClient!!.expeditionPalletDel(
@ -223,7 +223,7 @@ class GetPaletizadoresUserCase(context: Context) : RestClient(context) {
) )
} }
fun expeditionScanDel(usuario: String, password: String, vScanFk: String): Call<String> { fun expeditionScanDel(usuario: String, password: String, vScanFk: String): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(vScanFk) params.add(vScanFk)
return restClient!!.expeditionScanDel( return restClient!!.expeditionScanDel(
@ -241,7 +241,7 @@ class GetPaletizadoresUserCase(context: Context) : RestClient(context) {
password: String, password: String,
vPalletFk: String, vPalletFk: String,
vSectorFk: String vSectorFk: String
): Call<String> { ): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(vPalletFk) params.add(vPalletFk)
params.add(vSectorFk) params.add(vSectorFk)

View File

@ -48,7 +48,7 @@ class GetPreSacadorUseCase(context: Context) : RestClient(context) {
password: String, password: String,
id: String, id: String,
quantity: String quantity: String
): Call<String> { ): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(id) params.add(id)
params.add(quantity) params.add(quantity)

View File

@ -33,7 +33,7 @@ class GetQualityUserCase(context: Context) : RestClient(context) {
password: String, password: String,
vId: String, vId: String,
vStars: String vStars: String
): Call<String> { ): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(vId) params.add(vId)
params.add(vStars) params.add(vStars)

View File

@ -203,7 +203,7 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
itemShelvingFk: String, itemShelvingFk: String,
saleFk: String, saleFk: String,
quantity: String quantity: String
): Call<String> { ): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(itemShelvingFk) params.add(itemShelvingFk)
params.add(saleFk) params.add(saleFk)
@ -224,7 +224,7 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
itemShelvingFk: String, itemShelvingFk: String,
itemPlacementSupplyFk: String, itemPlacementSupplyFk: String,
quantity: String quantity: String
): Call<String> { ): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(itemShelvingFk) params.add(itemShelvingFk)
params.add(itemPlacementSupplyFk) params.add(itemPlacementSupplyFk)
@ -362,7 +362,7 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
saleFk: String, saleFk: String,
quantity: String, quantity: String,
originalQuantity: String originalQuantity: String
): Call<String> { ): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(saleFk) params.add(saleFk)
params.add(quantity) params.add(quantity)
@ -378,7 +378,7 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
type: String, type: String,
warehouseFk: String, warehouseFk: String,
originalQuantity: String originalQuantity: String
): Call<String> { ): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(saleFk) params.add(saleFk)
params.add(quantity) params.add(quantity)
@ -395,7 +395,7 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
) )
} }
fun saleTrackingDel(usuario: String, password: String, saleFk: String): Call<String> { fun saleTrackingDel(usuario: String, password: String, saleFk: String): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(saleFk) params.add(saleFk)
return restClient!!.saleTrackingDel( return restClient!!.saleTrackingDel(
@ -484,7 +484,7 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
password: String, password: String,
saleFk: String, saleFk: String,
quantity: String quantity: String
): Call<String> { ): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(saleFk) params.add(saleFk)
params.add(quantity) params.add(quantity)
@ -522,7 +522,7 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
vSaleFk: String, vSaleFk: String,
vUserFk: String, vUserFk: String,
vTypeFk: String vTypeFk: String
): Call<String> { ): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(vSaleFk) params.add(vSaleFk)
params.add(vUserFk) params.add(vUserFk)

View File

@ -32,7 +32,7 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) {
packing: String, packing: String,
warehouse: String, warehouse: String,
grouping:String grouping:String
): Call<String> { ): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(shelving) params.add(shelving)
params.add(item) params.add(item)
@ -63,7 +63,7 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) {
itemShelvingFk: String, itemShelvingFk: String,
grouping:String grouping:String
): Call<String> { ): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(shelving) params.add(shelving)
params.add(item) params.add(item)
@ -90,7 +90,7 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) {
shelving: String, shelving: String,
items: List<String>, items: List<String>,
warehouse: String warehouse: String
): Call<String> { ): Call<Any> {
val params: ArrayList<Any> = ArrayList() val params: ArrayList<Any> = ArrayList()
params.add(shelving) params.add(shelving)
params.add(items) params.add(items)
@ -110,7 +110,7 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) {
password: String, password: String,
priority: String, priority: String,
shelving: String shelving: String
): Call<String> { ): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(priority) params.add(priority)
params.add(shelving) params.add(shelving)
@ -136,7 +136,7 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) {
return restClient!!.shelvingPark("json", "1", usuario, password, "application/json", params) return restClient!!.shelvingPark("json", "1", usuario, password, "application/json", params)
} }
fun saleParking_add( /* fun saleParking_add(
usuario: String, usuario: String,
password: String, password: String,
sales:List<String>, sales:List<String>,
@ -146,14 +146,14 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) {
params.add(sales) params.add(sales)
params.add(parking) params.add(parking)
return restClient!!.saleParking_add("json", "1", usuario, password, "application/json", params) return restClient!!.saleParking_add("json", "1", usuario, password, "application/json", params)
} }*/
fun shelvingChange( fun shelvingChange(
usuario: String, usuario: String,
password: String, password: String,
origen: String, origen: String,
destino: String destino: String
): Call<String> { ): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(origen) params.add(origen)
params.add(destino) params.add(destino)
@ -167,7 +167,7 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) {
) )
} }
fun clearShelvingList(usuario: String, password: String, shelvingFk: String): Call<String> { fun clearShelvingList(usuario: String, password: String, shelvingFk: String): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(shelvingFk) params.add(shelvingFk)
return restClient!!.clearShelvingList( return restClient!!.clearShelvingList(
@ -185,7 +185,7 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) {
password: String, password: String,
itemFk: String, itemFk: String,
shelvingFk: String shelvingFk: String
): Call<String> { ): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(itemFk) params.add(itemFk)
params.add(shelvingFk) params.add(shelvingFk)
@ -199,7 +199,7 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) {
) )
} }
fun itemShelvingDelete(usuario: String, password: String, itemFk: String): Call<String> { fun itemShelvingDelete(usuario: String, password: String, itemFk: String): Call<Any> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(itemFk) params.add(itemFk)
return restClient!!.itemShelvingDelete( return restClient!!.itemShelvingDelete(

View File

@ -1,5 +1,6 @@
package es.verdnatura.domain package es.verdnatura.domain
//import es.verdnatura.presentation.view.feature.buscaritemall.model.ItemLocationAll
import com.google.gson.JsonObject import com.google.gson.JsonObject
import es.verdnatura.presentation.view.feature.ajustes.model.Printers import es.verdnatura.presentation.view.feature.ajustes.model.Printers
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO 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.ItemPackingType
import es.verdnatura.presentation.view.feature.articulo.model.ItemProposal import es.verdnatura.presentation.view.feature.articulo.model.ItemProposal
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO 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.BuyerVO
import es.verdnatura.presentation.view.feature.calidad.model.ItemBuyerVO import es.verdnatura.presentation.view.feature.calidad.model.ItemBuyerVO
import es.verdnatura.presentation.view.feature.collection.SalesModified 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.diadeventa.model.ItemShelvingSaleDate
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO
@ -145,7 +144,7 @@ interface VerdnaturaService {
@Header("user") user: String, @Header("user") user: String,
@Header("pass") pass: String, @Header("pass") pass: String,
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params:List<String> @Body params: List<String>
): ):
Call<Unit> Call<Unit>
@ -156,7 +155,7 @@ interface VerdnaturaService {
@Header("user") user: String, @Header("user") user: String,
@Header("pass") pass: String, @Header("pass") pass: String,
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params:List<String> @Body params: List<String>
): ):
Call<Unit> Call<Unit>
@ -214,7 +213,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
//SACADORES / CONTROLADORES ========================================================================> //SACADORES / CONTROLADORES ========================================================================>
@POST("almacennew/collectionGet") //NO SALIX @POST("almacennew/collectionGet") //NO SALIX
@ -293,16 +292,16 @@ interface VerdnaturaService {
): ):
Call<Unit> Call<Unit>
/* @POST("almacennew/collectionTicketGet")//REVISADA-ANULADA POT collection_getTickets /* @POST("almacennew/collectionTicketGet")//REVISADA-ANULADA POT collection_getTickets
fun collectionTicketGet( fun collectionTicketGet(
@Header("aplicacion") aplicacion: String, @Header("aplicacion") aplicacion: String,
@Header("version") version: String, @Header("version") version: String,
@Header("user") user: String, @Header("user") user: String,
@Header("pass") pass: String, @Header("pass") pass: String,
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<CollectionVO>*/ Call<CollectionVO>*/
@POST("almacennew/ticket_checkFullyControlled")//NO SALIX @POST("almacennew/ticket_checkFullyControlled")//NO SALIX
fun ticket_checkFullyControlled( fun ticket_checkFullyControlled(
@ -360,16 +359,16 @@ interface VerdnaturaService {
): ):
Call<String> Call<String>
/* @POST("almacennew/saleTracking_update")//REVISADA /* @POST("almacennew/saleTracking_update")//REVISADA
fun saleTracking_update( fun saleTracking_update(
@Header("aplicacion") aplicacion: String, @Header("aplicacion") aplicacion: String,
@Header("version") version: String, @Header("version") version: String,
@Header("user") user: String, @Header("user") user: String,
@Header("pass") pass: String, @Header("pass") pass: String,
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<Unit>*/ Call<Unit>*/
@POST("almacennew/itemPlacementSupplyAiming")//REVISADA @POST("almacennew/itemPlacementSupplyAiming")//REVISADA
fun itemPlacementSupplyAiming( fun itemPlacementSupplyAiming(
@ -391,7 +390,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
@POST("almacennew/itemShelvingPlacementSupplyAdd")//REVISADA @POST("almacennew/itemShelvingPlacementSupplyAdd")//REVISADA
fun itemShelvingPlacementSupplyAdd( fun itemShelvingPlacementSupplyAdd(
@ -402,7 +401,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
@POST("almacennew/collectionStickerPrint")//REVISADA @POST("almacennew/collectionStickerPrint")//REVISADA
fun collectionStickerPrint( fun collectionStickerPrint(
@ -449,17 +448,17 @@ interface VerdnaturaService {
): ):
Call<Void> Call<Void>
/*sergio:modificada en el caso de que quiera utilizarse por item_Card /*sergio:modificada en el caso de que quiera utilizarse por item_Card
@POST("almacennew/itemGetAvailable")//REVISADA @POST("almacennew/itemGetAvailable")//REVISADA
fun itemGetAvailable( fun itemGetAvailable(
@Header("aplicacion") aplicacion: String, @Header("aplicacion") aplicacion: String,
@Header("version") version: String, @Header("version") version: String,
@Header("user") user: String, @Header("user") user: String,
@Header("pass") pass: String, @Header("pass") pass: String,
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<ItemVO>*/ Call<ItemVO>*/
@POST("almacennew/collectionAddItem")//REVISADA @POST("almacennew/collectionAddItem")//REVISADA
fun collectionAddItem( fun collectionAddItem(
@ -481,7 +480,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
@POST("almacennew/collectionMissingTrash")//REVISADA @POST("almacennew/collectionMissingTrash")//REVISADA
fun collectionMissingTrash( fun collectionMissingTrash(
@ -492,7 +491,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
@POST("almacennew/saleTrackingDel")//REVISADA @POST("almacennew/saleTrackingDel")//REVISADA
fun saleTrackingDel( fun saleTrackingDel(
@ -503,7 +502,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
@POST("almacennew/itemShelving_updateFromSale")//REVISADA @POST("almacennew/itemShelving_updateFromSale")//REVISADA
fun itemShelving_updateFromSale( fun itemShelving_updateFromSale(
@ -559,7 +558,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
@POST("almacennew/saleMistakeAdd")//REVISADA @POST("almacennew/saleMistakeAdd")//REVISADA
fun saleMistakeAdd( fun saleMistakeAdd(
@ -570,7 +569,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
@POST("almacennew/workerMistake_Add")//REVISADA @POST("almacennew/workerMistake_Add")//REVISADA
fun workerMistake_Add( fun workerMistake_Add(
@ -612,7 +611,7 @@ interface VerdnaturaService {
@Header("pass") pass: String, @Header("pass") pass: String,
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
): ):
Call<List<DepartmentMistake>> Call<List<DepartmentMistake>>
@POST("almacennew/worker_getFromHasMistake")//REVISADA @POST("almacennew/worker_getFromHasMistake")//REVISADA
@ -673,18 +672,18 @@ interface VerdnaturaService {
): ):
Call<List<ItemPackingType>> Call<List<ItemPackingType>>
/* @POST("almacennew/itemStockUpdate")//REVISADA /* @POST("almacennew/itemStockUpdate")//REVISADA
fun itemStockUpdate( fun itemStockUpdate(
@Header("aplicacion") aplicacion: String, @Header("aplicacion") aplicacion: String,
@Header("version") version: String, @Header("version") version: String,
@Header("user") user: String, @Header("user") user: String,
@Header("pass") pass: String, @Header("pass") pass: String,
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String>*/ Call<String>*/
@POST("almacennew/itemTrash")//REVISADA @POST("almacennew/itemTrash")//REVISADA
fun itemTrash( fun itemTrash(
@Header("aplicacion") aplicacion: String, @Header("aplicacion") aplicacion: String,
@Header("version") version: String, @Header("version") version: String,
@ -693,9 +692,9 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
@POST("almacennew/item_placement_save")//REVISADA /* @POST("almacennew/item_placement_save")//REVISADA
fun itemPlacementSave( fun itemPlacementSave(
@Header("aplicacion") aplicacion: String, @Header("aplicacion") aplicacion: String,
@Header("version") version: String, @Header("version") version: String,
@ -704,7 +703,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<String>*/
@POST("almacennew/buy_updateGrouping")//REVISADA @POST("almacennew/buy_updateGrouping")//REVISADA
fun updateGrouping( fun updateGrouping(
@ -728,7 +727,7 @@ interface VerdnaturaService {
): ):
Call<Any> Call<Any>
@POST("almacennew/update_ItemPackingType")//REVISADA /* @POST("almacennew/update_ItemPackingType")//REVISADA
fun updatePackingType( fun updatePackingType(
@Header("aplicacion") aplicacion: String, @Header("aplicacion") aplicacion: String,
@Header("version") version: String, @Header("version") version: String,
@ -737,7 +736,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<Boolean> Call<Boolean>*/
@POST("almacennew/itemSaveMin")//REVISADA @POST("almacennew/itemSaveMin")//REVISADA
fun itemSaveMin( fun itemSaveMin(
@ -748,7 +747,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
@POST("almacennew/item_saveReference")//REVISADA @POST("almacennew/item_saveReference")//REVISADA
fun item_saveReference( fun item_saveReference(
@ -758,7 +757,7 @@ interface VerdnaturaService {
@Header("pass") pass: String, @Header("pass") pass: String,
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<Unit> Call<Unit>
@POST("almacennew/barcodes_edit")//REVISADA @POST("almacennew/barcodes_edit")//REVISADA
@ -770,7 +769,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
//BUSCAR ITEM ========================================================================> //BUSCAR ITEM ========================================================================>
@POST("almacennew/getItemUbication")//REVISADA @POST("almacennew/getItemUbication")//REVISADA
@ -799,17 +798,17 @@ interface VerdnaturaService {
//INVENTARIO ========================================================================> //INVENTARIO ========================================================================>
/* @POST("almacennew/itemShelvingRadar")//REVISADA /* @POST("almacennew/itemShelvingRadar")//REVISADA
fun itemShelvingRadar( fun itemShelvingRadar(
@Header("aplicacion") aplicacion: String, @Header("aplicacion") aplicacion: String,
@Header("version") version: String, @Header("version") version: String,
@Header("user") user: String, @Header("user") user: String,
@Header("pass") pass: String, @Header("pass") pass: String,
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<List<ItemInventaryVO>> Call<List<ItemInventaryVO>>
*/ */
@POST("almacennew/itemShelving_filterBuyer")//REVISADA @POST("almacennew/itemShelving_filterBuyer")//REVISADA
fun itemShelvingRadarFilterBuyer( fun itemShelvingRadarFilterBuyer(
@Header("aplicacion") aplicacion: String, @Header("aplicacion") aplicacion: String,
@ -841,7 +840,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
//SHELVING PARKING ========================================================================> //SHELVING PARKING ========================================================================>
@POST("almacennew/shelvingParking_get")//REVISADA @POST("almacennew/shelvingParking_get")//REVISADA
@ -879,7 +878,6 @@ interface VerdnaturaService {
Call<Boolean> Call<Boolean>
@POST("almacennew/workerMachinery_isRegistered")//REVISADA @POST("almacennew/workerMachinery_isRegistered")//REVISADA
fun workerMachinery_isRegistered( fun workerMachinery_isRegistered(
@Header("aplicacion") aplicacion: String, @Header("aplicacion") aplicacion: String,
@ -957,7 +955,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
@POST("almacennew/itemShelvingMake")//REVISADA @POST("almacennew/itemShelvingMake")//REVISADA
fun itemShelvingMake( fun itemShelvingMake(
@ -968,7 +966,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
@POST("almacennew/itemShelvingMakeEdit")//REVISADA @POST("almacennew/itemShelvingMakeEdit")//REVISADA
fun itemShelvingMakeEdit( fun itemShelvingMakeEdit(
@ -979,7 +977,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
@POST("almacennew/itemShelvingMake_multi")//REVISADA @POST("almacennew/itemShelvingMake_multi")//REVISADA
fun itemShelvingMake_multi( fun itemShelvingMake_multi(
@ -990,9 +988,9 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<Any> @Body params: List<Any>
): ):
Call<String> Call<Any>
@POST("almacennew/saleParking_add")//REVISADA /* @POST("almacennew/saleParking_add")//REVISADA
fun saleParking_add( fun saleParking_add(
@Header("aplicacion") aplicacion: String, @Header("aplicacion") aplicacion: String,
@Header("version") version: String, @Header("version") version: String,
@ -1001,7 +999,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<Any> @Body params: List<Any>
): ):
Call<String> Call<String>*/
@POST("almacennew/shelvingPark")//REVISADA @POST("almacennew/shelvingPark")//REVISADA
@ -1024,7 +1022,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
@POST("almacennew/clearShelvingList")//REVISADA @POST("almacennew/clearShelvingList")//REVISADA
fun clearShelvingList( fun clearShelvingList(
@ -1035,7 +1033,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
@POST("almacennew/itemShelvingTransfer")//REVISADA @POST("almacennew/itemShelvingTransfer")//REVISADA
fun itemShelvingTransfer( fun itemShelvingTransfer(
@ -1046,7 +1044,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
@POST("almacennew/itemShelvingDelete")//REVISADA @POST("almacennew/itemShelvingDelete")//REVISADA
fun itemShelvingDelete( fun itemShelvingDelete(
@ -1057,7 +1055,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
//BUFFER ==============================================================================> //BUFFER ==============================================================================>
@ -1130,7 +1128,7 @@ interface VerdnaturaService {
@Header("pass") pass: String, @Header("pass") pass: String,
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<JsonObject> Call<JsonObject>
@POST("almacennew/itemShelving_getSaleDate")//REVISADA @POST("almacennew/itemShelving_getSaleDate")//REVISADA
@ -1141,7 +1139,7 @@ interface VerdnaturaService {
@Header("pass") pass: String, @Header("pass") pass: String,
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<List<ItemShelvingSaleDate>> Call<List<ItemShelvingSaleDate>>
@POST("almacennew/itemShelvingLog_get")//REVISADA @POST("almacennew/itemShelvingLog_get")//REVISADA
@ -1152,7 +1150,7 @@ interface VerdnaturaService {
@Header("pass") pass: String, @Header("pass") pass: String,
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<List<ItemShelvingLog>> Call<List<ItemShelvingLog>>
@POST("almacennew/shelvingLog_get")//REVISADA @POST("almacennew/shelvingLog_get")//REVISADA
@ -1163,7 +1161,7 @@ interface VerdnaturaService {
@Header("pass") pass: String, @Header("pass") pass: String,
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<List<ShelvingLog>> Call<List<ShelvingLog>>
@POST("almacennew/itemShelving_updateSpam")//REVISADA @POST("almacennew/itemShelving_updateSpam")//REVISADA
@ -1174,7 +1172,7 @@ interface VerdnaturaService {
@Header("pass") pass: String, @Header("pass") pass: String,
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<Boolean> Call<Boolean>
@ -1197,7 +1195,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
@POST("almacennew/expeditionPalletList")//REVISADA @POST("almacennew/expeditionPalletList")//REVISADA
fun expeditionPallet_List( fun expeditionPallet_List(
@ -1230,7 +1228,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
@POST("almacennew/checkRouteExpeditionScanPut")//REVISADA @POST("almacennew/checkRouteExpeditionScanPut")//REVISADA
fun checkRouteExpeditionScanPut( fun checkRouteExpeditionScanPut(
@ -1263,7 +1261,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
@POST("almacennew/expeditionScanList")//REVISADA @POST("almacennew/expeditionScanList")//REVISADA
fun expeditionScanList( fun expeditionScanList(
@ -1285,7 +1283,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
@POST("almacennew/expeditionPalletPrintSet")//REVISADA @POST("almacennew/expeditionPalletPrintSet")//REVISADA
fun expeditionPalletPrintSet( fun expeditionPalletPrintSet(
@ -1296,7 +1294,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
@POST("almacennew/expeditionState_addByPallet")//REVISADA @POST("almacennew/expeditionState_addByPallet")//REVISADA
fun expeditionState_addByPallet( fun expeditionState_addByPallet(
@ -1352,7 +1350,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Any>
//SMARTTAGS ========================================================================> //SMARTTAGS ========================================================================>
@POST("almacennew/workerShelving_add")//REVISADA @POST("almacennew/workerShelving_add")//REVISADA

View File

@ -4,14 +4,14 @@ class ResponseItemVO(
var response: String = "", var response: String = "",
var isError: Boolean = false, var isError: Boolean = false,
var errorMessage: String = "" var errorMessage: String = ""
) )
class ResponseItemMachineControl( class ResponseItemMachineControl(
var response: String = "", var response: String = "",
var isError: Boolean = false, var isError: Boolean = false,
var errorMessage: String = "", var errorMessage: String = "",
var type: String var type: String
) )
class DataMessageSalix( class DataMessageSalix(
var ticket: String = "", var ticket: String = "",
@ -19,9 +19,9 @@ class DataMessageSalix(
var quantity: String = "", var quantity: String = "",
var personSale: String = "" var personSale: String = ""
) )
class GeneralItem( class GeneralItem(
var code:String? = "", var code: String? = "",
var text:String? = "" var text: String? = ""
) )

View File

@ -43,7 +43,8 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
private val _printerList by lazy { MutableLiveData<PrintersList>() } private val _printerList by lazy { MutableLiveData<PrintersList>() }
val printerList: LiveData<PrintersList> val printerList: LiveData<PrintersList>
get() = _printerList get
() = _printerList
val loadSectorList = Transformations.map(_sectorList) {Event(it)} val loadSectorList = Transformations.map(_sectorList) {Event(it)}

View File

@ -1,7 +1,5 @@
package es.verdnatura.presentation.view.feature.ajustes.model package es.verdnatura.presentation.view.feature.ajustes.model
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
class AjustesItemVO ( class AjustesItemVO (
var id: Int, var id: Int,
var title: String = "", var title: String = "",

View File

@ -633,8 +633,8 @@ class ItemCardFragment(
user = user, user = user,
password = password, password = password,
newValue = value, newValue = value,
isTrash = "0", isTrash = "0"
"itemTrash"
) )
//changeOfflineValue(itemB,value, listBarcodes) //changeOfflineValue(itemB,value, listBarcodes)
showProgress() showProgress()
@ -647,8 +647,8 @@ class ItemCardFragment(
user = user, user = user,
password = password, password = password,
newValue = value, newValue = value,
isTrash = "1", isTrash = "1"
"itemTrash"
) )
//changeOfflineValue(itemB,value, listBarcodes) //changeOfflineValue(itemB,value, listBarcodes)
showProgress() showProgress()
@ -667,8 +667,8 @@ class ItemCardFragment(
user = user, user = user,
password = password, password = password,
newValue = (value.toInt() * -1).toString(), newValue = (value.toInt() * -1).toString(),
isTrash = "0", isTrash = "0"
"itemTrash"
) )
} }
} catch (e: Exception) { } catch (e: Exception) {
@ -748,11 +748,10 @@ class ItemCardFragment(
password = password, password = password,
value = code, value = code,
delete = delete, delete = delete,
"itemBarcode_update") )
} }
// viewModel.barcodesEdit(itemFk = itemFk, user = user, password = password, value = code, delete = delete,"itemBarcode_update") barcodeAdapter!!.notifyDataSetChanged()
barcodeAdapter!!.notifyDataSetChanged()
//changeOfflineValue(item,"", listBarcodes)
showProgress() showProgress()
} }
@ -784,8 +783,7 @@ class ItemCardFragment(
viewModel.updatePackingTypeSalix( viewModel.updatePackingTypeSalix(
getData(TOKEN), getData(TOKEN),
this.itemFk, this.itemFk,
itemPackingType, itemPackingType
"item_updatePackingType"
)/*}else{ )/*}else{
viewModel.updatePackingType( viewModel.updatePackingType(
this.itemFk, this.itemFk,

View File

@ -13,13 +13,12 @@ import es.verdnatura.presentation.view.feature.articulo.model.*
import retrofit2.Call import retrofit2.Call
import retrofit2.Callback import retrofit2.Callback
import retrofit2.Response import retrofit2.Response
import timber.log.Timber
class ItemCardViewModel(context: Context) : BaseViewModel() { class ItemCardViewModel(context: Context) : BaseViewModel() {
private val getItemCardUserCase:GetItemCardUserCase = GetItemCardUserCase(context) private val getItemCardUserCase: GetItemCardUserCase = GetItemCardUserCase(context)
val version : String = "5.0.0" val version: String = "5.0.0"
private val _itemcard by lazy { MutableLiveData<ItemCardVO>() } private val _itemcard by lazy { MutableLiveData<ItemCardVO>() }
val itemcard: LiveData<ItemCardVO> val itemcard: LiveData<ItemCardVO>
get() = _itemcard get() = _itemcard
@ -37,46 +36,92 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
get() = _itemProposallist get() = _itemProposallist
fun getItemCard(
itemFk: String,
warehouseFk: String,
user: String,
password: String,
callFunction: String
) {
getItemCardUserCase.getItemCard(user, password, itemFk, warehouseFk)
.enqueue(object : Callback<ItemCardVO> {
override fun onFailure(call: Call<ItemCardVO>, t: Throwable) {
_itemcard.value = ItemCardVO(
isError = true,
errorMessage = 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<ItemCardVO>{
override fun onFailure(call: Call<ItemCardVO>, t: Throwable) {
_itemcard.value = ItemCardVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<ItemCardVO>, response: Response<ItemCardVO>) {
// 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<ItemCardVO>, response: Response<ItemCardVO>) {
// 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) { fun item_getSimilar(
getItemCardUserCase.item_getSimilar(user,password,itemFk,warehouseFk,vShipped,vIsShowedByType).enqueue(object :Callback<List<ItemProposal>>{ itemFk: String,
warehouseFk: String,
vShipped: String,
vIsShowedByType: String,
user: String,
password: String,
callFunction: String
) {
getItemCardUserCase.item_getSimilar(
user,
password,
itemFk,
warehouseFk,
vShipped,
vIsShowedByType
).enqueue(object : Callback<List<ItemProposal>> {
override fun onFailure(call: Call<List<ItemProposal>>, t: Throwable) { override fun onFailure(call: Call<List<ItemProposal>>, t: Throwable) {
val listError:ArrayList<ItemProposal> = ArrayList() val listError: ArrayList<ItemProposal> = ArrayList()
listError.add(ItemProposal(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))) listError.add(
ItemProposal(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
)
_itemProposallist.value = ItemProposalList(listError) _itemProposallist.value = ItemProposalList(listError)
} }
override fun onResponse(call: Call<List<ItemProposal>>, response: Response<List<ItemProposal>>) { override fun onResponse(
if (response.body() != null){ call: Call<List<ItemProposal>>,
_itemProposallist.value = response.body()?.let { ItemProposalList(it) response: Response<List<ItemProposal>>
) {
if (response.body() != null) {
_itemProposallist.value = response.body()?.let {
ItemProposalList(it)
} }
}else{ } else {
val listError:ArrayList<ItemProposal> = ArrayList() val listError: ArrayList<ItemProposal> = ArrayList()
listError.add(ItemProposal(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))) listError.add(
ItemProposal(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
)
)
)
_itemProposallist.value = ItemProposalList(listError) _itemProposallist.value = ItemProposalList(listError)
} }
@ -86,22 +131,38 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
} }
fun getItemPackingType(user:String,password:String,callFunction:String) { fun getItemPackingType(user: String, password: String, callFunction: String) {
getItemCardUserCase.getItemPackingType(user,password).enqueue(object : getItemCardUserCase.getItemPackingType(user, password).enqueue(object :
Callback<List<ItemPackingType>>{ Callback<List<ItemPackingType>> {
override fun onFailure(call: Call<List<ItemPackingType>>, t: Throwable) { override fun onFailure(call: Call<List<ItemPackingType>>, t: Throwable) {
val listError:ArrayList<ItemPackingType> = ArrayList() val listError: ArrayList<ItemPackingType> = ArrayList()
listError.add(ItemPackingType(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))) listError.add(
ItemPackingType(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
)
_itemspackinglist.value = ItemPackingTypeList(listError) _itemspackinglist.value = ItemPackingTypeList(listError)
} }
override fun onResponse(call: Call<List<ItemPackingType>>, response: Response<List<ItemPackingType>>) { override fun onResponse(
if (response.body() != null){ call: Call<List<ItemPackingType>>,
response: Response<List<ItemPackingType>>
) {
if (response.body() != null) {
_itemspackinglist.value = response.body()?.let { ItemPackingTypeList(it) } _itemspackinglist.value = response.body()?.let { ItemPackingTypeList(it) }
}else{ } else {
val listError:ArrayList<ItemPackingType> = ArrayList() val listError: ArrayList<ItemPackingType> = ArrayList()
listError.add(ItemPackingType(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))) listError.add(
ItemPackingType(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
)
)
)
_itemspackinglist.value = ItemPackingTypeList(listError) _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 : getItemCardUserCase.getItemPackingTypeSalix(token).enqueue(object :
Callback<List<ItemPackingType>>{ Callback<List<ItemPackingType>> {
override fun onFailure(call: Call<List<ItemPackingType>>, t: Throwable) { override fun onFailure(call: Call<List<ItemPackingType>>, t: Throwable) {
val listError:ArrayList<ItemPackingType> = ArrayList() val listError: ArrayList<ItemPackingType> = ArrayList()
listError.add(ItemPackingType(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))) listError.add(
ItemPackingType(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
)
_itemspackinglist.value = ItemPackingTypeList(listError) _itemspackinglist.value = ItemPackingTypeList(listError)
} }
override fun onResponse(call: Call<List<ItemPackingType>>, response: Response<List<ItemPackingType>>) { override fun onResponse(
if (response.body() != null){ call: Call<List<ItemPackingType>>,
response: Response<List<ItemPackingType>>
) {
if (response.body() != null) {
_itemspackinglist.value = response.body()?.let { ItemPackingTypeList(it) } _itemspackinglist.value = response.body()?.let { ItemPackingTypeList(it) }
}else{ } else {
val listError:ArrayList<ItemPackingType> = ArrayList() val listError: ArrayList<ItemPackingType> = ArrayList()
listError.add(ItemPackingType(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))) listError.add(
ItemPackingType(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
)
)
)
_itemspackinglist.value = ItemPackingTypeList(listError) _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){ /* fun itemStockUpdate(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String,callFunction:String){
getItemCardUserCase.itemStockUpdate(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : Callback<String>{ getItemCardUserCase.itemStockUpdate(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : Callback<Any>{
override fun onFailure(call: Call<String>, t: Throwable) { override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada $callFunction."+t.message!!) _response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada $callFunction."+t.message!!)
} }
override fun onResponse(call: Call<String>, response: Response<String>) { override fun onResponse(call: Call<Any>, response: Response<Any>) {
if (response.body() == null){ if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada $callFunction") _response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada $callFunction")
}else{ }else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!) _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<Any> {
override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
} }
} override fun onResponse(call: Call<Any>, response: Response<Any>) {
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){ /* fun itemPlacementSave(itemFk:String,warehouseFk:String,user:String,password:String,value:String,callFunction:String){
getItemCardUserCase.itemTrash(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : Callback<String>{ getItemCardUserCase.itemPlacementSave(user,password,itemFk,warehouseFk,value).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) { override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) _response.value = ResponseItemVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))
} }
override fun onResponse(call: Call<String>, response: Response<String>) { override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){ if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{ }else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!) _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<Any> {
override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
} }
} override fun onResponse(call: Call<Any>, response: Response<Any>) {
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){ fun updatePacking(
getItemCardUserCase.itemPlacementSave(user,password,itemFk,warehouseFk,value).enqueue(object : Callback<String>{ itemFk: String,
override fun onFailure(call: Call<String>, t: Throwable) { user: String,
_response.value = ResponseItemVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)) password: String,
} value: String,
warehouseFk: String,
override fun onResponse(call: Call<String>, response: Response<String>) { callFunction: String
if (response.body() == null){ ) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) getItemCardUserCase.updatePacking(user, password, itemFk, value, warehouseFk)
}else{ .enqueue(object : Callback<Any> {
_response.value = ResponseItemVO(isError = false,response = response.body()!!) override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
} }
} override fun onResponse(call: Call<Any>, response: Response<Any>) {
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<Any>{
override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<Any>, response: Response<Any>) {
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<Any>{
override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<Any>, response: Response<Any>) {
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" //sergio ver como solucionar el tema del "Finish"
fun updatePackingType(itemFk:String,user:String,password:String,itemPackingType:String,callFunction:String){ /* fun updatePackingType(itemFk:String,user:String,password:String,itemPackingType:String,callFunction:String){
getItemCardUserCase.updatePackingType(user,password,itemFk,itemPackingType).enqueue(object : Callback<Boolean>{ getItemCardUserCase.updatePackingType(user,password,itemFk,itemPackingType).enqueue(object : Callback<Boolean>{
override fun onFailure(call: Call<Boolean>, t: Throwable) { override fun onFailure(call: Call<Boolean>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
} }
override fun onResponse(call: Call<Boolean>, response: Response<Boolean>) { override fun onResponse(call: Call<Boolean>, response: Response<Boolean>) {
if (response.body() == null){ if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{ }else{
//if (response.body()=="Finish"){ //if (response.body()=="Finish"){
// //Log.i("VERDNATURA:","Fisnih encontrado")} // //Log.i("VERDNATURA:","Fisnih encontrado")}
_response.value = ResponseItemVO(isError = false,response = response.body()!!.toString()) _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<Any> {
override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
} }
} override fun onResponse(call: Call<Any>, response: Response<Any>) {
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<Any>{
override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<Any>, response: Response<Any>) {
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<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
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){ fun itemSaveMin(
getItemCardUserCase.item_saveReference(user,password,itemFk,value).enqueue(object : Callback<Unit>{ itemFk: String,
override fun onFailure(call: Call<Unit>, t: Throwable) { user: String,
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) password: String,
} value: String,
callFunction: String
override fun onResponse(call: Call<Unit>, response: Response<Unit>) { ) {
getItemCardUserCase.itemSaveMin(user, password, itemFk, value)
if (!response.isSuccessful){ .enqueue(object : Callback<Any> {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) override fun onFailure(call: Call<Any>, t: Throwable) {
}else{ _response.value = ResponseItemVO(
_response.value = ResponseItemVO(isError = false) isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
} }
} override fun onResponse(call: Call<Any>, response: Response<Any>) {
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){ fun item_saveReference(
getItemCardUserCase.barcodes_edit(user,password,itemFk,value,delete).enqueue(object : Callback<String>{ itemFk: String,
override fun onFailure(call: Call<String>, t: Throwable) { user: String,
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) password: String,
} value: String,
callFunction: String
override fun onResponse(call: Call<String>, response: Response<String>) { ) {
if (response.body() == null){ getItemCardUserCase.item_saveReference(user, password, itemFk, value)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) .enqueue(object : Callback<Unit> {
}else{ override fun onFailure(call: Call<Unit>, t: Throwable) {
_response.value = ResponseItemVO(isError = false,response = response.body()!!) _response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
} }
} override fun onResponse(call: Call<Unit>, response: Response<Unit>) {
}) 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<Any> {
override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onResponse(call: Call<Any>, response: Response<Any>) {
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){ fun barcodesEditSalix(token: String, itemFk: String, barCodeValue: String) {
getItemCardUserCase.barcodes_editSalix(token,itemFk,barCodeValue).enqueue(object : Callback<Any>{ getItemCardUserCase.barcodes_editSalix(token, itemFk, barCodeValue)
override fun onFailure(call: Call<Any>, t: Throwable) { .enqueue(object : Callback<Any> {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) override fun onFailure(call: Call<Any>, t: Throwable) {
} _response.value = ResponseItemVO(
isError = true,
override fun onResponse(call: Call<Any>, response: Response<Any>) { errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
if (response.body() == null){ )
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.message()!!)
} }
} override fun onResponse(call: Call<Any>, response: Response<Any>) {
if (response.body() == null) {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
)
)
} else {
_response.value =
ResponseItemVO(isError = false, response = response.message()!!)
}
}) }
})
} }
} }

View File

@ -54,17 +54,17 @@ class QaualityViewModel(context: Context) : BaseViewModel() {
} }
fun itemShelvingStarsUpdate(usuario:String,password:String, vId: String,vStars: String) { fun itemShelvingStarsUpdate(usuario:String,password:String, vId: String,vStars: String) {
getQualityUserCase.itemShelvingStarsUpdate(usuario,password,vId,vStars).enqueue(object : Callback<String>{ getQualityUserCase.itemShelvingStarsUpdate(usuario,password,vId,vStars).enqueue(object : Callback<Any>{
override fun onFailure(call: Call<String>, t: Throwable) { override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelving_StarsUpdate."+t.message!!) _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
} }
override fun onResponse(call: Call<String>, response: Response<String>) { override fun onResponse(call: Call<Any>, response: Response<Any>) {
if (response.body() == null){ if (!response.isSuccessful()){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelving_StarsUpdate") _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{ }else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!) _response.value = ResponseItemVO(isError = false,response = response.message())
} }
} }
}) })

View File

@ -1,7 +1,6 @@
package es.verdnatura.presentation.view.feature.claim.fragment package es.verdnatura.presentation.view.feature.claim.fragment
import android.view.View
import android.view.View.GONE import android.view.View.GONE
import android.view.View.VISIBLE import android.view.View.VISIBLE
import android.view.inputmethod.EditorInfo 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.common.hideKeyboard
import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogList import es.verdnatura.presentation.view.component.CustomDialogList
import es.verdnatura.presentation.view.feature.smarttag.model.SmartTag
class ClaimFragment( class ClaimFragment(
var entryPoint: String = "" var entryPoint: String = ""
@ -33,7 +31,6 @@ class ClaimFragment(
private var claimAdapter: GeneralAdapter? = null private var claimAdapter: GeneralAdapter? = null
companion object { companion object {
fun newInstance(entryPoint: String) = ClaimFragment(entryPoint) fun newInstance(entryPoint: String) = ClaimFragment(entryPoint)
} }
@ -64,32 +61,32 @@ class ClaimFragment(
binding.mainToolbar.toolbarTitle.text = entryPoint 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 {
} override fun OnGeneralItemRowClickListener(item: GeneralItem) {
})
customDialogList.getRecyclerView().adapter = claimAdapter }
customDialogList.getRecyclerView().layoutManager = })
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) customDialogList.getRecyclerView().adapter = claimAdapter
} customDialogList.getRecyclerView().layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
}
private fun itemShelving_addByClaim(shelvingOrSmarttag: String) { private fun itemShelving_addByClaim(shelvingOrSmarttag: String) {
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
viewModel.itemShelving_addByClaim(getData(USER),getData(PASSWORD),listClaims.first().toString(),shelvingOrSmarttag) viewModel.itemShelving_addByClaim(
customDialogList.dismiss() getData(USER),
getData(PASSWORD),
listClaims.first().toString(),
shelvingOrSmarttag
)
customDialogList.dismiss()
} }
private fun hideKeyboards() {
try {
requireActivity().hideKeyboard()
} catch (e: Exception) {
}
}
private fun setEvents() { private fun setEvents() {
@ -117,10 +114,16 @@ private fun setAdapter(){
listClaims.clear() listClaims.clear()
claimAdapter!!.notifyDataSetChanged() claimAdapter!!.notifyDataSetChanged()
showInputClaim() showInputClaim()
ma.messageWithSound(it.errorMessage,true,false) ma.messageWithSound(it.errorMessage, true, false)
} else { } else {
customDialogList.dismiss() 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() listClaims.clear()
claimAdapter!!.notifyDataSetChanged() claimAdapter!!.notifyDataSetChanged()
showInputClaim() showInputClaim()
@ -160,16 +163,13 @@ private fun setAdapter(){
} }
private fun add_item(itemScaned:String){ private fun add_item(itemScaned: String) {
var nameClaim: String
nameClaim = val nameClaim: String = getTextScaned(listClaims.size + 1) + itemScaned
getTextScaned(listClaims.size + 1) + itemScaned
customDialogList.setTitle(getTextToPosition(listClaims.size + 1)) customDialogList.setTitle(getTextToPosition(listClaims.size + 1))
listClaims.add(GeneralItem(itemScaned, nameClaim)) listClaims.add(GeneralItem(itemScaned, nameClaim))
claimAdapter!!.notifyDataSetChanged() claimAdapter!!.notifyDataSetChanged()
//customDialogList.setValue("")
} }
@ -180,8 +180,8 @@ private fun setAdapter(){
ma.hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
customDialogList.dismiss() customDialogList.dismiss()
requireActivity().onBackPressed() requireActivity().onBackPressed()
}.setValue("").show() }.setValue("").show()
@ -191,12 +191,12 @@ private fun setAdapter(){
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event -> customDialogList.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) { 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()) add_item(customDialogList.getValue())
if (listClaims.size >1) { if (listClaims.size > 1) {
itemShelving_addByClaim(customDialogList.getValue().uppercase()) itemShelving_addByClaim(customDialogList.getValue().uppercase())
} }
@ -209,7 +209,7 @@ private fun setAdapter(){
false false
} }
hideKeyboard() hideKeyboard()
} }

View File

@ -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) { "ROSA" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {

View File

@ -113,7 +113,6 @@ class CollectionFragment(
mpok = MediaPlayer.create((activity as MainActivity), R.raw.ok) mpok = MediaPlayer.create((activity as MainActivity), R.raw.ok)
if ((collection.collectionFk != null) && type.equals(CONTROLADOR)) { if ((collection.collectionFk != null) && type.equals(CONTROLADOR)) {
//sergio: comprueba si viene de la pantalla de controlador //sergio: comprueba si viene de la pantalla de controlador
@ -685,8 +684,7 @@ class CollectionFragment(
viewModel.saleTrackingDel( viewModel.saleTrackingDel(
getData(USER), getData(USER),
getData(PASSWORD), getData(PASSWORD),
saleFk = sales[positionUnmarked].saleFk, saleFk = sales[positionUnmarked].saleFk
"saleTracking_del"
) )
goBack = false goBack = false
@ -740,8 +738,8 @@ class CollectionFragment(
message=message+"\r\n" message=message+"\r\n"
} }
Log.d("VERDNATURA::","Persona a enviar "+collection.tickets.get(0).salesPersonFk) //Log.d("VERDNATURA::","Persona a enviar "+collection.tickets.get(0).salesPersonFk)
Log.d("VERDNATURA::","El message a enviar "+message) //Log.d("VERDNATURA::","El message a enviar "+message)
viewModel.sendChekingPresence( viewModel.sendChekingPresence(
token = getData(TOKEN), token = getData(TOKEN),
workerId = collection.tickets.get(0).salesPersonFk, workerId = collection.tickets.get(0).salesPersonFk,
@ -797,7 +795,7 @@ class CollectionFragment(
viewModel.sendChekingPresence( viewModel.sendChekingPresence(
token = getData(TOKEN), token = getData(TOKEN),
workerId = salePerson, workerId = "19294",
message = message, "sendChekingPresence" message = message, "sendChekingPresence"
) )
} }
@ -1572,8 +1570,8 @@ class CollectionFragment(
getData(PASSWORD), getData(PASSWORD),
itemShelvingFk = itemShelvingFk, itemShelvingFk = itemShelvingFk,
saleFk = sales[storedPosition].saleFk, saleFk = sales[storedPosition].saleFk,
quantity = if (quantity != "0") quantity else customDialogList.getValue(), quantity = if (quantity != "0") quantity else customDialogList.getValue()
callFunction = "itemShelvingSaleSupplyAdd"
) )
@ -2085,8 +2083,7 @@ class CollectionFragment(
getData(PASSWORD), getData(PASSWORD),
saleFk = sales[position].saleFk, saleFk = sales[position].saleFk,
quantity = totalQuantity.toString(), quantity = totalQuantity.toString(),
originalQuantity = sales[position].quantity, originalQuantity = sales[position].quantity
"saleMove"
) )
/* sales[position].quantity = quantity /* sales[position].quantity = quantity
@ -2506,8 +2503,7 @@ class CollectionFragment(
password = getData(PASSWORD), password = getData(PASSWORD),
vSaleFk = mistakeSale?.saleFk!!, vSaleFk = mistakeSale?.saleFk!!,
vUserFk = mistakeSale?.workerFk!!, vUserFk = mistakeSale?.workerFk!!,
vTypeFk = it.id, "saleMistake_Add" vTypeFk = it.id)
)
"Causa del error registrado".toast(requireContext()) "Causa del error registrado".toast(requireContext())
customDialogList.dismiss() customDialogList.dismiss()
} }

View File

@ -13,20 +13,20 @@ import es.verdnatura.R
import es.verdnatura.databinding.FragmentFaltasBinding import es.verdnatura.databinding.FragmentFaltasBinding
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.* import es.verdnatura.presentation.common.*
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.faltas.adapter.FaltasAdapter import es.verdnatura.presentation.view.feature.faltas.adapter.FaltasAdapter
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(FaltasViewModel::class) { class FaltasFragment :
BaseFragment<FragmentFaltasBinding, FaltasViewModel>(FaltasViewModel::class) {
private var adapter : FaltasAdapter? = null private var adapter: FaltasAdapter? = null
private lateinit var customDialogInput: CustomDialogInput private lateinit var customDialogInput: CustomDialogInput
private var listInvetory:ArrayList<ItemFaltasVO> = ArrayList() private var listInvetory: ArrayList<ItemFaltasVO> = ArrayList()
private var listInvetoryAux:ArrayList<ItemFaltasVO> = ArrayList() private var listInvetoryAux: ArrayList<ItemFaltasVO> = ArrayList()
// private lateinit var customDialog: CustomDialog
// private lateinit var customDialog: CustomDialog
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
private var reload = false private var reload = false
private var hideLoad = true private var hideLoad = true
@ -44,30 +44,30 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
viewModel.getFaltas(getData(USER),getData(PASSWORD),getData(WAREHOUSEFK)) viewModel.getFaltas(getData(USER), getData(PASSWORD), getData(WAREHOUSEFK))
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }
override fun init() { override fun init() {
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
ma.hideBottomNavigation(View.GONE) ma.hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text = getString(R.string.faultsReview) binding.mainToolbar.toolbarTitle.text = getString(R.string.faultsReview)
setToolBar() setToolBar()
customDialogInput = CustomDialogInput(requireContext()) customDialogInput = CustomDialogInput(requireContext())
// customDialog = CustomDialog(requireContext()) // customDialog = CustomDialog(requireContext())
setEvents() setEvents()
if (reload){ if (reload) {
reload = false reload = false
hideLoad = false hideLoad = false
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.getFaltas(getData(USER),getData(PASSWORD),getData(WAREHOUSEFK)) viewModel.getFaltas(getData(USER), getData(PASSWORD), getData(WAREHOUSEFK))
} }
super.init() super.init()
} }
private fun setToolBar(){ private fun setToolBar() {
val listIcons: ArrayList<ImageView> = ArrayList() val listIcons: ArrayList<ImageView> = ArrayList()
val iconReload = ImageView(context) val iconReload = ImageView(context)
@ -78,26 +78,28 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
} }
listIcons.add(iconReload) listIcons.add(iconReload)
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons,object: OnOptionsSelectedListener { binding.mainToolbar.toolbarIcons.adapter =
override fun onOptionsItemSelected(item: Drawable) { ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
if (item == iconReload.drawable){ override fun onOptionsItemSelected(item: Drawable) {
binding.splashProgress.visibility = View.VISIBLE if (item == iconReload.drawable) {
viewModel.getFaltas(getData(USER),getData(PASSWORD),getData(WAREHOUSEFK)) 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 { binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed() requireActivity().onBackPressed()
} }
binding.filterItemFk.setOnKeyListener { v, keyCode, event -> binding.filterItemFk.setOnKeyListener { v, keyCode, event ->
if (binding.filterItemFk.text.toString().isNullOrEmpty()){ if (binding.filterItemFk.text.toString().isNullOrEmpty()) {
if (listInvetory.size != listInvetoryAux.size){ if (listInvetory.size != listInvetoryAux.size) {
listInvetory.removeAll(listInvetoryAux) listInvetory.removeAll(listInvetoryAux)
listInvetoryAux.forEach { listInvetoryAux.forEach {
listInvetory.add(it) listInvetory.add(it)
@ -105,10 +107,10 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
} }
}else{ } else {
listInvetory.removeAll(listInvetoryAux) listInvetory.removeAll(listInvetoryAux)
listInvetoryAux.forEach { listInvetoryAux.forEach {
if (it.itemFk.contains(binding.filterItemFk.text.toString(),true)){ if (it.itemFk.contains(binding.filterItemFk.text.toString(), true)) {
listInvetory.add(it) listInvetory.add(it)
} }
} }
@ -121,35 +123,54 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
} }
override fun observeViewModel() { override fun observeViewModel() {
with(viewModel){ with(viewModel) {
faltasList.observe(viewLifecycleOwner, Observer { faltasList.observe(viewLifecycleOwner, Observer {
if (hideLoad){ if (hideLoad) {
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
}else{ } else {
hideLoad = true hideLoad = true
} }
listInvetory = ArrayList() listInvetory = ArrayList()
listInvetoryAux = ArrayList() listInvetoryAux = ArrayList()
it.list.forEach { it.list.forEach {
listInvetory.add(it) listInvetory.add(it)
listInvetoryAux.add(it) listInvetoryAux.add(it)
} }
adapter = FaltasAdapter(listInvetory,object: OnFaltasNichoClickListener { adapter = FaltasAdapter(listInvetory, object : OnFaltasNichoClickListener {
override fun onFaltasNichoClickListener(item: ItemFaltasVO) { override fun onFaltasNichoClickListener(item: ItemFaltasVO) {
customDialogInput.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){ customDialogInput.setTitle(item.itemFk + "\n" + item.longName + " " + item.size)
viewModel.itemStockUpdate(item.itemFk,getData(WAREHOUSEFK),getData(USER),getData(PASSWORD),customDialogInput.getValue(),"0","temTrash") .setDescription("Cantidad real(" + item.nicho + ")")
.setOkButton("Tirar") {
viewModel.itemStockUpdate(
item.itemFk,
getData(WAREHOUSEFK),
getData(USER),
getData(PASSWORD),
customDialogInput.getValue(),
"0"
)
changeOfflineValue(item) changeOfflineValue(item)
customDialogInput.dismiss() customDialogInput.dismiss()
}.setKoButton("Cancelar"){ }.setKoButton("Cancelar") {
customDialogInput.dismiss() customDialogInput.dismiss()
}.setValue("0").show() }.setValue("0").show()
customDialogInput.getEditText().requestFocus() customDialogInput.getEditText().requestFocus()
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event -> customDialogInput.getEditText()
.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
if (!customDialogInput.getValue().isNullOrEmpty()){ if (!customDialogInput.getValue().isNullOrEmpty()) {
viewModel.itemStockUpdate(item.itemFk,getData(WAREHOUSEFK),getData(USER),getData(PASSWORD),customDialogInput.getValue(),"0","temTrash") viewModel.itemStockUpdate(
item.itemFk,
getData(WAREHOUSEFK),
getData(USER),
getData(PASSWORD),
customDialogInput.getValue(),
"0"
)
changeOfflineValue(item) changeOfflineValue(item)
} }
customDialogInput.setValue("") customDialogInput.setValue("")
@ -160,32 +181,36 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
false false
} }
} }
},object: OnFaltasReviewClickListener{ }, object : OnFaltasReviewClickListener {
override fun onFaltasReviewClickListener(item: ItemFaltasVO) { override fun onFaltasReviewClickListener(item: ItemFaltasVO) {
viewModel.faultsReview_isChecked(getData(USER),getData(PASSWORD),item.itemFk,getData(WAREHOUSEFK),"faultsReview_isChecked") viewModel.faultsReview_isChecked(
changeOfflineValue(item) getData(USER),
} getData(PASSWORD),
item.itemFk,
getData(WAREHOUSEFK),
"faultsReview_isChecked"
)
changeOfflineValue(item)
}
},pasillerosItemClickListener!!) }, pasillerosItemClickListener!!)
binding.locationRecyclerview.adapter = adapter binding.locationRecyclerview.adapter = adapter
binding.locationRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) binding.locationRecyclerview.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
}) })
response.observe(viewLifecycleOwner, Observer { response.observe(viewLifecycleOwner, Observer {
if (it.isError){ if (it.isError) {
ma.messageWithSound(it.errorMessage,it.isError,false) ma.messageWithSound(it.errorMessage, it.isError, false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()*/
} }
}) })
} }
} }
private fun changeOfflineValue(item: ItemFaltasVO){ private fun changeOfflineValue(item: ItemFaltasVO) {
var i = 0 var i = 0
var position = 0 var position = 0
listInvetory.forEach { listInvetory.forEach {

View File

@ -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 : getItemCardUserCase.itemStockUpdate(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object :
Callback<String> { Callback<Any> {
override fun onFailure(call: Call<String>, t: Throwable) { override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
} }
override fun onResponse(call: Call<String>, response: Response<String>) { override fun onResponse(call: Call<Any>, response: Response<Any>) {
if (response.body() == null){ if (response.isSuccessful()){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{ }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){ fun faultsReview_isChecked(user:String,password:String,itemFk:String,warehouseFk:String,callFunction:String){
getInventaryUserCase.faultsReview_isChecked(user,password,itemFk,warehouseFk).enqueue(object : getInventaryUserCase.faultsReview_isChecked(user,password,itemFk,warehouseFk).enqueue(object :
Callback<String> { Callback<Any> {
override fun onFailure(call: Call<String>, t: Throwable) { override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
} }
override fun onResponse(call: Call<String>, response: Response<String>) { override fun onResponse(call: Call<Any>, response: Response<Any>) {
if (response.body() == null){ if (!response.isSuccessful){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{ }else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!) _response.value = ResponseItemVO(isError = false,response = response.message())
} }
} }

View File

@ -214,7 +214,7 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
//sergio: cambiado customdialogInput pòr customdialog 6.1.4 //sergio: cambiado customdialogInput pòr customdialog 6.1.4
customDialog.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){ customDialog.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){
//customDialogInput.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){ //customDialogInput.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){
viewModel.itemTrash(item.itemFk,getData(WAREHOUSEFK),getData(USER),getData(PASSWORD),item.nicho,"0","itemTrash") viewModel.itemTrash(item.itemFk,getData(WAREHOUSEFK),getData(USER),getData(PASSWORD),item.nicho,"0")
//viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,"0","0") //viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,"0","0")
// viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0") // viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0")
changeOfflineValue(item) changeOfflineValue(item)

View File

@ -150,7 +150,7 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
fun itemStockUpdate(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String){ /*fun itemStockUpdate(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String){
//sergio: se modifica por CAU a itemTrash //sergio: se modifica por CAU a itemTrash
// https://cau.verdnatura.es/scp/tickets.php?id=21043 al nuevo procedimiento itemTrash // https://cau.verdnatura.es/scp/tickets.php?id=21043 al nuevo procedimiento itemTrash
getItemCardUserCase.itemStockUpdate(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : Callback<String>{ getItemCardUserCase.itemStockUpdate(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : Callback<String>{
@ -170,24 +170,24 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
} }
}) })
} }*/
//sergio: se modifica por CAU a itemTrash //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<String>{ getItemCardUserCase.itemTrash(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : Callback<Any>{
override fun onFailure(call: Call<String>, t: Throwable) { override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
} }
override fun onResponse(call: Call<String>, response: Response<String>) { override fun onResponse(call: Call<Any>, response: Response<Any>) {
if (response.body() == null){ if (!response.isSuccessful){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{ }else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!) _response.value = ResponseItemVO(isError = false,response = response.message())
} }
} }

View File

@ -131,8 +131,9 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
val openURL = Intent(Intent.ACTION_VIEW) val openURL = Intent(Intent.ACTION_VIEW)
openURL.data = openURL.data =
// sergio REdmine Tarea #3730 // sergio REdmine Tarea #3730
Uri.parse("https://app.verdnatura.es/bin/vn-picking.apk") //Uri.parse("https://app.verdnatura.es/bin/vn-picking.apk")
// Uri.parse(it.url) Uri.parse(it.url)
//Log.d("VERDNATURA::","Datos"+ openURL.data)
startActivity(openURL) startActivity(openURL)
} }
@ -383,7 +384,8 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
viewModel.checkVersion( viewModel.checkVersion(
user = binding.edittextUsername.text.toString(), user = binding.edittextUsername.text.toString(),
password = binding.edittextPassword.text.toString(), password = binding.edittextPassword.text.toString(),
nameApp = "warehouse", "getVersion" nameApp = "warehouse", "getVersion",
) )
} }

View File

@ -290,7 +290,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
it.appname, it.appname,
it.version, it.version,
it.IsVersionCritical, it.IsVersionCritical,
//it.url, it.url,
isError = false, isError = false,
errorMessage = "" errorMessage = ""
) )

View File

@ -37,7 +37,7 @@ class versionApp(
val appname: String = "", val appname: String = "",
val version: String = "", val version: String = "",
var IsVersionCritical: Int = 0, var IsVersionCritical: Int = 0,
// var url: String="", var url: String="",
var isError: Boolean = false, var isError: Boolean = false,
var errorMessage: String = "" var errorMessage: String = ""
) )

View File

@ -488,7 +488,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
"Flejado buffer" -> { "Flejado buffer" -> {
addFragmentOnTop(BufferFragment.newInstance(item.title)) addFragmentOnTop(BufferFragment.newInstance(item.title))
} }
/*sergio:pruebas*/
"Pre Control" -> { "Pre Control" -> {
addFragmentOnTop(PreControladorFragment.newInstance()) addFragmentOnTop(PreControladorFragment.newInstance())
} }

View File

@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment
import android.content.Context import android.content.Context
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.util.Log
import android.view.View import android.view.View
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
@ -101,7 +102,7 @@ class ExpeditionPalletDetailFragment(
}else if(item == iconBorrar){ }else if(item == iconBorrar){
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.expeditionPalletDel(getData(USER), viewModel.expeditionPalletDel(getData(USER),
getData(PASSWORD),itemPallet!!.Pallet,"expeditionPallet_Del") getData(PASSWORD),itemPallet!!.Pallet)
}else if(item == iconPrint){ }else if(item == iconPrint){
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
@ -154,6 +155,7 @@ class ExpeditionPalletDetailFragment(
}else{ }else{
binding.splashProgress.visibility=View.VISIBLE binding.splashProgress.visibility=View.VISIBLE
Log.d("VERDNATURA::","Cambiando estado a paletizado")
viewModel.expeditionState_addByPallet( getData(USER),getData(PASSWORD),itemPallet!!.Pallet,"PALLETIZED","expeditionState_addByPallet") viewModel.expeditionState_addByPallet( getData(USER),getData(PASSWORD),itemPallet!!.Pallet,"PALLETIZED","expeditionState_addByPallet")
} }

View File

@ -59,16 +59,16 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel() {
}) })
} }
fun expeditionPalletDel(usuario:String,password:String,vPalletFk:String,callFunction:String){ fun expeditionPalletDel(usuario:String,password:String,vPalletFk:String){
getPaletizadoresUserCase.expeditionPalletDel(usuario,password,vPalletFk).enqueue(object : Callback<String>{ getPaletizadoresUserCase.expeditionPalletDel(usuario,password,vPalletFk).enqueue(object : Callback<Any>{
override fun onFailure(call: Call<String>, t: Throwable) { override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
} }
override fun onResponse(call: Call<String>, response: Response<String>) { override fun onResponse(call: Call<Any>, response: Response<Any>) {
if (response.body() == null){ if (response.isSuccessful){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{ }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, vPalletFk: String,
vSectorFk: String,callFunction:String){ vSectorFk: String,callFunction:String){
getPaletizadoresUserCase.expeditionPalletPrintSet(usuario,password,vPalletFk,vSectorFk).enqueue(object : Callback<String>{ getPaletizadoresUserCase.expeditionPalletPrintSet(usuario,password,vPalletFk,vSectorFk).enqueue(object : Callback<Any>{
override fun onFailure(call: Call<String>, t: Throwable) { override fun onFailure(call: Call<Any>, t: Throwable) {
_responsePrintPallet.value = ResponseItemVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)) _responsePrintPallet.value = ResponseItemVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))
} }
override fun onResponse(call: Call<String>, response: Response<String>) { override fun onResponse(call: Call<Any>, response: Response<Any>) {
if (response.body() == null){ if (!response.isSuccessful){
_responsePrintPallet.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) _responsePrintPallet.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{ }else{
_responsePrintPallet.value = ResponseItemVO(isError = false,response = response.body()!!) _responsePrintPallet.value = ResponseItemVO(isError = false,response = response.message())
} }
} }
}) })

View File

@ -131,9 +131,7 @@ class ExpeditionPalletFragment(
response.observe(viewLifecycleOwner, Observer { response.observe(viewLifecycleOwner, Observer {
if (it.isError){ if (it.isError){
ma.messageWithSound(it.errorMessage,true,false) 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())) listExpeditions.add(0,BarcodeVO(code = customDialogList.getValue()))
customDialogList.setDescription("Total: "+listExpeditions.size) customDialogList.setDescription("Total: "+listExpeditions.size)
viewModel.expeditionScanPut(getData(USER), 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()}") ////Log.i("VERDNATURA:"," palletizando ${it.list.get(0).palletFk} expedi: ${customDialogList.getValue()}")
viewModel.checkRouteExpeditionScanPut(getData(USER), viewModel.checkRouteExpeditionScanPut(getData(USER),
getData(PASSWORD),it.list.get(0).palletFk,customDialogList.getValue(),"expedition_checkRoute") getData(PASSWORD),it.list.get(0).palletFk,customDialogList.getValue(),"expedition_checkRoute")

View File

@ -92,16 +92,16 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
}) })
} }
fun expeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String,callFunction:String){ fun expeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String){
getPaletizadoresUserCase.expeditionScanPut(usuario,password,vPalletFk,vExpeditionFk).enqueue(object : Callback<String>{ getPaletizadoresUserCase.expeditionScanPut(usuario,password,vPalletFk,vExpeditionFk).enqueue(object : Callback<Any>{
override fun onFailure(call: Call<String>, t: Throwable) { override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
} }
override fun onResponse(call: Call<String>, response: Response<String>) { override fun onResponse(call: Call<Any>, response: Response<Any>) {
if (response.body() == null){ if (!response.isSuccessful){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{ }else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!) _response.value = ResponseItemVO(isError = false,response = response.message())
} }
} }
}) })

View File

@ -6,6 +6,8 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetPaletizadoresUserCase import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel 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.Event
import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionScanList import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionScanList
@ -35,7 +37,6 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel() {
val responseDeleteScan: LiveData<ResponseItemVO> val responseDeleteScan: LiveData<ResponseItemVO>
get() = _responseDeleteScan get() = _responseDeleteScan
//sergio:añadido para llamada nueva checkexpeditionScan
private val _responseCheckexpeditionScanPut by lazy { MutableLiveData<ResponseItemVO>() } private val _responseCheckexpeditionScanPut by lazy { MutableLiveData<ResponseItemVO>() }
val responseCheckexpeditionScanPut: LiveData<ResponseItemVO> val responseCheckexpeditionScanPut: LiveData<ResponseItemVO>
get() = _responseCheckexpeditionScanPut get() = _responseCheckexpeditionScanPut
@ -91,15 +92,17 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel() {
} }
fun expeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String){ fun expeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String){
getPaletizadoresUserCase.expeditionScanPut(usuario,password,vPalletFk,vExpeditionFk).enqueue(object : Callback<String>{ getPaletizadoresUserCase.expeditionScanPut(usuario,password,vPalletFk,vExpeditionFk).enqueue(object : Callback<Any>{
override fun onFailure(call: Call<String>, t: Throwable) { override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada expeditionScan_Put."+t.message!!) _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(
nameofFunction(this),t.message!!)
)
} }
override fun onResponse(call: Call<String>, response: Response<String>) { override fun onResponse(call: Call<Any>, response: Response<Any>) {
if (response.body() == null){ if (!response.isSuccessful){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada expeditionScan_Put") _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()!!))
}else{ }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){ fun expeditionScanDel(usuario:String,password:String,vScanFk:String){
getPaletizadoresUserCase.expeditionScanDel(usuario,password,vScanFk).enqueue(object : Callback<String>{ getPaletizadoresUserCase.expeditionScanDel(usuario,password,vScanFk).enqueue(object : Callback<Any>{
override fun onFailure(call: Call<String>, t: Throwable) { override fun onFailure(call: Call<Any>, t: Throwable) {
_responseDeleteScan.value = ResponseItemVO(isError = true,errorMessage = "Error al llamar expeditionScan_Del."+t.message!!) _responseDeleteScan.value = ResponseItemVO(isError = true,errorMessage = "Error al llamar expeditionScan_Del."+t.message!!)
} }
override fun onResponse(call: Call<String>, response: Response<String>) { override fun onResponse(call: Call<Any>, response: Response<Any>) {
if (response.body() == null){ if (response.body() == null){
_responseDeleteScan.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada expeditionScan_Del") _responseDeleteScan.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada expeditionScan_Del")
}else{ }else{
_responseDeleteScan.value = ResponseItemVO(isError = false,response = response.body()!!) _responseDeleteScan.value = ResponseItemVO(isError = false,response = response.message())
} }
} }
}) })

View File

@ -115,7 +115,7 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
ma.hideKeyboard(customDialogHor.getDestinoEditText()) ma.hideKeyboard(customDialogHor.getDestinoEditText())
if (!customDialogHor.getDestinoValue().isNullOrEmpty() && !customDialogHor.getHoraValue().isNullOrEmpty()){ if (!customDialogHor.getDestinoValue().isNullOrEmpty() && !customDialogHor.getHoraValue().isNullOrEmpty()){
viewModel.expeditionTruckAdd(getData(USER), viewModel.expeditionTruckAdd(getData(USER),
getData(PASSWORD),customDialogHor.getHoraValue(),customDialogHor.getDestinoValue(),"expeditionTruck_Add") getData(PASSWORD),customDialogHor.getHoraValue(),customDialogHor.getDestinoValue())
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
customDialogHor.dismiss() customDialogHor.dismiss()
} }
@ -130,7 +130,7 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
if (!customDialogHor.getDestinoValue().isNullOrEmpty() && !customDialogHor.getHoraValue().isNullOrEmpty()){ if (!customDialogHor.getDestinoValue().isNullOrEmpty() && !customDialogHor.getHoraValue().isNullOrEmpty()){
viewModel.expeditionTruckAdd(getData(USER), viewModel.expeditionTruckAdd(getData(USER),
getData(PASSWORD),customDialogHor.getHoraValue(),customDialogHor.getDestinoValue(),"expeditionTruck_Add") getData(PASSWORD),customDialogHor.getHoraValue(),customDialogHor.getDestinoValue())
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
customDialogHor.dismiss() customDialogHor.dismiss()
} }

View File

@ -55,17 +55,17 @@ class ExpeditionTruckListViewModel(context: Context) : BaseViewModel() {
}) })
} }
fun expeditionTruckAdd(usuario:String,password:String,vHour:String,vDescription:String,callFunction:String){ fun expeditionTruckAdd(usuario:String,password:String,vHour:String,vDescription:String){
getPaletizadoresUserCase.expeditionTruckAdd(usuario,password,vHour,vDescription).enqueue(object : Callback<String>{ getPaletizadoresUserCase.expeditionTruckAdd(usuario,password,vHour,vDescription).enqueue(object : Callback<Any>{
override fun onFailure(call: Call<String>, t: Throwable) { override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
} }
override fun onResponse(call: Call<String>, response: Response<String>) { override fun onResponse(call: Call<Any>, response: Response<Any>) {
if (response.body() == null){ if (!response.isSuccessful){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{ }else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!) _response.value = ResponseItemVO(isError = false,response = response.message())
} }
} }

View File

@ -63,7 +63,7 @@ class ParkingSaleViewModel(context: Context) : BaseViewModel() {
} }
}) })
} }
fun saleParking_add(usuario: String, password: String, sales:List<String>,parking: String,callFunction:String) /* fun saleParking_add(usuario: String, password: String, sales:List<String>,parking: String,callFunction:String)
{ {
getUbicadorUserCase.saleParking_add(usuario, password, sales, parking) getUbicadorUserCase.saleParking_add(usuario, password, sales, parking)
.enqueue(object : Callback<String> .enqueue(object : Callback<String>
@ -91,6 +91,6 @@ class ParkingSaleViewModel(context: Context) : BaseViewModel() {
} }
} }
}) })
} }*/
} }

View File

@ -189,7 +189,7 @@ class PasilleroViewModel : BaseViewModel() {
PasillerosItemVO( PasillerosItemVO(
30, 30,
R.drawable.pallet_shipping_selected, 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"
) )
) )

View File

@ -574,7 +574,7 @@ class EndSacadorFragment(
) )
} else { } else {
binding.mainToolbar.toolbarTitle.text = ticket if (ticket.isNullOrBlank()){binding.mainToolbar.toolbarTitle.text = collection.collectionFk}
sales = ArrayList() sales = ArrayList()
salesList.forEach { salesList.forEach {
@ -657,7 +657,8 @@ class EndSacadorFragment(
if (it.saldo == it.picked) if (it.saldo == it.picked)
totalMark += 1 totalMark += 1
} }
binding.mainToolbar.toolbarTitle.text = ticket if (ticket.isNullOrBlank()){binding.mainToolbar.toolbarTitle.text = collection.collectionFk}
binding.mainToolbar.toolbarSubtitle.text = "" + totalMark + "/" + sales.size binding.mainToolbar.toolbarSubtitle.text = "" + totalMark + "/" + sales.size
if (totalMark == sales.size) { if (totalMark == sales.size) {
"Ticket completo".toast(this.context, Toast.LENGTH_SHORT) "Ticket completo".toast(this.context, Toast.LENGTH_SHORT)
@ -1002,7 +1003,7 @@ class EndSacadorFragment(
password = getData(PASSWORD), password = getData(PASSWORD),
itemShelvingFk = itemShelvingFk, itemShelvingFk = itemShelvingFk,
saleFk = sales[storedPosition].idMovimiento, saleFk = sales[storedPosition].idMovimiento,
quantity = customDialogList.getValue(), callFunction = "itemShelvingSaleSupplyAdd" quantity = customDialogList.getValue()
) )
} catch (e: Exception) { } catch (e: Exception) {
@ -1139,7 +1140,8 @@ class EndSacadorFragment(
//OTROS //OTROS
private fun setToolBar() { private fun setToolBar() {
binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE binding.mainToolbar.toolbarSubtitle.visibility = VISIBLE
binding.mainToolbar.toolbarTitle.text=collection.collectionFk
val listIcons: ArrayList<ImageView> = ArrayList() val listIcons: ArrayList<ImageView> = ArrayList()
@ -1195,35 +1197,6 @@ class EndSacadorFragment(
requireActivity().hideKeyboard() requireActivity().hideKeyboard()
} }
/* private fun parkingTicket(ticket: String, parking: String) {
var saleParkingList: MutableList<String> = 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 { companion object {
fun newInstance(collection: CollectionVO?, entrypoint: String) = EndSacadorFragment( fun newInstance(collection: CollectionVO?, entrypoint: String) = EndSacadorFragment(
@ -1409,7 +1382,7 @@ class EndSacadorFragment(
password = getData(PASSWORD), password = getData(PASSWORD),
saleFk = sales[position].idMovimiento, saleFk = sales[position].idMovimiento,
quantity = totalQuantity.toString(), quantity = totalQuantity.toString(),
originalQuantity = sales[position].quantity.toString(), "saleMove" originalQuantity = sales[position].quantity.toString()
) )
Log.d("VERDNATURA::", "responseSaleMove enviando") Log.d("VERDNATURA::", "responseSaleMove enviando")
/* /*

View File

@ -803,7 +803,7 @@ class PreSacadorFragment :
password = getData(PASSWORD), password = getData(PASSWORD),
itemShelvingFk = itemShelvingFk, itemShelvingFk = itemShelvingFk,
saleFk = sales[storedPosition].idMovimiento, saleFk = sales[storedPosition].idMovimiento,
quantity = customDialogList.getValue(), callFunction = "itemShelvingSaleSupplyAdd" quantity = customDialogList.getValue()
) )
} catch (e: Exception) { } catch (e: Exception) {
@ -994,34 +994,6 @@ class PreSacadorFragment :
requireActivity().hideKeyboard() requireActivity().hideKeyboard()
} }
/* private fun parkingTicket(ticket: String, parking: String) {
var saleParkingList: MutableList<String> = 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 { companion object {
@ -1200,7 +1172,7 @@ class PreSacadorFragment :
password = getData(PASSWORD), password = getData(PASSWORD),
saleFk = sales[position].idMovimiento, saleFk = sales[position].idMovimiento,
quantity = totalQuantity.toString(), quantity = totalQuantity.toString(),
originalQuantity = sales[position].quantity.toString(), "saleMove" originalQuantity = sales[position].quantity.toString()
) )
/* /*
try { try {

View File

@ -31,7 +31,8 @@ import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionViewModel>( class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionViewModel>(
ReposicionViewModel::class){ ReposicionViewModel::class
) {
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
@ -39,23 +40,23 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
private lateinit var customDialogList: CustomDialogList private lateinit var customDialogList: CustomDialogList
private lateinit var customDialogInput: CustomDialogInput private lateinit var customDialogInput: CustomDialogInput
private var sales:ArrayList<PreSacadorItemVO> = ArrayList() private var sales: ArrayList<PreSacadorItemVO> = ArrayList()
private var lm : LinearLayoutManager? = null private var lm: LinearLayoutManager? = null
private var saleAdapter: ReposicionAdapter? = null private var saleAdapter: ReposicionAdapter? = null
var mperror: MediaPlayer? = null var mperror: MediaPlayer? = null
var mpok: MediaPlayer? = null var mpok: MediaPlayer? = null
private var storedBackPosition : Int = 0 private var storedBackPosition: Int = 0
private var storedShelvingPosition:Int = 0 private var storedShelvingPosition: Int = 0
private var storedPosition: Int = 0 private var storedPosition: Int = 0
private var listPlacementSupply:ArrayList<BarcodeVO> = ArrayList() private var listPlacementSupply: ArrayList<BarcodeVO> = ArrayList()
private var itemShelvingFkStored : String = "" private var itemShelvingFkStored: String = ""
private var placementSupplyAdapter : BarcodeAdapter? = null private var placementSupplyAdapter: BarcodeAdapter? = null
private var goBack:Boolean = false private var goBack: Boolean = false
private var goBack2:Boolean = false private var goBack2: Boolean = false
companion object { companion object {
fun newInstance() = ReposicionFragment() fun newInstance() = ReposicionFragment()
@ -72,7 +73,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
customDialogList = CustomDialogList(requireContext()) customDialogList = CustomDialogList(requireContext())
customDialogInput = CustomDialogInput(requireContext()) customDialogInput = CustomDialogInput(requireContext())
ma.hideBottomNavigation(View.GONE) ma.hideBottomNavigation(View.GONE)
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
binding.mainToolbar.toolbarTitle.text = getString(R.string.itemPlacementSupplyGetOrder) binding.mainToolbar.toolbarTitle.text = getString(R.string.itemPlacementSupplyGetOrder)
setToolBar() setToolBar()
@ -81,8 +82,8 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
mperror = MediaPlayer.create((activity as MainActivity),R.raw.error) mperror = MediaPlayer.create((activity as MainActivity), R.raw.error)
mpok = MediaPlayer.create((activity as MainActivity),R.raw.ok) mpok = MediaPlayer.create((activity as MainActivity), R.raw.ok)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }
@ -94,32 +95,42 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
} }
private fun setEvents(){ private fun setEvents() {
binding.mainToolbar.backButton.setOnClickListener { binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed() requireActivity().onBackPressed()
} }
binding.btnObtener.setOnClickListener { binding.btnObtener.setOnClickListener {
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.itemPlacementSupplyGetOrder(usuario = getData(USER),password = getData(PASSWORD),sectorFk = getData(SECTORFK),"itemPlacementSupplyGetOrder") viewModel.itemPlacementSupplyGetOrder(
usuario = getData(USER),
password = getData(PASSWORD),
sectorFk = getData(SECTORFK),
"itemPlacementSupplyGetOrder"
)
} }
binding.btnCancelar.setOnClickListener { binding.btnCancelar.setOnClickListener {
customDialog.setTitle("Confirmar").setDescription("¿Estás seguro de cerrar el pedido?").setKoButton("Cerrar"){ customDialog.setTitle("Confirmar").setDescription("¿Estás seguro de cerrar el pedido?")
scanRequest() .setKoButton("Cerrar") {
customDialog.dismiss() scanRequest()
}.setOkButton("Cerrar"){ customDialog.dismiss()
}.setOkButton("Cerrar") {
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
if (sales.count() > 0){ if (sales.count() > 0) {
viewModel.itemPlacementSupplyCloseOrder(usuario = getData(USER),password = getData(PASSWORD),id = sales[0].id,quantity = sales[0].quantity.toString(),"itemPlacementSupplyCloseOrder") viewModel.itemPlacementSupplyCloseOrder(
usuario = getData(USER),
password = getData(PASSWORD),
id = sales[0].id,
quantity = sales[0].quantity.toString()
)
} }
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()
} }
//ESCANER ========= //ESCANER =========
@ -127,11 +138,11 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
binding.scanInput.requestFocus() binding.scanInput.requestFocus()
binding.scanInput.setOnEditorActionListener { v, actionId, event -> binding.scanInput.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { 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()) "Pedido completado".toast(requireContext())
}else{ } else {
findSale(binding.scanInput.text.toString()) findSale(binding.scanInput.text.toString())
} }
@ -150,18 +161,23 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
//LISTA ========= //LISTA =========
binding.collectionSwipe.setOnRefreshListener { binding.collectionSwipe.setOnRefreshListener {
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.itemPlacementSupplyGetOrder(usuario = getData(USER),password = getData(PASSWORD),sectorFk = getData(SECTORFK),"itemPlacementSupplyGetOrder") viewModel.itemPlacementSupplyGetOrder(
usuario = getData(USER),
password = getData(PASSWORD),
sectorFk = getData(SECTORFK),
"itemPlacementSupplyGetOrder"
)
binding.collectionSwipe.isRefreshing = false binding.collectionSwipe.isRefreshing = false
} }
} }
private fun hideKeyboards(){ private fun hideKeyboards() {
requireActivity().hideKeyboard() requireActivity().hideKeyboard()
} }
override fun observeViewModel() { override fun observeViewModel() {
with(viewModel){ with(viewModel) {
salesList.observe(viewLifecycleOwner, Observer { salesList.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
createSaleList(it) createSaleList(it)
@ -175,21 +191,22 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
responseCode.observe(viewLifecycleOwner, Observer { responseCode.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
if (!goBack2){ if (!goBack2) {
if (it.isError){ if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage).setKoButton("Cerrar"){ customDialog.setTitle("Error").setDescription(it.errorMessage)
scanRequest() .setKoButton("Cerrar") {
customDialog.dismiss() scanRequest()
}.show() customDialog.dismiss()
}else{ }.show()
if (checkItemScan(it.response)){ } else {
if (checkItemScan(it.response)) {
scanRequest() scanRequest()
customDialogList.dismiss() customDialogList.dismiss()
mpok?.start() mpok?.start()
onQuantityOfShelvingSelected(itemShelvingFkStored) onQuantityOfShelvingSelected(itemShelvingFkStored)
}else{ } else {
customDialogList.setValueTwo("") customDialogList.setValueTwo("")
// showErrorMessage("El resultado del procedimiento barcodeToItem de la etiqueta escaneada es: " +it.response) // showErrorMessage("El resultado del procedimiento barcodeToItem de la etiqueta escaneada es: " +it.response)
showErrorMessage("La línea de compra de la etiqueta escaneada no existe.") showErrorMessage("La línea de compra de la etiqueta escaneada no existe.")
mperror?.start() mperror?.start()
} }
@ -212,23 +229,24 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
super.observeViewModel() super.observeViewModel()
} }
private fun createSaleList(salesList : List<PreSacadorItemVO>){ private fun createSaleList(salesList: List<PreSacadorItemVO>) {
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
if (salesList.isNullOrEmpty()){ if (salesList.isNullOrEmpty()) {
customDialog.setTitle("Reposición").setDescription("No existen pedidos para reponer").setKoButton("Cancelar"){ customDialog.setTitle("Reposición").setDescription("No existen pedidos para reponer")
if (sales.count()>0){ .setKoButton("Cancelar") {
sales.clear() if (sales.count() > 0) {
saleAdapter!!.notifyDataSetChanged() sales.clear()
} saleAdapter!!.notifyDataSetChanged()
customDialog.dismiss() }
}.show() customDialog.dismiss()
}.show()
binding.scanInput.visibility = View.GONE binding.scanInput.visibility = View.GONE
binding.btnCancelar.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()) "Pedido completado".toast(requireContext())
binding.scanInput.visibility = View.GONE binding.scanInput.visibility = View.GONE
binding.btnCancelar.visibility = View.GONE binding.btnCancelar.visibility = View.GONE
}else{ } else {
binding.scanInput.visibility = View.VISIBLE binding.scanInput.visibility = View.VISIBLE
binding.btnCancelar.visibility = View.VISIBLE binding.btnCancelar.visibility = View.VISIBLE
@ -239,7 +257,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
} }
lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
saleAdapter = ReposicionAdapter(sales,pasillerosItemClickListener!!,object : saleAdapter = ReposicionAdapter(sales, pasillerosItemClickListener!!, object :
OnSaleClickListener { OnSaleClickListener {
override fun onSaleClick(sale: SaleVO) { override fun onSaleClick(sale: SaleVO) {
sales.forEachIndexed { index, saleVO -> sales.forEachIndexed { index, saleVO ->
@ -261,24 +279,24 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
//SEARCH AND MARK //SEARCH AND MARK
private fun findSale(txtscan:String){ private fun findSale(txtscan: String) {
var index = 0 var index = 0
var isBreak = false var isBreak = false
var isOk = false var isOk = false
for (saleVO in sales) { for (saleVO in sales) {
if(saleVO.quantity != saleVO.picked){ if (saleVO.quantity != saleVO.picked) {
//1- Por carro //1- Por carro
var shelvingIndex = 0 var shelvingIndex = 0
for (placementVO in saleVO.carros){ for (placementVO in saleVO.carros) {
if (txtscan.uppercase() == placementVO.shelving.uppercase()){ if (txtscan.uppercase() == placementVO.shelving.uppercase()) {
if (mpok!= null) mpok!!.start() if (mpok != null) mpok!!.start()
isOk = true isOk = true
showShelving(index,shelvingIndex) showShelving(index, shelvingIndex)
isBreak = true isBreak = true
break break
} }
shelvingIndex+=1 shelvingIndex += 1
} }
if (isBreak) break if (isBreak) break
} }
@ -287,30 +305,30 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
if (!isOk) { if (!isOk) {
mperror!!.start() mperror!!.start()
("Elemento escaneado no encontrado: "+txtscan).toast(requireContext()) ("Elemento escaneado no encontrado: " + txtscan).toast(requireContext())
} }
} }
private fun findSale(txtscan:String,position: Int){ private fun findSale(txtscan: String, position: Int) {
var index = 0 var index = 0
var isBreak = false var isBreak = false
var isOk = false var isOk = false
val saleVO = sales[position] val saleVO = sales[position]
if(saleVO.quantity != saleVO.picked){ if (saleVO.quantity != saleVO.picked) {
//1- Por carro //1- Por carro
var shelvingIndex = 0 var shelvingIndex = 0
for (placementVO in saleVO.carros){ for (placementVO in saleVO.carros) {
if (txtscan.uppercase() == placementVO.shelving.uppercase()){ if (txtscan.uppercase() == placementVO.shelving.uppercase()) {
if(mpok != null) mpok!!.start() if (mpok != null) mpok!!.start()
isOk = true isOk = true
showShelving(position,shelvingIndex) showShelving(position, shelvingIndex)
isBreak = true isBreak = true
break break
} }
shelvingIndex+=1 shelvingIndex += 1
} }
} }
index += 1 index += 1
@ -318,22 +336,23 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
if (!isOk) { if (!isOk) {
mperror!!.start() mperror!!.start()
("Elemento escaneado no encontrado: "+txtscan).toast(requireContext()) ("Elemento escaneado no encontrado: " + txtscan).toast(requireContext())
} }
} }
//SHELVINGS //SHELVINGS
private fun showShelving(position:Int,shelvingPosition:Int){ private fun showShelving(position: Int, shelvingPosition: Int) {
storedShelvingPosition = shelvingPosition storedShelvingPosition = shelvingPosition
storedPosition = position storedPosition = position
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
var quantityGet = "0" var quantityGet = "0"
try{ try {
quantityGet = (sales[position].saldo - sales[position].picked).toString() quantityGet = (sales[position].saldo - sales[position].picked).toString()
}catch (e:Exception){} } catch (e: Exception) {
}
viewModel.itemPlacementSupplyAiming( viewModel.itemPlacementSupplyAiming(
usuario = getData(USER), usuario = getData(USER),
password = getData(PASSWORD), password = getData(PASSWORD),
itemFk = sales[position].itemFk, itemFk = sales[position].itemFk,
quantity = quantityGet, quantity = quantityGet,
@ -342,13 +361,13 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
) )
} }
private fun printShelvingResult(placementSupplyListVO: PlacementSupplyListVO){ private fun printShelvingResult(placementSupplyListVO: PlacementSupplyListVO) {
var shelving = "" var shelving = ""
var item = "" var item = ""
var longName = "" var longName = ""
var total = "0" var total = "0"
var itemShelvingFk = "0" var itemShelvingFk = "0"
if (!placementSupplyListVO.list.isEmpty()){ if (!placementSupplyListVO.list.isEmpty()) {
val placement = placementSupplyListVO.list[0] val placement = placementSupplyListVO.list[0]
shelving = placement.shelving shelving = placement.shelving
item = placement.itemFk item = placement.itemFk
@ -361,61 +380,65 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
listPlacementSupply.add(BarcodeVO(code = it.proposal)) listPlacementSupply.add(BarcodeVO(code = it.proposal))
} }
customDialogList.setTitle("$shelving($item) $total de $longName").setOkButton("Coger"){ customDialogList.setTitle("$shelving($item) $total de $longName").setOkButton("Coger") {
if (customDialogList.getValueTwo().isNotEmpty()){ if (customDialogList.getValueTwo().isNotEmpty()) {
if (checkItemScan(customDialogList.getValueTwo())){ if (checkItemScan(customDialogList.getValueTwo())) {
onQuantityOfShelvingSelected(itemShelvingFk) onQuantityOfShelvingSelected(itemShelvingFk)
mpok?.start() mpok?.start()
customDialogList.dismiss() customDialogList.dismiss()
}else{ } else {
itemShelvingFkStored = itemShelvingFk itemShelvingFkStored = itemShelvingFk
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.getIdFromCode( viewModel.getIdFromCode(
usuario = getData(USER), usuario = getData(USER),
password = getData(PASSWORD), password = getData(PASSWORD),
code = customDialogList.getValueTwo(),"barcodeToItem" code = customDialogList.getValueTwo(), "barcodeToItem"
) )
customDialogList.dismiss() customDialogList.dismiss()
} }
scanRequest() scanRequest()
hideKeyboards() hideKeyboards()
}else{ } else {
"Escanea item para validar".toast(requireContext()) "Escanea item para validar".toast(requireContext())
} }
}.setKoButton("Cerrar"){ }.setKoButton("Cerrar") {
scanRequest() scanRequest()
hideKeyboards() hideKeyboards()
customDialogList.dismiss() customDialogList.dismiss()
}.setHintValue("Cantidad que coges:").setValue(total).setHintValueTwo("Escanea item").setValueTwo("").show() }.setHintValue("Cantidad que coges:").setValue(total).setHintValueTwo("Escanea item")
.setValueTwo("").show()
customDialogList.getEditTextTwo().post(Runnable { customDialogList.getEditTextTwo().post(Runnable {
customDialogList.getEditTextTwo().requestFocusFromTouch() customDialogList.getEditTextTwo().requestFocusFromTouch()
val lManager: InputMethodManager = val lManager: InputMethodManager =
requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
lManager.hideSoftInputFromWindow(customDialogList.getEditTextTwo().windowToken, InputMethodManager.SHOW_FORCED) lManager.hideSoftInputFromWindow(
customDialogList.getEditTextTwo().windowToken,
InputMethodManager.SHOW_FORCED
)
}) })
customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event -> customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (customDialogList.getValueTwo().isNotEmpty()){ if (customDialogList.getValueTwo().isNotEmpty()) {
if (checkItemScan(customDialogList.getValueTwo())){ if (checkItemScan(customDialogList.getValueTwo())) {
onQuantityOfShelvingSelected(itemShelvingFk) onQuantityOfShelvingSelected(itemShelvingFk)
mpok?.start() mpok?.start()
customDialogList.dismiss() customDialogList.dismiss()
}else{ } else {
itemShelvingFkStored = itemShelvingFk itemShelvingFkStored = itemShelvingFk
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.getIdFromCode( viewModel.getIdFromCode(
usuario = getData(USER), usuario = getData(USER),
password = getData(PASSWORD), password = getData(PASSWORD),
code = customDialogList.getValueTwo(),"barcodeToItem" code = customDialogList.getValueTwo(), "barcodeToItem"
) )
customDialogList.dismiss() customDialogList.dismiss()
} }
}else{ } else {
"Escanea item para validar".toast(requireContext()) "Escanea item para validar".toast(requireContext())
} }
scanRequest() scanRequest()
@ -426,46 +449,52 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
false false
} }
placementSupplyAdapter = BarcodeAdapter(listPlacementSupply,object: OnBarcodeRowClickListener { placementSupplyAdapter =
override fun onBarcodeRowClickListener(item: BarcodeVO) { BarcodeAdapter(listPlacementSupply, object : OnBarcodeRowClickListener {
placementSupplyListVO.list.forEach { override fun onBarcodeRowClickListener(item: BarcodeVO) {
if (it.proposal == item.code){ placementSupplyListVO.list.forEach {
customDialogList.setValue(it.total) if (it.proposal == item.code) {
total = it.total customDialogList.setValue(it.total)
itemShelvingFk = it.itemShelvingFk total = it.total
itemShelvingFk = it.itemShelvingFk
}
} }
}
} }
},showDelete = false) }, showDelete = false)
customDialogList.getRecyclerView().adapter = placementSupplyAdapter customDialogList.getRecyclerView().adapter = placementSupplyAdapter
customDialogList.getRecyclerView().layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) customDialogList.getRecyclerView().layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
} }
private fun onQuantityOfShelvingSelected(itemShelvingFk:String){ private fun onQuantityOfShelvingSelected(itemShelvingFk: String) {
//1 - MODIFICAR CANTIDAD DEL CARRO //1 - MODIFICAR CANTIDAD DEL CARRO
try { try {
val shelvingVisible = sales[storedPosition].carros[storedShelvingPosition].stockTotal val shelvingVisible = sales[storedPosition].carros[storedShelvingPosition].stockTotal
sales[storedPosition].carros[storedShelvingPosition].stockTotal = (shelvingVisible.toInt() - customDialogList.getValue().toInt()).toString() sales[storedPosition].carros[storedShelvingPosition].stockTotal =
(shelvingVisible.toInt() - customDialogList.getValue().toInt()).toString()
viewModel.itemShelvingPlacementSupplyAdd( viewModel.itemShelvingPlacementSupplyAdd(
usuario = getData(USER), usuario = getData(USER),
password = getData(PASSWORD), password = getData(PASSWORD),
itemShelvingFk = itemShelvingFk, itemShelvingFk = itemShelvingFk,
itemPlacementSupplyFk = sales[storedPosition].id, itemPlacementSupplyFk = sales[storedPosition].id,
quantity = customDialogList.getValue(),"itemShelvingPlacementSupplyAdd" quantity = customDialogList.getValue(), "itemShelvingPlacementSupplyAdd"
) )
}catch (e:Exception){} } catch (e: Exception) {
}
//2- MODIFICAR EL PICKED DEL SALE //2- MODIFICAR EL PICKED DEL SALE
try{ try {
sales[storedPosition].saldo = sales[storedPosition].saldo - customDialogList.getValue().toInt() sales[storedPosition].saldo =
}catch (e:Exception){} sales[storedPosition].saldo - customDialogList.getValue().toInt()
} catch (e: Exception) {
}
//3- MARCAR LINEA //3- MARCAR LINEA
markLine(storedPosition) markLine(storedPosition)
@ -475,7 +504,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
//OTROS //OTROS
private fun setToolBar(){ private fun setToolBar() {
binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE
val listIcons: ArrayList<ImageView> = ArrayList() val listIcons: ArrayList<ImageView> = ArrayList()
@ -489,52 +518,59 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
listIcons.add(iconParking) listIcons.add(iconParking)
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons,object: OnOptionsSelectedListener { binding.mainToolbar.toolbarIcons.adapter =
override fun onOptionsItemSelected(item: Drawable) { ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
when (item) {
iconParking.drawable -> 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() binding.scanInput.requestFocus()
hideKeyboards() hideKeyboards()
} }
private fun checkItemScan(valueToCheck:String):Boolean{ private fun checkItemScan(valueToCheck: String): Boolean {
val saleToCheck = sales[storedPosition] val saleToCheck = sales[storedPosition]
return saleToCheck.itemFk == valueToCheck return saleToCheck.itemFk == valueToCheck
} }
private fun showErrorMessage(text:String){ private fun showErrorMessage(text: String) {
customDialog.setTitle("Error al marcar la linea").setDescription(text).setKoButton("Cerrar"){ customDialog.setTitle("Error al marcar la linea").setDescription(text)
customDialog.dismiss() .setKoButton("Cerrar") {
}.show() customDialog.dismiss()
}.show()
} }
private fun showScanner(index:Int, sale:PreSacadorItemVO){ private fun showScanner(index: Int, sale: PreSacadorItemVO) {
customDialogInput.setTitle(""+sale.itemFk).setDescription("Escanea el carro para el item seleccionado").setOkButton("Aceptar"){ customDialogInput.setTitle("" + sale.itemFk)
.setDescription("Escanea el carro para el item seleccionado").setOkButton("Aceptar") {
if (!customDialogInput.getValue().isNullOrEmpty()) { if (!customDialogInput.getValue().isNullOrEmpty()) {
findSale(customDialogInput.getValue(),index) findSale(customDialogInput.getValue(), index)
} }
customDialogInput.setValue("") customDialogInput.setValue("")
scanRequest() scanRequest()
customDialogInput.dismiss() customDialogInput.dismiss()
hideKeyboards() hideKeyboards()
}.setKoButton("Cancelar"){ }.setKoButton("Cancelar") {
customDialogInput.dismiss() customDialogInput.dismiss()
}.setValue("").show() }.setValue("").show()
customDialogInput.getEditText().requestFocus() customDialogInput.getEditText().requestFocus()
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event -> customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
if (!customDialogInput.getValue().isNullOrEmpty()) { if (!customDialogInput.getValue().isNullOrEmpty()) {
findSale(customDialogInput.getValue(),index) findSale(customDialogInput.getValue(), index)
} }
customDialogInput.setValue("") customDialogInput.setValue("")
scanRequest() scanRequest()
@ -548,31 +584,32 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
} }
private fun unMarkLine(position: Int){ private fun unMarkLine(position: Int) {
if (sales[position].quantity == sales[position].picked){ if (sales[position].quantity == sales[position].picked) {
customDialog.setTitle("Desmarcar linea").setDescription("Vas a desmarcar la linea: "+sales[position].itemFk+ " ¿Estás seguro?").setOkButton("Desmarcar"){ customDialog.setTitle("Desmarcar linea")
sales[position].picked = 0 .setDescription("Vas a desmarcar la linea: " + sales[position].itemFk + " ¿Estás seguro?")
saleAdapter!!.notifyDataSetChanged() .setOkButton("Desmarcar") {
sales[position].picked = 0
saleAdapter!!.notifyDataSetChanged()
/*viewModel.saleTrackingDel( /*viewModel.saleTrackingDel(
usuario = user, usuario = user,
password = password, password = password,
saleFk = sales[position].idMovimiento saleFk = sales[position].idMovimiento
)*/ )*/
scanRequest() scanRequest()
customDialog.dismiss() customDialog.dismiss()
}.setKoButton("Cancelar"){ }.setKoButton("Cancelar") {
scanRequest() scanRequest()
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()
} }
} }
private fun markLine(position:Int){ private fun markLine(position: Int) {
saleAdapter!!.notifyDataSetChanged() saleAdapter!!.notifyDataSetChanged()
} }

View File

@ -21,7 +21,8 @@ import retrofit2.Response
class ReposicionViewModel(context: Context) : BaseViewModel() { class ReposicionViewModel(context: Context) : BaseViewModel() {
private val getPreSacadorUseCase: GetPreSacadorUseCase = GetPreSacadorUseCase(context) private val getPreSacadorUseCase: GetPreSacadorUseCase = GetPreSacadorUseCase(context)
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context) private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context)
private val getSacadorControladorUserCase: GetSacadorControladorUserCase = GetSacadorControladorUserCase(context) private val getSacadorControladorUserCase: GetSacadorControladorUserCase =
GetSacadorControladorUserCase(context)
private val _salesList by lazy { MutableLiveData<List<PreSacadorItemVO>>() } private val _salesList by lazy { MutableLiveData<List<PreSacadorItemVO>>() }
val salesList: LiveData<List<PreSacadorItemVO>> val salesList: LiveData<List<PreSacadorItemVO>>
@ -43,111 +44,211 @@ class ReposicionViewModel(context: Context) : BaseViewModel() {
val responseCode: LiveData<ResponseItemVO> val responseCode: LiveData<ResponseItemVO>
get() = _responseCode get() = _responseCode
fun itemPlacementSupplyGetOrder(usuario:String,password:String,sectorFk:String,callFunction:String){ fun itemPlacementSupplyGetOrder(
getPreSacadorUseCase.itemPlacementSupplyGetOrder(usuario,password,sectorFk).enqueue(object : usuario: String,
Callback<List<PreSacadorItemVO>> { password: String,
override fun onFailure(call: Call<List<PreSacadorItemVO>>, t: Throwable) { sectorFk: String,
_salesList.value = listOf() callFunction: String
} ) {
override fun onResponse( getPreSacadorUseCase.itemPlacementSupplyGetOrder(usuario, password, sectorFk)
call: Call<List<PreSacadorItemVO>>, .enqueue(object :
response: Response<List<PreSacadorItemVO>> Callback<List<PreSacadorItemVO>> {
) { override fun onFailure(call: Call<List<PreSacadorItemVO>>, t: Throwable) {
if (response.body() != null){
_salesList.value = response.body()?.let { it }
}else{
_salesList.value = listOf() _salesList.value = listOf()
} }
}
})
}
fun parking(usuario: String,password: String,ticketFk: String,parking:String,callFunction:String){ override fun onResponse(
getUbicadorUserCase.shelvingPark(usuario,password,ticketFk,parking).enqueue(object : Callback<String>{ call: Call<List<PreSacadorItemVO>>,
override fun onFailure(call: Call<String>, t: Throwable) { response: Response<List<PreSacadorItemVO>>
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) ) {
} if (response.body() != null) {
_salesList.value = response.body()?.let { it }
override fun onResponse(call: Call<String>, response: Response<String>) { } else {
if (response.body() == null){ _salesList.value = listOf()
_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){ fun parking(
getSacadorControladorUserCase.itemPlacementSupplyAiming(usuario,password,shelvingFk,quantity,itemFk).enqueue(object : usuario: String,
password: String,
ticketFk: String,
parking: String,
callFunction: String
) {
getUbicadorUserCase.shelvingPark(usuario, password, ticketFk, parking)
.enqueue(object : Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
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<List<PlacementSupplyVO>> { Callback<List<PlacementSupplyVO>> {
override fun onFailure(call: Call<List<PlacementSupplyVO>>, t: Throwable) { override fun onFailure(call: Call<List<PlacementSupplyVO>>, t: Throwable) {
val listError:ArrayList<PlacementSupplyVO> = ArrayList() val listError: ArrayList<PlacementSupplyVO> = 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) _placementSuppleyList.value = PlacementSupplyListVO(listError)
} }
override fun onResponse( override fun onResponse(
call: Call<List<PlacementSupplyVO>>, call: Call<List<PlacementSupplyVO>>,
response: Response<List<PlacementSupplyVO>> response: Response<List<PlacementSupplyVO>>
) { ) {
if (response.body() != null){ if (response.body() != null) {
_placementSuppleyList.value = response.body()?.let { PlacementSupplyListVO(it) } _placementSuppleyList.value = response.body()?.let { PlacementSupplyListVO(it) }
}else{ } else {
val listError:ArrayList<PlacementSupplyVO> = ArrayList() val listError: ArrayList<PlacementSupplyVO> = ArrayList()
listError.add(PlacementSupplyVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))) listError.add(
PlacementSupplyVO(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
)
)
)
_placementSuppleyList.value = PlacementSupplyListVO(listError) _placementSuppleyList.value = PlacementSupplyListVO(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<String>{ getSacadorControladorUserCase.getIdFromCode(usuario, password, code)
override fun onFailure(call: Call<String>, t: Throwable) { .enqueue(object : Callback<String> {
_responseCode.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) override fun onFailure(call: Call<String>, t: Throwable) {
_responseCode.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
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<Any> {
override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
} }
override fun onResponse(call: Call<String>, response: Response<String>) { override fun onResponse(call: Call<Any>, response: Response<Any>) {
if (response.body() == null){ if (!response.isSuccessful) {
_responseCode.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) _response.value = ResponseItemVO(
}else{ isError = true,
_responseCode.value = ResponseItemVO(isError = false,response = response.body()!!) errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
)
)
} else {
_response.value = ResponseItemVO(isError = false, response = response.message())
} }
} }
}) })
} }
fun itemPlacementSupplyCloseOrder(
fun itemShelvingPlacementSupplyAdd(usuario:String,password:String,itemShelvingFk:String,itemPlacementSupplyFk:String,quantity:String,callFunction:String){ usuario: String,
getSacadorControladorUserCase.itemShelvingPlacementSupplyAdd(usuario,password,itemShelvingFk,itemPlacementSupplyFk,quantity).enqueue(object : Callback<String>{ password: String,
override fun onFailure(call: Call<String>, t: Throwable) { id: String,
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) quantity: String
} ) {
getPreSacadorUseCase.itemPlacementSupplyCloseOrder(usuario, password, id, quantity)
override fun onResponse(call: Call<String>, response: Response<String>) { .enqueue(object : Callback<Any> {
if (response.body() == null){ override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) _responseClose.value = ResponseItemVO(
}else{ isError = true,
_response.value = ResponseItemVO(isError = false,response = response.body()!!) errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
} }
}
})
}
fun itemPlacementSupplyCloseOrder(usuario:String,password:String,id:String,quantity:String,callFunction:String){ override fun onResponse(call: Call<Any>, response: Response<Any>) {
getPreSacadorUseCase.itemPlacementSupplyCloseOrder(usuario,password,id,quantity).enqueue(object : Callback<String>{ if (!response.isSuccessful()) {
override fun onFailure(call: Call<String>, t: Throwable) { _responseClose.value = ResponseItemVO(
_responseClose.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) isError = true,
} errorMessage = getMessageFromAllResponse(
nameofFunction(this),
override fun onResponse(call: Call<String>, response: Response<String>) { response.message()
if (response.body() == null){ )
_responseClose.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) )
}else{ } else {
_responseClose.value = ResponseItemVO(isError = false,response = response.body()!!) _responseClose.value =
ResponseItemVO(isError = false, response = response.message())
}
} }
} })
})
} }
} }

View File

@ -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.adapter.CollectionAdapter
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
import es.verdnatura.presentation.view.feature.smarttag.sacador.fragment.AssociateSmartTagsFragment import es.verdnatura.presentation.view.feature.smarttag.sacador.fragment.AssociateSmartTagsFragment
import java.lang.Boolean.TRUE
class SacadorFragment : class SacadorFragment :
@ -31,6 +32,7 @@ class SacadorFragment :
private var collectionsList: ArrayList<CollectionVO> = ArrayList() private var collectionsList: ArrayList<CollectionVO> = ArrayList()
private var adapter: CollectionAdapter? = null private var adapter: CollectionAdapter? = null
private var resultTagMode:String? = "" private var resultTagMode:String? = ""
private var getCollections=false
companion object { companion object {
@ -48,17 +50,19 @@ class SacadorFragment :
override fun init() { override fun init() {
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.GONE
binding.splashProgressTwo.visibility = View.GONE binding.splashProgressTwo.visibility = View.GONE
binding.mainToolbar.toolbarTitle.text = getString(R.string.getcollection) binding.mainToolbar.toolbarTitle.text = getString(R.string.getcollection)
setToolBar() setToolBar()
setEvents() setEvents()
// viewModel.smartTagInsertTicket("568672")
/*var working_in_test=false //sergio: Ok en app /*var working_in_test=false //sergio: Ok en app
if (!working_in_test) {*/ if (!working_in_test) {*/
viewModel.collectionGetSalix(token = getData(TOKEN)) if (getCollections){
viewModel.collectionGetSalix(token = getData(TOKEN))
}
/* }else{ /* }else{
viewModel.collectionGet( getData(USER), viewModel.collectionGet( getData(USER),
getData(PASSWORD),"collection_get") getData(PASSWORD),"collection_get")
@ -73,13 +77,17 @@ class SacadorFragment :
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
// Use the Kotlin extension in the fragment-ktx artifact
setFragmentResultListener("requestKey") { requestKey, bundle -> setFragmentResultListener("requestKey") { requestKey, bundle ->
val result = bundle.getString("tagMode") val result = bundle.getString("tagMode")
resultTagMode=result resultTagMode=result
Log.d("VERDNATURA::","el result es "+result) Log.d("VERDNATURA::","el result es "+result)
if (result.equals("complete")){
getCollections=TRUE
}
if (result.equals("complete") && getData(TAGSTYPE).equals("SmartTags")) { if (result.equals("complete") && getData(TAGSTYPE).equals("SmartTags")) {
Log.d("VERDNATURA::","Entramos a collectionNew_SMARTGS"+result)
viewModel.collection_new_smarttag(getData(USER), viewModel.collection_new_smarttag(getData(USER),
getData(PASSWORD), getData(SECTORFK), getData(WAGON), getData(TAGSTYPE),"collection_new_wagon") getData(PASSWORD), getData(SECTORFK), getData(WAGON), getData(TAGSTYPE),"collection_new_wagon")
@ -98,10 +106,6 @@ class SacadorFragment :
val listIcons: ArrayList<ImageView> = ArrayList() val listIcons: ArrayList<ImageView> = 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) val iconAdd = ImageView(context)
iconAdd.setImageResource(R.drawable.ic_add_black_24dp) iconAdd.setImageResource(R.drawable.ic_add_black_24dp)
val iconVehicleIn = ImageView(context) val iconVehicleIn = ImageView(context)
@ -228,6 +232,8 @@ class SacadorFragment :
} else { } else {
ma.messageWithSound(it.errorMessage,false,false) ma.messageWithSound(it.errorMessage,false,false)
Log.d("VERDNATURA::","La colec es "+it.response)
viewModel.smartTagInsertTicket(it.response)
goBack = false} goBack = false}
}) })
@ -240,6 +246,7 @@ class SacadorFragment :
} else { } else {
ma.messageWithSound(it.errorMessage,false,false) ma.messageWithSound(it.errorMessage,false,false)
viewModel.collectionGetSalix(getData(TOKEN))
} }
goBack = false} goBack = false}
}) })

View File

@ -160,7 +160,8 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
object : object :
Callback<String> { Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) { override fun onFailure(call: Call<String>, t: Throwable) {
_responseCollectionSmarttag.value = // _response.value=
_responseCollectionSmarttag.value =
ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
@ -171,11 +172,14 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
response: Response<String> response: Response<String>
) { ) {
if (response.body() != null) { 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()!!) ResponseItemVO(isError = false, response = response.body()!!)
} else { } else {
_responseCollectionSmarttag.value = ResponseItemVO( _responseCollectionSmarttag.value =
ResponseItemVO(
isError = true, isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
) )

View File

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

View File

@ -104,9 +104,6 @@ class AutomaticAddItemFragment(
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
if (it.isError){ if (it.isError){
ma.messageWithSound(it.errorMessage,true,false) ma.messageWithSound(it.errorMessage,true,false)
/*customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()*/
}else{ }else{
requireActivity().onBackPressed() requireActivity().onBackPressed()
} }

View File

@ -5,6 +5,8 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetUbicadorUserCase import es.verdnatura.domain.GetUbicadorUserCase
import es.verdnatura.presentation.base.BaseViewModel 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.common.ResponseItemVO
import retrofit2.Call import retrofit2.Call
import retrofit2.Callback import retrofit2.Callback
@ -21,16 +23,18 @@ class AutomaticAddItemViewModel (context: Context): BaseViewModel() {
fun itemShelvingMake_multi(usuario:String,password:String,shelving:String,items:List<String>,warehouse:String){ fun itemShelvingMake_multi(usuario:String,password:String,shelving:String,items:List<String>,warehouse:String){
getUbicadorUserCase.itemShelvingMake_multi(usuario,password,shelving,items,warehouse).enqueue(object : getUbicadorUserCase.itemShelvingMake_multi(usuario,password,shelving,items,warehouse).enqueue(object :
Callback<String> { Callback<Any> {
override fun onFailure(call: Call<String>, t: Throwable) { override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage ="Error al guardar items itemShelvingMake."+t.message!!) _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(
nameofFunction(this),t.message!!)
)
} }
override fun onResponse(call: Call<String>, response: Response<String>) { override fun onResponse(call: Call<Any>, response: Response<Any>) {
if (response.body() == null){ if (!response.isSuccessful){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelvingMake multiple") _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()!!))
}else{ }else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!) _response.value = ResponseItemVO(isError = false,response = response.message()!!)
} }
} }

View File

@ -1,7 +1,6 @@
package es.verdnatura.presentation.view.feature.ubicador.fragment package es.verdnatura.presentation.view.feature.ubicador.fragment
import android.content.Context import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.media.MediaPlayer import android.media.MediaPlayer
import android.os.Build import android.os.Build
@ -73,7 +72,7 @@ class UbicadorFragment(
if (!shelvingFk.isNullOrEmpty()) { if (!shelvingFk.isNullOrEmpty()) {
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
binding.mainToolbar.toolbarTitle.text = shelvingFk binding.mainToolbar.toolbarTitle.text = shelvingFk
viewModel.itemShelvingList( getData(USER), getData(PASSWORD), shelvingFk, "itemShelvingList") viewModel.itemShelvingList(getData(USER), getData(PASSWORD), shelvingFk)
} }
super.init() super.init()
} }
@ -99,7 +98,7 @@ class UbicadorFragment(
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconReload.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp) 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(iconAdd)
listIcons.add(iconReload) listIcons.add(iconReload)
@ -114,8 +113,7 @@ class UbicadorFragment(
viewModel.itemShelvingList( viewModel.itemShelvingList(
getData(USER), getData(USER),
getData(PASSWORD), getData(PASSWORD),
shelvingFk, shelvingFk
"itemShelvingList"
) )
} }
} }
@ -148,8 +146,7 @@ class UbicadorFragment(
viewModel.itemShelvingList( viewModel.itemShelvingList(
getData(USER), getData(USER),
getData(PASSWORD), getData(PASSWORD),
binding.editMatricula.text.toString(), binding.editMatricula.text.toString()
"itemShelvingList"
) )
} }
@ -168,8 +165,7 @@ class UbicadorFragment(
getData(USER), getData(USER),
getData(PASSWORD), getData(PASSWORD),
binding.editPrioridad.text.toString(), binding.editPrioridad.text.toString(),
shelvingFk, shelvingFk
"shelvingPriority_update"
) )
} }
@ -246,8 +242,7 @@ class UbicadorFragment(
getData(USER), getData(USER),
getData(PASSWORD), getData(PASSWORD),
shelvingFk, shelvingFk,
customDialogInput.getValue(), customDialogInput.getValue()
"shelvingChange"
) )
shelvingFk = customDialogInput.getValue() shelvingFk = customDialogInput.getValue()
binding.mainToolbar.toolbarTitle.text = binding.mainToolbar.toolbarTitle.text =
@ -267,8 +262,7 @@ class UbicadorFragment(
getData(USER), getData(USER),
getData(PASSWORD), getData(PASSWORD),
shelvingFk, shelvingFk,
customDialogInput.getValue(), customDialogInput.getValue()
"shelvingChange"
) )
shelvingFk = customDialogInput.getValue() shelvingFk = customDialogInput.getValue()
binding.mainToolbar.toolbarTitle.text = binding.mainToolbar.toolbarTitle.text =
@ -285,19 +279,21 @@ class UbicadorFragment(
binding.deleteImg.setOnClickListener { binding.deleteImg.setOnClickListener {
customDialog.setTitle("Vaciar carro") customDialog.setTitle("Vaciar carro")
.setDescription("Esta operación no se puede rectificar.").setOkButton("Vaciar") { .setDescription("Esta operación no se puede rectificar.").setOkButton("Vaciar") {
viewModel.clearShelvingList(getData(USER), viewModel.clearShelvingList(
getData(PASSWORD), shelvingFk, "clearShelvingList") getData(USER),
listItems.forEach { getData(PASSWORD), shelvingFk
it.stickers = "0" )
it.visible = "0" listItems.forEach {
} it.stickers = "0"
if (adapter != null) { it.visible = "0"
adapter!!.notifyDataSetChanged() }
} if (adapter != null) {
customDialog.dismiss() adapter!!.notifyDataSetChanged()
}.setKoButton("Cancelar") { }
customDialog.dismiss() customDialog.dismiss()
}.show() }.setKoButton("Cancelar") {
customDialog.dismiss()
}.show()
} }
@ -306,14 +302,16 @@ class UbicadorFragment(
private fun setTooltips() { private fun setTooltips() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
binding.editImg.tooltipText="Permite cambiar la matrícula al carro" binding.editImg.tooltipText = "Permite cambiar la matrícula al carro"
binding.deleteImg.tooltipText="Borra todos los items del 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.editPrioridad.tooltipText =
binding.parkingImg.tooltipText="Permite aparcar el carro" "Cambia la prioridad de los items del carro. Cuanto más alta antes cogerán los sacadores."
binding.automaticImg.tooltipText="Permite añadir items al carro de manera continuada. No uno a uno" 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() { override fun observeViewModel() {
with(viewModel) { with(viewModel) {
@ -376,39 +374,44 @@ class UbicadorFragment(
response.observe(viewLifecycleOwner, Observer { response.observe(viewLifecycleOwner, Observer {
if (it.isError) { if (it.isError) {
ma.messageWithSound(it.errorMessage,it.isError,false) ma.messageWithSound(it.errorMessage, it.isError, false)
/* mperror!!.start() /* mperror!!.start()
customDialog.setTitle("Error").setDescription(it.errorMessage) customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") { .setOkButton("Cerrar") {
customDialog.dismiss() customDialog.dismiss()
}.show()*/ }.show()*/
} }
}) })
responsepriority.observe(viewLifecycleOwner, Observer { responsepriority.observe(viewLifecycleOwner, Observer {
ma.messageWithSound( 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) { /* if (it.isError) {
mperror!!.start() mperror!!.start()
customDialog.setTitle("Error").setDescription(it.errorMessage) customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") { .setOkButton("Cerrar") {
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()
} else { } else {
(it.response).toast(requireContext()) (it.response).toast(requireContext())
}*/ }*/
}) })
responseMake.observe(viewLifecycleOwner, Observer { responseMake.observe(viewLifecycleOwner, Observer {
if (!shelvingFk.isNullOrEmpty()) { if (!shelvingFk.isNullOrEmpty()) {
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
binding.mainToolbar.toolbarTitle.text = shelvingFk binding.mainToolbar.toolbarTitle.text = shelvingFk
viewModel.itemShelvingList(getData(USER), viewModel.itemShelvingList(
getData(PASSWORD), shelvingFk, "itemShelvingList") getData(USER),
getData(PASSWORD), shelvingFk
)
} }
}) })
} }
@ -442,8 +445,8 @@ class UbicadorFragment(
customDialogUbicador.getGroupingValue() customDialogUbicador.getGroupingValue()
) )
}.setKoButton("Cerrar") { }.setKoButton("Cerrar") {
customDialogUbicador.dismiss() customDialogUbicador.dismiss()
}.show() }.show()
customDialogUbicador.getEditItem().requestFocus() customDialogUbicador.getEditItem().requestFocus()
ma.hideKeyboard(customDialogUbicador.getEditItem()) ma.hideKeyboard(customDialogUbicador.getEditItem())
@ -576,7 +579,6 @@ class UbicadorFragment(
getData(WAREHOUSEFK), getData(WAREHOUSEFK),
"1", "1",
itemShelvingFk, itemShelvingFk,
"itemShelvingMakeEdit",
groupingPack groupingPack
) )
changeOfflineValue( changeOfflineValue(
@ -609,7 +611,6 @@ class UbicadorFragment(
getData(WAREHOUSEFK), getData(WAREHOUSEFK),
"1", "1",
itemShelvingFk, itemShelvingFk,
"itemShelvingMakeEdit",
groupingPack groupingPack
) )
changeOfflineValue( changeOfflineValue(
@ -679,8 +680,7 @@ class UbicadorFragment(
getData(USER), getData(USER),
getData(PASSWORD), getData(PASSWORD),
item.id, item.id,
customDialogInput.getValue(), customDialogInput.getValue()
"itemShelvingTransfer"
) )
listItems.remove(item) listItems.remove(item)
adapter!!.notifyDataSetChanged() adapter!!.notifyDataSetChanged()
@ -691,8 +691,8 @@ class UbicadorFragment(
}.setKoButton("Cancelar") { }.setKoButton("Cancelar") {
customDialogInput.dismiss() customDialogInput.dismiss()
}.show() }.show()
customDialogInput.getEditText().requestFocus() customDialogInput.getEditText().requestFocus()
ma.hideKeyboard(customDialogInput.getEditText()) ma.hideKeyboard(customDialogInput.getEditText())
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event -> customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
@ -701,8 +701,7 @@ class UbicadorFragment(
getData(USER), getData(USER),
getData(PASSWORD), getData(PASSWORD),
item.id, item.id,
customDialogInput.getValue(), customDialogInput.getValue()
"itemShelvingTransfer"
) )
listItems.remove(item) listItems.remove(item)
adapter!!.notifyDataSetChanged() adapter!!.notifyDataSetChanged()
@ -713,22 +712,24 @@ class UbicadorFragment(
} }
customDialogTwoButtons.dismiss() customDialogTwoButtons.dismiss()
}.setOkButtonTwo("Eliminar") { }.setOkButtonTwo("Eliminar") {
customDialog.setTitle("Confirmar") customDialog.setTitle("Confirmar")
.setDescription("Confirmas eliminar el artículo: " + item.item + "?") .setDescription("Confirmas eliminar el artículo: " + item.item + "?")
.setOkButton("Eliminar") { .setOkButton("Eliminar") {
listItems.remove(item) listItems.remove(item)
adapter!!.notifyDataSetChanged() adapter!!.notifyDataSetChanged()
viewModel.itemShelvingDelete(getData(USER), viewModel.itemShelvingDelete(
getData(PASSWORD), item.id, "itemShelvingDelete") getData(USER),
customDialogTwoButtons.dismiss() getData(PASSWORD), item.id
customDialog.dismiss() )
}.setKoButton("Cancelar") { customDialogTwoButtons.dismiss()
customDialog.dismiss() customDialog.dismiss()
}.setKoButton("Cancelar") {
customDialog.dismiss()
customDialogTwoButtons.dismiss()
}.show()
}.setKoButton("Cancelar") {
customDialogTwoButtons.dismiss() customDialogTwoButtons.dismiss()
}.show() }.show()
}.setKoButton("Cancelar") {
customDialogTwoButtons.dismiss()
}.show()
} }
} }

View File

@ -41,68 +41,131 @@ class UbicadorViewModel(context: Context) : BaseViewModel() {
val loadShelvingList = Transformations.map(_shelvingList) { Event(it) } val loadShelvingList = Transformations.map(_shelvingList) { Event(it) }
fun itemShelvingList(usuario:String,password:String,vShelvingFk:String,callFunction:String){ fun itemShelvingList(
getUbicadorUserCase.itemShelvingList(usuario,password,vShelvingFk.uppercase()).enqueue(object : usuario: String,
Callback<List<ItemUbicadorVO>> { password: String,
override fun onFailure(call: Call<List<ItemUbicadorVO>>, t: Throwable) { vShelvingFk: String
val listError:ArrayList<ItemUbicadorVO> = ArrayList() ) {
listError.add(ItemUbicadorVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))) getUbicadorUserCase.itemShelvingList(usuario, password, vShelvingFk.uppercase())
_shelvingList.value = ItemUbicadorListVO(listError) .enqueue(object :
} Callback<List<ItemUbicadorVO>> {
override fun onFailure(call: Call<List<ItemUbicadorVO>>, t: Throwable) {
override fun onResponse( val listError: ArrayList<ItemUbicadorVO> = ArrayList()
call: Call<List<ItemUbicadorVO>>, listError.add(
response: Response<List<ItemUbicadorVO>> ItemUbicadorVO(
) { isError = true,
if (response.body() != null){ errorMessage = getMessageFromAllResponse(
_shelvingList.value = response.body()?.let { ItemUbicadorListVO(it) } nameofFunction(this),
}else{ t.message!!
val listError:ArrayList<ItemUbicadorVO> = ArrayList() )
listError.add(ItemUbicadorVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))) )
)
_shelvingList.value = ItemUbicadorListVO(listError) _shelvingList.value = ItemUbicadorListVO(listError)
} }
}
}) override fun onResponse(
call: Call<List<ItemUbicadorVO>>,
response: Response<List<ItemUbicadorVO>>
) {
if (response.body() != null) {
_shelvingList.value = response.body()?.let { ItemUbicadorListVO(it) }
} else {
val listError: ArrayList<ItemUbicadorVO> = 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){ fun shelvingPriorityUpdate(
getUbicadorUserCase.shelvingPriorityUpdate(usuario,password,priority,shelving).enqueue(object : Callback<String>{ usuario: String,
override fun onFailure(call: Call<String>, t: Throwable) { password: String,
_responsepriority.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) priority: String,
} shelving: String
override fun onResponse(call: Call<String>, response: Response<String>) { ) {
getUbicadorUserCase.shelvingPriorityUpdate(usuario, password, priority, shelving)
.enqueue(object : Callback<Any> {
override fun onFailure(call: Call<Any>, t: Throwable) {
_responsepriority.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
if (!response.isSuccessful){ override fun onResponse(call: Call<Any>, response: Response<Any>) {
_responsepriority.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_responsepriority.value = ResponseItemVO(isError = false,response = "Prioridad modificada")
}
/*if (response.body() == null){ if (!response.isSuccessful) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) _responsepriority.value = ResponseItemVO(
}else{ isError = true,
_response.value = ResponseItemVO(isError = false,response = response.body()!!) 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){ fun itemShelvingMake(
getUbicadorUserCase.itemShelvingMake(usuario,password,shelving,item,quantity,packing,warehouse,grouping).enqueue(object : Callback<String>{ usuario: String,
override fun onFailure(call: Call<String>, t: Throwable) { password: String,
_responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) 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<Any> {
override fun onFailure(call: Call<Any>, t: Throwable) {
_responseMake.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
} }
override fun onResponse(call: Call<String>, response: Response<String>) { override fun onResponse(call: Call<Any>, response: Response<Any>) {
if (response.body() == null){ if (!response.isSuccessful) {
_responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) _responseMake.value = ResponseItemVO(
}else{ isError = true,
_responseMake.value = ResponseItemVO(isError = false,response = response.body()!!) 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){ fun itemShelvingMakeEdit(
getUbicadorUserCase.itemShelvingMakeEdit(usuario,password,shelving,item,deep,quantity,packing,warehouse,level,itemShelvingFk,grouping).enqueue(object : Callback<String>{ usuario: String,
override fun onFailure(call: Call<String>, t: Throwable) { password: String,
_responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) 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<Any> {
override fun onFailure(call: Call<Any>, t: Throwable) {
_responseMake.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
} }
override fun onResponse(call: Call<String>, response: Response<String>) { override fun onResponse(call: Call<Any>, response: Response<Any>) {
if (response.body() == null){ if (!response.isSuccessful) {
_responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) _responseMake.value = ResponseItemVO(
}else{ isError = true,
_responseMake.value = ResponseItemVO(isError = false,response = response.body()!!) 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){ fun shelvingPark(
getUbicadorUserCase.shelvingPark(usuario,password,shelving,parking).enqueue(object : Callback<String>{ usuario: String,
override fun onFailure(call: Call<String>, t: Throwable) { password: String,
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) shelving: String,
} parking: String,
override fun onResponse(call: Call<String>, response: Response<String>) { callFunction: String
if (response.body() == null){ ) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) getUbicadorUserCase.shelvingPark(usuario, password, shelving, parking)
}else{ .enqueue(object : Callback<String> {
_response.value = ResponseItemVO(isError = false,response = response.body()!!) override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
} }
}
}) override fun onResponse(call: Call<String>, response: Response<String>) {
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){ fun shelvingChange(
getUbicadorUserCase.shelvingChange(usuario,password,origen,destino).enqueue(object : Callback<String>{ usuario: String,
override fun onFailure(call: Call<String>, t: Throwable) { password: String,
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) origen: String,
} destino: String
override fun onResponse(call: Call<String>, response: Response<String>) { ) {
if (response.body() == null){ getUbicadorUserCase.shelvingChange(usuario, password, origen, destino)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) .enqueue(object : Callback<Any> {
}else{ override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(isError = false,response = response.body()!!) _response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
} }
}
}) override fun onResponse(call: Call<Any>, response: Response<Any>) {
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){ fun clearShelvingList(
getUbicadorUserCase.clearShelvingList(usuario,password,shelvingFk).enqueue(object : Callback<String>{ usuario: String,
override fun onFailure(call: Call<String>, t: Throwable) { password: String,
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) shelvingFk: String
}
override fun onResponse(call: Call<String>, response: Response<String>) { ) {
if (response.body() == null){ getUbicadorUserCase.clearShelvingList(usuario, password, shelvingFk)
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) .enqueue(object : Callback<Any> {
}else{ override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(isError = false,response = response.body()!!) _response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
} }
}
}) override fun onResponse(call: Call<Any>, response: Response<Any>) {
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){ fun itemShelvingTransfer(
getUbicadorUserCase.itemShelvingTransfer(usuario,password,itemFk,shelvingFk).enqueue(object : Callback<String>{ usuario: String,
override fun onFailure(call: Call<String>, t: Throwable) { password: String,
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) itemFk: String,
} shelvingFk: String
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){ ) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) getUbicadorUserCase.itemShelvingTransfer(usuario, password, itemFk, shelvingFk)
}else{ .enqueue(object : Callback<Any> {
_response.value = ResponseItemVO(isError = false,response = response.body()!!) override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
} }
}
}) override fun onResponse(call: Call<Any>, response: Response<Any>) {
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){ fun itemShelvingDelete(usuario: String, password: String, itemFk: String) {
getUbicadorUserCase.itemShelvingDelete(usuario,password,itemFk).enqueue(object : Callback<String>{ getUbicadorUserCase.itemShelvingDelete(usuario, password, itemFk)
override fun onFailure(call: Call<String>, t: Throwable) { .enqueue(object : Callback<Any> {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) override fun onFailure(call: Call<Any>, t: Throwable) {
} _response.value = ResponseItemVO(
override fun onResponse(call: Call<String>, response: Response<String>) { isError = true,
if (response.body() == null){ errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
_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<Any>, response: Response<Any>) {
if (!response.isSuccessful) {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
)
)
} else {
_response.value =
ResponseItemVO(isError = false, response = response.message())
}
}
})
} }
} }

View File

@ -12,20 +12,19 @@
<EditText <EditText
android:id="@+id/scan_input" android:id="@+id/scan_input"
style="@style/ScanLineTextSearch"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:backgroundTint="@android:color/white"
android:hint="@string/Escaner" android:hint="@string/Escaner"
android:inputType="text" android:inputType="text"
android:lines="1" android:lines="1"
android:maxLines="1" android:maxLines="1"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:textColorHint="@android:color/darker_gray" android:textColorHint="@android:color/darker_gray"
android:textSize="@dimen/body2"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/main_toolbar" app:layout_constraintTop_toTopOf="@+id/main_toolbar"/>
android:paddingLeft="@dimen/default_layout_margin"/>
@ -33,6 +32,7 @@
android:id="@+id/collection_swipe" android:id="@+id/collection_swipe"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginTop="5dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

View File

@ -35,9 +35,9 @@
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:id="@+id/scan_input" android:id="@+id/scan_input"
style="@style/InputLineTextSearch" style="@style/ScanLineTextSearch"
android:layout_width="match_parent" android:layout_width="match_parent"
android:backgroundTint="@android:color/white"
android:hint="@string/Escaneaetiqueta" android:hint="@string/Escaneaetiqueta"
android:inputType="text" android:inputType="text"
android:lines="1" android:lines="1"

View File

@ -224,7 +224,7 @@
android:layout_marginEnd="@dimen/layout_margin_min" android:layout_marginEnd="@dimen/layout_margin_min"
android:text="@{sale.pickedQuantity}" android:text="@{sale.pickedQuantity}"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" android:textSize="@dimen/body1"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/txtde" app:layout_constraintEnd_toStartOf="@+id/txtde"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
@ -237,7 +237,7 @@
android:layout_marginEnd="@dimen/layout_margin_min" android:layout_marginEnd="@dimen/layout_margin_min"
android:text="@string/de" android:text="@string/de"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" android:textSize="@dimen/body1"
app:layout_constraintEnd_toStartOf="@+id/item_article_quantity" app:layout_constraintEnd_toStartOf="@+id/item_article_quantity"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
@ -250,7 +250,7 @@
android:paddingRight="10dp" android:paddingRight="10dp"
android:text="@{sale.quantity}" android:text="@{sale.quantity}"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" android:textSize="@dimen/body1"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"

View File

@ -163,4 +163,5 @@
<string name="Selecccionaimpresoara">Selecciona impresora</string> <string name="Selecccionaimpresoara">Selecciona impresora</string>
<string name="claim">Ubicación de reclamación</string> <string name="claim">Ubicación de reclamación</string>
<string name="claims">Reclamaciones</string> <string name="claims">Reclamaciones</string>
<string name="scanPallet">Escáner paletizar</string>
</resources> </resources>

View File

@ -135,6 +135,7 @@
<string name="ExpeditionState">Expedtion state</string> <string name="ExpeditionState">Expedtion state</string>
<string name="BuffersManegement">Buffer Management</string> <string name="BuffersManegement">Buffer Management</string>
<string name="PalletMake">Pallet make</string> <string name="PalletMake">Pallet make</string>
<string name="scanPallet">Scan pallet</string>
<string name="bufferempty">Buffer empty</string> <string name="bufferempty">Buffer empty</string>
<string name="bufferfill">Buffer fill</string> <string name="bufferfill">Buffer fill</string>
<string name="bufferaccumulate">Buffer Acumulate</string> <string name="bufferaccumulate">Buffer Acumulate</string>