This commit is contained in:
Enrique Blasco 2020-10-26 06:43:17 +01:00
parent 0221d9b6c3
commit d45e713166
7 changed files with 98 additions and 50 deletions

View File

@ -14,8 +14,8 @@ android {
applicationId "es.verdnatura" applicationId "es.verdnatura"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 29 targetSdkVersion 29
versionCode 39 versionCode 42
versionName "5.2.9" versionName "5.3.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }

View File

@ -210,7 +210,7 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
override fun onError(error: Int) { override fun onError(error: Int) {
Log.i("Speech", "onError "+error) Log.i("Speech", "onError "+error)
mSpeechRecognizer!!.destroy() if (mSpeechRecognizer != null) mSpeechRecognizer!!.destroy()
mSpeechRecognizer = null mSpeechRecognizer = null
initialize() initialize()
} }

View File

@ -125,7 +125,7 @@ class CollectionFragment(
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
customDialogThreeButtons = CustomDialogThreeButtons(requireContext()) customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
activity!!.main_bottom_navigation.visibility = View.GONE activity!!.main_bottom_navigation.visibility = View.GONE
splash_progress.visibility = View.VISIBLE if (splash_progress != null) splash_progress.visibility = View.VISIBLE
toolbar_title.text = "collectionTicket_get" toolbar_title.text = "collectionTicket_get"
setToolBar() setToolBar()
setEvents() setEvents()
@ -201,7 +201,7 @@ class CollectionFragment(
//LISTA ========= //LISTA =========
collection_swipe.setOnRefreshListener { collection_swipe.setOnRefreshListener {
splash_progress.visibility = View.VISIBLE if (splash_progress != null) splash_progress.visibility = View.VISIBLE
viewModel.collectionTicketGet(user,password,collection.collectionFk,sectorFk) viewModel.collectionTicketGet(user,password,collection.collectionFk,sectorFk)
collection_swipe.isRefreshing = false collection_swipe.isRefreshing = false
} }
@ -217,7 +217,7 @@ class CollectionFragment(
with(viewModel){ with(viewModel){
collectionTicketList.observe(viewLifecycleOwner, Observer { collectionTicketList.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.GONE if (splash_progress != null) splash_progress.visibility = View.GONE
if (!it.isError){ if (!it.isError){
if(it.tickets.isNotEmpty()){ if(it.tickets.isNotEmpty()){
collection = it collection = it
@ -228,7 +228,7 @@ class CollectionFragment(
}else{ }else{
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Aceptar"){ customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Aceptar"){
customDialog.dismiss() customDialog.dismiss()
activity!!.onBackPressed() if (activity != null) activity!!.onBackPressed()
}.show() }.show()
} }
@ -236,19 +236,19 @@ class CollectionFragment(
}) })
placementSuppleyList.observe(viewLifecycleOwner, Observer { placementSuppleyList.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.GONE if (splash_progress != null) splash_progress.visibility = View.GONE
if (!goBack) printShelvingResult(it) if (!goBack) printShelvingResult(it)
goBack = false goBack = false
}) })
item.observe(viewLifecycleOwner, Observer { item.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.GONE if (splash_progress != null) splash_progress.visibility = View.GONE
if (!goBack) toastDisponibility(it) if (!goBack) toastDisponibility(it)
goBack = false goBack = false
}) })
responseNew.observe(viewLifecycleOwner, Observer { responseNew.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.GONE if (splash_progress != null) splash_progress.visibility = View.GONE
if (!goBack){ if (!goBack){
if (it.isError){ if (it.isError){
customDialog.setTitle("Disponibilidad").setDescription(it.errorMessage).setKoButton("Cerrar"){ customDialog.setTitle("Disponibilidad").setDescription(it.errorMessage).setKoButton("Cerrar"){
@ -256,7 +256,7 @@ class CollectionFragment(
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()
}else{ }else{
splash_progress.visibility = View.VISIBLE if (splash_progress != null) splash_progress.visibility = View.VISIBLE
viewModel.collectionTicketGet(user,password,collection.collectionFk,sectorFk) viewModel.collectionTicketGet(user,password,collection.collectionFk,sectorFk)
} }
} }
@ -266,7 +266,7 @@ class CollectionFragment(
}) })
responseCode.observe(viewLifecycleOwner, Observer { responseCode.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.GONE if (splash_progress != null) splash_progress.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).setKoButton("Cerrar"){
@ -282,7 +282,7 @@ class CollectionFragment(
}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)
mperror?.start() if (mperror != null) mperror?.start()
} }
} }
} }
@ -297,7 +297,7 @@ class CollectionFragment(
}) })
mistakeList.observe(viewLifecycleOwner, Observer { mistakeList.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.GONE if (splash_progress != null) splash_progress.visibility = View.GONE
if (!goBack) showMistakeList(it.list) if (!goBack) showMistakeList(it.list)
goBack = false goBack = false
}) })
@ -314,9 +314,10 @@ class CollectionFragment(
} }
toolbar_title.text = collection.collectionFk toolbar_title.text = collection.collectionFk
splash_progress.visibility = View.GONE if (splash_progress != null) splash_progress.visibility = View.GONE
var salesList:ArrayList<SaleVO> = ArrayList() var salesList:ArrayList<SaleVO> = ArrayList()
tickets = ArrayList() tickets = ArrayList()
var observations = ""
collection.tickets.forEach { ticket -> collection.tickets.forEach { ticket ->
ticket.sales.forEach {saleVO -> ticket.sales.forEach {saleVO ->
if (type == SACADOR && saleVO.quantity != "0"){ if (type == SACADOR && saleVO.quantity != "0"){
@ -328,8 +329,9 @@ class CollectionFragment(
if (tickets.firstOrNull { it == saleVO.ticketFk}.isNullOrEmpty()) if (tickets.firstOrNull { it == saleVO.ticketFk}.isNullOrEmpty())
tickets.add(saleVO.ticketFk) tickets.add(saleVO.ticketFk)
} }
} }
observations = observations + " " + ticket.observations
} }
sales = salesList.sortedWith(compareBy({ it.saleOrder })) sales = salesList.sortedWith(compareBy({ it.saleOrder }))
@ -364,7 +366,7 @@ class CollectionFragment(
},object: OnMistakeClickListener{ },object: OnMistakeClickListener{
override fun onMistakeClickListener(sale: SaleVO) { override fun onMistakeClickListener(sale: SaleVO) {
splash_progress.visibility = View.VISIBLE if (splash_progress != null) splash_progress.visibility = View.VISIBLE
mistakeSale = sale mistakeSale = sale
viewModel.mistakeType(usuario = user, password = password) viewModel.mistakeType(usuario = user, password = password)
} }
@ -381,6 +383,7 @@ class CollectionFragment(
setScrollListener(lm!!) setScrollListener(lm!!)
changeInitTicketState() changeInitTicketState()
printObservations(observations)
} }
private fun setScrollListener(lm: LinearLayoutManager){ private fun setScrollListener(lm: LinearLayoutManager){
@ -393,6 +396,14 @@ class CollectionFragment(
} }
private fun printObservations(observations: String){
if (observations.trim().isNotEmpty()){
customDialog.setTitle("Observaciones").setDescription(observations).setOkButton("Aceptar"){
customDialog.hide()
customDialog.dismiss()
}.show()
}
}
//SEARCH AND MARK //SEARCH AND MARK
private fun findSale(txtscan:String){ private fun findSale(txtscan:String){
@ -400,6 +411,9 @@ class CollectionFragment(
var index = 0 var index = 0
var isBreak = false var isBreak = false
var isOk = false var isOk = false
goBack = false
goBack2 = false
if (type == SACADOR){ if (type == SACADOR){
for (saleVO in sales) { for (saleVO in sales) {
if(saleVO.isPrepared != "1" && saleVO.isPreviousPrepared != "1"){ if(saleVO.isPrepared != "1" && saleVO.isPreviousPrepared != "1"){
@ -415,7 +429,7 @@ class CollectionFragment(
var shelvingIndex = 0 var shelvingIndex = 0
for (placementVO in saleVO.placements){ for (placementVO in saleVO.placements){
if (placementVO.shelving != null && placementVO.visible != null && txtscan.toUpperCase() == placementVO.shelving.toUpperCase() && placementVO.visible != "(0)"){ if (placementVO.shelving != null && placementVO.visible != null && txtscan.toUpperCase() == placementVO.shelving.toUpperCase() && placementVO.visible != "(0)"){
mpok!!.start() if (mpok != null) mpok!!.start()
isOk = true isOk = true
showShelving(index,shelvingIndex) showShelving(index,shelvingIndex)
isBreak = true isBreak = true
@ -449,10 +463,10 @@ class CollectionFragment(
parking = txtscan parking = txtscan
) )
} }
mpok!!.start() if (mpok != null) mpok!!.start()
"Ticket aparcado".toast(requireContext()) "Ticket aparcado".toast(requireContext())
}else{ }else{
mperror!!.start() if (mperror != null) mperror!!.start()
} }
} }
@ -461,7 +475,7 @@ class CollectionFragment(
if(saleVO.isControlled == "0"){ if(saleVO.isControlled == "0"){
//1- Por itemFk //1- Por itemFk
if (txtscan == saleVO.itemFk){ if (txtscan == saleVO.itemFk){
mpok!!.start() if (mpok != null) mpok!!.start()
isOk = true isOk = true
markLine(index,type) markLine(index,type)
break break
@ -469,7 +483,7 @@ class CollectionFragment(
//2- Por barcode //2- Por barcode
saleVO.Barcodes.forEach { barcode -> saleVO.Barcodes.forEach { barcode ->
if (txtscan == barcode){ if (txtscan == barcode){
mpok!!.start() if (mpok != null) mpok!!.start()
isOk = true isOk = true
markLine(index,type) markLine(index,type)
isBreak = true isBreak = true
@ -490,10 +504,10 @@ class CollectionFragment(
parking = txtscan parking = txtscan
) )
} }
mpok!!.start() if (mpok != null) mpok!!.start()
getString(R.string.Ticketaparcado).toast(requireContext()) getString(R.string.Ticketaparcado).toast(requireContext())
}else{ }else{
splash_progress.visibility = View.VISIBLE if (splash_progress != null) splash_progress.visibility = View.VISIBLE
storedPosition = 0 storedPosition = 0
storedBackPosition = 0 storedBackPosition = 0
viewModel.collectionTicketGet(user,password,txtscan,sectorFk) viewModel.collectionTicketGet(user,password,txtscan,sectorFk)
@ -510,18 +524,18 @@ class CollectionFragment(
if(saleVO.isPrepared != "1" && saleVO.isPreviousPrepared != "1"){ if(saleVO.isPrepared != "1" && saleVO.isPreviousPrepared != "1"){
//1- Por itemFk //1- Por itemFk
if (txtscan == saleVO.itemFk){ /*if (txtscan == saleVO.itemFk){
mpok!!.start() if (mpok != null) mpok!!.start()
isOk = true isOk = true
markLine(position,type) markLine(position,type)
} }*/
if (!isOk){ if (!isOk){
//2- Por carro //2- Por carro
var shelvingIndex = 0 var shelvingIndex = 0
for (placementVO in saleVO.placements){ for (placementVO in saleVO.placements){
if (txtscan.toUpperCase() == placementVO.shelving.toUpperCase()){ if (txtscan.toUpperCase() == placementVO.shelving.toUpperCase()){
mpok!!.start() if (mpok != null) mpok!!.start()
isOk = true isOk = true
showShelving(position,shelvingIndex) showShelving(position,shelvingIndex)
break break
@ -529,17 +543,17 @@ class CollectionFragment(
shelvingIndex+=1 shelvingIndex+=1
} }
} }
/*
if (!isOk){ if (!isOk){
//3- Por barcode //3- Por barcode
saleVO.Barcodes.forEach { barcode -> saleVO.Barcodes.forEach { barcode ->
if (txtscan == barcode){ if (txtscan == barcode){
mpok!!.start() if (mpok != null) mpok!!.start()
isOk = true isOk = true
markLine(position,type) markLine(position,type)
} }
} }
} }*/
} }
if (!isOk) { if (!isOk) {
if (txtscan.contains("-")){ if (txtscan.contains("-")){
@ -551,10 +565,10 @@ class CollectionFragment(
parking = txtscan parking = txtscan
) )
} }
mpok!!.start() if (mpok != null) mpok!!.start()
"Ticket aparcado".toast(requireContext()) "Ticket aparcado".toast(requireContext())
}else{ }else{
mperror!!.start() if (mperror != null) mperror!!.start()
} }
} }
@ -640,7 +654,7 @@ class CollectionFragment(
private fun showShelving(position:Int,shelvingPosition:Int){ private fun showShelving(position:Int,shelvingPosition:Int){
storedShelvingPosition = shelvingPosition storedShelvingPosition = shelvingPosition
storedPosition = position storedPosition = position
splash_progress.visibility = View.VISIBLE if (splash_progress != null) splash_progress.visibility = View.VISIBLE
var quantityGet = "0" var quantityGet = "0"
try{ try{
quantityGet = (sales[position].quantity.toInt() - sales[position].pickedQuantity.toInt()).toString() quantityGet = (sales[position].quantity.toInt() - sales[position].pickedQuantity.toInt()).toString()
@ -692,7 +706,7 @@ class CollectionFragment(
customDialogList.dismiss() customDialogList.dismiss()
} else { } else {
itemShelvingFkStored = itemShelvingFk itemShelvingFkStored = itemShelvingFk
splash_progress.visibility = View.VISIBLE if (splash_progress != null) splash_progress.visibility = View.VISIBLE
viewModel.getIdFromCode( viewModel.getIdFromCode(
usuario = user, usuario = user,
password = password, password = password,
@ -721,9 +735,12 @@ class CollectionFragment(
try{ try{
customDialogList.getEditTextTwo().post(Runnable { customDialogList.getEditTextTwo().post(Runnable {
customDialogList.getEditTextTwo().requestFocusFromTouch() customDialogList.getEditTextTwo().requestFocusFromTouch()
val lManager: InputMethodManager = if (activity != null) {
activity!!.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager val lManager: InputMethodManager =
lManager.hideSoftInputFromWindow(customDialogList.getEditTextTwo().windowToken, InputMethodManager.SHOW_FORCED) activity!!.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
lManager.hideSoftInputFromWindow(customDialogList.getEditTextTwo().windowToken, InputMethodManager.SHOW_FORCED)
}
}) })
}catch (e:Exception){} }catch (e:Exception){}
try { try {
@ -875,7 +892,7 @@ class CollectionFragment(
}else if (customDialogList.getValue().isNullOrEmpty() || customDialogList.getValueTwo().isNullOrEmpty()) { }else if (customDialogList.getValue().isNullOrEmpty() || customDialogList.getValueTwo().isNullOrEmpty()) {
getString(R.string.Todosloscampossonobligatorios).toast(requireContext()) getString(R.string.Todosloscampossonobligatorios).toast(requireContext())
}else{ }else{
splash_progress.visibility = View.VISIBLE if (splash_progress != null) splash_progress.visibility = View.VISIBLE
viewModel.collectionAddItem( viewModel.collectionAddItem(
usuario = user, usuario = user,
password = password, password = password,
@ -916,7 +933,7 @@ class CollectionFragment(
}else if (customDialogList.getValue().isNullOrEmpty() || customDialogList.getValueTwo().isNullOrEmpty()) { }else if (customDialogList.getValue().isNullOrEmpty() || customDialogList.getValueTwo().isNullOrEmpty()) {
getString(R.string.Todosloscampossonobligatorios).toast(requireContext()) getString(R.string.Todosloscampossonobligatorios).toast(requireContext())
}else{ }else{
splash_progress.visibility = View.VISIBLE if (splash_progress != null) splash_progress.visibility = View.VISIBLE
viewModel.collectionAddItem( viewModel.collectionAddItem(
usuario = user, usuario = user,
password = password, password = password,
@ -984,7 +1001,7 @@ class CollectionFragment(
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()) {
splash_progress.visibility = View.VISIBLE if (splash_progress != null) splash_progress.visibility = View.VISIBLE
viewModel.itemGetAvailable( viewModel.itemGetAvailable(
usuario = user, usuario = user,
password = password, password = password,
@ -1029,7 +1046,7 @@ class CollectionFragment(
} }
} }
//toolbar_title.text = "" + totalMark + "/" + sales.size //toolbar_title.text = "" + totalMark + "/" + sales.size
toolbar_title.text = if (collection.collectionFk != null )collection.collectionFk else "" if (toolbar_title != null) toolbar_title.text = if (collection.collectionFk != null )collection.collectionFk else ""
toolbar_subtitle.text = "" +totalMark + "/" + sales.size toolbar_subtitle.text = "" +totalMark + "/" + sales.size
if (totalMark == sales.size) { if (totalMark == sales.size) {
getString(R.string.Coleccióncompleta).toast(this.context,Toast.LENGTH_SHORT) getString(R.string.Coleccióncompleta).toast(this.context,Toast.LENGTH_SHORT)
@ -1311,7 +1328,7 @@ class CollectionFragment(
} }
private fun showMistakeList(list:List<MistakeTypeVO>){ private fun showMistakeList(list:List<MistakeTypeVO>){
splash_progress.visibility = View.GONE if (splash_progress != null) splash_progress.visibility = View.GONE
listPlacementSupply = ArrayList() listPlacementSupply = ArrayList()
list.forEach { list.forEach {
listPlacementSupply.add(BarcodeVO(code = it.description)) listPlacementSupply.add(BarcodeVO(code = it.description))

View File

@ -214,8 +214,12 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
override fun onBackPressed() { override fun onBackPressed() {
try{
fm.executePendingTransactions()
}catch (e:Exception){}
if (fm.backStackEntryCount > 0) { if (fm.backStackEntryCount > 0) {
fm.popBackStackImmediate() fm.popBackStackImmediate()
}else { }else {
customDialog.setTitle("Cerrar sesión").setDescription("¿Estás seguro de cerrar la sesión?").setOkButton("Salir"){ customDialog.setTitle("Cerrar sesión").setDescription("¿Estás seguro de cerrar la sesión?").setOkButton("Salir"){

View File

@ -17,7 +17,8 @@ class TicketVO(
var level : String = "", var level : String = "",
var agencyName : String = "", var agencyName : String = "",
var salesPersonFk : String = "", var salesPersonFk : String = "",
var sales : List<SaleVO> = listOf() var sales : List<SaleVO> = listOf(),
var observations: String = ""
) )
class SaleVO( class SaleVO(
var ticketFk : String = "", var ticketFk : String = "",

View File

@ -1,6 +1,7 @@
package es.verdnatura.presentation.view.feature.ubicador.fragment package es.verdnatura.presentation.view.feature.ubicador.fragment
import android.content.SharedPreferences import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.view.View import android.view.View
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
@ -9,9 +10,11 @@ import es.verdnatura.R
import es.verdnatura.databinding.FragmentAutomaticAddItemBinding import es.verdnatura.databinding.FragmentAutomaticAddItemBinding
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnAutomaticItemClickListener import es.verdnatura.presentation.common.OnAutomaticItemClickListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.view.component.CustomDialog 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.component.CustomDialogUbicador import es.verdnatura.presentation.view.component.CustomDialogUbicador
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.ubicador.adapter.AutomaticAdapter import es.verdnatura.presentation.view.feature.ubicador.adapter.AutomaticAdapter
import es.verdnatura.presentation.view.feature.ubicador.model.ItemEscanerVO import es.verdnatura.presentation.view.feature.ubicador.model.ItemEscanerVO
@ -33,6 +36,7 @@ class AutomaticAddItemFragment(
private var listItems:ArrayList<ItemEscanerVO> = ArrayList() private var listItems:ArrayList<ItemEscanerVO> = ArrayList()
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
private var deep:Int = 1 private var deep:Int = 1
private var contador = 0
companion object { companion object {
fun newInstance(entryPoint:String) = AutomaticAddItemFragment(entryPoint) fun newInstance(entryPoint:String) = AutomaticAddItemFragment(entryPoint)
@ -54,12 +58,23 @@ class AutomaticAddItemFragment(
toolbar_title.text = "itemShelvingMake" toolbar_title.text = "itemShelvingMake"
setEvents() setEvents()
setViews() setViews()
setToolBar()
super.init() super.init()
} }
private fun setToolBar(){
toolbar_subtitle.visibility = View.VISIBLE
}
private fun setSubtitle(){
toolbar_subtitle.text = "Etiquetas: "+contador
}
private fun setViews(){ private fun setViews(){
adapter = AutomaticAdapter(listItems,object: OnAutomaticItemClickListener{ adapter = AutomaticAdapter(listItems,object: OnAutomaticItemClickListener{
override fun onAutomaticItemClickListener(position: Int) { override fun onAutomaticItemClickListener(position: Int) {
contador -= 1
setSubtitle()
listItems.removeAt(position) listItems.removeAt(position)
adapter!!.notifyDataSetChanged() adapter!!.notifyDataSetChanged()
} }
@ -73,7 +88,9 @@ class AutomaticAddItemFragment(
edit_matricula.setOnEditorActionListener { v, actionId, event -> edit_matricula.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 (!edit_matricula.text.toString().isNullOrEmpty()){ if (!edit_matricula.text.toString().isNullOrEmpty()){
listItems.add(ItemEscanerVO(edit_matricula.text.toString())) contador += 1
setSubtitle()
listItems.add(0,ItemEscanerVO(edit_matricula.text.toString()))
adapter!!.notifyDataSetChanged() adapter!!.notifyDataSetChanged()
} }
edit_matricula.setText("") edit_matricula.setText("")

View File

@ -29,7 +29,9 @@ import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import es.verdnatura.presentation.view.feature.ubicador.adapter.UbicadorAdapter import es.verdnatura.presentation.view.feature.ubicador.adapter.UbicadorAdapter
import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO
import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_collection.*
import kotlinx.android.synthetic.main.fragment_ubicador.* import kotlinx.android.synthetic.main.fragment_ubicador.*
import kotlinx.android.synthetic.main.fragment_ubicador.splash_progress
import kotlinx.android.synthetic.main.toolbar.* import kotlinx.android.synthetic.main.toolbar.*
class UbicadorFragment( class UbicadorFragment(
@ -417,7 +419,7 @@ class UbicadorFragment(
} }
private fun changeOfflineValue(item:ItemUbicadorVO){ private fun changeOfflineValue(item:ItemUbicadorVO){
splash_progress.visibility = View.VISIBLE if (splash_progress != null) splash_progress.visibility = View.VISIBLE
/*listItems.add(item) /*listItems.add(item)
adapter?.notifyDataSetChanged()*/ adapter?.notifyDataSetChanged()*/
} }
@ -425,10 +427,17 @@ class UbicadorFragment(
private fun showMoreOptions(item:ItemUbicadorVO){ private fun showMoreOptions(item:ItemUbicadorVO){
customDialogTwoButtons.setTitle(item.item).setDescription("Selecciona una acción").setOkButton("Transferir"){ customDialogTwoButtons.setTitle(item.item).setDescription("Selecciona una acción").setOkButton("Transferir"){
customDialogInput.setTitle("Nueva matrícula").setDescription("Introduce el destino para item: "+item.item).setValue("").setOkButton("Transferir"){ customDialogInput.setTitle("Nueva matrícula").setDescription("Introduce el destino para item: "+item.item).setValue("").setOkButton("Transferir"){
viewModel.itemShelvingTransfer(user,password,item.id,customDialogInput.getValue()) if (customDialogInput.getValue().isNotEmpty()){
listItems.remove(item) viewModel.itemShelvingTransfer(user,password,item.id,customDialogInput.getValue())
adapter!!.notifyDataSetChanged() listItems.remove(item)
customDialogInput.dismiss() adapter!!.notifyDataSetChanged()
customDialogInput.dismiss()
}else{
"Carro incorrecto".toast(requireContext())
}
}.setKoButton("Cancelar"){ }.setKoButton("Cancelar"){
customDialogInput.dismiss() customDialogInput.dismiss()
}.show() }.show()