feat qr previa refs $6477
This commit is contained in:
parent
0e97150278
commit
4640cffc30
|
@ -42,7 +42,7 @@ fun EditText.toInt(): Int {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun String.isParking(): Boolean {
|
fun String.isParking(): Boolean {
|
||||||
val regex = Regex("[\\S-\\S]{5,}")
|
val regex = Regex("[\\S-\\S]{5}")
|
||||||
return regex.matches(this)
|
return regex.matches(this)
|
||||||
}
|
}
|
||||||
fun String.isShelving(): Boolean {
|
fun String.isShelving(): Boolean {
|
||||||
|
|
|
@ -18,7 +18,9 @@ import androidx.recyclerview.widget.RecyclerView
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentPreSacadorBinding
|
import es.verdnatura.databinding.FragmentPreSacadorBinding
|
||||||
import es.verdnatura.domain.ConstAndValues.SECTORFK
|
import es.verdnatura.domain.ConstAndValues.SECTORFK
|
||||||
|
import es.verdnatura.domain.isParking
|
||||||
import es.verdnatura.domain.notNull
|
import es.verdnatura.domain.notNull
|
||||||
|
import es.verdnatura.domain.toInt
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
|
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
|
||||||
|
@ -133,9 +135,8 @@ class EndSacadorFragment(
|
||||||
|
|
||||||
if (!binding.scanInput.text.toString().isNullOrEmpty()) {
|
if (!binding.scanInput.text.toString().isNullOrEmpty()) {
|
||||||
|
|
||||||
|
|
||||||
if (itemScanIsQr(binding.scanInput.text.toString())) {
|
if (itemScanIsQr(binding.scanInput.text.toString())) {
|
||||||
|
try {
|
||||||
ticket = itemScanValue(
|
ticket = itemScanValue(
|
||||||
binding.scanInput.text.toString(),
|
binding.scanInput.text.toString(),
|
||||||
arrayOf("saleGroup"),
|
arrayOf("saleGroup"),
|
||||||
|
@ -143,20 +144,26 @@ class EndSacadorFragment(
|
||||||
) as Int
|
) as Int
|
||||||
|
|
||||||
addSaleGroupToCollection(ticket)
|
addSaleGroupToCollection(ticket)
|
||||||
|
} catch (ex: Exception) {
|
||||||
|
ex.toast(requireContext())
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (binding.scanInput.text.contains("-")) {
|
if ((binding.scanInput.text.toString()).isParking()) {
|
||||||
pasillerosItemClickListener?.onPasillerosItemClickListener(
|
pasillerosItemClickListener?.onPasillerosItemClickListener(
|
||||||
PasillerosItemVO(
|
PasillerosItemVO(
|
||||||
title = getString(R.string.Parking)
|
title = getString(R.string.Parking)
|
||||||
), ""
|
), ""
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if (binding.scanInput.text.first().isDigit()) {
|
||||||
|
addSaleGroupToCollection(binding.scanInput.toInt())
|
||||||
|
} else {
|
||||||
findSale(binding.scanInput.text.toString())
|
findSale(binding.scanInput.text.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
binding.scanInput.setText("")
|
binding.scanInput.setText("")
|
||||||
|
@ -559,6 +566,7 @@ private fun setListPosition(position: Int) {
|
||||||
|
|
||||||
//SEARCH AND MARK
|
//SEARCH AND MARK
|
||||||
private fun findSale(txtscan: String) {
|
private fun findSale(txtscan: String) {
|
||||||
|
println("text scanned" + txtscan)
|
||||||
var index = 0
|
var index = 0
|
||||||
var isBreak = false
|
var isBreak = false
|
||||||
var isOk = false
|
var isOk = false
|
||||||
|
|
Loading…
Reference in New Issue