From 97d981fe89081db0808c20de9cd71f396f5e56d0 Mon Sep 17 00:00:00 2001 From: Sergio De la torre Date: Thu, 16 Nov 2023 10:01:53 +0100 Subject: [PATCH] refs #5652 setItemVisible --- .../articulo/fragment/ItemCardFragment.kt | 598 ++++++++---------- .../articulo/fragment/ItemCardViewModel.kt | 55 +- app/src/main/res/values-es/strings.xml | 3 +- app/src/main/res/values-fr/strings.xml | 3 +- app/src/main/res/values-pt/strings.xml | 3 +- app/src/main/res/values/strings.xml | 3 +- 6 files changed, 313 insertions(+), 352 deletions(-) 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 185f5a71..c149365b 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 @@ -77,14 +77,12 @@ class ItemCardFragment( customDialogTwo = CustomDialogTwoButtons(requireContext()) customDynamic = CustomDialogDynamicButtons(requireContext(), this) - - if (!itemFk.isNullOrEmpty()) { + if (itemFk.isNotEmpty()) { getItemCard(itemFk) } setToolBar() super.init() - } private fun setToolBar() { @@ -128,13 +126,12 @@ class ItemCardFragment( itemInfoG!!.id.toString() ) - } iconSalix.drawable -> { binding.splashProgress.visibility = View.VISIBLE - var itemId = itemInfoG!!.id - var entryPoint = Gson().toJson( + val itemId = itemInfoG!!.id + val entryPoint = Gson().toJson( mutableMapOf( "entryPoint" to itemId, "web" to "${getData("base_urlSalix")}/#!/item/$itemId/summary" @@ -166,8 +163,7 @@ class ItemCardFragment( binding.editItemFk.setOnEditorActionListener { _, actionId, _ -> if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { - if (!binding.editItemFk.text.toString().isNullOrEmpty()) - //Tarea#5109 + if (binding.editItemFk.text.toString().isNotEmpty()) try { getItemCard( itemScanValue( @@ -180,7 +176,6 @@ class ItemCardFragment( ma.messageWithSound(ex.message.toString(), true, true) } - // getItemCard(binding.editItemFk.text.toString()) binding.editItemFk.setText("") ma.hideKeyboard(binding.editItemFk) return@setOnEditorActionListener true @@ -191,6 +186,9 @@ class ItemCardFragment( binding.mainToolbar.backButton.setOnClickListener { requireActivity().onBackPressed() + customDynamic.removeViewsDialog() + customDynamic.cancel() + } binding.itemcardImage.setOnClickListener { @@ -259,7 +257,7 @@ class ItemCardFragment( addressLosesList.observe(viewLifecycleOwner, Observer { binding.splashProgress.visibility = GONE if (it.list.isEmpty()) { - ma.messageWithSound(getString(R.string.empty), true, false) + ma.messageWithSound(getString(R.string.NotAddress), true, false) } else { showDialogTrashFault(it.list) } @@ -278,6 +276,7 @@ class ItemCardFragment( itemsPackingType.add(ItemPackingType(item.code, item.description)) } catch (e: Exception) { + getString(R.string.errorInput).toast(requireContext()) } } } @@ -417,143 +416,52 @@ class ItemCardFragment( adapter = ItemCardAdapter(listItemsRow, object : OnItemCardRowClickListener { override fun onItemCardRowClickListener(item: ItemCardRowVO) { - if (item.action == "itemProposal") { + when (item.action) { + "itemProposal" -> { + ma.onPasillerosItemClickListener( + PasillerosItemVO( + title = getString(R.string.titleSearchSimilarItems) + ), itemInfoG!!.id.toString() + ) + } - ma.onPasillerosItemClickListener( - PasillerosItemVO( - title = getString(R.string.titleSearchSimilarItems) - ), itemInfoG!!.id.toString() - ) + "toBarcode" -> { + prepareBarcodeDialog() + } - } else { - if (item.action == "updateSector") { - showDialogSelectItemTypePacking() - } else { - if (item.action != "toBarcode" && item.action != "buscarItem" && item.action != "itemStockUpdateAdd" && item.action != "itemStockUpdateRemove") { - customDialogInput.setTitle(item.title!!) - .setDescription( - getString(R.string.currentVAlue) + if (item.value.isNullOrEmpty()) "" else { - item.value - } - ) - .setOkButton(getString(R.string.save)) { - ma.hideKeyboard(customDialogInput.getEditText()) + "buscarItem" -> { + ma.onPasillerosItemClickListener( + PasillerosItemVO( + title = getString(R.string.titleItemSearch) + ), itemInfoG!!.id.toString() + ) + } - //Tarea 6182 - try { - editItemCardRow(item, customDialogInput.getValue().toInt()) - } catch (ex: Exception) { - if (item.action == "itemSaveStem" && customDialogInput.getValue() - .isNullOrBlank() - ) - viewModel.item_saveStems( - itemFk = itemInfoG!!.id, - value = null - ) else { - getString(R.string.errorInput).toast(requireContext()) - } + "itemStockUpdateRemove", "itemStockUpdateAdd" -> { + customDialogInput.getEditText().setRawInputType( + InputType.TYPE_CLASS_NUMBER + ) + showCustomDialog( + item, if (item.action == "itemStockUpdateRemove") { + getString(R.string.quantityToUnregister) + } else { + getString(R.string.quantityToRegister) + } + ) - } + } - customDialogInput.dismiss() - - }.setKoButton(getString(R.string.cancel)) { - ma.hideKeyboard(customDialogInput.getEditText()) - customDialogInput.dismiss() - }.setValue("").show() - customDialogInput.getEditText().requestFocus() - customDialogInput.getEditText() - .setOnEditorActionListener { _, actionId, _ -> - - if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { - if (!customDialogInput.getValue().isNullOrEmpty()) - editItemCardRow( - item, - customDialogInput.getValue().toInt() - ) - customDialogInput.setValue("") - customDialogInput.dismiss() - ma.hideKeyboard(customDialogInput.getEditText()) - return@setOnEditorActionListener true - } - false - } - } else if (item.action == "toBarcode") { - //BARCODE ROW - prepareBarcodeDialog(item) - } else if (item.action == "buscarItem") { - ma.onPasillerosItemClickListener( - PasillerosItemVO( - title = getString(R.string.titleItemSearch) - ), itemInfoG!!.id.toString() - ) - } else if (item.action == "itemStockUpdateAdd") { - customDialogInput.setTitle(item.title!!) - .setDescription(getString(R.string.quantityToRegister)) - .setOkButton(getString(R.string.save)) { - ma.hideKeyboard(customDialogInput.getEditText()) - editItemCardRow(item, customDialogInput.getValue().toInt()) - customDialogInput.dismiss() - - }.setKoButton(getString(R.string.cancel)) { - ma.hideKeyboard(customDialogInput.getEditText()) - customDialogInput.dismiss() - }.setValue("").show() - customDialogInput.getEditText().requestFocus() - customDialogInput.getEditText() - .setOnEditorActionListener { _, actionId, _ -> - if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { - if (!customDialogInput.getValue().isNullOrEmpty()) - editItemCardRow( - item, - customDialogInput.getValue().toInt() - ) - customDialogInput.setValue("") - customDialogInput.dismiss() - ma.hideKeyboard(customDialogInput.getEditText()) - return@setOnEditorActionListener true - } - false - } - } else if (item.action == "itemStockUpdateRemove") { - customDialogInput.getEditText().setRawInputType( - InputType.TYPE_CLASS_NUMBER - ) - customDialogInput.setTitle(item.title!!) - .setDescription(getString(R.string.quantityToUnregister)) - .setOkButton(getString(R.string.save)) { - ma.hideKeyboard(customDialogInput.getEditText()) - editItemCardRow(item, customDialogInput.getValue().toInt()) - customDialogInput.dismiss() - - }.setKoButton(getString(R.string.cancel)) { - ma.hideKeyboard(customDialogInput.getEditText()) - customDialogInput.dismiss() - }.setValue("").show() - customDialogInput.getEditText().requestFocus() - customDialogInput.getEditText() - .setOnEditorActionListener { _, actionId, _ -> - if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { - if (!customDialogInput.getValue().isNullOrEmpty()) - editItemCardRow( - item, - customDialogInput.getValue().toInt() - ) - customDialogInput.setValue("") - customDialogInput.dismiss() - ma.hideKeyboard(customDialogInput.getEditText()) - return@setOnEditorActionListener true - } - false - } - } + else -> { + showCustomDialog( + item, getString(R.string.currentVAlue) + ) } } + + } }) - //itemcard_recyclerview.adapter = adapter binding.itemcardRecyclerview.adapter = adapter - //itemcard_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) binding.itemcardRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) binding.scrollView.post { @@ -564,243 +472,289 @@ class ItemCardFragment( binding.splashProgressTwo.visibility = GONE } - private fun editItemCardRow(item: ItemCardRowVO, value: Int) { + private fun showCustomDialog(item: ItemCardRowVO, textDescrip: String) { + customDialogInput.setTitle(item.title!!) + .setDescription(textDescrip) + .setOkButton(getString(R.string.save)) { + customDialogAdd(item) + customDialogInput.dismiss() + + }.setKoButton(getString(R.string.cancel)) { + ma.hideKeyboard(customDialogInput.getEditText()) + customDialogInput.dismiss() + }.setValue("").show() + customDialogInput.getEditText().requestFocus() + customDialogInput.getEditText() + .setOnEditorActionListener { _, actionId, _ -> + if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { + customDialogAdd(item) + return@setOnEditorActionListener true + } + false + } + } + + private fun customDialogAdd(item: ItemCardRowVO) { + try { + if (customDialogInput.getValue().isNotEmpty()) + editItemCardRow( + item, + customDialogInput.getValue().toInt() + ) + customDialogInput.setValue("") + customDialogInput.dismiss() + ma.hideKeyboard(customDialogInput.getEditText()) + } catch (ex: Exception) { + getString(R.string.errorInput).toast(requireContext()) + } + } + + private fun editItemCardRow(item: ItemCardRowVO, value: Int) { + println("item $item.action") when (item.action) { "itemStockUpdateAdd" -> { showProgress() - viewModel.itemTrash( + viewModel.setVisibleDiscard(itemInfoG!!.id, warehouseFk!!, value * -1, null) + /*viewModel.itemTrash( itemFk = itemInfoG!!.id, warehouseFk = warehouseFk!!, newValue = (value * -1), isTrash = false + )*/ + } + + "itemStockUpdateRemove" -> prepareItemStockUpdate2(item, value) + "updateGrouping" -> + viewModel.updateGrouping( + itemFk = itemInfoG!!.id, + value = value, + warehouseFk = warehouseFk!! ) + + "updatePacking" -> viewModel.updatePacking( + itemFk = itemInfoG!!.id, + value = value, + warehouseFk = warehouseFk!! + ) + + "itemSaveStem" -> viewModel.item_saveStems( + itemFk = itemInfoG!!.id, + value = value + ) + + "item_saveReference" -> viewModel.item_saveReference( + itemFk = itemInfoG!!.id, + value = value + ) + + } - "itemStockUpdateRemove" -> prepareItemStockUpdate2(item, value) - "updateGrouping" -> - viewModel.updateGrouping( - itemFk = itemInfoG!!.id, - value = value, - warehouseFk = warehouseFk!! - ) - - "updatePacking" -> viewModel.updatePacking( - itemFk = itemInfoG!!.id, - value = value, - warehouseFk = warehouseFk!! - ) - - "itemSaveStem" -> viewModel.item_saveStems( - itemFk = itemInfoG!!.id, - value = value - ) - - "item_saveReference" -> viewModel.item_saveReference( - itemFk = itemInfoG!!.id, - value = value - ) - - + if (item.action != "itemStockUpdate" && item.action != "itemStockUpdateRemove" && item.action != "itemStockUpdateAdd") + // changeOfflineValue(item,value, listBarcodes) + showProgress() } - if (item.action != "itemStockUpdate" && item.action != "itemStockUpdateRemove" && item.action != "itemStockUpdateAdd") - // changeOfflineValue(item,value, listBarcodes) - showProgress() -} -private fun prepareItemStockAdd(value: Int) { + private fun prepareItemStockAdd(value: Int) { - showProgress() - viewModel.itemTrash( - itemFk = itemInfoG!!.id, - warehouseFk = warehouseFk!!, - newValue = (value * -1), - isTrash = false + showProgress() + viewModel.itemTrash( + itemFk = itemInfoG!!.id, + warehouseFk = warehouseFk!!, + newValue = (value * -1), + isTrash = false - ) -} + ) + } //sergio: changeOffLineValue solo hace visible el progress -private fun showProgress() { - binding.splashProgress.visibility = View.VISIBLE -} - -private fun prepareItemStockUpdate2(itemB: ItemCardRowVO, value: Int) { - - //Tarea 5652 , quitar código cuando está asignada tarea - var test = true - if (test) { + private fun showProgress() { binding.splashProgress.visibility = View.VISIBLE - viewModel.getAddress() - quantityToDiscard = value + } - } else { - try { - value.toInt() + private fun prepareItemStockUpdate2(itemB: ItemCardRowVO, value: Int) { - if (itemB.action == "itemStockUpdateRemove") { + //Tarea 5652 , quitar código cuando está asignada tarea + var test = true + if (test) { + binding.splashProgress.visibility = View.VISIBLE + viewModel.getAddress() + quantityToDiscard = value - customDialogTwo.setTitle(itemB.title!!) - .setDescription(getString(R.string.deleteStock)) - .setOkButton(getString(R.string.fault)) { - viewModel.itemTrash( - itemFk = itemInfoG!!.id, - warehouseFk = warehouseFk!!, - newValue = value, - isTrash = false + } else { + try {10 + value - ) - //changeOfflineValue(itemB,value, listBarcodes) - showProgress() - customDialogTwo.dismiss() + if (itemB.action == "itemStockUpdateRemove") { - }.setOkButtonTwo(getString(R.string.trash)) { - viewModel.itemTrash( - itemFk = itemInfoG!!.id, - warehouseFk = warehouseFk!!, - newValue = value, - isTrash = true + customDialogTwo.setTitle(itemB.title!!) + .setDescription(getString(R.string.deleteStock)) + .setOkButton(getString(R.string.fault)) { + viewModel.itemTrash( + itemFk = itemInfoG!!.id, + warehouseFk = warehouseFk!!, + newValue = value, + isTrash = false - ) + ) + //changeOfflineValue(itemB,value, listBarcodes) + showProgress() + customDialogTwo.dismiss() - showProgress() - customDialogTwo.dismiss() + }.setOkButtonTwo(getString(R.string.trash)) { + viewModel.itemTrash( + itemFk = itemInfoG!!.id, + warehouseFk = warehouseFk!!, + newValue = value, + isTrash = true - }.setKoButton(getString(R.string.cancel)) { + ) - customDialogTwo.dismiss() - }.show() + showProgress() + customDialogTwo.dismiss() - } else { + }.setKoButton(getString(R.string.cancel)) { - showProgress() - viewModel.itemTrash( - itemFk = itemInfoG!!.id, - warehouseFk = warehouseFk!!, - newValue = (value * -1), - isTrash = false + customDialogTwo.dismiss() + }.show() + + } else { + + showProgress() + viewModel.itemTrash( + itemFk = itemInfoG!!.id, + warehouseFk = warehouseFk!!, + newValue = (value * -1), + isTrash = false + + ) + } + } catch (e: Exception) { + // binding.itemcardLayout.visibility = View.GONE + ma.messageWithSound(getString(R.string.errorNotNumber), true, true) - ) } - } catch (e: Exception) { - // binding.itemcardLayout.visibility = View.GONE - ma.messageWithSound(getString(R.string.errorNotNumber), true, true) - } } -} -private fun showDialogTrashFault(listAddress: List) { + private fun showDialogTrashFault(listAddress: List) { - customDynamic.setTitle("") - customDynamic.setDescription(getString(R.string.deleteStock)) - customDynamic.createDynamicButtons(listAddress) - customDynamic.show() -} + customDynamic.setTitle("") + customDynamic.setDescription(getString(R.string.deleteStock)) + customDynamic.createDynamicButtons(listAddress) + customDynamic.show() -private fun prepareBarcodeDialog(itemB: ItemCardRowVO) { + } - customDialogList.setTitle(getString(R.string.barcodes)) - .setOkButton(getString(R.string.save)) { + private fun prepareBarcodeDialog() { + + customDialogList.setTitle(getString(R.string.barcodes)) + .setOkButton(getString(R.string.save)) { + setUpdateBarcode() + }.setKoButton(getString(R.string.close)) { + ma.hideKeyboard(customDialogList.getEditText()) + }.setValue("").show() + + customDialogList.getEditText().setOnEditorActionListener { _, actionId, _ -> + if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { + setUpdateBarcode() + return@setOnEditorActionListener true + } + false + } + + barcodeAdapter = BarcodeAdapter(listBarcodes, object : OnBarcodeRowClickListener { + override fun onBarcodeRowClickListener(item: BarcodeVO) { + updateBarcode(item.code!!, true) + customDialogList.setValue("") + customDialogList.dismiss() + } + }) + customDialogList.getRecyclerView().adapter = barcodeAdapter + + customDialogList.getRecyclerView().layoutManager = + LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) + } + + private fun setUpdateBarcode() { + try { ma.hideKeyboard(customDialogList.getEditText()) - if (!customDialogList.getValue().isEmpty()) - updateBarcode(customDialogList.getValue(), false) - customDialogList.dismiss() - - }.setKoButton(getString(R.string.close)) { - ma.hideKeyboard(customDialogList.getEditText()) - customDialogList.dismiss() - }.setValue("").show() - - - ma.hideKeyboard(customDialogList.getEditText()) - customDialogList.getEditText().setOnEditorActionListener { _, actionId, _ -> - if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { - if (!customDialogList.getValue().isNullOrEmpty()) + if (customDialogList.getValue().isNotEmpty()) updateBarcode(customDialogList.getValue(), false) customDialogList.setValue("") customDialogList.dismiss() - ma.hideKeyboard(customDialogList.getEditText()) - return@setOnEditorActionListener true + + } catch (ex: Exception) { + getString(R.string.errorInput).toast(requireContext()) } - false + } - barcodeAdapter = BarcodeAdapter(listBarcodes, object : OnBarcodeRowClickListener { - override fun onBarcodeRowClickListener(item: BarcodeVO) { - updateBarcode(item.code!!, true) - customDialogList.setValue("") - customDialogList.dismiss() - } - }) - customDialogList.getRecyclerView().adapter = barcodeAdapter + private fun updateBarcode(code: String, delete: Boolean) { + if (delete) { + var i = 0 + var posDelete = 0 + listBarcodes.forEach { + if (it.code == code) + posDelete = i + i += 1 + } + listBarcodes.removeAt(posDelete) + viewModel.barcodesEdit( + itemFk = itemInfoG!!.id, + value = code, + delete = delete, + ) + } else { + listBarcodes.add(BarcodeVO(code)) + viewModel.barcodesEditSalix( + itemFk = itemInfoG!!.id, + barCodeValue = code + ) - customDialogList.getRecyclerView().layoutManager = - LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) -} - -private fun updateBarcode(code: String, delete: Boolean) { - if (delete) { - var i = 0 - var posDelete = 0 - listBarcodes.forEach { - if (it.code == code) - posDelete = i - i += 1 } - listBarcodes.removeAt(posDelete) - viewModel.barcodesEdit( - itemFk = itemInfoG!!.id, - value = code, - delete = delete, + + barcodeAdapter!!.notifyDataSetChanged() + showProgress() + } + + private fun showDialogSelectItemTypePacking() { + + var array = arrayOfNulls(itemsPackingType.size) + for (indice in array.indices) { + array[indice] = + itemsPackingType[indice].code + " : " + itemsPackingType[indice].description + } + val builder = AlertDialog.Builder(this.context) + builder.setTitle(getString(R.string.mensajeseleccionencajado)) + .setItems( + array + ) { _, position -> + + updateItemPackingType(itemsPackingType[position].code) + + } + + builder.create().show() + } + + private fun updateItemPackingType(itemPackingType: String) { + binding.splashProgress.visibility = View.VISIBLE + viewModel.updatePackingTypeSalix( + itemInfoG!!.id, + itemPackingType ) - } else { - listBarcodes.add(BarcodeVO(code)) - viewModel.barcodesEditSalix( - itemFk = itemInfoG!!.id, - barCodeValue = code - ) - } - barcodeAdapter!!.notifyDataSetChanged() - showProgress() -} + override fun onClickDynamic(addressFK: Int) { -private fun showDialogSelectItemTypePacking() { - - var array = arrayOfNulls(itemsPackingType.size) - for (indice in array.indices) { - array[indice] = - itemsPackingType[indice].code + " : " + itemsPackingType[indice].description + binding.splashProgress.visibility = View.VISIBLE + viewModel.setVisibleDiscard(itemInfoG!!.id, warehouseFk!!, quantityToDiscard, addressFK) + customDynamic.dismiss() + customDynamic.cancel() } - val builder = AlertDialog.Builder(this.context) - builder.setTitle(getString(R.string.mensajeseleccionencajado)) - .setItems( - array - ) { _, position -> - - updateItemPackingType(itemsPackingType[position].code) - - } - - builder.create().show() -} - -private fun updateItemPackingType(itemPackingType: String) { - binding.splashProgress.visibility = View.VISIBLE - viewModel.updatePackingTypeSalix( - itemInfoG!!.id, - itemPackingType - ) -} - -override fun onClickDynamic(addressFK: Int) { - customDynamic.dismiss() - binding.splashProgress.visibility = View.VISIBLE - viewModel.setVisibleDiscard(itemInfoG!!.id, warehouseFk!!, quantityToDiscard, addressFK) -} } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardViewModel.kt index 8cf36017..12fd77cd 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardViewModel.kt @@ -8,7 +8,7 @@ import es.verdnatura.domain.SilexCallback import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.nameofFunction -import es.verdnatura.presentation.common.ItemDiscardSalix +import es.verdnatura.presentation.common.ItemDiscardSalixShortage import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.common.itemBarCodeSalix import es.verdnatura.presentation.view.feature.articulo.model.AddressLoses @@ -163,10 +163,12 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) { itemFk: Int, warehouseFk: Int, quantity: Int, - addressFk: Int, + addressFk: Int?, ) { - salix.setVisibleDiscard(ItemDiscardSalix(itemFk, warehouseFk, quantity, addressFk)) + salix.setVisibleDiscard( + ItemDiscardSalixShortage(itemFk, warehouseFk, quantity, addressFk) + ) .enqueue(object : SilexCallback(context) { override fun onError(t: Throwable) { _response.value = ResponseItemVO( @@ -377,34 +379,35 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) { fun getAddress() { - salix.getAddressSalix().enqueue(object : SilexCallback>(context) { - override fun onError(t: Throwable) { + salix.getAddressSalix("""{ "include": [ { "relation": "address", "scope": { "fields": { "nickname": true } } } ] }""") + .enqueue(object : SilexCallback>(context) { + override fun onError(t: Throwable) { - val listError: ArrayList = ArrayList() - listError.add(AddressLoses(isError = true, errorMessage = t.message!!)) - _addressLosesList.value = AddressLosesList(listError) - } - - override fun onSuccess(response: Response>) { - - if (response.body() != null) { - _addressLosesList.value = response.body()?.let { AddressLosesList(it) } - } else { val listError: ArrayList = ArrayList() - listError.add( - AddressLoses( - isError = true, - errorMessage = getMessageFromAllResponse( - nameofFunction(this), - response.message() - ) - ) - ) + listError.add(AddressLoses(isError = true, errorMessage = t.message!!)) _addressLosesList.value = AddressLosesList(listError) } - } - }) + override fun onSuccess(response: Response>) { + + if (response.body() != null) { + _addressLosesList.value = response.body()?.let { AddressLosesList(it) } + } else { + val listError: ArrayList = ArrayList() + listError.add( + AddressLoses( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + ) + _addressLosesList.value = AddressLosesList(listError) + } + } + + }) } } diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index cbca1775..856c1481 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -559,7 +559,6 @@ Va a modificar el número de serie asociado a su dispositivo. Indica la cantidad que coges Cambiar a A2 - Cambiar a A2 Indica el carro donde está ubicado el item: Cargar furgoneta Descargar furgoneta @@ -685,6 +684,8 @@ Nota añadida correctamente Permite borrar las revisiones de la matrícula Problemas al intentar abrir/crear el fichero + Error al escanear expedición + No hay consignatarios para dar de baja el ítem diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index c49e46ee..8d3636ac 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -559,7 +559,6 @@ Va a modificar el número de serie asociado a su dispositivo. Indica la cantidad que coges Cambiar a A2 - Cambiar a A2 Indica el carro donde está ubicado el item: Charger fourgon Décharger fourgon @@ -685,6 +684,8 @@ Nota añadida correctamente Permite borrar las revisiones de la matrícula Problemas al intentar abrir/crear el fichero + Error al escanear expedición + No hay consignatarios para dar de baja el ítem diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 08968453..7ce21213 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -559,7 +559,6 @@ Va a modificar el número de serie asociado a su dispositivo. Indica la cantidad que coges Cambiar a A2 - Cambiar a A2 Indica el carro donde está ubicado el item: Cargar furgoneta Descargar furgoneta @@ -685,6 +684,8 @@ Nota añadida correctamente Permite borrar las revisiones de la matrícula Problemas al intentar abrir/crear el fichero + Error al escanear expedición + No hay consignatarios para dar de baja el ítem diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7fc12630..2a78c617 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -409,7 +409,6 @@ Ubicator Packing Holanda Self-autoconsumption - Change to A2 Self-autoconsumption from your warehouse Reubication Add Automatically items to shelving @@ -684,5 +683,7 @@ Nota añadida correctamente Permite borrar las revisiones de la matrícula Problemas al intentar abrir/crear el fichero + Error al escanear expedición + No hay consignatarios para dar de baja el ítem