feat: refs #8175 refactorCode

This commit is contained in:
Sergio De la torre 2024-11-20 08:08:17 +01:00
parent 2bfa6c8373
commit bd4ffa35bf
23 changed files with 225 additions and 156 deletions

View File

@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

View File

@ -44,7 +44,6 @@ class MobileApplication : Application(), InteceptorListener {
signListener = listener
}
// lateinit var silex: VerdnaturaService
lateinit var salix: SalixService
var userId: Int? = null
var userName: String? = null

View File

@ -18,7 +18,7 @@ import com.google.android.gms.location.LocationCallback
import com.google.android.gms.location.LocationResult
import com.google.android.gms.location.Priority
import es.verdnatura.MobileApplication
import timber.log.Timber.d
import es.verdnatura.domain.toast
interface LocationUpdateCallback {
fun onLocationReceived(location: LocationResult)
@ -36,7 +36,7 @@ abstract class BaseActivity<T : ViewDataBinding> : AppCompatActivity() {
var locationUpdateCallback: LocationUpdateCallback? = null
protected lateinit var binding: T
private lateinit var fusedLocationClient:FusedLocationProviderClient
private lateinit var fusedLocationClient: FusedLocationProviderClient
private val locationRequest =
com.google.android.gms.location.LocationRequest.Builder(
Priority.PRIORITY_LOW_POWER,
@ -50,8 +50,8 @@ abstract class BaseActivity<T : ViewDataBinding> : AppCompatActivity() {
setContentView(getLayoutId())
try {
initDataBinding()
}catch (ex:Exception){
d(ex.message.toString())
} catch (ex: Exception) {
ex.message!!.toast(context = this)
}
mobileApplication = application as MobileApplication
init()
@ -62,7 +62,6 @@ abstract class BaseActivity<T : ViewDataBinding> : AppCompatActivity() {
open fun addBindingVariables() {}
abstract fun init()
private fun initDataBinding() {
binding = DataBindingUtil.setContentView(this, getLayoutId())
binding.lifecycleOwner = this

View File

@ -69,10 +69,10 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(
addBindingVariables()
}
fun textScanned_filterDouble(textScanned: String): String {
fun textScannedFilterDouble(textScanned: String): String {
if (textScanned.length > 13) {
var size = textScanned.length
val size = textScanned.length
if (textScanned.substring((size / 2), size) == textScanned.substring(0, size / 2)
) {
return textScanned.substring(0, size / 2)
@ -149,8 +149,8 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(
fun getInfoVersionNameApp(): String {
val manager: PackageManager = requireContext().packageManager
val info: PackageInfo = manager.getPackageInfo(requireContext().packageName, 0)
mobileApplication.versionName = info.versionName
return info.versionName
mobileApplication.versionName = info.versionName.toString()
return mobileApplication.versionName
}
fun getDevicePDA(): Int? {

View File

@ -8,7 +8,7 @@ import es.verdnatura.databinding.ItemGeneralRowBinding
class GeneralAdapter(
private var items: List<GeneralItem>,
private val onDeleteItemRowClickListener: OnGeneralItemRowClickListener,
private val onDeleteItemRowClickListener: OnGeneralItemRowClickListener? = null,
private var showDelete: Boolean = false,
private val onRowClickListener: OnGeneralRowClickListener? = null
) : RecyclerView.Adapter<GeneralAdapter.ItemHolder>() {
@ -24,10 +24,6 @@ class GeneralAdapter(
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
holder.bind(items[position])
/*holder.binding.root.setOnClickListener {
onGeneralItemRowClickListener.onGeneralItemRowClickListener(items[position])
}*/
}
inner class ItemHolder(
@ -43,7 +39,7 @@ class GeneralAdapter(
itemCode.visibility = View.GONE
}
binding.itemImage.setOnClickListener {
onDeleteItemRowClickListener.onGeneralItemRowClickListener(item)
onDeleteItemRowClickListener?.onGeneralItemRowClickListener(item)
}
binding.itemCode.setOnClickListener {
onRowClickListener?.onRowClickListener(item)

View File

@ -113,8 +113,7 @@ class ItemCardFragment(
listIcons.add(iconSalix)
listIcons.add(iconReload)
listIcons.add(iconHistory)
listIcons.add(iconPrint)
// listIcons.add(iconPrint)
binding.mainToolbar.toolbarIcons.adapter =
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {

View File

@ -1,6 +1,5 @@
package es.verdnatura.presentation.view.feature.collection.fragment
import android.app.AlertDialog
import android.content.Context
import android.graphics.drawable.Drawable
import android.media.MediaPlayer
@ -37,6 +36,7 @@ import es.verdnatura.domain.notNull
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.ItemScanned
import es.verdnatura.presentation.common.LabelDialogHelper
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
import es.verdnatura.presentation.common.OnMistakeClickListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener
@ -410,7 +410,7 @@ class CollectionFragment(
if (!binding.scanInput.text.toString().isNullOrEmpty()) {
binding.mainToolbar.toolbarIcons.visibility = VISIBLE
//sergio:para ver si ha marcado dos veces el mismo ticket
binding.scanInput.setText(textScanned_filterDouble(binding.scanInput.text!!.toString()))
binding.scanInput.setText(textScannedFilterDouble(binding.scanInput.text!!.toString()))
//de momento solo está el qr de artículo
isScanned =
@ -969,7 +969,7 @@ class CollectionFragment(
myGroupList
},*/
saleAdapter = SaleAdapter(
myGroupList,
myGroupList as MutableList,
pasillerosItemClickListener!!,
object : OnQuantityClickListener {
@ -2276,20 +2276,20 @@ class CollectionFragment(
}
}
if (isTicket) {
val builder = AlertDialog.Builder(context)
builder.setTitle(getString(R.string.selectLabeltoPrint))
val labelCount = arrayOf("1", "2", "3", "4", "5", "6", "7", "8", "9", "10")
builder.setItems(labelCount) { dialog, which ->
viewModel.collectionStickerPrint(
collectionFk = collection.collectionFk, labelCount = (which + 1)
)
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(
PRINTERNAME
)).toast(requireContext())
val labelDialogHelper = LabelDialogHelper(requireContext())
labelDialogHelper.showLabelDialog(
onItemSelected = { labelCount ->
viewModel.collectionStickerPrint(
collectionFk = collection.collectionFk,
labelCount = labelCount
)
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(
PRINTERNAME
)).toast(requireContext())
}
)
}
val dialog = builder.create()
dialog.show()
} else {
viewModel.collectionStickerPrint(
collectionFk = collection.collectionFk, null

View File

@ -381,7 +381,7 @@ class CollectionFragmentPicker(
if (!binding.scanInput.text.toString().isNullOrEmpty()) {
//sergio:para ver si ha marcado dos veces el mismo ticket
binding.scanInput.setText(textScanned_filterDouble(binding.scanInput.text!!.toString()))
binding.scanInput.setText(textScannedFilterDouble(binding.scanInput.text!!.toString()))
//de momento solo está el qr de artículo
isScanned =

View File

@ -1,6 +1,5 @@
package es.verdnatura.presentation.view.feature.collection.fragment
import android.app.AlertDialog
import android.content.Context
import android.graphics.drawable.Drawable
import android.media.MediaPlayer
@ -27,6 +26,7 @@ import es.verdnatura.domain.notNull
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.ItemScanned
import es.verdnatura.presentation.common.LabelDialogHelper
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
import es.verdnatura.presentation.common.OnMistakeClickListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener
@ -259,7 +259,7 @@ class CollectionFragmentPickerNew(
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {//ID=0 ACTION_NEXT ID=5 ACTION_UNESPECEFIED)
if (binding.scanInput.text.toString().isNotEmpty()) {
binding.scanInput.setText(textScanned_filterDouble(binding.scanInput.text!!.toString()))
binding.scanInput.setText(textScannedFilterDouble(binding.scanInput.text!!.toString()))
isScanned =
event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
if (itemScanIsQr(binding.scanInput.text.toString())) {
@ -405,29 +405,6 @@ class CollectionFragmentPickerNew(
}
responseConfirmReservedItemShelvingSale.observe(viewLifecycleOwner) {
myGroupList[positionConfirm].isPicked = 1
saleAdapter!!.notifyDataSetChanged()
lm!!.scrollToPositionWithOffset(storedPosition, 0)
/* viewModel.collectionTicketGetSalix(
collection.collectionFk, print = false
)*/
}
/*
responseItemShelvingSale.observe(viewLifecycleOwner) {
myGroupList[positionConfirm].isPicked = 1
myGroupList[positionConfirm].reservedQuantity = quantityConfirm
viewModel.collectionTicketGetSalix(
collection.collectionFk, print = false
)
lm!!.scrollToPositionWithOffset(positionConfirm, 0)
ma.messageWithSound(
getString(R.string.operationSuccess), it.isError, !it.isError, isToasted = false
)
}*/
loadUnpicked.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull {
@ -439,6 +416,18 @@ class CollectionFragmentPickerNew(
}
}
loadPicked.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull {
if (it) {
myGroupList[positionConfirm].isPicked = 1
saleAdapter!!.notifyItemChanged(positionConfirm)
lm!!.scrollToPositionWithOffset(positionConfirm, 0)
setTotalLines()
} else {
updateScreen()
}
}
}
responseItemShelvingSaleGroup.observe(viewLifecycleOwner) {
viewModel.collectionTicketGetSalix(
@ -658,7 +647,10 @@ class CollectionFragmentPickerNew(
isMarking = true
viewModel.itemShelvingSaleSetQuantity(
myGroupList[position].itemShelvingSaleFk, quantity, isItemShelvingSaleEmpty
myGroupList[position].itemShelvingSaleFk,
quantity,
isItemShelvingSaleEmpty,
shelvingFk = myGroupList[position].code!!
)
val mySale = sales[position].itemShelvingSaleFk
@ -869,22 +861,7 @@ class CollectionFragmentPickerNew(
}.setOkButtonTwo(getString(R.string.no)) {
scanRequest()
customDialogThreeButtonsQuantity.dismiss()
viewModel.itemShelvingSaleExists(
myGroupList[position].itemShelvingSaleFk,
myGroupList[position].itemShelvingFk,
position,
quantity
)
/* if (quantity == 0) {
viewModel.itemShelvingSaleExists(
myGroupList[position].itemShelvingSaleFk,
myGroupList[position].itemShelvingFk,
position,
quantity
)
} else {
markLine(position, quantity, true)
}*/
markLine(position, quantity, true)
}.setKoButton(getString(R.string.cancel)) {
scanRequest()
customDialogThreeButtonsQuantity.dismiss()
@ -1108,20 +1085,19 @@ class CollectionFragmentPickerNew(
}
}
if (isTicket) {
val builder = AlertDialog.Builder(context)
builder.setTitle(getString(R.string.selectLabeltoPrint))
val labelCount = arrayOf("1", "2", "3", "4", "5", "6", "7", "8", "9", "10")
builder.setItems(labelCount) { dialog, which ->
viewModel.collectionStickerPrint(
collectionFk = collection.collectionFk, labelCount = (which + 1)
)
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(
PRINTERNAME
)).toast(requireContext())
val labelDialogHelper = LabelDialogHelper(requireContext())
labelDialogHelper.showLabelDialog(
onItemSelected = { labelCount ->
viewModel.collectionStickerPrint(
collectionFk = collection.collectionFk,
labelCount = labelCount
)
}
val dialog = builder.create()
dialog.show()
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(
PRINTERNAME
)).toast(requireContext())
}
)
} else {
viewModel.collectionStickerPrint(
collectionFk = collection.collectionFk, null

View File

@ -1,6 +1,5 @@
package es.verdnatura.presentation.view.feature.collection.fragment
import android.app.AlertDialog
import android.content.Context
import android.graphics.drawable.Drawable
import android.media.MediaPlayer
@ -38,6 +37,7 @@ import es.verdnatura.domain.toLong
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.ItemScanned
import es.verdnatura.presentation.common.LabelDialogHelper
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
import es.verdnatura.presentation.common.OnMistakeClickListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener
@ -362,7 +362,7 @@ class CollectionFragmentPreChecker(
if (!binding.scanInput.text.toString().isNullOrEmpty()) {
//sergio:para ver si ha marcado dos veces el mismo ticket
binding.scanInput.setText(textScanned_filterDouble(binding.scanInput.text!!.toString()))
binding.scanInput.setText(textScannedFilterDouble(binding.scanInput.text!!.toString()))
//de momento solo está el qr de artículo
isScanned =
@ -399,10 +399,10 @@ class CollectionFragmentPreChecker(
it.sales.forEach { at ->
if (at.saleGroupFk != saleGroup) {
viewModel.setParking(
ticketFk = at.saleGroupFk.toInt(),
ticketFk = at.saleGroupFk!!.toInt(),
parking = myQr.more
)
saleGroup = at.saleGroupFk
saleGroup = at.saleGroupFk!!
}
}
@ -964,15 +964,16 @@ class CollectionFragmentPreChecker(
val isOnReservationMode = mobileApplication.dataStoreApp.readDataStoreKey<Boolean>(
ConstAndValues.RESERVATIONMODE
)
//lolass
if (isOnReservationMode) {
) || (mobileApplication.dataStoreApp.readDataStoreKey<Boolean?>(
ConstAndValues.SECTORISONRESERVATIONMODE
) == true)
sales = salesList.filter {
sales = if (isOnReservationMode) {
salesList.filter {
it.sectorFk == mobileApplication.dataStoreApp.readDataStoreKey<Int>(SECTORFK)
}.sortedWith(compareBy({ it.saleOrder }))
} else {
sales = salesList.filter {
salesList.filter {
it.sectorFk == mobileApplication.dataStoreApp.readDataStoreKey<Int>(SECTORFK)
}.sortedWith(compareBy({ it.picked }))
}
@ -983,7 +984,7 @@ class CollectionFragmentPreChecker(
saleAdapter =
SaleAdapter(
sales,
sales as MutableList,
pasillerosItemClickListener!!,
object : OnQuantityClickListener {
@ -2266,21 +2267,19 @@ class CollectionFragmentPreChecker(
}
}
if (isTicket) {
val builder = AlertDialog.Builder(context)
builder.setTitle(getString(R.string.selectLabeltoPrint))
val labelCount = arrayOf("1", "2", "3", "4", "5", "6", "7", "8", "9", "10")
builder.setItems(labelCount) { dialog, which ->
viewModel.collectionStickerPrint(
collectionFk = collection.collectionFk,
labelCount = (which + 1)
)
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(
PRINTERNAME
)).toast(requireContext())
val labelDialogHelper = LabelDialogHelper(requireContext())
labelDialogHelper.showLabelDialog(
onItemSelected = { labelCount ->
viewModel.collectionStickerPrint(
collectionFk = collection.collectionFk,
labelCount = labelCount
)
}
val dialog = builder.create()
dialog.show()
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(
PRINTERNAME
)).toast(requireContext())
}
)
} else {
viewModel.collectionStickerPrint(
collectionFk = collection.collectionFk,

View File

@ -180,8 +180,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val loadAddNew: LiveData<Event<ResponseItemVO>> = _responseNew.map { Event(it) }
private val _responseCode by lazy { MutableLiveData<Int?>() }
val responseCode: LiveData<Int?>
get() = _responseCode
val responseCode: LiveData<Int?> = _responseCode
val loadResponseCode: LiveData<Event<Int?>> = _responseCode.map { Event(it) }
private val _responseIncQuantity by lazy { MutableLiveData<ResponseItemVO>() }
val responseIncQuantity: LiveData<ResponseItemVO>
@ -431,10 +431,18 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
itemShelvingSaleFk: Int,
quantity: Int,
isItemShelvingSaleEmpty: Boolean?,
sectorFk: Int? = null
sectorFk: Int? = null,
shelvingFk: String
) {
salix.itemShelvingSaleSetquantitySalix(
params = arrayListOf(itemShelvingSaleFk, quantity, isItemShelvingSaleEmpty, sectorFk)
params = arrayListOf(
itemShelvingSaleFk,
quantity,
isItemShelvingSaleEmpty,
sectorFk,
shelvingFk
).formatWithQuotes()
).enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
@ -444,6 +452,12 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
_responseCollectionAddItem.value = true
}
override fun onError(t: Throwable) {
_responseConfirmReservedItemShelvingSale.value = false
super.onError(t)
}
})
}

View File

@ -55,7 +55,7 @@ class ControladorFragment :
goBack = false
if (!binding.scanInput.text.isNullOrEmpty()) {
binding.scanInput.setText(textScanned_filterDouble(binding.scanInput.text!!.toString()))
binding.scanInput.setText(textScannedFilterDouble(binding.scanInput.text!!.toString()))
try {
binding.scanInput.setText(
itemScanValue(

View File

@ -175,7 +175,7 @@ class LogExpeditionFragment(
binding.routeLayout.visibility = View.VISIBLE
binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE
binding.route.text = routeDelivery.ticket.routeFk.toString()
binding.agency.text = routeDelivery.ticket.route.agencyMode.agency.name ?: ""
binding.agency.text = routeDelivery.ticket.route?.agencyMode?.agency?.name ?: ""
binding.scanInput.setText("")
}

View File

@ -78,7 +78,7 @@ data class Agency(
class TicketSalix(
var id: Int,
var routeFk: Int?,
var route: RouteSalix,
var route: RouteSalix?,
)

View File

@ -44,7 +44,6 @@ import es.verdnatura.presentation.view.feature.inventario.model.ItemShelvingVisi
import es.verdnatura.presentation.view.feature.inventario.model.ItemShelvingVisibleZero
import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO
import kotlinx.coroutines.runBlocking
import timber.log.Timber.d
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
class InventaryParkingFragment(
@ -77,13 +76,15 @@ class InventaryParkingFragment(
override fun getLayoutId(): Int = R.layout.fragment_inventory_parking
override fun onPause() {
try {
// try {
if (binding.inventoryParkingRecyclerview.layoutManager != null) {
val layoutManager =
binding.inventoryParkingRecyclerview.layoutManager as LinearLayoutManager
scrollPosition = layoutManager.findFirstVisibleItemPosition()
} catch (exception: Exception) {
d(exception)
}
/* } catch (ex: Exception) {
ex.message!! + "hola".toast(requireContext())
}*/
isBack = true
super.onPause()
@ -193,7 +194,7 @@ class InventaryParkingFragment(
)
} catch (ex: Exception) {
d(ex)
ex.message!!.toast(requireContext())
}
}
@ -475,10 +476,14 @@ class InventaryParkingFragment(
ex.message!!.toast(requireContext())
}
positionShelvingChecking = myListInventory.indexOfFirst { item ->
item.shelvingFk.uppercase() == binding.editMatricula.text.toString()
positionShelvingChecking = try {
myListInventory.indexOfFirst { item ->
item.shelvingFk.uppercase() == binding.editMatricula.text.toString()
}
} catch (ex: Exception) {
-1
}
if (positionShelvingChecking != -1) {
shelvingSaved =
myListInventory[positionShelvingChecking].shelvingFk.uppercase()
@ -611,7 +616,7 @@ class InventaryParkingFragment(
positionShelvingChecking = -1
} catch (ex: Exception) {
d(ex)
ex.message!!.toast(requireContext())
}
}
}

View File

@ -18,8 +18,8 @@ data class WorkerData(
val labelerFk: Int,
val sectorFk: Int,
val sector: Sector?,
val printer: Printer,
val train: Train,
val printer: Printer?,
val train: Train?,
val id: Int,
val name: String,
val nickname: String,

View File

@ -1,7 +1,6 @@
package es.verdnatura.presentation.view.feature.paletizador.adapter
import android.content.Context
import android.util.Log
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.core.content.ContextCompat
@ -12,47 +11,63 @@ import es.verdnatura.presentation.common.OnComprobarPalletViewClickListener
import es.verdnatura.presentation.common.OnPalletClickListener
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
import timber.log.Timber.d
class ExpeditionPalletAdapter (
class ExpeditionPalletAdapter(
private val items: List<ItemPalletVO>,
private val onPalletClickListener: OnPalletClickListener,
private val onComprobarPalletViewClickListener: OnComprobarPalletViewClickListener,
private val itemExpeditionTruckVO: ItemExpeditionTruckVO
): RecyclerView.Adapter<ExpeditionPalletAdapter.ItemHolder> () {
) : RecyclerView.Adapter<ExpeditionPalletAdapter.ItemHolder>() {
private var context:Context? = null
private var context: Context? = null
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
this.context = parent.context
return ItemHolder(
ItemExpeditionpalletRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
ItemExpeditionpalletRowBinding.inflate(
LayoutInflater.from(parent.context),
parent,
false
)
)
}
override fun getItemCount() =items.size
override fun getItemCount() = items.size
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
holder.bind(items[position])
holder.binding.root.setOnClickListener {
onPalletClickListener.onPalletClickListener(itemExpeditionTruckVO,items[position])
onPalletClickListener.onPalletClickListener(itemExpeditionTruckVO, items[position])
}
holder.binding.root.setOnLongClickListener {
onComprobarPalletViewClickListener.onComprobarPalletViewClickListener(itemExpeditionTruckVO,items[position])
onComprobarPalletViewClickListener.onComprobarPalletViewClickListener(
itemExpeditionTruckVO,
items[position]
)
true
}
}
inner class ItemHolder(
val binding: ItemExpeditionpalletRowBinding
) : RecyclerView.ViewHolder(binding.root){
) : RecyclerView.ViewHolder(binding.root) {
private val res = binding.root.context.resources
fun bind(item: ItemPalletVO) {
binding.apply {
this.item = item
if (item.Rutas != 1){
expeditionPalletRutas.setTextColor(ContextCompat.getColor(context!!, R.color.verdnatura_red))
}else {
expeditionPalletRutas.setTextColor(ContextCompat.getColor(context!!, R.color.verdnatura_white))
if (item.Rutas != 1) {
expeditionPalletRutas.setTextColor(
ContextCompat.getColor(
context!!,
R.color.verdnatura_red
)
)
} else {
expeditionPalletRutas.setTextColor(
ContextCompat.getColor(
context!!,
R.color.verdnatura_white
)
)
}
}
}

View File

@ -90,7 +90,7 @@ class ExpeditionDeleteFragment(var title: String = "") :
if (binding.editMatricula.text.toString().isNotEmpty()) {
try {
val itemScaned = itemScanValue(
textScanned_filterDouble(binding.editMatricula.text.toString()),
textScannedFilterDouble(binding.editMatricula.text.toString()),
arrayOf("expedition"),
"id"
).toString().toLong()

View File

@ -93,7 +93,7 @@ class ExpeditionPreparedStateFragment(var codeState: String = "PREPARED", var ti
if (binding.editMatricula.text.toString().isNotEmpty()) {
try {
val itemScaned = itemScanValue(
textScanned_filterDouble(binding.editMatricula.text.toString()),
textScannedFilterDouble(binding.editMatricula.text.toString()),
arrayOf("expedition"),
"id"
).toString().toLong()

View File

@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.sacador.fragment
import android.content.Context
import android.graphics.drawable.Drawable
import android.text.InputType
import android.util.Log.d
import android.view.View
import android.view.inputmethod.EditorInfo
import android.widget.ImageView
@ -242,7 +243,12 @@ class SacadorFragmentNew(
} else {
if (it.response.isNotBlank()) {
if (collectionsList.isNotEmpty()) {
addCollectionToList(it.response.toInt())
try {
addCollectionToList(it.response.toInt())
} catch (ex: Exception) {
d("vn", ex.message.toString())
}
} else {
callBack(type)
}

View File

@ -86,7 +86,7 @@ class AutomaticAddItemFragment(
listItems.add(
0,
itemScanValue(
textScanned_filterDouble(binding.editMatricula.text.toString()),
textScannedFilterDouble(binding.editMatricula.text.toString()),
arrayOf("buy"),
"more"
).toString().toLong()
@ -161,7 +161,7 @@ class AutomaticAddItemFragment(
customDialogList.setDescription(
getString(R.string.scanShelvingsLocate)
).setOkButton(getString(R.string.locate)) {
listItems.clear()
listShelvings.forEach {
viewModel.itemShelvingMakeMulti(
it.code!!,

View File

@ -70,9 +70,70 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
val loadBuyUltimateResponse: LiveData<Event<Boolean>> = _buyUltimateResponse.map { Event(it) }
fun itemShelvingListNew(
vShelvingFk: String
shelvingFk: String
) {
salix.itemShelvingListNew(params = listOf(vShelvingFk.uppercase()).formatWithQuotes())
salix.itemShelvingListNew(params = listOf(shelvingFk.uppercase()).formatWithQuotes())
.enqueue(
object : SalixCallback<List<ItemUbicador>>(context) {
override fun onSuccess(response: Response<List<ItemUbicador>>) {
_shelvingListNew.value = response.body()?.let { ItemUbicadorListNew(it) }
}
},
)
}
//Tarea 6869
fun itemShelvingGet(
shelvingFk: String
) {
salix.itemShelvingGet(
filter = """{
"fields":[
"priority",
"parkingFk",
"code"
],
"include":[
{
"relation":"parking",
"scope":{
"fields":[
"code"
]
}
},
{
"relation":"itemShelving",
"scope":{
"fields":[
"id",
"itemFk",
"visible",
"packing",
"grouping",
"isChecked",
"available",
"buyFk"
],
"include":{
"relation":"item",
"scope":{
"fields":[
"name",
"longName",
"size"
]
}
}
}
}
],
"where":{
"code":"$shelvingFk"
}
}""".trim()
)
.enqueue(
object : SalixCallback<List<ItemUbicador>>(context) {
override fun onSuccess(response: Response<List<ItemUbicador>>) {

View File

@ -1,6 +1,6 @@
#Mon Apr 19 11:48:11 CEST 2021
#Fri Nov 08 16:21:41 CET 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip