feat qr previa refs $6477

This commit is contained in:
Sergio De la torre 2024-06-19 08:49:08 +02:00
parent 0e97150278
commit 4640cffc30
2 changed files with 739 additions and 731 deletions

View File

@ -42,7 +42,7 @@ fun EditText.toInt(): Int {
}
fun String.isParking(): Boolean {
val regex = Regex("[\\S-\\S]{5,}")
val regex = Regex("[\\S-\\S]{5}")
return regex.matches(this)
}
fun String.isShelving(): Boolean {

View File

@ -18,7 +18,9 @@ import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.R
import es.verdnatura.databinding.FragmentPreSacadorBinding
import es.verdnatura.domain.ConstAndValues.SECTORFK
import es.verdnatura.domain.isParking
import es.verdnatura.domain.notNull
import es.verdnatura.domain.toInt
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
@ -133,9 +135,8 @@ class EndSacadorFragment(
if (!binding.scanInput.text.toString().isNullOrEmpty()) {
if (itemScanIsQr(binding.scanInput.text.toString())) {
try {
ticket = itemScanValue(
binding.scanInput.text.toString(),
arrayOf("saleGroup"),
@ -143,20 +144,26 @@ class EndSacadorFragment(
) as Int
addSaleGroupToCollection(ticket)
} catch (ex: Exception) {
ex.toast(requireContext())
}
} else {
if (binding.scanInput.text.contains("-")) {
if ((binding.scanInput.text.toString()).isParking()) {
pasillerosItemClickListener?.onPasillerosItemClickListener(
PasillerosItemVO(
title = getString(R.string.Parking)
), ""
)
} else {
if (binding.scanInput.text.first().isDigit()) {
addSaleGroupToCollection(binding.scanInput.toInt())
} else {
findSale(binding.scanInput.text.toString())
}
}
}
}
binding.scanInput.setText("")
@ -559,6 +566,7 @@ private fun setListPosition(position: Int) {
//SEARCH AND MARK
private fun findSale(txtscan: String) {
println("text scanned" + txtscan)
var index = 0
var isBreak = false
var isOk = false