Version 23.3Beta Cambiado a Instant la fecha del JSON y puesto nombre more

This commit is contained in:
Sergio De la torre 2023-02-07 09:21:27 +01:00
parent af0f32ae31
commit 0436cb50bf
7 changed files with 33 additions and 14 deletions

View File

@ -83,9 +83,15 @@
</select>
</component>
<component name="ChangeListManager">
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="Version 23.3Beta Añadido error si falla el ubicador y solucionado al leer artículos. Modificado saleMistakeAdd para que solo envíe dos parámetros.">
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="Version 23.3Beta Solucionada llamada Número de paquetes en balda al hacer ENTER">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/Extensions.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/Extensions.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/common/itemScanned.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/common/itemScanned.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -182,7 +188,7 @@
</option>
<option name="RECENT_BRANCH_BY_REPOSITORY">
<map>
<entry key="$PROJECT_DIR$" value="testBeta" />
<entry key="$PROJECT_DIR$" value="testBeta_5109_qr" />
</map>
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />

View File

@ -1,8 +1,6 @@
package es.verdnatura.presentation.common
import android.content.Context
import android.os.Build
import android.util.Log.d
import androidx.annotation.RequiresApi
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
@ -14,6 +12,20 @@ data class itemScanned(var scanned: JSONObject) {
var table: String = scanned.get("table").toString()
var id: Int = scanned.get("id").toString().toInt()
var company: String = scanned.get("company").toString()
var more: String = scanned.get("more").toString()
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: LocalDateTime = LocalDateTime.parse(
scanned.get("created").toString(),
DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
)*/
/* var created: LocalDateTime =
(scanned.get("created").toString()).toDate().formatTo("yyyy-MM-dd HH:mm")
)*/
}
//Tarea#5109
@ -43,7 +55,6 @@ fun itemScanIsQr(value: String): Boolean {
}
@RequiresApi(Build.VERSION_CODES.O)
fun itemScanValue(value: String, table: String, field: String): Any {
val gson = Gson()
@ -58,18 +69,20 @@ fun itemScanValue(value: String, table: String, field: String): Any {
valueToReturn.forEach {
if (it.key == field) {
return it.value.toString() /*si no li pose toString torna error double to string*/
// return it.value.toString() /*si no li pose toString torna error double to string*/
return (it.value as Double).toInt()
}
}
}
throw Exception("QR no válido")
throw Exception("QR no válido")
} catch (Ex: Exception) {
if (Ex.message!!.contains("QR")){
if (Ex.message!!.contains("QR")) {
throw Ex
}else{
} else {
return value
}
}

View File

@ -163,7 +163,7 @@ class ItemCardFragment(
if (!binding.editItemFk.text.toString().isNullOrEmpty())
//Tarea#5109
try {
getItemCard(itemScanValue(binding.editItemFk.text.toString(),"buy","id").toString())
getItemCard(itemScanValue(binding.editItemFk.text.toString(),"buy","more").toString())
}catch (Ex:Exception){
ma.messageWithSound(Ex.message.toString(), true,true)
}

View File

@ -60,7 +60,7 @@ class BuscarItemFragment(
/* #Tarea 5109*/
try {
getLocations(itemScanValue(binding.editItemFk.text.toString(), "buy", "id"))
getLocations(itemScanValue(binding.editItemFk.text.toString(), "buy", "more"))
} catch (Ex: Exception) {
ma.messageWithSound(Ex.message.toString(), true, true)
}

View File

@ -1538,7 +1538,7 @@ class CollectionFragment(
itemScanValue(
customDialogList.getValue(),
"buy",
"id"
"more"
).toString()
)

View File

@ -896,7 +896,7 @@ class EndSacadorFragment(
itemScanValue(
customDialogList.getValueTwo(),
"buy",
"id"
"more"
).toString()
)

View File

@ -236,7 +236,7 @@ class UbicadorFragment(
code = itemScanValue(
binding.editMatricula.text.toString(),
"buy",
"id"
"more"
).toString()
)
} catch (Ex: Exception) {