diff --git a/app/build.gradle b/app/build.gradle index 3a7a1c6c..5111ebf0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,8 +12,8 @@ android { applicationId "es.verdnatura" minSdkVersion 21 targetSdkVersion 29 - versionCode 28 - versionName "5.1.8" + versionCode 29 + versionName "5.1.9" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/es/verdnatura/domain/ApiUtils.kt b/app/src/main/java/es/verdnatura/domain/ApiUtils.kt index 8503557a..44fd872c 100644 --- a/app/src/main/java/es/verdnatura/domain/ApiUtils.kt +++ b/app/src/main/java/es/verdnatura/domain/ApiUtils.kt @@ -8,8 +8,8 @@ import java.util.concurrent.TimeUnit class ApiUtils { companion object { - // const val BASE_URL:String = "http://192.168.0.28:8009/" - const val BASE_URL:String = "https://app.verdnatura.es/" + //const val BASE_URL:String = "http://192.168.0.12:8009/" + const val BASE_URL:String = "https://app.verdnatura.es/" fun getApiService():VerdnaturaService{ val retrofit = Retrofit.Builder() .baseUrl(BASE_URL) diff --git a/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt index 9ee12c54..e6e47106 100644 --- a/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt @@ -23,6 +23,18 @@ class GetUbicadorUserCase : RestClient() { return restClient!!.itemShelvingMake("json","1",usuario,password,"application/json",params) } + fun itemShelvingMakeEdit(usuario:String,password:String,shelving:String,item:String,deep:String,quantity:String,packing:String,warehouse:String,level:String) : Call { + val params:ArrayList = ArrayList(); + params.add(shelving) + params.add(item) + params.add(deep) + params.add(quantity) + params.add(packing) + params.add(warehouse) + params.add(level) + return restClient!!.itemShelvingMakeEdit("json","1",usuario,password,"application/json",params) + } + fun itemShelvingMake_multi(usuario:String,password:String,shelving:String,items:List,deep:String,warehouse:String,level:String) : Call { val params:ArrayList = ArrayList(); params.add(shelving) diff --git a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt index 4db801ac..4d5b8131 100644 --- a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt +++ b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt @@ -358,6 +358,15 @@ interface VerdnaturaService { @Body params: List): Call + @POST("almacennew/itemShelvingMakeEdit") + fun itemShelvingMakeEdit(@Header("aplicacion") aplicacion: String, + @Header("version") version: String, + @Header("user") user: String, + @Header("pass") pass: String, + @Header("Content-Type") content_type: String, + @Body params: List): + Call + @POST("almacennew/itemShelvingMake_multi") fun itemShelvingMake_multi(@Header("aplicacion") aplicacion: String, @Header("version") version: String, diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt index 9101db92..583b82c6 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt @@ -169,6 +169,8 @@ class ItemCardFragment( customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ customDialog.dismiss() }.show() + }else{ + getItemCard(itemFk) } }) } @@ -262,7 +264,9 @@ class ItemCardFragment( } private fun changeOfflineValue(item:ItemCardRowVO,newValue:String, barcodes:List){ - var i = 0 + + splash_progress.visibility = View.VISIBLE + /*var i = 0 var position = 0 listItemsRow.forEach { if (it.title == item.title) { @@ -272,7 +276,7 @@ class ItemCardFragment( } if (listItemsRow.get(position).title != "BARCODE") listItemsRow.get(position).value = newValue else listItemsRow.get(position).barcodes = barcodes - adapter?.notifyDataSetChanged() + adapter?.notifyDataSetChanged()*/ } private fun prepareItemStockUpdate(itemB:ItemCardRowVO,value:String){ diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt index e7f34bc1..645d48c0 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt @@ -292,11 +292,6 @@ class UbicadorFragment( var title = "Nuevo Item" if (delete) title = "Editar item "+itemFk customDialogUbicador.setTitle(title).setItemValue(itemFk).setPackingValue(packing).setEtiquetaValue(etiquetas).setVisibleValue(visible).setOkButton("Guardar"){ - if (delete){ - listItems.remove(itemUbicador) - adapter!!.notifyDataSetChanged() - itemUbicador?.id?.let { viewModel.itemShelvingDelete(user,password, it) } - } var packingUpdate = false if (packing != customDialogUbicador.getPackingValue() || etiquetas != customDialogUbicador.getEtiquetaValue()){ packingUpdate = true @@ -311,11 +306,6 @@ class UbicadorFragment( customDialogUbicador.getVisibleItem().setOnEditorActionListener { v, actionId, event -> if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { - if (delete){ - listItems.remove(itemUbicador) - adapter!!.notifyDataSetChanged() - itemUbicador?.id?.let { viewModel.itemShelvingDelete(user,password, it) } - } var packingUpdate = false if (packing != customDialogUbicador.getPackingValue() || etiquetas != customDialogUbicador.getEtiquetaValue()){ packingUpdate = true @@ -328,11 +318,6 @@ class UbicadorFragment( customDialogUbicador.getEtiquetaItem().setOnEditorActionListener { v, actionId, event -> if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { - if (delete){ - listItems.remove(itemUbicador) - adapter!!.notifyDataSetChanged() - itemUbicador?.id?.let { viewModel.itemShelvingDelete(user,password, it) } - } var packingUpdate = false if (packing != customDialogUbicador.getPackingValue() || etiquetas != customDialogUbicador.getEtiquetaValue()){ packingUpdate = true @@ -370,7 +355,7 @@ class UbicadorFragment( } }else{ if (!itemFk.isNullOrEmpty() && !visible.isNullOrEmpty() && !updatePacking){ - viewModel.itemShelvingMake(user,password,shelvingFk,itemFk,deep.toString(),visible,packing,warehouseFk,"1") + viewModel.itemShelvingMakeEdit(user,password,shelvingFk,itemFk,deep.toString(),visible,packing,warehouseFk,"1") changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible,packing = packing)) customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("") customDialogUbicador.getEditItem().requestFocus() @@ -379,7 +364,7 @@ class UbicadorFragment( }else if(!itemFk.isNullOrEmpty() && !etiquetas.isNullOrEmpty() && updatePacking){ val visible_calc = (etiquetas.toInt() * packing.toInt()).toString() - viewModel.itemShelvingMake(user,password,shelvingFk,itemFk,deep.toString(),visible_calc,packing,warehouseFk,"1") + viewModel.itemShelvingMakeEdit(user,password,shelvingFk,itemFk,deep.toString(),visible_calc,packing,warehouseFk,"1") changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible_calc,packing = packing,stickers = etiquetas)) customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("") customDialogUbicador.getEditItem().requestFocus() @@ -420,8 +405,9 @@ class UbicadorFragment( } private fun changeOfflineValue(item:ItemUbicadorVO){ - listItems.add(item) - adapter?.notifyDataSetChanged() + splash_progress.visibility = View.VISIBLE + /*listItems.add(item) + adapter?.notifyDataSetChanged()*/ } private fun showMoreOptions(item:ItemUbicadorVO){ diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt index 7aa96ba8..fa0a4ea2 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt @@ -94,6 +94,24 @@ class UbicadorViewModel : BaseViewModel() { }) } + fun itemShelvingMakeEdit(usuario:String,password:String,shelving:String,item:String,deep:String,quantity:String,packing:String,warehouse:String,level:String){ + getUbicadorUserCase.itemShelvingMakeEdit(usuario,password,shelving,item,deep,quantity,packing,warehouse,level).enqueue(object : Callback{ + override fun onFailure(call: Call, t: Throwable) { + _responseMake.value = ResponseItemVO(isError = true,errorMessage ="Error al guardar item: "+item+ " Respuesta:"+t.message!!) + } + + override fun onResponse(call: Call, response: Response) { + if (response.body() == null){ + _responseMake.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelvingMakeEdit") + }else{ + _responseMake.value = ResponseItemVO(isError = false,response = response.body()!!) + } + + } + + }) + } + fun shelvingPark(usuario:String,password:String,shelving:String,parking:String){ getUbicadorUserCase.shelvingPark(usuario,password,shelving,parking).enqueue(object : Callback{ override fun onFailure(call: Call, t: Throwable) {