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()
|
||||
|
||||
@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
|
||||
}
|
||||
}
|
||||
fun itemScanValue(value: String, table: String, field: String): Any {
|
||||
|
||||
fun itemScanValue(value: String, table: Array<String>, field: String): Any {
|
||||
val item: ItemScanned
|
||||
return try {
|
||||
|
||||
|
@ -37,14 +38,28 @@ fun itemScanValue(value: String, table: String, field: String): Any {
|
|||
return value
|
||||
}
|
||||
|
||||
if (item.company == "vnl" && item.table == table) {
|
||||
if (item.company == "vnl" && item.table in table) {
|
||||
when (item.table) {
|
||||
|
||||
when (field) {
|
||||
"id" -> return item.id
|
||||
"more" -> return item.more
|
||||
"ticket" -> {
|
||||
return item.id
|
||||
}
|
||||
|
||||
"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")
|
||||
|
||||
|
|
Loading…
Reference in New Issue