refs #6982 feat:pickerHelper
This commit is contained in:
parent
2be1c44f83
commit
1260fcaa20
|
@ -168,7 +168,7 @@ interface OnCollectionSelectedListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OnCollectionTicketSelectedListener {
|
interface OnCollectionTicketSelectedListener {
|
||||||
fun onCollectionSelected(collection: CollectionTicket, type: String)
|
fun onCollectionSelected(collection: CollectionTicket, type: String, hasPicking:Boolean = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OnQuantityClickListener {
|
interface OnQuantityClickListener {
|
||||||
|
|
|
@ -28,11 +28,22 @@ import es.verdnatura.domain.ConstAndValues.BASEURLSALIX
|
||||||
import es.verdnatura.domain.ConstAndValues.CONTROLADOR
|
import es.verdnatura.domain.ConstAndValues.CONTROLADOR
|
||||||
import es.verdnatura.domain.ConstAndValues.PRINTERNAME
|
import es.verdnatura.domain.ConstAndValues.PRINTERNAME
|
||||||
import es.verdnatura.domain.ConstAndValues.SACADOR
|
import es.verdnatura.domain.ConstAndValues.SACADOR
|
||||||
import es.verdnatura.domain.ConstAndValues.SECTORFK
|
|
||||||
import es.verdnatura.domain.notNull
|
import es.verdnatura.domain.notNull
|
||||||
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.*
|
import es.verdnatura.presentation.common.ItemScanned
|
||||||
|
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
|
||||||
|
import es.verdnatura.presentation.common.OnMistakeClickListener
|
||||||
|
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||||
|
import es.verdnatura.presentation.common.OnPackingClickSaleListener
|
||||||
|
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||||
|
import es.verdnatura.presentation.common.OnQuantityClickSaleListener
|
||||||
|
import es.verdnatura.presentation.common.OnSaleClickSaleListener
|
||||||
|
import es.verdnatura.presentation.common.OnTicketClickSaleListener
|
||||||
|
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||||
|
import es.verdnatura.presentation.common.hideKeyboard
|
||||||
|
import es.verdnatura.presentation.common.itemScanIsQr
|
||||||
|
import es.verdnatura.presentation.common.itemScanValue
|
||||||
import es.verdnatura.presentation.view.component.CustomDialog
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogInput
|
import es.verdnatura.presentation.view.component.CustomDialogInput
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogList
|
import es.verdnatura.presentation.view.component.CustomDialogList
|
||||||
|
@ -44,12 +55,16 @@ import es.verdnatura.presentation.view.feature.collection.adapter.SaleAdapterNew
|
||||||
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.*
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
|
||||||
|
import es.verdnatura.presentation.view.feature.sacador.model.Sale
|
||||||
|
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||||
class CollectionFragmentPickerNew(
|
class CollectionFragmentPickerNew(
|
||||||
var collection: CollectionTicket, var type: String = SACADOR
|
var collection: CollectionTicket,
|
||||||
|
var type: String = SACADOR,
|
||||||
|
var hasPickingOrder: Boolean = false
|
||||||
) : BaseFragment<FragmentCollectionNewBinding, CollectionViewModel>(
|
) : BaseFragment<FragmentCollectionNewBinding, CollectionViewModel>(
|
||||||
CollectionViewModel::class
|
CollectionViewModel::class
|
||||||
) {
|
) {
|
||||||
|
@ -91,8 +106,12 @@ class CollectionFragmentPickerNew(
|
||||||
private lateinit var myGroupList: List<Sale>
|
private lateinit var myGroupList: List<Sale>
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(collection: CollectionTicket, type: String) =
|
fun newInstance(
|
||||||
CollectionFragmentPickerNew(collection, type)
|
collection: CollectionTicket,
|
||||||
|
type: String,
|
||||||
|
hasPickingOrder: Boolean = false
|
||||||
|
) =
|
||||||
|
CollectionFragmentPickerNew(collection, type, hasPickingOrder)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAttach(context: Context) {
|
override fun onAttach(context: Context) {
|
||||||
|
@ -127,9 +146,11 @@ class CollectionFragmentPickerNew(
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
setEvents()
|
setEvents()
|
||||||
setToolBar()
|
setToolBar()
|
||||||
|
|
||||||
if (collection.tickets.isNotEmpty()) {
|
if (collection.tickets.isNotEmpty()) {
|
||||||
createCollectionList()
|
createCollectionList()
|
||||||
}
|
}
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +204,7 @@ class CollectionFragmentPickerNew(
|
||||||
override fun onOptionsItemSelected(item: Drawable) {
|
override fun onOptionsItemSelected(item: Drawable) {
|
||||||
|
|
||||||
when (item) {
|
when (item) {
|
||||||
iconViewCollection.drawable -> getCollection()
|
//iconViewCollection.drawable -> getCollection()
|
||||||
iconPrint.drawable -> print()
|
iconPrint.drawable -> print()
|
||||||
iconAdd.drawable -> addItem()
|
iconAdd.drawable -> addItem()
|
||||||
iconWorker.drawable -> showUser()
|
iconWorker.drawable -> showUser()
|
||||||
|
@ -227,26 +248,26 @@ class CollectionFragmentPickerNew(
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getCollection() {
|
/* private fun getCollection() {
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
if (!buttonPushedGetCollection) {
|
if (!buttonPushedGetCollection) {
|
||||||
viewModel.collection_get(
|
viewModel.collection_get(
|
||||||
collection.collectionFk,
|
collection.collectionFk,
|
||||||
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
|
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
|
||||||
print = "0",
|
print = "0",
|
||||||
type
|
type
|
||||||
)
|
)
|
||||||
buttonPushedGetCollection = true
|
buttonPushedGetCollection = true
|
||||||
} else {
|
} else {
|
||||||
viewModel.collectionTicketGetSalix(
|
viewModel.collectionTicketGetSalix(
|
||||||
lastScanned,
|
lastScanned,
|
||||||
print = false
|
print = false
|
||||||
|
|
||||||
)
|
)
|
||||||
buttonPushedGetCollection = false
|
buttonPushedGetCollection = false
|
||||||
}
|
}
|
||||||
lastScanned = collection.collectionFk
|
lastScanned = collection.collectionFk
|
||||||
}
|
}*/
|
||||||
|
|
||||||
private fun scanRequest() {
|
private fun scanRequest() {
|
||||||
binding.scanInput.requestFocus()
|
binding.scanInput.requestFocus()
|
||||||
|
@ -412,10 +433,12 @@ class CollectionFragmentPickerNew(
|
||||||
})*/
|
})*/
|
||||||
responseExistsItemShelvingSale.observe(viewLifecycleOwner, Observer {
|
responseExistsItemShelvingSale.observe(viewLifecycleOwner, Observer {
|
||||||
if (!goBack) {
|
if (!goBack) {
|
||||||
if (it.exists){
|
if (it.exists) {
|
||||||
markLine(it.position, it.quantity,true)
|
markLine(it.position, it.quantity, true)
|
||||||
}else{
|
} else {
|
||||||
"Actualizando las líneas porque la reserva está modificada".toast(requireContext())
|
"Actualizando las líneas porque la reserva está modificada".toast(
|
||||||
|
requireContext()
|
||||||
|
)
|
||||||
viewModel.collectionTicketGetSalix(collection.collectionFk, false)
|
viewModel.collectionTicketGetSalix(collection.collectionFk, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -584,12 +607,21 @@ class CollectionFragmentPickerNew(
|
||||||
|
|
||||||
tickets = ArrayList()
|
tickets = ArrayList()
|
||||||
var observations = ""
|
var observations = ""
|
||||||
|
val myPickingFrom = mobileApplication.dataStoreApp.readDataStoreKey<Int>("PICKING_FROM")
|
||||||
|
val myPickingTo = mobileApplication.dataStoreApp.readDataStoreKey<Int>("PICKING_TO")
|
||||||
collection.tickets.forEach { ticket ->
|
collection.tickets.forEach { ticket ->
|
||||||
|
|
||||||
if (!observations.isNullOrEmpty()) observations =
|
if (!observations.isNullOrEmpty()) observations =
|
||||||
observations + " " + ticket.observations
|
observations + " " + ticket.observations
|
||||||
ticket.sales.forEach { sale ->
|
ticket.sales.forEach { sale ->
|
||||||
salesList.add(sale)
|
|
||||||
|
if (hasPickingOrder) {
|
||||||
|
if (sale.pickingOrder != null && sale.pickingOrder in myPickingFrom..myPickingTo) {
|
||||||
|
salesList.add(sale)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
salesList.add(sale)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -650,7 +682,7 @@ class CollectionFragmentPickerNew(
|
||||||
showScanner(index, sale)
|
showScanner(index, sale)
|
||||||
} else {
|
} else {
|
||||||
println("Sacador **** desmarcar")
|
println("Sacador **** desmarcar")
|
||||||
unMarkLine(index, sales[index])
|
unMarkLine(index, myGroupList[index])
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -864,22 +896,28 @@ class CollectionFragmentPickerNew(
|
||||||
R.string.sure
|
R.string.sure
|
||||||
)
|
)
|
||||||
).setOkButton(getString(R.string.unmark)) {
|
).setOkButton(getString(R.string.unmark)) {
|
||||||
sale.isPicked = 0
|
if (!sale.isParent && sale.reservedQuantity == 0 && sale.originalQuantity != sale.saleQuantity) {
|
||||||
saleAdapter!!.notifyDataSetChanged()
|
"No es posible desmarcar. Hablar con responsable almacén".toast(requireContext())
|
||||||
var mySale = sale.saleFk
|
} else {
|
||||||
for (indice in myGroupList.indices) {
|
/* saleAdapter!!.notifyDataSetChanged()
|
||||||
if (!myGroupList[indice].isParent && myGroupList[indice].saleFk == mySale) {
|
var mySale = sale.saleFk
|
||||||
d("VERDNATURA::", "la pos del index de la sale es" + indice)
|
for (indice in myGroupList.indices) {
|
||||||
storedBackPosition = indice
|
if (!myGroupList[indice].isParent && myGroupList[indice].saleFk == mySale) {
|
||||||
}
|
d("VERDNATURA::", "la pos del index de la sale es" + indice)
|
||||||
|
storedBackPosition = indice
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
storedBackPosition = position
|
||||||
|
setListPosition(position, false)
|
||||||
|
|
||||||
|
viewModel.itemShelvingSaleUnpicked(myGroupList[position].itemShelvingSaleFk)
|
||||||
|
sale.isPicked = 0
|
||||||
|
positionUnmarked = position
|
||||||
|
setTotalLines()
|
||||||
|
scanRequest()
|
||||||
}
|
}
|
||||||
storedBackPosition = position
|
|
||||||
setListPosition(position, false)
|
|
||||||
viewModel.itemShelvingSaleUnpicked(sales[position].itemShelvingSaleFk)
|
|
||||||
println("itemshelvingSale ${sales[position].itemShelvingSaleFk}")
|
|
||||||
positionUnmarked = position
|
|
||||||
setTotalLines()
|
|
||||||
scanRequest()
|
|
||||||
customDialog.dismiss()
|
customDialog.dismiss()
|
||||||
}.setKoButton(getString(R.string.cancel)) {
|
}.setKoButton(getString(R.string.cancel)) {
|
||||||
scanRequest()
|
scanRequest()
|
||||||
|
@ -953,8 +991,16 @@ class CollectionFragmentPickerNew(
|
||||||
var quantityToReserve = customDialogList.getValue().toInt()
|
var quantityToReserve = customDialogList.getValue().toInt()
|
||||||
|
|
||||||
if (quantityToReserve < totalReserved) {
|
if (quantityToReserve < totalReserved) {
|
||||||
customDialogList.dismiss()
|
|
||||||
showQuestionUbicationEmpty(position, quantityToReserve)
|
if (customDialogList.getValueTwo() in sales[position].Barcodes || customDialogList.getValueTwo() == sales[position].itemFk.toString()) {
|
||||||
|
customDialogList.dismiss()
|
||||||
|
showQuestionUbicationEmpty(position, quantityToReserve)
|
||||||
|
} else {
|
||||||
|
ma.messageWithSound(
|
||||||
|
message = "Indique el item correctamente", isError =
|
||||||
|
true, isPlayed = true, isToasted = false
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (quantityToReserve > totalReserved) {
|
if (quantityToReserve > totalReserved) {
|
||||||
|
@ -1025,7 +1071,8 @@ class CollectionFragmentPickerNew(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showQuestionUbicationEmpty(position: Int, quantity: Int = 0) {
|
private fun showQuestionUbicationEmpty(position: Int, quantity: Int = 0) {
|
||||||
customDialogThreeButtonsQuantity.setTitle("Cambio de cantidad a $quantity")
|
|
||||||
|
customDialogThreeButtonsQuantity.setTitle("Cambio de cantidad a $quantity del artículo ${sales[position].itemFk}")
|
||||||
.setDescription("¿Quedan unidades del artículo ${sales[position].itemFk} en el carro escaneado?")
|
.setDescription("¿Quedan unidades del artículo ${sales[position].itemFk} en el carro escaneado?")
|
||||||
.setValue("").setCustomDialogValue(View.GONE)
|
.setValue("").setCustomDialogValue(View.GONE)
|
||||||
customDialogThreeButtonsQuantity.setOkButtonAdd("SI") {
|
customDialogThreeButtonsQuantity.setOkButtonAdd("SI") {
|
||||||
|
@ -1038,9 +1085,15 @@ class CollectionFragmentPickerNew(
|
||||||
}.setOkButtonTwo("NO") {
|
}.setOkButtonTwo("NO") {
|
||||||
scanRequest()
|
scanRequest()
|
||||||
customDialogThreeButtonsQuantity.dismiss()
|
customDialogThreeButtonsQuantity.dismiss()
|
||||||
if (quantity == 0){
|
if (quantity == 0) {
|
||||||
viewModel.itemShelvingSaleExists(myGroupList[position].itemShelvingSaleFk, position, quantity)
|
viewModel.itemShelvingSaleExists(
|
||||||
}else{markLine(position, quantity, true)}
|
myGroupList[position].itemShelvingSaleFk,
|
||||||
|
position,
|
||||||
|
quantity
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
markLine(position, quantity, true)
|
||||||
|
}
|
||||||
//markLine(position, quantity, true)
|
//markLine(position, quantity, true)
|
||||||
}.setKoButton("CANCELAR") {
|
}.setKoButton("CANCELAR") {
|
||||||
scanRequest()
|
scanRequest()
|
||||||
|
|
|
@ -850,6 +850,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
getString(R.string.tickets) -> {
|
getString(R.string.tickets) -> {
|
||||||
addFragmentOnTop(TicketsFragment.newInstance(item.title, entryPoint))
|
addFragmentOnTop(TicketsFragment.newInstance(item.title, entryPoint))
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.pickerHelper) -> {
|
getString(R.string.pickerHelper) -> {
|
||||||
addFragmentOnTop(PickerHelperFragment.newInstance(item.title))
|
addFragmentOnTop(PickerHelperFragment.newInstance(item.title))
|
||||||
}
|
}
|
||||||
|
@ -981,9 +982,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCollectionSelected(collection: CollectionTicket, type: String) {
|
override fun onCollectionSelected(
|
||||||
|
collection: CollectionTicket,
|
||||||
|
type: String,
|
||||||
|
hasPicking: Boolean
|
||||||
|
) {
|
||||||
|
|
||||||
addFragmentOnTop(CollectionFragmentPickerNew.newInstance(collection, type))
|
addFragmentOnTop(CollectionFragmentPickerNew.newInstance(collection, type, hasPicking))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,46 +3,37 @@ package es.verdnatura.presentation.view.feature.sacador.fragment
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.os.Build
|
|
||||||
import android.text.InputType
|
|
||||||
import android.view.View.GONE
|
import android.view.View.GONE
|
||||||
import android.view.View.VISIBLE
|
import android.view.View.VISIBLE
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import androidx.annotation.RequiresApi
|
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import androidx.lifecycle.Observer
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import com.google.gson.JsonArray
|
|
||||||
import com.google.gson.JsonObject
|
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentInventoryParkingBinding
|
import es.verdnatura.databinding.FragmentGeneralBlackBinding
|
||||||
|
import es.verdnatura.domain.ConstAndValues
|
||||||
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.OnBarcodeRowClickListener
|
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
|
||||||
import es.verdnatura.presentation.common.OnMoreClickListener
|
import es.verdnatura.presentation.common.OnCollectionTicketSelectedListener
|
||||||
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||||
import es.verdnatura.presentation.common.OnVisibleInventoryClickListener
|
|
||||||
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||||
import es.verdnatura.presentation.common.itemScanValue
|
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogInput
|
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogList
|
import es.verdnatura.presentation.view.component.CustomDialogList
|
||||||
import es.verdnatura.presentation.view.feature.articulo.adapter.BarcodeAdapter
|
import es.verdnatura.presentation.view.feature.articulo.adapter.BarcodeAdapter
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
|
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
|
||||||
import es.verdnatura.presentation.view.feature.inventario.adapter.InventoryParkingAdapter
|
import es.verdnatura.presentation.view.feature.inventario.adapter.InventoryParkingAdapter
|
||||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventoryParking
|
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventoryParking
|
||||||
import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
|
|
||||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||||
class PickerHelperFragment(
|
class PickerHelperFragment(
|
||||||
var title: String = "",
|
var title: String = ""
|
||||||
) : BaseFragment<FragmentInventoryParkingBinding, SacadorViewModel>(
|
) : BaseFragment<FragmentGeneralBlackBinding, SacadorViewModel>(
|
||||||
SacadorViewModel::class
|
SacadorViewModel::class
|
||||||
) {
|
) {
|
||||||
|
private var onCollectionSelectedListener: OnCollectionTicketSelectedListener? = null
|
||||||
private var adapter: InventoryParkingAdapter? = null
|
private var adapter: InventoryParkingAdapter? = null
|
||||||
private lateinit var customDialogInput: CustomDialogInput
|
|
||||||
private lateinit var customDialogList: CustomDialogList
|
private lateinit var customDialogList: CustomDialogList
|
||||||
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
||||||
private var isBack = false
|
private var isBack = false
|
||||||
|
@ -62,56 +53,47 @@ class PickerHelperFragment(
|
||||||
fun newInstance(title: String) = PickerHelperFragment(title)
|
fun newInstance(title: String) = PickerHelperFragment(title)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_inventory_parking
|
override fun getLayoutId(): Int = R.layout.fragment_general_black
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
|
|
||||||
try {
|
|
||||||
val layoutManager =
|
|
||||||
binding.inventoryParkingRecyclerview.layoutManager as LinearLayoutManager
|
|
||||||
scrollPosition = layoutManager.findFirstVisibleItemPosition()
|
|
||||||
} catch (exception: Exception) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
isBack = true
|
isBack = true
|
||||||
super.onPause()
|
super.onPause()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAttach(context: Context) {
|
override fun onAttach(context: Context) {
|
||||||
if (context is OnPasillerosItemClickListener) pasillerosItemClickListener = context
|
|
||||||
super.onAttach(context)
|
super.onAttach(context)
|
||||||
|
if (context is OnCollectionTicketSelectedListener) onCollectionSelectedListener = context
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
|
|
||||||
customDialogInput = CustomDialogInput(requireContext())
|
|
||||||
customDialogList = CustomDialogList(requireContext())
|
customDialogList = CustomDialogList(requireContext())
|
||||||
|
|
||||||
ma.hideBottomNavigation(GONE)
|
ma.hideBottomNavigation(GONE)
|
||||||
binding.mainToolbar.toolbarTitle.text = title
|
binding.mainToolbar.toolbarTitle.text = title
|
||||||
setEvents()
|
setEvents()
|
||||||
setViews()
|
|
||||||
setToolBar()
|
setToolBar()
|
||||||
if (!isBack) {
|
checkParkingsToPicker()
|
||||||
setParkingFromTo()
|
|
||||||
}
|
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setViews() {
|
private fun checkParkingsToPicker() {
|
||||||
binding.inventoryParkingRecyclerview.addOnScrollListener(object :
|
|
||||||
RecyclerView.OnScrollListener() {
|
val parkingFrom = mobileApplication.dataStoreApp.readDataStoreKey<String>("PARKING_FROM")
|
||||||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
val parkingTo = mobileApplication.dataStoreApp.readDataStoreKey<String>("PARKING_TO")
|
||||||
scrollPosition =
|
|
||||||
(recyclerView.layoutManager as LinearLayoutManager).findFirstVisibleItemPosition()
|
if (parkingTo.isNotBlank()) {
|
||||||
super.onScrolled(recyclerView, dx, dy)
|
binding.mainToolbar.toolbarTitle.text =
|
||||||
}
|
getString(R.string.parkingForPicking, parkingFrom, parkingTo)
|
||||||
})
|
} else {
|
||||||
|
showSettingsHelper(
|
||||||
|
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
|
||||||
private fun setToolBar() {
|
private fun setToolBar() {
|
||||||
|
|
||||||
val iconAdd = ImageView(context)
|
val iconAdd = ImageView(context)
|
||||||
|
@ -129,25 +111,15 @@ class PickerHelperFragment(
|
||||||
val iconParkingFrom = ImageView(context)
|
val iconParkingFrom = ImageView(context)
|
||||||
iconParkingFrom.setImageResource(R.drawable.ic_eye_inventory)
|
iconParkingFrom.setImageResource(R.drawable.ic_eye_inventory)
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
iconParkingFrom.tooltipText = getTooltip(R.drawable.ic_eye_inventory)
|
||||||
iconParkingFrom.tooltipText = getTooltip(R.drawable.ic_eye_inventory)
|
iconReload.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
|
||||||
iconReload.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
|
iconAdd.tooltipText = getString(R.string.addItemShelving)
|
||||||
iconAdd.tooltipText = getString(R.string.addItemShelving)
|
iconReset.tooltipText = getTooltip(R.drawable.ic_remove_checks)
|
||||||
iconReset.tooltipText = getTooltip(R.drawable.ic_remove_checks)
|
iconFilter.tooltipText = getTooltip(R.drawable.ic_filter_inventory)
|
||||||
iconFilter.tooltipText = getTooltip(R.drawable.ic_filter_inventory)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (listIcons.isEmpty()) {
|
listIcons.add(iconReset)
|
||||||
listIcons.add(iconParkingFrom)
|
listIcons.add(iconParkingFrom)
|
||||||
listIcons.add(iconFilter)
|
|
||||||
listIcons.add(iconReset)
|
|
||||||
} else {
|
|
||||||
listIcons.clear()
|
|
||||||
listIcons.add(iconParkingFrom)
|
|
||||||
listIcons.add(iconFilter)
|
|
||||||
listIcons.add(iconReset)
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.mainToolbar.toolbarIcons.adapter =
|
binding.mainToolbar.toolbarIcons.adapter =
|
||||||
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
||||||
|
@ -155,123 +127,58 @@ class PickerHelperFragment(
|
||||||
|
|
||||||
when (item) {
|
when (item) {
|
||||||
|
|
||||||
iconFilter.drawable -> {
|
|
||||||
try {
|
|
||||||
filterActivated = !filterActivated
|
|
||||||
adapter!!.setItems(if (filterActivated) {
|
|
||||||
myListInventory.filter { it.isChecked == null || it.isChecked == 0 }
|
|
||||||
} else {
|
|
||||||
myListInventory
|
|
||||||
})
|
|
||||||
iconFilter.drawable.setTint(
|
|
||||||
ContextCompat.getColor(
|
|
||||||
context!!,
|
|
||||||
if (filterActivated) R.color.verdnatura_pumpkin_orange else R.color.verdnatura_white
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
} catch (ex: Exception) {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
iconReset.drawable -> {
|
iconReset.drawable -> {
|
||||||
if (!myListInventory.isNullOrEmpty()) {
|
|
||||||
binding.textinputlayoutMatricula.visibility = VISIBLE
|
showResetShelving()
|
||||||
showResetShelving()
|
|
||||||
} else {
|
|
||||||
getString(R.string.listInventoryEmpty).toast(requireContext())
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
iconParkingFrom.drawable -> {
|
iconParkingFrom.drawable -> {
|
||||||
|
|
||||||
setParkingFromTo()
|
showSettingsHelper()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
chageListAdapter(listIcons.filter { it != iconReset })
|
|
||||||
binding.mainToolbar.toolbarIcons.layoutManager =
|
binding.mainToolbar.toolbarIcons.layoutManager =
|
||||||
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun chageListAdapter(filterList: List<ImageView>, removeReset: Boolean = false) {
|
|
||||||
if (!removeReset) {
|
|
||||||
(binding.mainToolbar.toolbarIcons.adapter as ToolBarAdapterTooltip).setItemsList(
|
|
||||||
filterList
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
(binding.mainToolbar.toolbarIcons.adapter as ToolBarAdapterTooltip).setItemsList(
|
|
||||||
filterList.filter {
|
|
||||||
it.drawable.constantState?.equals(
|
|
||||||
context?.getDrawable(
|
|
||||||
R.drawable.ic_remove_checks
|
|
||||||
)?.constantState
|
|
||||||
) != true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun showResetShelving() {
|
private fun showResetShelving() {
|
||||||
customDialogInput.setFocusText()
|
binding.mainToolbar.toolbarTitle.text = title
|
||||||
customDialogInput.setInputText(InputType.TYPE_CLASS_TEXT)
|
runBlocking {
|
||||||
customDialogInput.setTitle(getString(R.string.checkItemShelvingDescrip))
|
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||||
.setDescription(getString(R.string.checkItemShelvingSelect))
|
"PARKING_FROM", ""
|
||||||
.setOkButton(getString(R.string.cancel)) {
|
)
|
||||||
customDialogInput.dismiss()
|
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||||
}.setKoButton(getString(R.string.ok)) {
|
"PICKING_FROM", 0
|
||||||
checkSelvingsForUpdate(customDialogInput.getValue())
|
)
|
||||||
}.show()
|
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||||
|
"PARKING_TO", ""
|
||||||
customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ ->
|
)
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||||
|
"PICKING_TO", 0
|
||||||
if (customDialogInput.getValue().isNotEmpty()) {
|
)
|
||||||
checkSelvingsForUpdate(customDialogInput.getValue())
|
|
||||||
}
|
|
||||||
return@setOnEditorActionListener true
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
}
|
||||||
|
showSettingsHelper()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkSelvingsForUpdate(shelvingInput: String) {
|
private fun showSettingsHelper() {
|
||||||
|
|
||||||
val filter = JsonObject()
|
customDialogList.setTitle(
|
||||||
val inqValues = JsonArray()
|
"Parkings del almacén"
|
||||||
for (item in myListInventory) {
|
)
|
||||||
if (item.shelvingFk == shelvingInput) {
|
customDialogList.setDescription(
|
||||||
inqValues.add(item.id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (inqValues.size() == 0) {
|
|
||||||
ma.messageWithSound("", true, true, "", null)
|
|
||||||
} else {
|
|
||||||
filter.add("id", JsonObject().apply { add("inq", inqValues) })
|
|
||||||
/* viewModel.itemShelvingsReset(
|
|
||||||
filter, ItemShelvingChecked(null, mobileApplication.userId!!)
|
|
||||||
)*/
|
|
||||||
}
|
|
||||||
ma.hideKeyboard(customDialogInput.getEditText())
|
|
||||||
customDialogInput.setValue("")
|
|
||||||
customDialogInput.dismiss()
|
|
||||||
binding.editMatricula.requestFocus()
|
|
||||||
|
|
||||||
}
|
"Indica los parkings por los que voy a estar sacando"
|
||||||
|
)
|
||||||
private fun setParkingFromTo() {
|
|
||||||
binding.textinputlayoutMatricula.visibility = VISIBLE
|
|
||||||
customDialogList.setTitle("Parkings del almacén")
|
|
||||||
customDialogList.setDescription("Indica los parkings por los que voy a sacar")
|
|
||||||
.setKoButton(getString(R.string.cancel)) {
|
.setKoButton(getString(R.string.cancel)) {
|
||||||
ma.hideKeyboard(customDialogList.getEditText())
|
ma.hideKeyboard(customDialogList.getEditText())
|
||||||
listParkings = ArrayList()
|
listParkings = ArrayList()
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
|
ma.onMyBackPressed()
|
||||||
}.setValue("").show()
|
}.setValue("").show()
|
||||||
|
|
||||||
customDialogList.getEditText().requestFocus()
|
customDialogList.getEditText().requestFocus()
|
||||||
|
@ -282,26 +189,35 @@ class PickerHelperFragment(
|
||||||
if (customDialogList.getValue().isNotEmpty()) {
|
if (customDialogList.getValue().isNotEmpty()) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (listParkings.size == 2) {
|
when (listParkings.size) {
|
||||||
callGetInventory(
|
0 -> {
|
||||||
listParkings.first().code!!.uppercase(),
|
listParkings.add(0, BarcodeVO(code = customDialogList.getValue()))
|
||||||
customDialogList.getValue().uppercase()
|
viewModel.getPickingOrder(customDialogList.getValue())
|
||||||
)
|
|
||||||
|
}
|
||||||
|
|
||||||
|
1 -> {
|
||||||
|
listParkings.add(
|
||||||
|
0,
|
||||||
|
BarcodeVO(code = customDialogList.getValue())
|
||||||
|
)
|
||||||
|
viewModel.getPickingOrder(customDialogList.getValue())
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
listParkings.clear()
|
||||||
|
customDialogList.dismiss()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
ma.hideKeyboard(customDialogList.getEditText())
|
|
||||||
listParkings.clear()
|
|
||||||
customDialogList.dismiss()
|
|
||||||
binding.editMatricula.requestFocus()
|
|
||||||
} else {
|
|
||||||
customDialogList.setDescription(getString(R.string.selectParkingsTo))
|
|
||||||
listParkings.add(0, BarcodeVO(code = customDialogList.getValue()))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
ma.messageWithSound(e.message.toString(), true, true, "", true)
|
ma.messageWithSound(e.message.toString(), isError = true, isPlayed = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
listWagonsAdapter!!.notifyItemInserted(listParkings.size - 1)
|
listWagonsAdapter!!.notifyItemChanged(0)
|
||||||
}
|
}
|
||||||
customDialogList.setValue("")
|
customDialogList.setValue("")
|
||||||
ma.hideKeyboard(customDialogList.getEditText())
|
ma.hideKeyboard(customDialogList.getEditText())
|
||||||
|
@ -311,7 +227,8 @@ class PickerHelperFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
listWagonsAdapter = BarcodeAdapter(
|
listWagonsAdapter = BarcodeAdapter(
|
||||||
listParkings, object : OnBarcodeRowClickListener {
|
listParkings,
|
||||||
|
object : OnBarcodeRowClickListener {
|
||||||
override fun onBarcodeRowClickListener(item: BarcodeVO) {
|
override fun onBarcodeRowClickListener(item: BarcodeVO) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -324,130 +241,32 @@ class PickerHelperFragment(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun callGetInventory(parkingFromScan: String, parkingToScan: String) {
|
|
||||||
parkingFrom = parkingFromScan
|
|
||||||
parkingTo = parkingToScan
|
|
||||||
/* viewModel.getInventoryParking(
|
|
||||||
parkingFromScan, parkingToScan
|
|
||||||
)*/
|
|
||||||
binding.mainToolbar.toolbarTitle.text = "$parkingFrom → $parkingTo"
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
private fun setEvents() {
|
private fun setEvents() {
|
||||||
|
|
||||||
|
binding.scanInput.visibility = VISIBLE
|
||||||
|
binding.scanInput.setHint(getString(R.string.scanCollection))
|
||||||
binding.mainToolbar.backButton.setOnClickListener {
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
isBack = true
|
ma.onMyBackPressed()
|
||||||
if (shelvingSaved.isNullOrBlank()) {
|
|
||||||
ma.onMyBackPressed()
|
|
||||||
} else {
|
|
||||||
resetChecking()
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.inventorySwipe.setOnRefreshListener {
|
binding.scanInput.requestFocus()
|
||||||
|
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
|
||||||
positionShelvingChecking = -1
|
|
||||||
positionItemChecking = -1
|
|
||||||
shelvingSaved = ""
|
|
||||||
/* viewModel.getInventoryParking(
|
|
||||||
parkingFrom, parkingTo
|
|
||||||
)*/
|
|
||||||
|
|
||||||
binding.editMatricula.hint = getString(R.string.scanShelving)
|
|
||||||
chageListAdapter(listIcons.filter {
|
|
||||||
it.drawable.constantState?.equals(
|
|
||||||
context?.getDrawable(
|
|
||||||
R.drawable.ic_remove_checks
|
|
||||||
)?.constantState
|
|
||||||
) != true
|
|
||||||
})
|
|
||||||
|
|
||||||
binding.inventorySwipe.isRefreshing = false
|
|
||||||
|
|
||||||
}
|
|
||||||
binding.editMatricula.requestFocus()
|
|
||||||
binding.editMatricula.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) {
|
||||||
|
|
||||||
if (!binding.editMatricula.text.toString().isEmpty()) {
|
if (binding.scanInput.text.toString().isNotEmpty()) {
|
||||||
|
|
||||||
if (positionShelvingChecking == -1) {
|
try {
|
||||||
|
navigateToCollectionList(binding.scanInput.text.toString().toInt())
|
||||||
|
|
||||||
try {
|
} catch (ex: Exception) {
|
||||||
binding.editMatricula.setText(
|
ex.message!!.toast(requireContext())
|
||||||
itemScanValue(
|
|
||||||
binding.editMatricula.text.toString(), "buy", "more"
|
|
||||||
).toString().uppercase()
|
|
||||||
)
|
|
||||||
} catch (ex: Exception) {
|
|
||||||
ex.message!!.toast(requireContext())
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
positionShelvingChecking = myListInventory.indexOfFirst { item ->
|
|
||||||
item.shelvingFk.uppercase() == binding.editMatricula.text.toString()
|
|
||||||
}
|
|
||||||
if (positionShelvingChecking != -1) {
|
|
||||||
shelvingSaved = myListInventory[positionShelvingChecking].shelvingFk.uppercase()
|
|
||||||
}
|
|
||||||
|
|
||||||
var allChecked = if (positionShelvingChecking != -1) {
|
|
||||||
myListInventory.filter { it.shelvingFk.uppercase() == myListInventory[positionShelvingChecking].shelvingFk.uppercase() }
|
|
||||||
.all { item ->
|
|
||||||
item.isChecked != null && item.isChecked!! > 0
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (allChecked) {
|
|
||||||
ma.messageWithSound(
|
|
||||||
getString(R.string.plateChecked), false, true, "", isToasted = true
|
|
||||||
)
|
|
||||||
chageListAdapter(listIcons)
|
|
||||||
adapter!!.setItems(myListInventory.filter { it.shelvingFk.uppercase() == myListInventory[positionShelvingChecking].shelvingFk.uppercase() })
|
|
||||||
positionShelvingChecking = -1
|
|
||||||
positionItemChecking = -1
|
|
||||||
shelvingSaved = ""
|
|
||||||
binding.editMatricula.hint = getString(R.string.scanShelving)
|
|
||||||
binding.textinputlayoutMatricula.hint = getString(R.string.scanShelving)
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (positionShelvingChecking == -1) {
|
|
||||||
ma.messageWithSound(
|
|
||||||
getString(R.string.shelvingNotFound), true, true, "", true
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
|
|
||||||
chageListAdapter(listIcons)
|
|
||||||
adapter!!.setItems(myListInventory.filter { it.shelvingFk == myListInventory[positionShelvingChecking].shelvingFk })
|
|
||||||
|
|
||||||
binding.editMatricula.hint = getString(R.string.scanItemForChecking)
|
|
||||||
binding.textinputlayoutMatricula.hint =
|
|
||||||
getString(R.string.scanItemForChecking)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
/* viewModel.getIdFromCodeSalix(
|
|
||||||
code = itemScanValue(
|
|
||||||
binding.editMatricula.text.toString(), "buy", "more"
|
|
||||||
).toString()
|
|
||||||
)*/
|
|
||||||
|
|
||||||
} catch (ex: Exception) {
|
|
||||||
ma.messageWithSound(ex.message!!, true, true, "", null)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
binding.editMatricula.setText("")
|
|
||||||
ma.hideKeyboard(binding.editMatricula)
|
|
||||||
|
binding.scanInput.setText("")
|
||||||
|
ma.hideKeyboard(binding.scanInput)
|
||||||
}
|
}
|
||||||
return@setOnEditorActionListener true
|
return@setOnEditorActionListener true
|
||||||
}
|
}
|
||||||
|
@ -456,55 +275,12 @@ class PickerHelperFragment(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun resetChecking() {
|
private fun navigateToCollectionList(collectionFk: Int) {
|
||||||
chageListAdapter(listIcons)
|
onCollectionSelectedListener!!.onCollectionSelected(
|
||||||
positionShelvingChecking = -1
|
CollectionTicket(collectionFk = collectionFk),
|
||||||
positionItemChecking = -1
|
ConstAndValues.PREPARED,
|
||||||
shelvingSaved = ""
|
true
|
||||||
binding.editMatricula.hint = getString(R.string.scanShelving)
|
)
|
||||||
binding.textinputlayoutMatricula.hint = getString(R.string.scanShelving)
|
|
||||||
callGetInventory(parkingFrom, parkingTo)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun checkItem(itemCode: String) {
|
|
||||||
positionItemChecking = myListInventory.indexOfFirst { item ->
|
|
||||||
item.itemFk == itemCode.toInt() && item.shelvingFk.uppercase() == myListInventory[positionShelvingChecking].shelvingFk.uppercase() && item.isChecked == null
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (positionItemChecking == -1) {
|
|
||||||
ma.messageWithSound(
|
|
||||||
getString(R.string.itemNotFoundScanAgain), true, true, "", true
|
|
||||||
)
|
|
||||||
|
|
||||||
positionShelvingChecking = -1
|
|
||||||
binding.editMatricula.hint = getString(R.string.scanShelvingAgain)
|
|
||||||
} else {
|
|
||||||
|
|
||||||
try {
|
|
||||||
/* viewModel.itemShelvingUpdate(
|
|
||||||
myListInventory[positionItemChecking].id,
|
|
||||||
ItemShelvingChecked(true, mobileApplication.userId!!)
|
|
||||||
)*/
|
|
||||||
myListInventory[positionItemChecking].isChecked = 1
|
|
||||||
adapter!!.notifyDataSetChanged()
|
|
||||||
binding.editMatricula.hint = getString(R.string.scanShelving)
|
|
||||||
|
|
||||||
var allChecked =
|
|
||||||
myListInventory.filter { it.shelvingFk.uppercase() == myListInventory[positionShelvingChecking].shelvingFk.uppercase() }
|
|
||||||
.all { item ->
|
|
||||||
item.isChecked != null && item.isChecked!! > 0
|
|
||||||
}
|
|
||||||
if (allChecked) {
|
|
||||||
shelvingSaved = ""
|
|
||||||
}
|
|
||||||
positionItemChecking = -1
|
|
||||||
positionShelvingChecking = -1
|
|
||||||
|
|
||||||
} catch (ex: Exception) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
|
@ -512,87 +288,54 @@ class PickerHelperFragment(
|
||||||
|
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
|
|
||||||
|
response.observe(viewLifecycleOwner) {
|
||||||
|
if (!it.isError && it.response.isNotBlank()) {
|
||||||
|
|
||||||
|
runBlocking {
|
||||||
|
when (listParkings.size) {
|
||||||
|
1 -> {
|
||||||
|
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||||
|
"PARKING_FROM",
|
||||||
|
listParkings.first().code.toString()
|
||||||
|
)
|
||||||
|
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||||
|
"PICKING_FROM",
|
||||||
|
it.response.toInt()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
response.observe(viewLifecycleOwner, Observer {
|
2 -> {
|
||||||
chageListAdapter(listIcons, true)
|
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||||
callGetInventory(
|
"PARKING_TO",
|
||||||
parkingFrom, parkingTo
|
listParkings.first().code.toString()
|
||||||
)
|
)
|
||||||
|
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||||
|
"PICKING_TO",
|
||||||
|
it.response.toInt()
|
||||||
|
)
|
||||||
|
binding.mainToolbar.toolbarTitle.text =
|
||||||
|
getString(R.string.parkingForPicking, listParkings[1].code,listParkings[0].code)
|
||||||
|
listParkings.clear()
|
||||||
|
customDialogList.dismiss()
|
||||||
|
|
||||||
})
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
//listParkings.clear()
|
||||||
|
// customDialogList.dismiss()
|
||||||
|
// showSettingsHelper()
|
||||||
|
ma.messageWithSound(
|
||||||
|
"Parking no encontrado",
|
||||||
|
isError = true,
|
||||||
|
isPlayed = true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createListInventoryParking(
|
|
||||||
) {
|
|
||||||
|
|
||||||
adapter = InventoryParkingAdapter((if (filterActivated) {
|
|
||||||
if (!shelvingSaved.isNullOrEmpty()) {
|
|
||||||
myListInventory.filter { (it.isChecked == null || it.isChecked == 0) && it.shelvingFk.uppercase() == shelvingSaved.uppercase() }
|
|
||||||
} else {
|
|
||||||
myListInventory.filter { it.isChecked == null || it.isChecked == 0 }
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if (!shelvingSaved.isNullOrEmpty()) {
|
|
||||||
myListInventory.filter { it.shelvingFk.uppercase() == shelvingSaved.uppercase() }
|
|
||||||
} else {
|
|
||||||
myListInventory
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
onPasillerosItemClickListener = pasillerosItemClickListener!!,
|
|
||||||
onVisibleInventoryClickListener = object : OnVisibleInventoryClickListener {
|
|
||||||
override fun onVisibleInventoryClickListener(item: ItemInventoryParking) {
|
|
||||||
changeVisible(item)
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
onMoreClickListener = object : OnMoreClickListener {
|
|
||||||
override fun onMoreClickListener(item: ItemUbicadorVO) {
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
binding.inventoryParkingRecyclerview.adapter = adapter
|
|
||||||
binding.inventoryParkingRecyclerview.layoutManager = LinearLayoutManager(
|
|
||||||
requireContext(), LinearLayoutManager.VERTICAL, false
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun changeVisible(item: ItemInventoryParking) {
|
|
||||||
|
|
||||||
customDialogInput.setInputText(InputType.TYPE_CLASS_NUMBER)
|
|
||||||
customDialogInput.setTitle(getString(R.string.quantity))
|
|
||||||
customDialogInput.setDescription(getString(R.string.quantityVisible)).setValue(item.visible.toString())
|
|
||||||
.setOkButton(getString(R.string.modify)) {
|
|
||||||
try {
|
|
||||||
if (customDialogInput.getValue().toInt() >= 0) {
|
|
||||||
/*viewModel.itemShelvingUpdate(
|
|
||||||
item.id, if (customDialogInput.getValue().toInt() == 0) {
|
|
||||||
ItemShelvingVisibleZero(customDialogInput.getValue().toInt(), true)
|
|
||||||
} else {
|
|
||||||
ItemShelvingVisible(customDialogInput.getValue().toInt())
|
|
||||||
}
|
|
||||||
)*/
|
|
||||||
|
|
||||||
} else {
|
|
||||||
throw Exception("")
|
|
||||||
}
|
|
||||||
} catch (err: Exception) {
|
|
||||||
(getString(R.string.errorQuantity).toast(requireContext()))
|
|
||||||
}
|
|
||||||
customDialogInput.setValue("")
|
|
||||||
customDialogInput.dismiss()
|
|
||||||
|
|
||||||
}.setKoButton(getString(R.string.cancel)) {
|
|
||||||
customDialogInput.dismiss()
|
|
||||||
}.show()
|
|
||||||
customDialogInput.setFocusText()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -753,6 +753,8 @@
|
||||||
<string name="attachImage">"Imágenes: "</string>
|
<string name="attachImage">"Imágenes: "</string>
|
||||||
<string name="pickerHelper">Sacadores asistente</string>
|
<string name="pickerHelper">Sacadores asistente</string>
|
||||||
<string name="pickerHelperDescrip">Permite sacar parte de la colección</string>
|
<string name="pickerHelperDescrip">Permite sacar parte de la colección</string>
|
||||||
|
<string name="parkingForPicking">P:%1$s→%2$s</string>
|
||||||
|
<string name="scanCollection">Escanea colección</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -753,5 +753,7 @@
|
||||||
<string name="attachImage">"Imágenes: "</string>
|
<string name="attachImage">"Imágenes: "</string>
|
||||||
<string name="pickerHelper">Sacadores asistente</string>
|
<string name="pickerHelper">Sacadores asistente</string>
|
||||||
<string name="pickerHelperDescrip">Permite sacar parte de la colección</string>
|
<string name="pickerHelperDescrip">Permite sacar parte de la colección</string>
|
||||||
|
<string name="parkingForPicking">P:%1$s→%2$s</string>
|
||||||
|
<string name="scanCollection">Escanea colección</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -753,5 +753,7 @@
|
||||||
<string name="attachImage">"Imágenes: "</string>
|
<string name="attachImage">"Imágenes: "</string>
|
||||||
<string name="pickerHelper">Sacadores asistente</string>
|
<string name="pickerHelper">Sacadores asistente</string>
|
||||||
<string name="pickerHelperDescrip">Permite sacar parte de la colección</string>
|
<string name="pickerHelperDescrip">Permite sacar parte de la colección</string>
|
||||||
|
<string name="parkingForPicking">P:%1$s→%2$s</string>
|
||||||
|
<string name="scanCollection">Escanea colección</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -753,5 +753,7 @@
|
||||||
<string name="attachImage">Imágenes: </string>
|
<string name="attachImage">Imágenes: </string>
|
||||||
<string name="pickerHelper">Sacadores asistente</string>
|
<string name="pickerHelper">Sacadores asistente</string>
|
||||||
<string name="pickerHelperDescrip">Permite sacar parte de la colección</string>
|
<string name="pickerHelperDescrip">Permite sacar parte de la colección</string>
|
||||||
|
<string name="parkingForPicking">P:%1$s→%2$s</string>
|
||||||
|
<string name="scanCollection">Escanea colección</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue