refs #4414 marcar_lineas_QR_previa

This commit is contained in:
Sergio De la torre 2023-03-22 13:32:26 +01:00
parent a59c313a41
commit b62f27a1f5
1 changed files with 24 additions and 15 deletions

View File

@ -10,6 +10,7 @@ import android.os.Build
import android.os.Bundle
import android.os.Parcelable
import android.text.InputType
import android.text.InputType.TYPE_CLASS_NUMBER
import android.text.InputType.TYPE_CLASS_TEXT
import android.util.Log.d
import android.view.KeyEvent
@ -48,6 +49,7 @@ import es.verdnatura.presentation.view.feature.collection.adapter.SaleAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import es.verdnatura.presentation.view.feature.sacador.model.*
import org.json.JSONObject
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
@ -266,8 +268,16 @@ class CollectionFragment(
}
private fun showPrevia() {
private fun markPrevia(saleGroupScanned: String) {
sales.forEachIndexed { pos, s ->
if (!s.saleGroupFk.isNullOrEmpty() && s.saleGroupFk == saleGroupScanned) {
markLine(pos, type)
}
}
}
private fun showPrevia() {
customDialogList.getEditText().setRawInputType(TYPE_CLASS_NUMBER)
customDialogList.setTitle(getString(R.string.scanPreviousTicket))
.setOkButton(getString(R.string.end)) {
ma.hideKeyboard(customDialogList.getEditText())
@ -283,12 +293,7 @@ class CollectionFragment(
if (!customDialogList.getValue().isEmpty()) {
ma.hideKeyboard(customDialogList.getEditText())
var saleGroupScanned = customDialogList.getValue()
sales.forEachIndexed { pos, s ->
if (!s.saleGroupFk.isNullOrEmpty() && s.saleGroupFk == saleGroupScanned) {
markLine(pos, type)
}
}
markPrevia(saleGroupScanned)
customDialogList.dismiss()
}
customDialogList.setValue("")
@ -356,14 +361,18 @@ class CollectionFragment(
//de momento solo está el qr de artículo
isScanned =
event != null && event.action == ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
var myItem = try {
itemScanValue(
binding.scanInput.text.toString(),
"buy",
"more"
).toString()
} catch (ex: Exception) {
binding.scanInput.text.toString()
if (itemScanIsQr(binding.scanInput.text.toString())) {
var myQr = itemScanned(JSONObject(binding.scanInput.text.toString()))
when (myQr.table) {
"saleGroup" -> {
markPrevia(myQr.id.toString())
}
"buy" -> binding.scanInput.setText(myQr.more)
}
} else {
findSale(binding.scanInput.text.toString())
}
buttonPushedGetCollection = false