feat crashlytics refs #6810

This commit is contained in:
Sergio De la torre 2024-06-24 15:41:08 +02:00
parent 4416820122
commit 59b91ffc61
10 changed files with 62 additions and 31 deletions

View File

@ -3,7 +3,7 @@ package es.verdnatura.presentation.view.feature.buffer.fragment
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentBufferBinding import es.verdnatura.databinding.FragmentBufferBinding
import es.verdnatura.domain.toInt import es.verdnatura.domain.toLong
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
class BufferFragment( class BufferFragment(
@ -46,7 +46,7 @@ class BufferFragment(
} }
viewModel.bufferSetTypeByName( viewModel.bufferSetTypeByName(
binding.scanInput.toInt(), binding.scanInput.toLong(),
entryPoint entryPoint
) )

View File

@ -19,7 +19,7 @@ class BufferFragmentViewModel(val context: Context) : BaseViewModel(context) {
val bufferLoadResponse: LiveData<String> val bufferLoadResponse: LiveData<String>
get() = _bufferLoadResponse get() = _bufferLoadResponse
fun bufferSetTypeByName(vBufferFk: Int, vType: String) { fun bufferSetTypeByName(vBufferFk: Number, vType: String) {
salix.buffer_setTypeByName(params = listOf(vBufferFk, vType).formatWithQuotes()) salix.buffer_setTypeByName(params = listOf(vBufferFk, vType).formatWithQuotes())
.enqueue(object : SalixCallback<List<JsonObject>>(context) { .enqueue(object : SalixCallback<List<JsonObject>>(context) {
override fun onSuccess(response: Response<List<JsonObject>>) { override fun onSuccess(response: Response<List<JsonObject>>) {

View File

@ -395,7 +395,7 @@ class CollectionFragmentPicker(
"buy" -> binding.scanInput.setText(myQr.more) "buy" -> binding.scanInput.setText(myQr.more)
"ticket" -> { "ticket" -> {
binding.scanInput.setText(myQr.id) binding.scanInput.setText(myQr.id.toString())
findSale(binding.scanInput.text.toString()) findSale(binding.scanInput.text.toString())
} }
} }

View File

@ -9,7 +9,7 @@ import android.widget.Toast
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentExpeditionLogDeliveryBinding import es.verdnatura.databinding.FragmentExpeditionLogDeliveryBinding
import es.verdnatura.domain.toInt import es.verdnatura.domain.toLong
import es.verdnatura.domain.toast import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnOptionsSelectedListener import es.verdnatura.presentation.common.OnOptionsSelectedListener
@ -28,7 +28,7 @@ class LogExpeditionFragment(
) { ) {
private var adapter: ExpeditionLogAdapter? = null private var adapter: ExpeditionLogAdapter? = null
private var originalItem: Int = 0 private var originalItem: Long = 0
private var isScanned: Boolean = false private var isScanned: Boolean = false
companion object { companion object {
@ -88,8 +88,8 @@ class LogExpeditionFragment(
isScanned = isScanned =
event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
try { try {
viewModel.expeditionGetLog(binding.scanInput.toInt()) viewModel.expeditionGetLog(binding.scanInput.toLong())
originalItem = binding.scanInput.toInt() originalItem = binding.scanInput.toLong()
binding.mainToolbar.toolbarTitle.text = binding.mainToolbar.toolbarTitle.text =
getString( getString(
R.string.titleLogExpedition, R.string.titleLogExpedition,

View File

@ -30,7 +30,7 @@ class Expeditions(
) )
class ExpeditionSalix( class ExpeditionSalix(
val expeditionFk: Int, val expeditionFk: Number,
val stateCode: String?, val stateCode: String?,
val isScanned: Int? = 0 val isScanned: Int? = 0
) )

View File

@ -101,7 +101,7 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
} }
fun expeditionGetLog( fun expeditionGetLog(
expedition: Int expedition: Number
) { ) {
salix.getExpeditionStates( salix.getExpeditionStates(
"""{"where": {"expeditionFk": $expedition},"include": [{"relation": "expeditionStateType","scope": {"fields": ["id","description"]}}],"fields": {"id": true,"created": true,"typeFk": true}}""" """{"where": {"expeditionFk": $expedition},"include": [{"relation": "expeditionStateType","scope": {"fields": ["id","description"]}}],"fields": {"id": true,"created": true,"typeFk": true}}"""
@ -126,7 +126,7 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
} }
fun getRoutesFromExpedition( fun getRoutesFromExpedition(
expedition: Int expedition: Number
) { ) {
salix.getRoutesFromExpedition( salix.getRoutesFromExpedition(
filter = """{ filter = """{

View File

@ -11,20 +11,19 @@ import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
class InventoryAdapter ( class InventoryAdapter(
private val items: List<ItemInventaryVO>, private val items: List<ItemInventaryVO>,
private val onInvetoryNichoClickListener: OnInvetoryNichoClickListener, private val onInvetoryNichoClickListener: OnInvetoryNichoClickListener,
private val onPasillerosItemClickListener: OnPasillerosItemClickListener private val onPasillerosItemClickListener: OnPasillerosItemClickListener
): RecyclerView.Adapter<InventoryAdapter.ItemHolder> () { ) : RecyclerView.Adapter<InventoryAdapter.ItemHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
return ItemHolder( return ItemHolder(
ItemInventaryRowBinding.inflate(LayoutInflater.from(parent.context),parent,false) ItemInventaryRowBinding.inflate(LayoutInflater.from(parent.context), parent, false)
) )
} }
override fun getItemCount() =items.size override fun getItemCount() = items.size
override fun onBindViewHolder(holder: ItemHolder, position: Int) { override fun onBindViewHolder(holder: ItemHolder, position: Int) {
holder.bind(items[position]) holder.bind(items[position])
@ -32,36 +31,59 @@ class InventoryAdapter (
inner class ItemHolder( inner class ItemHolder(
val binding: ItemInventaryRowBinding val binding: ItemInventaryRowBinding
) : RecyclerView.ViewHolder(binding.root){ ) : RecyclerView.ViewHolder(binding.root) {
private val res = binding.root.context.resources private val res = binding.root.context.resources
fun bind(item: ItemInventaryVO) { fun bind(item: ItemInventaryVO) {
binding.apply { binding.apply {
this.item = item this.item = item
if(item.producer.isNullOrEmpty()){ if (item.producer.isNullOrEmpty()) {
itemProducer.visibility = View.GONE itemProducer.visibility = View.GONE
}else{ } else {
itemProducer.visibility = View.VISIBLE itemProducer.visibility = View.VISIBLE
} }
if (item.itemColour.isNullOrEmpty()){ if (item.itemColour.isNullOrEmpty()) {
itemColor.visibility = View.GONE itemColor.visibility = View.GONE
}else{ } else {
itemColor.visibility = View.VISIBLE itemColor.visibility = View.VISIBLE
} }
itemNicho.setOnClickListener { itemNicho.setOnClickListener {
onInvetoryNichoClickListener.onInvetoryNichoClickListener(item) onInvetoryNichoClickListener.onInvetoryNichoClickListener(item)
} }
itemFk.setOnClickListener { itemFk.setOnClickListener {
onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = res.getString( onPasillerosItemClickListener.onPasillerosItemClickListener(
R.string.titleItemConsult)),item.itemFk.toString()) PasillerosItemVO(
title = res.getString(
R.string.titleItemConsult
)
), item.itemFk.toString()
)
} }
itemUp.setOnClickListener { itemUp.setOnClickListener {
onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = res.getString( onPasillerosItemClickListener.onPasillerosItemClickListener(
R.string.titleItemSearch)),item.itemFk.toString()) PasillerosItemVO(
title = res.getString(
R.string.titleItemSearch
)
), item.itemFk.toString()
)
} }
itemDown.setOnClickListener { itemDown.setOnClickListener {
onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = res.getString( onPasillerosItemClickListener.onPasillerosItemClickListener(
R.string.titleItemSearch)),item.itemFk.toString()) PasillerosItemVO(
title = res.getString(
R.string.titleItemSearch
)
), item.itemFk.toString()
)
} }
binding.txtPendingAmount.text = if (item.pendingAmount != null) {
binding.root.context.getString(R.string.pendingAmount, item.pendingAmount)
} else {
item.size
}
} }
} }
} }

View File

@ -5,7 +5,7 @@ import android.view.inputmethod.EditorInfo
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentItemexpeditionstateCardBinding import es.verdnatura.databinding.FragmentItemexpeditionstateCardBinding
import es.verdnatura.domain.toInt import es.verdnatura.domain.toLong
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.view.feature.paletizador.adapter.ExpeditionStateAdapter import es.verdnatura.presentation.view.feature.paletizador.adapter.ExpeditionStateAdapter
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpedetionState import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpedetionState
@ -44,7 +44,7 @@ class ExpeditionStateFragment(
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().isNotEmpty()) { if (binding.editItemFk.text.toString().isNotEmpty()) {
try { try {
viewModel.expeditionGetStateJSON(binding.editItemFk.toInt()) viewModel.expeditionGetStateJSON(binding.editItemFk.toLong())
itemScan = binding.editItemFk.text.toString() itemScan = binding.editItemFk.text.toString()
} catch (ex: Exception) { } catch (ex: Exception) {
ma.messageWithSound( ma.messageWithSound(

View File

@ -20,7 +20,7 @@ class ExpeditionStateViewModel(val context: Context) : BaseViewModel(context) {
val itemExpedition: LiveData<ItemExpedetionState> val itemExpedition: LiveData<ItemExpedetionState>
get() = _itemExpedition get() = _itemExpedition
fun expeditionGetStateJSON(expeditionFk: Int) { fun expeditionGetStateJSON(expeditionFk: Long) {
salix.expedition_getState(params = arrayListOf(expeditionFk)) salix.expedition_getState(params = arrayListOf(expeditionFk))
.enqueue(object : SalixCallback<ArrayList<JsonObject>>(context) { .enqueue(object : SalixCallback<ArrayList<JsonObject>>(context) {
override fun onSuccess(response: Response<ArrayList<JsonObject>>) { override fun onSuccess(response: Response<ArrayList<JsonObject>>) {

View File

@ -158,7 +158,16 @@ class EndSacadorFragment(
} else { } else {
if (binding.scanInput.text.first().isDigit()) { if (binding.scanInput.text.first().isDigit()) {
try {
addSaleGroupToCollection(binding.scanInput.toInt()) addSaleGroupToCollection(binding.scanInput.toInt())
} catch (ex: Exception) {
ma.messageWithSound(
getString(R.string.errorInput),
isError = true,
isPlayed = true,
isToasted = true
)
}
} else { } else {
findSale(binding.scanInput.text.toString()) findSale(binding.scanInput.text.toString())
} }