This commit is contained in:
Enrique Blasco 2020-09-01 22:49:48 +02:00
parent f84bb08b5f
commit 9ec2bfcc45
7 changed files with 54 additions and 25 deletions

View File

@ -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"
}

View File

@ -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)

View File

@ -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<String> {
val params:ArrayList<String> = 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<String>,deep:String,warehouse:String,level:String) : Call<String> {
val params:ArrayList<Any> = ArrayList();
params.add(shelving)

View File

@ -358,6 +358,15 @@ interface VerdnaturaService {
@Body params: List<String>):
Call<String>
@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<String>):
Call<String>
@POST("almacennew/itemShelvingMake_multi")
fun itemShelvingMake_multi(@Header("aplicacion") aplicacion: String,
@Header("version") version: String,

View File

@ -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<BarcodeVO>){
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){

View File

@ -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){

View File

@ -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<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_responseMake.value = ResponseItemVO(isError = true,errorMessage ="Error al guardar item: "+item+ " Respuesta:"+t.message!!)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_responseMake.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelvingMakeEdit")
}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<String>{
override fun onFailure(call: Call<String>, t: Throwable) {