feat qr #refs 7520
This commit is contained in:
parent
3bed3d96b4
commit
284d4509b1
|
@ -13,7 +13,7 @@ data class ItemScanned(var scanned: JSONObject) {
|
||||||
var user: Int = scanned.get("user").toString().toInt()
|
var user: Int = scanned.get("user").toString().toInt()
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
var created = DateTimeFormatter.ISO_INSTANT.parse(scanned.get("created").toString())
|
var created = DateTimeFormatter.ISO_INSTANT.parse(scanned.get("created").toString())
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,8 @@ fun itemScanIsQr(value: String): Boolean {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fun itemScanValue(value: String, table: String, field: String): Any {
|
|
||||||
|
fun itemScanValue(value: String, table: Array<String>, field: String): Any {
|
||||||
val item: ItemScanned
|
val item: ItemScanned
|
||||||
return try {
|
return try {
|
||||||
|
|
||||||
|
@ -37,14 +38,28 @@ fun itemScanValue(value: String, table: String, field: String): Any {
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.company == "vnl" && item.table == table) {
|
if (item.company == "vnl" && item.table in table) {
|
||||||
|
when (item.table) {
|
||||||
|
|
||||||
when (field) {
|
"ticket" -> {
|
||||||
"id" -> return item.id
|
return item.id
|
||||||
"more" -> return item.more
|
}
|
||||||
|
|
||||||
|
"saleGroup" -> {
|
||||||
|
return item.id
|
||||||
|
}
|
||||||
|
|
||||||
|
"buy" -> {
|
||||||
|
when (field) {
|
||||||
|
"id" -> return item.id
|
||||||
|
"more" -> return item.more
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"expeditionPallet" -> {
|
||||||
|
return item.id
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
throw Exception("QR no válido")
|
throw Exception("QR no válido")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue