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