diff --git a/.idea/misc.xml b/.idea/misc.xml index 97b3f254..63d3027a 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -276,7 +276,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index b9a06f20..8e317776 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -83,17 +83,17 @@ - + - - - - + + + - + + @@ -781,7 +782,7 @@ - @@ -882,48 +883,58 @@ file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt - 520 + 526 file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt - 563 + 569 file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt - 566 + 572 file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt - 567 + 573 file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt - 576 + 582 file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt - 610 + 616 file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt - 613 + 619 file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt - 616 + 622 - file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt - 163 - + + file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemFragment.kt + 82 + + + file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemFragment.kt + 64 + diff --git a/app/src/main/java/es/verdnatura/presentation/common/itemScanned.kt b/app/src/main/java/es/verdnatura/presentation/common/itemScanned.kt index d783c612..a174c608 100644 --- a/app/src/main/java/es/verdnatura/presentation/common/itemScanned.kt +++ b/app/src/main/java/es/verdnatura/presentation/common/itemScanned.kt @@ -1,7 +1,11 @@ package es.verdnatura.presentation.common +import android.content.Context import android.os.Build +import android.util.Log.d import androidx.annotation.RequiresApi +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken import org.json.JSONObject import java.time.LocalDateTime import java.time.format.DateTimeFormatter @@ -9,19 +13,25 @@ import java.time.format.DateTimeFormatter data class itemScanned(var scanned: JSONObject) { var table: String = scanned.get("table").toString() var id: Int = scanned.get("id").toString().toInt() + var company: String = scanned.get("company").toString() } + //Tarea#5109 @RequiresApi(Build.VERSION_CODES.O) data class itemScannedAll(var scanned: JSONObject) { var company: String = scanned.get("company").toString() var user: Int = scanned.get("user").toString().toInt() - var created: LocalDateTime = LocalDateTime.parse(scanned.get("created").toString(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + var created: LocalDateTime = LocalDateTime.parse( + scanned.get("created").toString(), + DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss") + ) var table: String = scanned.get("table").toString() var id: String = scanned.get("id").toString() var more: String = scanned.get("more").toString() } + //Tarea #5109 -private fun itemScanIsQr(value: String): Boolean { +fun itemScanIsQr(value: String): Boolean { return try { itemScanned(JSONObject(value)) @@ -31,4 +41,37 @@ private fun itemScanIsQr(value: String): Boolean { return false } -} \ No newline at end of file +} + +@RequiresApi(Build.VERSION_CODES.O) +fun itemScanValue(value: String, table: String, field: String): Any { + val gson = Gson() + + return try { + + var item = itemScanned(JSONObject(value)) + + if (item.company == "vnl" && item.table == table) { + + var valueToReturn: Map = + gson.fromJson(value, object : TypeToken>() {}.type) + valueToReturn.forEach { + + if (it.key == field) { + return it.value.toString() /*si no li pose toString torna error double to string*/ + } + + } + } + + throw Exception("QR no válido") + + } catch (Ex: Exception) { + if (Ex.message!!.contains("QR")){ + throw Ex + }else{ + return value + } + } + +} 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 8d6b4c3e..12bd55a7 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 @@ -15,7 +15,6 @@ import androidx.recyclerview.widget.LinearLayoutManager import com.google.gson.Gson import es.verdnatura.R import es.verdnatura.databinding.FragmentItemCardBinding -import es.verdnatura.domain.toast import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.common.* import es.verdnatura.presentation.view.component.CustomDialogInput @@ -116,10 +115,10 @@ class ItemCardFragment( } iconHistory.drawable -> { - ma.onPasillerosItemClickListener( - PasillerosItemVO(title = getString(R.string.titleHistorical)), - itemInfoG!!.id.toString() - ) + ma.onPasillerosItemClickListener( + PasillerosItemVO(title = getString(R.string.titleHistorical)), + itemInfoG!!.id.toString() + ) } @@ -154,15 +153,22 @@ class ItemCardFragment( } + @RequiresApi(Build.VERSION_CODES.O) private fun setEvents() { - //edit_itemFk.requestFocus() + binding.editItemFk.requestFocus() - //edit_itemFk.setOnEditorActionListener { v, actionId, event -> + binding.editItemFk.setOnEditorActionListener { _, actionId, _ -> if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { - //if (!edit_itemFk.text.toString().isNullOrEmpty()) if (!binding.editItemFk.text.toString().isNullOrEmpty()) - getItemCard(binding.editItemFk.text.toString()) + //Tarea#5109 + try { + getItemCard(itemScanValue(binding.editItemFk.text.toString(),"buy","id").toString()) + }catch (Ex:Exception){ + ma.messageWithSound(Ex.message.toString(), true,true) + } + + // getItemCard(binding.editItemFk.text.toString()) binding.editItemFk.setText("") ma.hideKeyboard(binding.editItemFk) return@setOnEditorActionListener true @@ -666,9 +672,9 @@ class ItemCardFragment( customDialogList.dismiss() }.setKoButton(getString(R.string.close)) { - ma.hideKeyboard(customDialogList.getEditText()) - customDialogList.dismiss() - }.setValue("").show() + ma.hideKeyboard(customDialogList.getEditText()) + customDialogList.dismiss() + }.setValue("").show() ma.hideKeyboard(customDialogList.getEditText()) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemFragment.kt index 9bf2e169..092c6d4d 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemFragment.kt @@ -1,9 +1,11 @@ package es.verdnatura.presentation.view.feature.buscaritem.fragment import android.content.Context +import android.os.Build import android.view.View import android.view.View.GONE import android.view.inputmethod.EditorInfo +import androidx.annotation.RequiresApi import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import es.verdnatura.R @@ -11,6 +13,7 @@ import es.verdnatura.databinding.FragmentBuscarItemBinding import es.verdnatura.domain.notNull import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.common.OnPasillerosItemClickListener +import es.verdnatura.presentation.common.itemScanValue import es.verdnatura.presentation.view.feature.buscaritem.adapter.LocationAdapter @@ -32,11 +35,12 @@ class BuscarItemFragment( override fun getLayoutId(): Int = R.layout.fragment_buscar_item + @RequiresApi(Build.VERSION_CODES.O) override fun init() { ma.hideBottomNavigation(GONE) binding.mainToolbar.toolbarTitle.text = getString(R.string.getubicaition) - binding.editItemFk.inputType = android.text.InputType.TYPE_CLASS_NUMBER + //binding.editItemFk.inputType = android.text.InputType.TYPE_CLASS_NUMBER setEvents() if (itemFk != null) { getLocations(itemFk!!) @@ -45,13 +49,21 @@ class BuscarItemFragment( } + @RequiresApi(Build.VERSION_CODES.O) private fun setEvents() { binding.editItemFk.requestFocus() 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()) - getLocations(binding.editItemFk.text.toString()) + //getLocations(binding.editItemFk.text.toString()) + /* #Tarea 5109*/ + + try { + getLocations(itemScanValue(binding.editItemFk.text.toString(), "buy", "id")) + } catch (Ex: Exception) { + ma.messageWithSound(Ex.message.toString(), true, true) + } binding.editItemFk.setText("") ma.hideKeyboard(binding.editItemFk) return@setOnEditorActionListener true @@ -67,7 +79,7 @@ class BuscarItemFragment( } private fun getLocations(itemFk: Any) { - this.itemFk = itemFk + // this.itemFk = itemFk binding.splashProgress.visibility = View.VISIBLE viewModel.getLocations(itemFk) } @@ -89,7 +101,11 @@ class BuscarItemFragment( totalVisible += it.visible.toInt() } binding.mainToolbar.toolbarTitle.text = - getString(R.string.item) + itemFk + getString(R.string.visibleTotal) + totalVisible + getString(R.string.item) + if (it.list.isNotEmpty()) { + it.list.get(0).itemFk + } else { + "" + } + getString(R.string.visibleTotal) + totalVisible } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt index bbbc875f..1a78a290 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt @@ -18,6 +18,7 @@ import android.view.inputmethod.EditorInfo import android.view.inputmethod.InputMethodManager import android.widget.ImageView import android.widget.Toast +import androidx.annotation.RequiresApi import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView @@ -398,6 +399,7 @@ class CollectionFragment( } } + @RequiresApi(Build.VERSION_CODES.O) override fun observeViewModel() { with(viewModel) { binding.splashProgress.visibility = GONE @@ -604,20 +606,20 @@ class CollectionFragment( }) - /* responseMissingTrash.observe(viewLifecycleOwner, Observer { + /* responseMissingTrash.observe(viewLifecycleOwner, Observer { - if (!goBack) { - if (it.isError) { - ma.messageWithSound(it.errorMessage, isError = true, true) + if (!goBack) { + if (it.isError) { + ma.messageWithSound(it.errorMessage, isError = true, true) - } else { + } else { - missingTrashSuccesful() + missingTrashSuccesful() - } - } + } + } - })*/ + })*/ //Tarea 4280 /* responseTicketClosure.observe(viewLifecycleOwner, Observer { binding.splashProgress.visibility = GONE @@ -849,9 +851,9 @@ class CollectionFragment( binding.splashProgress.visibility = GONE if (it.isError) { //TEST3 - /* if (getDataInt(USERFK) == 18890 || getDataInt(USERFK) == 19591) { - "La línea NO se ha marcado correctamente".toast(context) - }*/ + /* if (getDataInt(USERFK) == 18890 || getDataInt(USERFK) == 19591) { + "La línea NO se ha marcado correctamente".toast(context) + }*/ if (!goBack) { ma.messageWithSound(it.errorMessage, it.isError, true) @@ -1493,6 +1495,7 @@ class CollectionFragment( ) } + @RequiresApi(Build.VERSION_CODES.O) private fun printShelvingResult(placementSupplyListVO: PlacementSupplyListVO) { //////Log.i("VERDNATURA:","Print CustomDialog") var shelving = "" @@ -1529,48 +1532,59 @@ class CollectionFragment( ) ) { if (customDialogList.getValueTwo().isNotEmpty()) { - if (isNumber(customDialogList.getValue()) && isNumber(total) && customDialogList.getValue() - .toInt() > total.toInt() - ) { - getString(R.string.quantityHigh).toast(requireContext()) - } else if (isNumber(customDialogList.getValue())) { - originalItemScan = customDialogList.getValueTwo().toInt() - // Log.i("VERDATURA","Le pasamos el siguiente item $originalItemScan que es el escaneado") - if (checkItemScan(customDialogList.getValueTwo())) { - onQuantityOfShelvingSelected(itemShelvingFk) - //Log.i("VERDNATURA:","Cantidad seleccionada") - mpok?.start() - /* Se quita para comprobar al final de saleTracking_mark - ReviewQuantityForRefreshingAndSorting( - customDialogList.getValue().toInt(), - sales[storedPosition].quantity!!.toInt(), - sales[storedPosition].pickedQuantity.toInt() - )*/ - customDialogList.dismiss() + /*Tarea #5109*/ + + customDialogList.setValue( + itemScanValue( + customDialogList.getValue(), + "buy", + "id" + ).toString() + ) + + + + if (isNumber(customDialogList.getValue()) && isNumber(total) && customDialogList.getValue() + .toInt() > total.toInt() + ) { + getString(R.string.quantityHigh).toast(requireContext()) + } else if (isNumber(customDialogList.getValue())) { + originalItemScan = customDialogList.getValueTwo().toInt() + // Log.i("VERDATURA","Le pasamos el siguiente item $originalItemScan que es el escaneado") + if (checkItemScan(customDialogList.getValueTwo())) { + onQuantityOfShelvingSelected(itemShelvingFk) + //Log.i("VERDNATURA:","Cantidad seleccionada") + mpok?.start() + /* Se quita para comprobar al final de saleTracking_mark + ReviewQuantityForRefreshingAndSorting( + customDialogList.getValue().toInt(), + sales[storedPosition].quantity!!.toInt(), + sales[storedPosition].pickedQuantity.toInt() + )*/ + customDialogList.dismiss() + } else { + itemShelvingFkStored = itemShelvingFk + binding.splashProgress.visibility = + VISIBLE + + viewModel.getIdFromCodeSalix( + code = customDialogList.getValueTwo(), + ) + /* } else { + viewModel.getIdFromCode( + usuario = getData(USER), + password = getData(PASSWORD), + code = customDialogList.getValueTwo(), "barcodeToItem" + ) + }*/ + + customDialogList.dismiss() + } + scanRequest() + hideKeyboards() } else { - itemShelvingFkStored = itemShelvingFk - binding.splashProgress.visibility = - VISIBLE - - viewModel.getIdFromCodeSalix( - code = customDialogList.getValueTwo(), - ) - /* } else { - viewModel.getIdFromCode( - usuario = getData(USER), - password = getData(PASSWORD), - code = customDialogList.getValueTwo(), "barcodeToItem" - ) - }*/ - - customDialogList.dismiss() + getString(R.string.quantityError).toast(requireContext()) } - scanRequest() - hideKeyboards() - } else { - getString(R.string.quantityError).toast(requireContext()) - } - } else { getString(R.string.scanItemValidate).toast(requireContext()) @@ -1584,7 +1598,7 @@ class CollectionFragment( .setHintValueTwo(getString(R.string.scanItem)) .setValueTwo("").show() } catch (e: Exception) { - + ma.messageWithSound(e.message.toString(), true, true) } try { customDialogList.getEditTextTwo().post(Runnable { @@ -1601,10 +1615,19 @@ class CollectionFragment( }) } catch (e: Exception) { } - try { + try {/*Tarea 5109 el catch no tenia error*/ customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event -> if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { + customDialogList.setValue( + itemScanValue( + customDialogList.getValue(), + "buy", + "id" + ).toString() + ) + + // Log.i("VERDNATURA:","Comprobando COGER-1") if (customDialogList.getValueTwo().isNotEmpty()) { try { @@ -1664,6 +1687,7 @@ class CollectionFragment( false } } catch (e: Exception) { + ma.messageWithSound(e.message.toString(), true, true) } placementSupplyAdapter = @@ -1707,7 +1731,7 @@ class CollectionFragment( private fun checkItemScan(valueToCheck: String): Boolean { - d("VERDNATURA::","Entramos a ver el checkItem") + d("VERDNATURA::", "Entramos a ver el checkItem") if (storedPosition >= 0 && sales.size > storedPosition) { val saleToCheck = sales[storedPosition] @@ -1720,7 +1744,7 @@ class CollectionFragment( } } } - d("VERDNATURA::","SAlimos de ver el checkItem") + d("VERDNATURA::", "SAlimos de ver el checkItem") return false } @@ -2165,134 +2189,134 @@ class CollectionFragment( customDialogThreeButtons.setDescription(getString(R.string.txtnuevacantidad)) .setValue("") - //Tarea4495 - // if (type != SACADOR) { - /* customDialogThreeButtons.setOkButton(getString(R.string.titleFaults)) { - checkAndCall( - position, - customDialogThreeButtons.getValue(), - getString(R.string.titleFaults) - ) + //Tarea4495 + // if (type != SACADOR) { + /* customDialogThreeButtons.setOkButton(getString(R.string.titleFaults)) { + checkAndCall( + position, + customDialogThreeButtons.getValue(), + getString(R.string.titleFaults) + ) - }.setOkButtonTwo(getString(R.string.BasuraRechazar)) { + }.setOkButtonTwo(getString(R.string.BasuraRechazar)) { - checkAndCall( - position, - customDialogThreeButtons.getValue(), - getString(R.string.BasuraRechazar) - ) - } - // } + checkAndCall( + position, + customDialogThreeButtons.getValue(), + getString(R.string.BasuraRechazar) + ) + } + // } - customDialogThreeButtons.setOkButtonThree(getString(R.string.Reject)) { - checkAndCall( - position, - customDialogThreeButtons.getValue(), - getString(R.string.Reject) - ) + customDialogThreeButtons.setOkButtonThree(getString(R.string.Reject)) { + checkAndCall( + position, + customDialogThreeButtons.getValue(), + getString(R.string.Reject) + ) - }.setOkButtonFour(getString(R.string.Split)) { - checkAndCall( - position, - customDialogThreeButtons.getValue(), - getString(R.string.Split) - )*/ + }.setOkButtonFour(getString(R.string.Split)) { + checkAndCall( + position, + customDialogThreeButtons.getValue(), + getString(R.string.Split) + )*/ .setOkButtonAdd(getString(R.string.Agregar)) { - /* checkAndCall( - position, - customDialogThreeButtons.getValue(), - getString(R.string.Agregar) - )*/ + /* checkAndCall( + position, + customDialogThreeButtons.getValue(), + getString(R.string.Agregar) + )*/ increaseQuantity(position, customDialogThreeButtons.getValue().toInt()) scanRequest() customDialogThreeButtons.dismiss() - }.setKoButton(getString(R.string.cancel)) { + }.setKoButton(getString(R.string.cancel)) { scanRequest() customDialogThreeButtons.dismiss() - }.show() + }.show() customDialogThreeButtons.setFocusDialogValue() } - /* private fun checkAndCall(position: Int, value: String, action: String) { - if (value.trim().isNullOrEmpty()) { - getString(R.string.Indicanuevacantidad).toast(requireContext()) - } else { + /* private fun checkAndCall(position: Int, value: String, action: String) { + if (value.trim().isNullOrEmpty()) { + getString(R.string.Indicanuevacantidad).toast(requireContext()) + } else { - when (action) { - getString(R.string.Agregar) -> increaseQuantity(position, value.toInt()) - getString(R.string.BasuraRechazar) -> TrashMissingReject( - position, - value.toInt(), - "TRUE" - ) - getString(R.string.titleFaults) -> TrashMissingReject( - position, - value.toInt(), - "FALSE" - ) - getString(R.string.Reject) -> TrashMissingReject( - position, - value.toInt(), - "reject" - ) - getString(R.string.Split) -> split(position, value.toInt()) + when (action) { + getString(R.string.Agregar) -> increaseQuantity(position, value.toInt()) + getString(R.string.BasuraRechazar) -> TrashMissingReject( + position, + value.toInt(), + "TRUE" + ) + getString(R.string.titleFaults) -> TrashMissingReject( + position, + value.toInt(), + "FALSE" + ) + getString(R.string.Reject) -> TrashMissingReject( + position, + value.toInt(), + "reject" + ) + getString(R.string.Split) -> split(position, value.toInt()) - } + } - scanRequest() - customDialogThreeButtons.dismiss() - } - }*/ + scanRequest() + customDialogThreeButtons.dismiss() + } + }*/ - /* private fun split(position: Int, quantity: Int) { + /* private fun split(position: Int, quantity: Int) { - //sergio: SPLIT SALIX + //sergio: SPLIT SALIX - quantityCollectionSplit = quantity - positionCollectionSplit = position + quantityCollectionSplit = quantity + positionCollectionSplit = position - var totalQuantity: Int = 0 - try { - totalQuantity = sales[position].quantity!!.toInt() - quantity.toInt() - } catch (e: Exception) { - } + var totalQuantity: Int = 0 + try { + totalQuantity = sales[position].quantity!!.toInt() - quantity.toInt() + } catch (e: Exception) { + } - viewModel.transferSalesSalix( - ticketFk = sales[position].ticketFk, - saleFk = sales[position].saleFk, - quantity = totalQuantity.toString() - ) + viewModel.transferSalesSalix( + ticketFk = sales[position].ticketFk, + saleFk = sales[position].saleFk, + quantity = totalQuantity.toString() + ) - }*/ + }*/ - /* private fun TrashMissingReject( - position: Int, - quantity: Int, - typeCollectionTrashMissingReject: String - ) { - typeCollectionMissing = typeCollectionTrashMissingReject - positionCollectionMissing = position - quantityCollectionMissing = quantity + /* private fun TrashMissingReject( + position: Int, + quantity: Int, + typeCollectionTrashMissingReject: String + ) { + typeCollectionMissing = typeCollectionTrashMissingReject + positionCollectionMissing = position + quantityCollectionMissing = quantity - var totalQuantity: Int = 0 - try { - totalQuantity = sales[position].quantity!!.toInt() - quantity.toInt() - } catch (e: Exception) { - } + var totalQuantity: Int = 0 + try { + totalQuantity = sales[position].quantity!!.toInt() - quantity.toInt() + } catch (e: Exception) { + } - viewModel.collectionMissingTrash( - saleFk = sales[position].saleFk, - quantity = totalQuantity.toString(), - warehouseFk = getData(WAREHOUSEFK), - type = typeCollectionTrashMissingReject, - originalQuantity = quantity - ) + viewModel.collectionMissingTrash( + saleFk = sales[position].saleFk, + quantity = totalQuantity.toString(), + warehouseFk = getData(WAREHOUSEFK), + type = typeCollectionTrashMissingReject, + originalQuantity = quantity + ) - }*/ + }*/ private fun missingTrashSuccesful() { @@ -2504,7 +2528,7 @@ class CollectionFragment( } customDialogList.setTitle(getString(R.string.errorCause)) - customDialogList.hideTextInput() + customDialogList.hideTextInput() .setKoButton(getString(R.string.cancel)) { scanRequest() hideKeyboards() diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt index d73edbb2..1c855a3c 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt @@ -73,7 +73,7 @@ class LoginFragment : BaseFragment(LoginVi binding.edittextPassword.setText("nightmare") } // se crean/listan las opciones de formas de trabajo - deleteWorkForm("all") + //deleteWorkForm("all") listForms = getWorkForm().sortedBy { it.created } binding.edittextServer.keyListener = null diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt index 4d0010d2..a3f44f4c 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt @@ -12,6 +12,7 @@ import android.view.inputmethod.EditorInfo import android.view.inputmethod.InputMethodManager import android.widget.ImageView import android.widget.Toast +import androidx.annotation.RequiresApi import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView @@ -75,7 +76,7 @@ class EndSacadorFragment( private var positionCollectionMissing = 0 private var quantityCollectionMissing = 0 private var positionIncreaseQuantity = 0 - private var quantityIncrease= 0 + private var quantityIncrease = 0 private var quantityCollectionSplit = 0 private var positionCollectionSplit = 0 @@ -169,6 +170,7 @@ class EndSacadorFragment( } } + @RequiresApi(Build.VERSION_CODES.O) override fun observeViewModel() { with(viewModel) { salesList.observe(viewLifecycleOwner, Observer { @@ -290,16 +292,16 @@ class EndSacadorFragment( } }) - /* responseMissingTrash.observe(viewLifecycleOwner, Observer { + /* responseMissingTrash.observe(viewLifecycleOwner, Observer { - if (it.isError) { - ma.messageWithSound(it.errorMessage, isError = true, true) + if (it.isError) { + ma.messageWithSound(it.errorMessage, isError = true, true) - } else { - missingTrashSuccesful() - setTotalLines() - } - })*/ + } else { + missingTrashSuccesful() + setTotalLines() + } + })*/ responseSaleGroupAdd.observe(viewLifecycleOwner, Observer { binding.splashProgress.visibility = GONE @@ -863,6 +865,7 @@ class EndSacadorFragment( ) } + @RequiresApi(Build.VERSION_CODES.O) private fun printShelvingResult(placementSupplyListVO: PlacementSupplyListVO) { var shelving = "" var item = "" @@ -887,22 +890,35 @@ class EndSacadorFragment( if (customDialogList.getValueTwo().isNotEmpty()) { - - - if (checkItemScan(customDialogList.getValueTwo())) { - onQuantityOfShelvingSelected(itemShelvingFk) - mpok?.start() - customDialogList.dismiss() - } else { - itemShelvingFkStored = itemShelvingFk - binding.splashProgress.visibility = View.VISIBLE - viewModel.getIdFromCode( - code = customDialogList.getValueTwo() + /*Tarea 5109*/ + try { + customDialogList.setValueTwo( + itemScanValue( + customDialogList.getValueTwo(), + "buy", + "id" + ).toString() ) - customDialogList.dismiss() + + + if (checkItemScan(customDialogList.getValueTwo())) { + onQuantityOfShelvingSelected(itemShelvingFk) + mpok?.start() + customDialogList.dismiss() + } else { + itemShelvingFkStored = itemShelvingFk + binding.splashProgress.visibility = View.VISIBLE + viewModel.getIdFromCode( + code = customDialogList.getValueTwo() + ) + customDialogList.dismiss() + } + } catch (Ex: Exception) { + ma.messageWithSound(Ex.message.toString(), true, true) } scanRequest() hideKeyboards() + } else { getString(R.string.scanItemValidate).toast(requireContext()) } @@ -929,26 +945,36 @@ class EndSacadorFragment( customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event -> if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { + try { + customDialogList.setValueTwo( + itemScanValue( + customDialogList.getValueTwo(), + "buy", + "id" + ).toString() + ) + originalItemScan = customDialogList.getValueTwo() + ////Log.i("VERDNATURA:","el item original es $originalItemScan") - - originalItemScan = customDialogList.getValueTwo() - ////Log.i("VERDNATURA:","el item original es $originalItemScan") - - if (customDialogList.getValueTwo().isNotEmpty()) { - if (checkItemScan(customDialogList.getValueTwo())) { - onQuantityOfShelvingSelected(itemShelvingFk) - mpok?.start() - customDialogList.dismiss() + if (customDialogList.getValueTwo().isNotEmpty()) { + if (checkItemScan(customDialogList.getValueTwo())) { + onQuantityOfShelvingSelected(itemShelvingFk) + mpok?.start() + customDialogList.dismiss() + } else { + itemShelvingFkStored = itemShelvingFk + binding.splashProgress.visibility = View.VISIBLE + viewModel.getIdFromCode( + code = customDialogList.getValueTwo() + ) + customDialogList.dismiss() + } } else { - itemShelvingFkStored = itemShelvingFk - binding.splashProgress.visibility = View.VISIBLE - viewModel.getIdFromCode( - code = customDialogList.getValueTwo() - ) - customDialogList.dismiss() + getString(R.string.scanItemValidate).toast(requireContext()) } - } else { - getString(R.string.scanItemValidate).toast(requireContext()) + } catch (Ex: Exception) { + ma.messageWithSound(Ex.message.toString(), true, true) + } scanRequest() hideKeyboards() @@ -1158,53 +1184,53 @@ class EndSacadorFragment( try { customDialogThreeButtons.setDescription(getString(R.string.txtnuevacantidad)) .setValue("") - /* .setOkButton(getString(R.string.titleFaults)) { - checkAndCall( - position, - customDialogThreeButtons.getValue().toInt(), - getString(R.string.titleFaults) - ) + /* .setOkButton(getString(R.string.titleFaults)) { + checkAndCall( + position, + customDialogThreeButtons.getValue().toInt(), + getString(R.string.titleFaults) + ) - }.setOkButtonTwo(getString(R.string.BasuraRechazar)) { + }.setOkButtonTwo(getString(R.string.BasuraRechazar)) { - checkAndCall( - position, - customDialogThreeButtons.getValue().toInt(), - getString(R.string.BasuraRechazar) - ) + checkAndCall( + position, + customDialogThreeButtons.getValue().toInt(), + getString(R.string.BasuraRechazar) + ) - }.setOkButtonThree(getString(R.string.Reject)) { - checkAndCall( - position, - customDialogThreeButtons.getValue().toInt(), - getString(R.string.Reject) - ) + }.setOkButtonThree(getString(R.string.Reject)) { + checkAndCall( + position, + customDialogThreeButtons.getValue().toInt(), + getString(R.string.Reject) + ) - }.setOkButtonFour(getString(R.string.Split)) { - checkAndCall( - position, - customDialogThreeButtons.getValue().toInt(), - getString(R.string.Split) - ) + }.setOkButtonFour(getString(R.string.Split)) { + checkAndCall( + position, + customDialogThreeButtons.getValue().toInt(), + getString(R.string.Split) + ) -*/ + */ .setOkButtonAdd(getString(R.string.Agregar)) { increaseQuantity(position, customDialogThreeButtons.getValue().toInt()) scanRequest() customDialogThreeButtons.dismiss() - /* checkAndCall( - position, - customDialogThreeButtons.getValue().toInt(), - getString(R.string.Agregar) - )*/ + /* checkAndCall( + position, + customDialogThreeButtons.getValue().toInt(), + getString(R.string.Agregar) + )*/ }.setKoButton(getString(R.string.cancel)) { scanRequest() customDialogThreeButtons.dismiss() }.show() customDialogThreeButtons.setFocusDialogValue() - }catch (ex:Exception){ + } catch (ex: Exception) { getString(R.string.errorQuantity).toast(context) } } 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 16d01d99..4eaab4ee 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 @@ -200,6 +200,7 @@ class UbicadorFragment( LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) } + @RequiresApi(Build.VERSION_CODES.O) @SuppressLint("SetTextI18n") private fun setEvents() { binding.mainToolbar.backButton.setOnClickListener { @@ -224,10 +225,23 @@ class UbicadorFragment( binding.editMatricula.text.toString() ) } else { - binding.splashProgress.visibility = VISIBLE - viewModel.getIdFromCode( + + /*Tarea#5109*/ + /*viewModel.getIdFromCode( code = binding.editMatricula.text.toString() - ) + )*/ + try { + binding.splashProgress.visibility = VISIBLE + viewModel.getIdFromCode( + code = itemScanValue( + binding.editMatricula.text.toString(), + "buy", + "id" + ).toString() + ) + } catch (Ex: Exception) { + ma.messageWithSound(Ex.message.toString(), true, true) + } } } @@ -534,7 +548,7 @@ class UbicadorFragment( } }) responseAddList.observe(viewLifecycleOwner, Observer { - binding.splashProgress.visibility= GONE + binding.splashProgress.visibility = GONE if (it.isError) { ma.messageWithSound(it.errorMessage, it.isError, false) @@ -591,19 +605,20 @@ class UbicadorFragment( }) responseMake.observe(viewLifecycleOwner, Observer { - binding.splashProgress.visibility=GONE - if (it.isError){ - ma.messageWithSound(it.errorMessage,true,true,isToasted = true) - }else{ - if (!shelvingFk.isNullOrEmpty()) { + binding.splashProgress.visibility = GONE + if (it.isError) { + ma.messageWithSound(it.errorMessage, true, true, isToasted = true) + } else { + if (!shelvingFk.isNullOrEmpty()) { - binding.mainToolbar.toolbarTitle.text = shelvingFk - binding.splashProgress.visibility = VISIBLE - viewModel.itemShelvingList( - shelvingFk - ) + binding.mainToolbar.toolbarTitle.text = shelvingFk + binding.splashProgress.visibility = VISIBLE + viewModel.itemShelvingList( + shelvingFk + ) - }} + } + } }) } @@ -840,7 +855,7 @@ class UbicadorFragment( .setDescription(getString(R.string.selectDestiny) + item.item).setValue("") .setOkButton(getString(R.string.transfer)) { if (customDialogInput.getValue().isNotEmpty()) { - binding.splashProgress.visibility= VISIBLE + binding.splashProgress.visibility = VISIBLE viewModel.itemShelvingTransfer( item.id, customDialogInput.getValue() diff --git a/app/src/main/res/layout/component_custom_list_dialog.xml b/app/src/main/res/layout/component_custom_list_dialog.xml index a8faf2c7..ee015aee 100644 --- a/app/src/main/res/layout/component_custom_list_dialog.xml +++ b/app/src/main/res/layout/component_custom_list_dialog.xml @@ -77,7 +77,7 @@ style="@style/InputLineTextSearch" android:layout_width="match_parent" android:backgroundTint="@android:color/white" - android:inputType="number" + android:inputType="text" android:lines="1" android:maxLines="1" android:textColor="@color/verdnatura_white"