Version 23.3Beta QR

This commit is contained in:
Sergio De la torre 2023-02-03 11:04:16 +01:00
parent caa3116f5c
commit 3215d047ff
10 changed files with 422 additions and 281 deletions

View File

@ -276,7 +276,7 @@
</option> </option>
</component> </component>
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

View File

@ -83,17 +83,17 @@
</select> </select>
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="Version 23.2 Modificado actualizar pantalla al transferir en Ubicador. Subida version"> <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.">
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/app/build.gradle" 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/google-services.json" beforeDir="false" afterPath="$PROJECT_DIR$/app/google-services.json" 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/base/BaseFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.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/ajustes/fragment/AjustesFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesFragment.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/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/collection/fragment/CollectionViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionViewModel.kt" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.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/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" /> <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" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/layout/component_custom_list_dialog.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/component_custom_list_dialog.xml" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -190,7 +190,7 @@
</option> </option>
<option name="RECENT_BRANCH_BY_REPOSITORY"> <option name="RECENT_BRANCH_BY_REPOSITORY">
<map> <map>
<entry key="$PROJECT_DIR$" value="test_#5052_ubicador" /> <entry key="$PROJECT_DIR$" value="testBeta" />
</map> </map>
</option> </option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@ -224,6 +224,7 @@
</component> </component>
<component name="ProblemsViewState"> <component name="ProblemsViewState">
<option name="proportion" value="0.50190353" /> <option name="proportion" value="0.50190353" />
<option name="selectedTabId" value="CurrentFile" />
<option name="sortByName" value="true" /> <option name="sortByName" value="true" />
</component> </component>
<component name="ProjectId" id="1rNnmCWH3aNvnQwcp2vPrEIlvP2" /> <component name="ProjectId" id="1rNnmCWH3aNvnQwcp2vPrEIlvP2" />
@ -781,7 +782,7 @@
<entry key="branch"> <entry key="branch">
<value> <value>
<list> <list>
<option value="test_#5052_ubicador" /> <option value="testBeta_5109_qr" />
</list> </list>
</value> </value>
</entry> </entry>
@ -882,48 +883,58 @@
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="kotlin-line"> <line-breakpoint enabled="true" type="kotlin-line">
<url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt</url> <url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt</url>
<line>520</line> <line>526</line>
<option name="timeStamp" value="5" /> <option name="timeStamp" value="5" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="kotlin-line"> <line-breakpoint enabled="true" type="kotlin-line">
<url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt</url> <url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt</url>
<line>563</line> <line>569</line>
<option name="timeStamp" value="6" /> <option name="timeStamp" value="6" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="kotlin-line"> <line-breakpoint enabled="true" type="kotlin-line">
<url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt</url> <url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt</url>
<line>566</line> <line>572</line>
<option name="timeStamp" value="7" /> <option name="timeStamp" value="7" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="kotlin-line"> <line-breakpoint enabled="true" type="kotlin-line">
<url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt</url> <url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt</url>
<line>567</line> <line>573</line>
<option name="timeStamp" value="8" /> <option name="timeStamp" value="8" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="kotlin-line"> <line-breakpoint enabled="true" type="kotlin-line">
<url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt</url> <url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt</url>
<line>576</line> <line>582</line>
<option name="timeStamp" value="9" /> <option name="timeStamp" value="9" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="kotlin-line"> <line-breakpoint enabled="true" type="kotlin-line">
<url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt</url> <url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt</url>
<line>610</line> <line>616</line>
<option name="timeStamp" value="10" /> <option name="timeStamp" value="10" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="kotlin-line"> <line-breakpoint enabled="true" type="kotlin-line">
<url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt</url> <url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt</url>
<line>613</line> <line>619</line>
<option name="timeStamp" value="11" /> <option name="timeStamp" value="11" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="kotlin-line"> <line-breakpoint enabled="true" type="kotlin-line">
<url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt</url> <url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt</url>
<line>616</line> <line>622</line>
<option name="timeStamp" value="12" /> <option name="timeStamp" value="12" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="kotlin-line"> <line-breakpoint enabled="true" type="kotlin-line">
<url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt</url> <url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemFragment.kt</url>
<line>163</line> <line>83</line>
<option name="timeStamp" value="15" /> <option name="timeStamp" value="28" />
</line-breakpoint>
<line-breakpoint enabled="true" type="kotlin-line">
<url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemFragment.kt</url>
<line>82</line>
<option name="timeStamp" value="29" />
</line-breakpoint>
<line-breakpoint enabled="true" type="kotlin-line">
<url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemFragment.kt</url>
<line>64</line>
<option name="timeStamp" value="30" />
</line-breakpoint> </line-breakpoint>
</breakpoints> </breakpoints>
</breakpoint-manager> </breakpoint-manager>

View File

@ -1,7 +1,11 @@
package es.verdnatura.presentation.common package es.verdnatura.presentation.common
import android.content.Context
import android.os.Build import android.os.Build
import android.util.Log.d
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import org.json.JSONObject import org.json.JSONObject
import java.time.LocalDateTime import java.time.LocalDateTime
import java.time.format.DateTimeFormatter import java.time.format.DateTimeFormatter
@ -9,19 +13,25 @@ import java.time.format.DateTimeFormatter
data class itemScanned(var scanned: JSONObject) { data class itemScanned(var scanned: JSONObject) {
var table: String = scanned.get("table").toString() var table: String = scanned.get("table").toString()
var id: Int = scanned.get("id").toString().toInt() var id: Int = scanned.get("id").toString().toInt()
var company: String = scanned.get("company").toString()
} }
//Tarea#5109 //Tarea#5109
@RequiresApi(Build.VERSION_CODES.O) @RequiresApi(Build.VERSION_CODES.O)
data class itemScannedAll(var scanned: JSONObject) { data class itemScannedAll(var scanned: JSONObject) {
var company: String = scanned.get("company").toString() var company: String = scanned.get("company").toString()
var user: Int = scanned.get("user").toString().toInt() var user: Int = scanned.get("user").toString().toInt()
var created: LocalDateTime = LocalDateTime.parse(scanned.get("created").toString(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) var created: LocalDateTime = LocalDateTime.parse(
scanned.get("created").toString(),
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
)
var table: String = scanned.get("table").toString() var table: String = scanned.get("table").toString()
var id: String = scanned.get("id").toString() var id: String = scanned.get("id").toString()
var more: String = scanned.get("more").toString() var more: String = scanned.get("more").toString()
} }
//Tarea #5109 //Tarea #5109
private fun itemScanIsQr(value: String): Boolean { fun itemScanIsQr(value: String): Boolean {
return try { return try {
itemScanned(JSONObject(value)) itemScanned(JSONObject(value))
@ -32,3 +42,36 @@ private fun itemScanIsQr(value: String): Boolean {
} }
} }
@RequiresApi(Build.VERSION_CODES.O)
fun itemScanValue(value: String, table: String, field: String): Any {
val gson = Gson()
return try {
var item = itemScanned(JSONObject(value))
if (item.company == "vnl" && item.table == table) {
var valueToReturn: Map<String, Any> =
gson.fromJson(value, object : TypeToken<Map<String, Any>>() {}.type)
valueToReturn.forEach {
if (it.key == field) {
return it.value.toString() /*si no li pose toString torna error double to string*/
}
}
}
throw Exception("QR no válido")
} catch (Ex: Exception) {
if (Ex.message!!.contains("QR")){
throw Ex
}else{
return value
}
}
}

View File

@ -15,7 +15,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
import com.google.gson.Gson import com.google.gson.Gson
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentItemCardBinding import es.verdnatura.databinding.FragmentItemCardBinding
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.* import es.verdnatura.presentation.common.*
import es.verdnatura.presentation.view.component.CustomDialogInput import es.verdnatura.presentation.view.component.CustomDialogInput
@ -154,15 +153,22 @@ class ItemCardFragment(
} }
@RequiresApi(Build.VERSION_CODES.O)
private fun setEvents() { private fun setEvents() {
//edit_itemFk.requestFocus()
binding.editItemFk.requestFocus() binding.editItemFk.requestFocus()
//edit_itemFk.setOnEditorActionListener { v, actionId, event ->
binding.editItemFk.setOnEditorActionListener { _, actionId, _ -> binding.editItemFk.setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
//if (!edit_itemFk.text.toString().isNullOrEmpty())
if (!binding.editItemFk.text.toString().isNullOrEmpty()) if (!binding.editItemFk.text.toString().isNullOrEmpty())
getItemCard(binding.editItemFk.text.toString()) //Tarea#5109
try {
getItemCard(itemScanValue(binding.editItemFk.text.toString(),"buy","id").toString())
}catch (Ex:Exception){
ma.messageWithSound(Ex.message.toString(), true,true)
}
// getItemCard(binding.editItemFk.text.toString())
binding.editItemFk.setText("") binding.editItemFk.setText("")
ma.hideKeyboard(binding.editItemFk) ma.hideKeyboard(binding.editItemFk)
return@setOnEditorActionListener true return@setOnEditorActionListener true

View File

@ -1,9 +1,11 @@
package es.verdnatura.presentation.view.feature.buscaritem.fragment package es.verdnatura.presentation.view.feature.buscaritem.fragment
import android.content.Context import android.content.Context
import android.os.Build
import android.view.View import android.view.View
import android.view.View.GONE import android.view.View.GONE
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import androidx.annotation.RequiresApi
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
@ -11,6 +13,7 @@ import es.verdnatura.databinding.FragmentBuscarItemBinding
import es.verdnatura.domain.notNull import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnPasillerosItemClickListener import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.common.itemScanValue
import es.verdnatura.presentation.view.feature.buscaritem.adapter.LocationAdapter import es.verdnatura.presentation.view.feature.buscaritem.adapter.LocationAdapter
@ -32,11 +35,12 @@ class BuscarItemFragment(
override fun getLayoutId(): Int = R.layout.fragment_buscar_item override fun getLayoutId(): Int = R.layout.fragment_buscar_item
@RequiresApi(Build.VERSION_CODES.O)
override fun init() { override fun init() {
ma.hideBottomNavigation(GONE) ma.hideBottomNavigation(GONE)
binding.mainToolbar.toolbarTitle.text = getString(R.string.getubicaition) binding.mainToolbar.toolbarTitle.text = getString(R.string.getubicaition)
binding.editItemFk.inputType = android.text.InputType.TYPE_CLASS_NUMBER //binding.editItemFk.inputType = android.text.InputType.TYPE_CLASS_NUMBER
setEvents() setEvents()
if (itemFk != null) { if (itemFk != null) {
getLocations(itemFk!!) getLocations(itemFk!!)
@ -45,13 +49,21 @@ class BuscarItemFragment(
} }
@RequiresApi(Build.VERSION_CODES.O)
private fun setEvents() { private fun setEvents() {
binding.editItemFk.requestFocus() binding.editItemFk.requestFocus()
binding.editItemFk.setOnEditorActionListener { _, actionId, _ -> binding.editItemFk.setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!binding.editItemFk.text.toString().isNullOrEmpty()) if (!binding.editItemFk.text.toString().isNullOrEmpty())
getLocations(binding.editItemFk.text.toString()) //getLocations(binding.editItemFk.text.toString())
/* #Tarea 5109*/
try {
getLocations(itemScanValue(binding.editItemFk.text.toString(), "buy", "id"))
} catch (Ex: Exception) {
ma.messageWithSound(Ex.message.toString(), true, true)
}
binding.editItemFk.setText("") binding.editItemFk.setText("")
ma.hideKeyboard(binding.editItemFk) ma.hideKeyboard(binding.editItemFk)
return@setOnEditorActionListener true return@setOnEditorActionListener true
@ -67,7 +79,7 @@ class BuscarItemFragment(
} }
private fun getLocations(itemFk: Any) { private fun getLocations(itemFk: Any) {
this.itemFk = itemFk // this.itemFk = itemFk
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.getLocations(itemFk) viewModel.getLocations(itemFk)
} }
@ -89,7 +101,11 @@ class BuscarItemFragment(
totalVisible += it.visible.toInt() totalVisible += it.visible.toInt()
} }
binding.mainToolbar.toolbarTitle.text = binding.mainToolbar.toolbarTitle.text =
getString(R.string.item) + itemFk + getString(R.string.visibleTotal) + totalVisible getString(R.string.item) + if (it.list.isNotEmpty()) {
it.list.get(0).itemFk
} else {
""
} + getString(R.string.visibleTotal) + totalVisible
} }

View File

@ -18,6 +18,7 @@ import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager import android.view.inputmethod.InputMethodManager
import android.widget.ImageView import android.widget.ImageView
import android.widget.Toast import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
@ -398,6 +399,7 @@ class CollectionFragment(
} }
} }
@RequiresApi(Build.VERSION_CODES.O)
override fun observeViewModel() { override fun observeViewModel() {
with(viewModel) { with(viewModel) {
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
@ -1493,6 +1495,7 @@ class CollectionFragment(
) )
} }
@RequiresApi(Build.VERSION_CODES.O)
private fun printShelvingResult(placementSupplyListVO: PlacementSupplyListVO) { private fun printShelvingResult(placementSupplyListVO: PlacementSupplyListVO) {
//////Log.i("VERDNATURA:","Print CustomDialog") //////Log.i("VERDNATURA:","Print CustomDialog")
var shelving = "" var shelving = ""
@ -1529,6 +1532,18 @@ class CollectionFragment(
) )
) { ) {
if (customDialogList.getValueTwo().isNotEmpty()) { if (customDialogList.getValueTwo().isNotEmpty()) {
/*Tarea #5109*/
customDialogList.setValue(
itemScanValue(
customDialogList.getValue(),
"buy",
"id"
).toString()
)
if (isNumber(customDialogList.getValue()) && isNumber(total) && customDialogList.getValue() if (isNumber(customDialogList.getValue()) && isNumber(total) && customDialogList.getValue()
.toInt() > total.toInt() .toInt() > total.toInt()
) { ) {
@ -1571,7 +1586,6 @@ class CollectionFragment(
getString(R.string.quantityError).toast(requireContext()) getString(R.string.quantityError).toast(requireContext())
} }
} else { } else {
getString(R.string.scanItemValidate).toast(requireContext()) getString(R.string.scanItemValidate).toast(requireContext())
} }
@ -1584,7 +1598,7 @@ class CollectionFragment(
.setHintValueTwo(getString(R.string.scanItem)) .setHintValueTwo(getString(R.string.scanItem))
.setValueTwo("").show() .setValueTwo("").show()
} catch (e: Exception) { } catch (e: Exception) {
ma.messageWithSound(e.message.toString(), true, true)
} }
try { try {
customDialogList.getEditTextTwo().post(Runnable { customDialogList.getEditTextTwo().post(Runnable {
@ -1601,10 +1615,19 @@ class CollectionFragment(
}) })
} catch (e: Exception) { } catch (e: Exception) {
} }
try { try {/*Tarea 5109 el catch no tenia error*/
customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event -> customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
customDialogList.setValue(
itemScanValue(
customDialogList.getValue(),
"buy",
"id"
).toString()
)
// Log.i("VERDNATURA:","Comprobando COGER-1") // Log.i("VERDNATURA:","Comprobando COGER-1")
if (customDialogList.getValueTwo().isNotEmpty()) { if (customDialogList.getValueTwo().isNotEmpty()) {
try { try {
@ -1664,6 +1687,7 @@ class CollectionFragment(
false false
} }
} catch (e: Exception) { } catch (e: Exception) {
ma.messageWithSound(e.message.toString(), true, true)
} }
placementSupplyAdapter = placementSupplyAdapter =
@ -1707,7 +1731,7 @@ class CollectionFragment(
private fun checkItemScan(valueToCheck: String): Boolean { private fun checkItemScan(valueToCheck: String): Boolean {
d("VERDNATURA::","Entramos a ver el checkItem") d("VERDNATURA::", "Entramos a ver el checkItem")
if (storedPosition >= 0 && sales.size > storedPosition) { if (storedPosition >= 0 && sales.size > storedPosition) {
val saleToCheck = sales[storedPosition] val saleToCheck = sales[storedPosition]
@ -1720,7 +1744,7 @@ class CollectionFragment(
} }
} }
} }
d("VERDNATURA::","SAlimos de ver el checkItem") d("VERDNATURA::", "SAlimos de ver el checkItem")
return false return false
} }

View File

@ -73,7 +73,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
binding.edittextPassword.setText("nightmare") binding.edittextPassword.setText("nightmare")
} }
// se crean/listan las opciones de formas de trabajo // se crean/listan las opciones de formas de trabajo
deleteWorkForm("all") //deleteWorkForm("all")
listForms = getWorkForm().sortedBy { it.created } listForms = getWorkForm().sortedBy { it.created }
binding.edittextServer.keyListener = null binding.edittextServer.keyListener = null

View File

@ -12,6 +12,7 @@ import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager import android.view.inputmethod.InputMethodManager
import android.widget.ImageView import android.widget.ImageView
import android.widget.Toast import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
@ -75,7 +76,7 @@ class EndSacadorFragment(
private var positionCollectionMissing = 0 private var positionCollectionMissing = 0
private var quantityCollectionMissing = 0 private var quantityCollectionMissing = 0
private var positionIncreaseQuantity = 0 private var positionIncreaseQuantity = 0
private var quantityIncrease= 0 private var quantityIncrease = 0
private var quantityCollectionSplit = 0 private var quantityCollectionSplit = 0
private var positionCollectionSplit = 0 private var positionCollectionSplit = 0
@ -169,6 +170,7 @@ class EndSacadorFragment(
} }
} }
@RequiresApi(Build.VERSION_CODES.O)
override fun observeViewModel() { override fun observeViewModel() {
with(viewModel) { with(viewModel) {
salesList.observe(viewLifecycleOwner, Observer { salesList.observe(viewLifecycleOwner, Observer {
@ -863,6 +865,7 @@ class EndSacadorFragment(
) )
} }
@RequiresApi(Build.VERSION_CODES.O)
private fun printShelvingResult(placementSupplyListVO: PlacementSupplyListVO) { private fun printShelvingResult(placementSupplyListVO: PlacementSupplyListVO) {
var shelving = "" var shelving = ""
var item = "" var item = ""
@ -887,6 +890,15 @@ class EndSacadorFragment(
if (customDialogList.getValueTwo().isNotEmpty()) { if (customDialogList.getValueTwo().isNotEmpty()) {
/*Tarea 5109*/
try {
customDialogList.setValueTwo(
itemScanValue(
customDialogList.getValueTwo(),
"buy",
"id"
).toString()
)
if (checkItemScan(customDialogList.getValueTwo())) { if (checkItemScan(customDialogList.getValueTwo())) {
@ -901,8 +913,12 @@ class EndSacadorFragment(
) )
customDialogList.dismiss() customDialogList.dismiss()
} }
} catch (Ex: Exception) {
ma.messageWithSound(Ex.message.toString(), true, true)
}
scanRequest() scanRequest()
hideKeyboards() hideKeyboards()
} else { } else {
getString(R.string.scanItemValidate).toast(requireContext()) getString(R.string.scanItemValidate).toast(requireContext())
} }
@ -929,8 +945,14 @@ class EndSacadorFragment(
customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event -> customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
try {
customDialogList.setValueTwo(
itemScanValue(
customDialogList.getValueTwo(),
"buy",
"id"
).toString()
)
originalItemScan = customDialogList.getValueTwo() originalItemScan = customDialogList.getValueTwo()
////Log.i("VERDNATURA:","el item original es $originalItemScan") ////Log.i("VERDNATURA:","el item original es $originalItemScan")
@ -950,6 +972,10 @@ class EndSacadorFragment(
} else { } else {
getString(R.string.scanItemValidate).toast(requireContext()) getString(R.string.scanItemValidate).toast(requireContext())
} }
} catch (Ex: Exception) {
ma.messageWithSound(Ex.message.toString(), true, true)
}
scanRequest() scanRequest()
hideKeyboards() hideKeyboards()
return@setOnEditorActionListener true return@setOnEditorActionListener true
@ -1187,7 +1213,7 @@ class EndSacadorFragment(
getString(R.string.Split) getString(R.string.Split)
) )
*/ */
.setOkButtonAdd(getString(R.string.Agregar)) { .setOkButtonAdd(getString(R.string.Agregar)) {
increaseQuantity(position, customDialogThreeButtons.getValue().toInt()) increaseQuantity(position, customDialogThreeButtons.getValue().toInt())
scanRequest() scanRequest()
@ -1204,7 +1230,7 @@ class EndSacadorFragment(
customDialogThreeButtons.dismiss() customDialogThreeButtons.dismiss()
}.show() }.show()
customDialogThreeButtons.setFocusDialogValue() customDialogThreeButtons.setFocusDialogValue()
}catch (ex:Exception){ } catch (ex: Exception) {
getString(R.string.errorQuantity).toast(context) getString(R.string.errorQuantity).toast(context)
} }
} }

View File

@ -200,6 +200,7 @@ class UbicadorFragment(
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
} }
@RequiresApi(Build.VERSION_CODES.O)
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
private fun setEvents() { private fun setEvents() {
binding.mainToolbar.backButton.setOnClickListener { binding.mainToolbar.backButton.setOnClickListener {
@ -224,10 +225,23 @@ class UbicadorFragment(
binding.editMatricula.text.toString() binding.editMatricula.text.toString()
) )
} else { } else {
/*Tarea#5109*/
/*viewModel.getIdFromCode(
code = binding.editMatricula.text.toString()
)*/
try {
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
viewModel.getIdFromCode( viewModel.getIdFromCode(
code = binding.editMatricula.text.toString() code = itemScanValue(
binding.editMatricula.text.toString(),
"buy",
"id"
).toString()
) )
} catch (Ex: Exception) {
ma.messageWithSound(Ex.message.toString(), true, true)
}
} }
} }
@ -534,7 +548,7 @@ class UbicadorFragment(
} }
}) })
responseAddList.observe(viewLifecycleOwner, Observer { responseAddList.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility= GONE binding.splashProgress.visibility = GONE
if (it.isError) { if (it.isError) {
ma.messageWithSound(it.errorMessage, it.isError, false) ma.messageWithSound(it.errorMessage, it.isError, false)
@ -591,10 +605,10 @@ class UbicadorFragment(
}) })
responseMake.observe(viewLifecycleOwner, Observer { responseMake.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility=GONE binding.splashProgress.visibility = GONE
if (it.isError){ if (it.isError) {
ma.messageWithSound(it.errorMessage,true,true,isToasted = true) ma.messageWithSound(it.errorMessage, true, true, isToasted = true)
}else{ } else {
if (!shelvingFk.isNullOrEmpty()) { if (!shelvingFk.isNullOrEmpty()) {
binding.mainToolbar.toolbarTitle.text = shelvingFk binding.mainToolbar.toolbarTitle.text = shelvingFk
@ -603,7 +617,8 @@ class UbicadorFragment(
shelvingFk shelvingFk
) )
}} }
}
}) })
} }
@ -840,7 +855,7 @@ class UbicadorFragment(
.setDescription(getString(R.string.selectDestiny) + item.item).setValue("") .setDescription(getString(R.string.selectDestiny) + item.item).setValue("")
.setOkButton(getString(R.string.transfer)) { .setOkButton(getString(R.string.transfer)) {
if (customDialogInput.getValue().isNotEmpty()) { if (customDialogInput.getValue().isNotEmpty()) {
binding.splashProgress.visibility= VISIBLE binding.splashProgress.visibility = VISIBLE
viewModel.itemShelvingTransfer( viewModel.itemShelvingTransfer(
item.id, item.id,
customDialogInput.getValue() customDialogInput.getValue()

View File

@ -77,7 +77,7 @@
style="@style/InputLineTextSearch" style="@style/InputLineTextSearch"
android:layout_width="match_parent" android:layout_width="match_parent"
android:backgroundTint="@android:color/white" android:backgroundTint="@android:color/white"
android:inputType="number" android:inputType="text"
android:lines="1" android:lines="1"
android:maxLines="1" android:maxLines="1"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"