feat reservas refs #6861

This commit is contained in:
Sergio De la torre 2024-09-24 10:31:04 +02:00
parent 28ad29c686
commit e6cf5ef2fb
8 changed files with 246 additions and 1814 deletions

View File

@ -12,7 +12,6 @@ object ConstAndValues {
const val SERIALNUMBER = "SERIALNUMBER" const val SERIALNUMBER = "SERIALNUMBER"
const val ON_CHECKING = "ON_CHECKING" const val ON_CHECKING = "ON_CHECKING"
const val PRECHECKER = "PRECHECKER" const val PRECHECKER = "PRECHECKER"
const val PRECHECKERNEW = "PRECHECKERNEW"
const val MAINACTIVITY = "MAIN" const val MAINACTIVITY = "MAIN"
const val VERTICKET = "SHOWTICKET" const val VERTICKET = "SHOWTICKET"
const val SECTORFKDEFAULT = -1 const val SECTORFKDEFAULT = -1
@ -67,11 +66,6 @@ object ConstAndValues {
const val LIMITRECORDSSHELVINGLOG = 50 const val LIMITRECORDSSHELVINGLOG = 50
const val RESERVATIONMODE = "operatorReservationMode" const val RESERVATIONMODE = "operatorReservationMode"
const val MODELWORKERTYPEACTIVITY = "APP" const val MODELWORKERTYPEACTIVITY = "APP"
val ACTIONNAMES = listOf(
"STOP",
"ON_CHECKING",
"Delivery"
)
} }

View File

@ -14,12 +14,12 @@ import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.SaleRowFragmentBinding import es.verdnatura.databinding.SaleRowFragmentBinding
import es.verdnatura.domain.ConstAndValues.PREITEMPICKERTEST import es.verdnatura.domain.ConstAndValues.PREITEMPICKERTEST
import es.verdnatura.domain.ConstAndValues.PREPARED
import es.verdnatura.domain.ConstAndValues.SACADOR import es.verdnatura.domain.ConstAndValues.SACADOR
import es.verdnatura.domain.toast import es.verdnatura.domain.toast
import es.verdnatura.presentation.common.OnMistakeClickListener import es.verdnatura.presentation.common.OnMistakeClickListener
import es.verdnatura.presentation.common.OnPackingClickSaleListener import es.verdnatura.presentation.common.OnPackingClickSaleListener
import es.verdnatura.presentation.common.OnPasillerosItemClickListener import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.common.OnQuantityClickSaleListener
import es.verdnatura.presentation.common.OnSaleClickSaleListener import es.verdnatura.presentation.common.OnSaleClickSaleListener
import es.verdnatura.presentation.common.OnTicketClickSaleListener import es.verdnatura.presentation.common.OnTicketClickSaleListener
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
@ -28,7 +28,6 @@ import es.verdnatura.presentation.view.feature.sacador.model.Sale
class SaleAdapterNew( class SaleAdapterNew(
private val items: List<Sale>, private val items: List<Sale>,
private val onPasillerosItemClickListener: OnPasillerosItemClickListener, private val onPasillerosItemClickListener: OnPasillerosItemClickListener,
private val onQuantityClick: OnQuantityClickSaleListener,
private val onSaleClickListener: OnSaleClickSaleListener, private val onSaleClickListener: OnSaleClickSaleListener,
private val onMistakeClickListener: OnMistakeClickListener, private val onMistakeClickListener: OnMistakeClickListener,
private val onPackingClick: OnPackingClickSaleListener, private val onPackingClick: OnPackingClickSaleListener,
@ -121,10 +120,9 @@ class SaleAdapterNew(
itemFirstToPicker.setOnClickListener { itemFirstToPicker.setOnClickListener {
onPackingClick.onPackingClick(sale) onPackingClick.onPackingClick(sale)
} }/* quantityReserved.setOnClickListener {
quantityReserved.setOnClickListener {
onQuantityClick.onQuantityClick(sale) onQuantityClick.onQuantityClick(sale)
} }*/
linearLayoutItem.setOnClickListener { linearLayoutItem.setOnClickListener {
@ -134,6 +132,7 @@ class SaleAdapterNew(
} }
} }
println("type es $type")
imageErrorMessage.setOnClickListener { imageErrorMessage.setOnClickListener {
// onMistakeClickListener.onMistakeClickListener(sale) // onMistakeClickListener.onMistakeClickListener(sale)
@ -203,7 +202,9 @@ class SaleAdapterNew(
txtdeNew.visibility = View.VISIBLE txtdeNew.visibility = View.VISIBLE
itemArticleQuantityPicked.visibility = View.VISIBLE itemArticleQuantityPicked.visibility = View.VISIBLE
itemArticleQuantityLine3.visibility = View.VISIBLE*/ itemArticleQuantityLine3.visibility = View.VISIBLE*/
if (type != SACADOR) {
imageErrorMessage.visibility = View.GONE
if (type != SACADOR && type != PREITEMPICKERTEST) {
val colorRes = val colorRes =
if (sale.hasMistake == true) R.color.verdnatura_red_salix else R.color.verdnatura_black if (sale.hasMistake == true) R.color.verdnatura_red_salix else R.color.verdnatura_black
imageErrorMessage.imageTintList = imageErrorMessage.imageTintList =
@ -221,7 +222,6 @@ class SaleAdapterNew(
adapter = SaleAdapterNew( adapter = SaleAdapterNew(
sale.sonSales, sale.sonSales,
onPasillerosItemClickListener, onPasillerosItemClickListener,
onQuantityClick,
onSaleClickListener, onSaleClickListener,
onMistakeClickListener, onMistakeClickListener,
onPackingClick onPackingClick
@ -271,7 +271,8 @@ class SaleAdapterNew(
val textToConcat2: String val textToConcat2: String
val result2: Int = sale.accumulatedQuantity % (sale.packing ?: sale.saleQuantity + 1) val result2: Int =
sale.accumulatedQuantity % (sale.packing ?: sale.saleQuantity + 1)
if (result2 != 0) { if (result2 != 0) {
textToConcat2 = textToConcat2 =
"${(sale.saleQuantity - sale.accumulatedQuantity) / (sale.grouping ?: 1)} x ${sale.grouping ?: "1"}" "${(sale.saleQuantity - sale.accumulatedQuantity) / (sale.grouping ?: 1)} x ${sale.grouping ?: "1"}"
@ -315,12 +316,19 @@ class SaleAdapterNew(
"${sale.reservedQuantity} de ${sale.saleQuantity}" "${sale.reservedQuantity} de ${sale.saleQuantity}"
if (sale.isPicked == 1) { if (sale.isPicked == 1) {
if (type == PREPARED) {
contentLayout.setBackgroundColor(
getColor(
context!!, R.color.verdnatura_orange_salix
)
)
} else {
contentLayout.setBackgroundColor( contentLayout.setBackgroundColor(
//lolass
getColor( getColor(
context!!, R.color.verdnatura_dark_sky_blue context!!, R.color.verdnatura_dark_sky_blue
) )
) )
}
} else { } else {
contentLayout.setBackgroundColor( contentLayout.setBackgroundColor(
getColor( getColor(
@ -330,8 +338,8 @@ class SaleAdapterNew(
} }
binding.itemParkingCode.text = if (type == PREITEMPICKERTEST) binding.itemParkingCode.text =
sale.parkingCodePrevia else sale.parkingCode if (type == PREITEMPICKERTEST) sale.parkingCodePrevia else sale.parkingCode
this.sale = sale this.sale = sale
@ -344,13 +352,11 @@ class SaleAdapterNew(
if (color.isNullOrBlank()) { if (color.isNullOrBlank()) {
DrawableCompat.setTint( DrawableCompat.setTint(
backgroundDrawableTicket, backgroundDrawableTicket, Color.TRANSPARENT
Color.TRANSPARENT
) )
} else { } else {
DrawableCompat.setTint( DrawableCompat.setTint(
backgroundDrawableTicket, backgroundDrawableTicket, Color.parseColor(color)
Color.parseColor(color)
) )
} }

View File

@ -32,7 +32,6 @@ import es.verdnatura.presentation.common.OnMistakeClickListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.OnPackingClickSaleListener import es.verdnatura.presentation.common.OnPackingClickSaleListener
import es.verdnatura.presentation.common.OnPasillerosItemClickListener import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.common.OnQuantityClickSaleListener
import es.verdnatura.presentation.common.OnSaleClickSaleListener import es.verdnatura.presentation.common.OnSaleClickSaleListener
import es.verdnatura.presentation.common.OnTicketClickSaleListener import es.verdnatura.presentation.common.OnTicketClickSaleListener
import es.verdnatura.presentation.common.ToolBarAdapterTooltip import es.verdnatura.presentation.common.ToolBarAdapterTooltip
@ -398,25 +397,16 @@ class CollectionFragmentPickerNew(
responseConfirmReservedItemShelvingSale.observe(viewLifecycleOwner) { responseConfirmReservedItemShelvingSale.observe(viewLifecycleOwner) {
if (it.isError) {
ma.messageWithSound(
it.errorMessage,
isError = true,
isPlayed = true
)
}
if (!it.isError) {
myGroupList[positionConfirm].isPicked = 1 myGroupList[positionConfirm].isPicked = 1
saleAdapter!!.notifyDataSetChanged() saleAdapter!!.notifyDataSetChanged()
lm!!.scrollToPositionWithOffset(storedPosition, 0) lm!!.scrollToPositionWithOffset(storedPosition, 0)
viewModel.collectionTicketGetSalix( /* viewModel.collectionTicketGetSalix(
collection.collectionFk, print = false collection.collectionFk, print = false
) )*/
}
} }
/*
responseItemShelvingSale.observe(viewLifecycleOwner) { responseItemShelvingSale.observe(viewLifecycleOwner) {
myGroupList[positionConfirm].isPicked = 1 myGroupList[positionConfirm].isPicked = 1
myGroupList[positionConfirm].reservedQuantity = quantityConfirm myGroupList[positionConfirm].reservedQuantity = quantityConfirm
@ -427,17 +417,17 @@ class CollectionFragmentPickerNew(
ma.messageWithSound( ma.messageWithSound(
getString(R.string.operationSuccess), it.isError, !it.isError, isToasted = false getString(R.string.operationSuccess), it.isError, !it.isError, isToasted = false
) )
} }*/
responseItemShelvingSaleUnPicked.observe(viewLifecycleOwner) { loadUnpicked.observe(viewLifecycleOwner) { event ->
myGroupList[positionUnmarked].isPicked = 1 event.getContentIfNotHandled().notNull {
myGroupList[positionUnmarked].isPicked = 0
myGroupList[positionUnmarked].reservedQuantity = quantityConfirm myGroupList[positionUnmarked].reservedQuantity = quantityConfirm
viewModel.collectionTicketGetSalix( saleAdapter!!.notifyItemChanged(positionUnmarked)
collection.collectionFk, print = false
)
lm!!.scrollToPositionWithOffset(positionUnmarked, 0) lm!!.scrollToPositionWithOffset(positionUnmarked, 0)
ma.messageWithSound(
getString(R.string.operationSuccess), it.isError, !it.isError, isToasted = false }
)
} }
responseItemShelvingSaleGroup.observe(viewLifecycleOwner) { responseItemShelvingSaleGroup.observe(viewLifecycleOwner) {
@ -512,24 +502,7 @@ class CollectionFragmentPickerNew(
saleAdapter = SaleAdapterNew( saleAdapter = SaleAdapterNew(
myGroupList, myGroupList,
pasillerosItemClickListener!!, pasillerosItemClickListener!!,
object : OnQuantityClickSaleListener {
override fun onQuantityClick(sale: Sale) {
sales.forEachIndexed { index, saleVO ->
if (saleVO.saleFk == sale.saleFk) {
if (sale.isPicked == 1) {
showErrorMessage(
title = getString(R.string.info),
text = getString(R.string.unmarkForModify)
)
}
}
}
}
},
object : OnSaleClickSaleListener { object : OnSaleClickSaleListener {
override fun onSaleClick(mySale: Sale) { override fun onSaleClick(mySale: Sale) {
myGroupList.forEachIndexed { index, sale -> myGroupList.forEachIndexed { index, sale ->

View File

@ -1,6 +1,5 @@
package es.verdnatura.presentation.view.feature.collection.fragment package es.verdnatura.presentation.view.feature.collection.fragment
import android.app.AlertDialog
import android.content.Context import android.content.Context
import android.graphics.Color import android.graphics.Color
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
@ -10,6 +9,7 @@ import android.os.Bundle
import android.text.InputType import android.text.InputType
import android.view.Gravity import android.view.Gravity
import android.view.KeyEvent import android.view.KeyEvent
import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.WindowManager import android.view.WindowManager
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
@ -24,7 +24,6 @@ import es.verdnatura.R
import es.verdnatura.databinding.FragmentCollectionNewBinding import es.verdnatura.databinding.FragmentCollectionNewBinding
import es.verdnatura.domain.ConstAndValues.BASEURLSALIX import es.verdnatura.domain.ConstAndValues.BASEURLSALIX
import es.verdnatura.domain.ConstAndValues.PRESACADOR import es.verdnatura.domain.ConstAndValues.PRESACADOR
import es.verdnatura.domain.ConstAndValues.PRINTERNAME
import es.verdnatura.domain.ConstAndValues.SECTORFK 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
@ -35,7 +34,6 @@ import es.verdnatura.presentation.common.OnMistakeClickListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.OnPackingClickSaleListener import es.verdnatura.presentation.common.OnPackingClickSaleListener
import es.verdnatura.presentation.common.OnPasillerosItemClickListener import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.common.OnQuantityClickSaleListener
import es.verdnatura.presentation.common.OnSaleClickSaleListener import es.verdnatura.presentation.common.OnSaleClickSaleListener
import es.verdnatura.presentation.common.OnTicketClickSaleListener import es.verdnatura.presentation.common.OnTicketClickSaleListener
import es.verdnatura.presentation.common.ToolBarAdapterTooltip import es.verdnatura.presentation.common.ToolBarAdapterTooltip
@ -68,7 +66,6 @@ class CollectionFragmentPickerPreviousNew(
CollectionViewModel::class CollectionViewModel::class
) { ) {
private var sales: List<Sale> = listOf() private var sales: List<Sale> = listOf()
private var salesParent: List<SaleVO> = listOf()
private var saleAdapter: SaleAdapterNew? = null private var saleAdapter: SaleAdapterNew? = null
private var lm: LinearLayoutManager? = null private var lm: LinearLayoutManager? = null
private var storedPosition: Int = 0 private var storedPosition: Int = 0
@ -81,27 +78,15 @@ class CollectionFragmentPickerPreviousNew(
private lateinit var customDialogThreeButtonsQuantity: CustomDialogThreeButtons private lateinit var customDialogThreeButtonsQuantity: CustomDialogThreeButtons
private var ticketSelected: Int = 0 private var ticketSelected: Int = 0
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
private var goBack: Boolean = false
private var goBack2: Boolean = false
private var goMistakeBack: Boolean = false
var mperror: MediaPlayer? = null var mperror: MediaPlayer? = null
var mpok: MediaPlayer? = null var mpok: MediaPlayer? = null
private var itemShelvingFkStored: Int = 0
private var storedBackPosition: Int = 0 private var storedBackPosition: Int = 0
private var tickets: ArrayList<String> = ArrayList() private var tickets: ArrayList<String> = ArrayList()
private var mistakeSale: SaleVO? = null
private var isMarking = false
private lateinit var ticketScanTxt: String
private var lastScanned: Int = 0 private var lastScanned: Int = 0
private var buttonPushedGetCollection = false
private var positionUnmarked = -1 private var positionUnmarked = -1
private var state = 0
private var originalItemScan: Long = 0
private var workerFkFromTicket: String? = null
private var isScanned: Boolean? = null private var isScanned: Boolean? = null
private var positionConfirm = 0 private var positionConfirm = 0
private var quantityConfirm = 0 private var quantityConfirm = 0
private var positionMarkPrevia = 0
private lateinit var myGroupList: List<Sale> private lateinit var myGroupList: List<Sale>
private var quantityReserveToCheckItemScan = 0 private var quantityReserveToCheckItemScan = 0
@ -119,11 +104,8 @@ class CollectionFragmentPickerPreviousNew(
override fun getLayoutId(): Int = R.layout.fragment_collection_new override fun getLayoutId(): Int = R.layout.fragment_collection_new
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
mperror = MediaPlayer.create((activity as MainActivity), R.raw.error) mperror = MediaPlayer.create((activity as MainActivity), R.raw.error)
mpok = MediaPlayer.create((activity as MainActivity), R.raw.ok) mpok = MediaPlayer.create((activity as MainActivity), R.raw.ok)
println("create onRunning")
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }
@ -139,7 +121,7 @@ class CollectionFragmentPickerPreviousNew(
customDialogThreeButtons = CustomDialogThreeButtons(requireContext()) customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
customDialogThreeButtonsQuantity = CustomDialogThreeButtons(requireContext()) customDialogThreeButtonsQuantity = CustomDialogThreeButtons(requireContext())
ma.hideBottomNavigation(View.GONE) ma.hideBottomNavigation(View.GONE)
println("type $type")
setEvents() setEvents()
setToolBar() setToolBar()
viewModel.collectionTicketGetSalix( viewModel.collectionTicketGetSalix(
@ -149,13 +131,6 @@ class CollectionFragmentPickerPreviousNew(
super.init() super.init()
} }
override fun onPause() {
super.onPause()
goBack = true
goBack2 = true
goMistakeBack = true
}
private fun setToolBar() { private fun setToolBar() {
binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE
binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE
@ -165,47 +140,32 @@ class CollectionFragmentPickerPreviousNew(
} }
val listIcons: ArrayList<ImageView> = ArrayList() val listIcons: ArrayList<ImageView> = ArrayList()
val iconPrint = ImageView(context)
iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
val iconAdd = ImageView(context) val iconAdd = ImageView(context)
iconAdd.setImageResource(R.drawable.ic_playlist_add_black_24dp) iconAdd.setImageResource(R.drawable.ic_playlist_add_black_24dp)
val iconViewCollection = ImageView(context)
iconViewCollection.setImageResource(R.drawable.ic_collection)
val iconWorker = ImageView(context)
iconWorker.setImageResource(R.drawable.ic_worker)
val iconPhone = ImageView(context)
iconPhone.setImageResource(R.drawable.phone_call)
val iconParking = ImageView(context) val iconParking = ImageView(context)
iconParking.setImageResource(R.drawable.ic_local_parking_black_24dp) iconParking.setImageResource(R.drawable.ic_local_parking_black_24dp)
val iconUpdate = ImageView(context) val iconUpdate = ImageView(context)
iconUpdate.setImageResource(R.drawable.ic_autorenew_black_24dp) iconUpdate.setImageResource(R.drawable.ic_autorenew_black_24dp)
iconPrint.tooltipText = getTooltip(R.drawable.ic_print_black_24dp)
iconAdd.tooltipText = getTooltip(R.drawable.ic_playlist_add_black_24dp) iconAdd.tooltipText = getTooltip(R.drawable.ic_playlist_add_black_24dp)
iconViewCollection.tooltipText = getTooltip(R.drawable.ic_collection)
iconPhone.tooltipText = getTooltip(R.drawable.phone_call)
iconParking.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp) iconParking.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp)
iconUpdate.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp) iconUpdate.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
// listIcons.add(iconPrint)
listIcons.add(iconAdd) listIcons.add(iconAdd)
listIcons.add(iconParking) listIcons.add(iconParking)
listIcons.add(iconUpdate) listIcons.add(iconUpdate)
// listIcons.remove(iconWorker)
binding.mainToolbar.toolbarIcons.adapter = binding.mainToolbar.toolbarIcons.adapter =
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener { ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) { override fun onOptionsItemSelected(item: Drawable) {
when (item) { when (item) {
//iconViewCollection.drawable -> getCollection()
iconPrint.drawable -> print()
iconAdd.drawable -> addItem() iconAdd.drawable -> addItem()
iconWorker.drawable -> showUser()
iconUpdate.drawable -> updateScreen() iconUpdate.drawable -> updateScreen()
iconParking.drawable -> pasillerosItemClickListener?.onPasillerosItemClickListener( iconParking.drawable -> pasillerosItemClickListener?.onPasillerosItemClickListener(
PasillerosItemVO( PasillerosItemVO(
title =R.string.Parking title = R.string.Parking
), "" ), ""
) )
} }
@ -222,44 +182,14 @@ class CollectionFragmentPickerPreviousNew(
) )
} }
/* private fun markPrevia(saleGroupScanned: String): Boolean {
println("Sacador saleGroup $saleGroupScanned ")
try {
for (indice in sales.indices) {
println("Sacador saleGroup ${sales[indice].saleGroupFk}")
if (sales[indice].saleGroupFk != null && sales[indice].saleGroupFk == saleGroupScanned.toInt()) {
println("Sacador saleGroup ${sales[indice].itemShelvingSaleFk}")
viewModel.itemShelvingSaleSetSaleGroup(saleGroupScanned.toInt())
positionMarkPrevia = indice
mpok!!.start()
return true
}
}
} catch (ex: Exception) {
return false
}
return false
}*/
private fun scanRequest() { private fun scanRequest() {
binding.scanInput.requestFocus() binding.scanInput.requestFocus()
hideKeyboards() hideKeyboards()
} }
private fun showUser() {
ma.onPasillerosItemClickListener(
PasillerosItemVO(title = R.string.titleUserControlVehicle),
workerFkFromTicket.toString()
)
}
private fun setEvents() { private fun setEvents() {
binding.mainToolbar.backButton.setOnClickListener { binding.mainToolbar.backButton.setOnClickListener {
println("reserva fuera")
ma.onMyBackPressed() ma.onMyBackPressed()
} }
//ESCANER ========= //ESCANER =========
@ -274,12 +204,8 @@ class CollectionFragmentPickerPreviousNew(
if (itemScanIsQr(binding.scanInput.text.toString())) { if (itemScanIsQr(binding.scanInput.text.toString())) {
val myQr = ItemScanned(JSONObject(binding.scanInput.text.toString())) val myQr = ItemScanned(JSONObject(binding.scanInput.text.toString()))
when (myQr.table) { when (myQr.table) {
"saleGroup" -> {/* if (type == CONTROLADOR) { "saleGroup" -> {
markPrevia(myQr.id.toString())
} else {*/
binding.scanInput.setText(myQr.id.toString()) binding.scanInput.setText(myQr.id.toString())
//findSale(binding.scanInput.text.toString())
// }
} }
"buy" -> binding.scanInput.setText(myQr.more) "buy" -> binding.scanInput.setText(myQr.more)
@ -289,7 +215,6 @@ class CollectionFragmentPickerPreviousNew(
ma.hideKeyboard(binding.scanInput) ma.hideKeyboard(binding.scanInput)
findSale(binding.scanInput.text.toString()) findSale(binding.scanInput.text.toString())
} }
buttonPushedGetCollection = false
} }
binding.scanInput.setText("") binding.scanInput.setText("")
hideKeyboards() hideKeyboards()
@ -302,16 +227,8 @@ class CollectionFragmentPickerPreviousNew(
//LISTA ========= //LISTA =========
binding.collectionSwipe.setOnRefreshListener { binding.collectionSwipe.setOnRefreshListener {
isMarking = false
binding.collectionSwipe.isRefreshing = false binding.collectionSwipe.isRefreshing = false
updateScreen()
updateScreen()/* viewModel.collectionTicketGet(
collection.collectionFk,
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
print = "0",
type
)*/
buttonPushedGetCollection = false
binding.collectionSwipe.isRefreshing = false binding.collectionSwipe.isRefreshing = false
} }
@ -336,11 +253,6 @@ class CollectionFragmentPickerPreviousNew(
if (it.tickets.isNotEmpty()) { if (it.tickets.isNotEmpty()) {
collection = it collection = it
createCollectionList() createCollectionList()
workerFkFromTicket = if (it.tickets[0].sales.isNotEmpty()) {
it.tickets[0].sales[0].workerFk.toString()
} else {
""
}
} else { } else {
binding.mainToolbar.toolbarSubtitle.text = "0/0" binding.mainToolbar.toolbarSubtitle.text = "0/0"
@ -356,8 +268,18 @@ class CollectionFragmentPickerPreviousNew(
} }
} }
loadExistsResponse.observe(viewLifecycleOwner) { event ->
responseExistsItemShelvingSale.observe(viewLifecycleOwner) { event.getContentIfNotHandled().notNull {
if (it.exists) {
markLine(it.position, it.quantity, true)
} else {
getString(R.string.updateSalesReserve).toast(
requireContext()
)
viewModel.collectionTicketGetSalix(collection.collectionFk, false)
}
}
}/*responseExistsItemShelvingSale.observe(viewLifecycleOwner) {
if (!goBack) { if (!goBack) {
if (it.exists) { if (it.exists) {
markLine(it.position, it.quantity, true) markLine(it.position, it.quantity, true)
@ -369,17 +291,8 @@ class CollectionFragmentPickerPreviousNew(
} }
} }
} }*/
responseParking.observe(viewLifecycleOwner) {
if (!goBack) {
ma.messageWithSound(
if (it.isError) it.errorMessage else getString(R.string.Aparcado),
it.isError,
true
)
}
}
loadResponseAddItem.observe(viewLifecycleOwner) { event -> loadResponseAddItem.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull { event.getContentIfNotHandled().notNull {
updateScreen() updateScreen()
@ -387,109 +300,45 @@ class CollectionFragmentPickerPreviousNew(
} }
responsePrint.observe(viewLifecycleOwner) { loadPicked.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull {
if (!goBack) {
if (it.isError) {
ma.messageWithSound(
it.errorMessage, isError = true, true
)
} else {
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(
PRINTERNAME
)).toast(
requireContext()
)
}
}
}
responseConfirmReservedItemShelvingSale.observe(viewLifecycleOwner) {
if (it.isError) {
ma.messageWithSound(
it.errorMessage, isError = true, true
)
setTotalLines()
} else {
myGroupList[positionConfirm].isPicked = 1 myGroupList[positionConfirm].isPicked = 1
saleAdapter!!.notifyItemChanged(positionConfirm) saleAdapter!!.notifyItemChanged(positionConfirm)
//lolass
lm!!.scrollToPositionWithOffset(storedBackPosition, 0)
// lm!!.scrollToPositionWithOffset(storedBackPosition + 1, 0)
setTotalLines()
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) lm!!.scrollToPositionWithOffset(positionConfirm, 0)
//saleAdapter!!.notifyDataSetChanged() //lm!!.scrollToPositionWithOffset(storedBackPosition + 1, 0)
ma.messageWithSound( setTotalLines()
"Confirmada acción", it.isError, !it.isError
)
} }
}
loadUnpicked.observe(viewLifecycleOwner) { event -> loadUnpicked.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull { event.getContentIfNotHandled().notNull {
myGroupList[positionUnmarked].isPicked = 1 myGroupList[positionUnmarked].isPicked = 0
myGroupList[positionUnmarked].reservedQuantity = quantityConfirm myGroupList[positionUnmarked].reservedQuantity = quantityConfirm
viewModel.collectionTicketGetSalix( saleAdapter!!.notifyItemChanged(positionUnmarked)
collection.collectionFk, print = false
)
lm!!.scrollToPositionWithOffset(positionUnmarked, 0) lm!!.scrollToPositionWithOffset(positionUnmarked, 0)
//saleAdapter!!.notifyDataSetChanged()
ma.messageWithSound(
"Confirmada acción", it.isError, !it.isError
)
}
}
responseItemShelvingSaleGroup.observe(viewLifecycleOwner) {
viewModel.collectionTicketGetSalix( }
collection.collectionFk, print = false
)
lm!!.scrollToPositionWithOffset(positionMarkPrevia, 0)
ma.messageWithSound(
getString(R.string.previousCollected), it.isError, !it.isError
)
} }
responseCode.observe(viewLifecycleOwner) { responseCode.observe(viewLifecycleOwner) {
if (!goBack2) {
if (it == null) { if (it == null) {
showErrorMessage(text = getString(R.string.codeNotExist)) showErrorMessage(text = getString(R.string.codeNotExist))
if (mperror != null) mperror?.start() if (mperror != null) mperror?.start()
} else { } else {
if (checkItemScan(it.toString())) { if (checkItemScan(it.toString(), positionConfirm)) {
scanRequest() scanRequest()
customDialogList.dismiss() customDialogList.dismiss()
mpok?.start() mpok?.start()
markLine(storedPosition, quantityReserveToCheckItemScan, false) markLine(positionConfirm, quantityReserveToCheckItemScan, false)
} else { } else {
customDialogList.setValueTwo("") customDialogList.setValueTwo("")
showErrorMessage(text = getString(R.string.lineNotExist)) showErrorMessage(text = getString(R.string.lineNotExist))
if (mperror != null) mperror?.start() if (mperror != null) mperror?.start()
} }
} }
}
goBack2 = false
} }
@ -497,7 +346,6 @@ class CollectionFragmentPickerPreviousNew(
} }
private fun createCollectionList() { private fun createCollectionList() {
state = 0
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString() binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString()
collection.map(requireContext()) collection.map(requireContext())
@ -509,8 +357,7 @@ class CollectionFragmentPickerPreviousNew(
val myPickingTo = mobileApplication.dataStoreApp.readDataStoreKey<Int>("PICKING_TO") val myPickingTo = mobileApplication.dataStoreApp.readDataStoreKey<Int>("PICKING_TO")
collection.tickets.forEach { ticket -> collection.tickets.forEach { ticket ->
if (observations.isNotEmpty()) observations = if (observations.isNotEmpty()) observations = observations + " " + ticket.observations
observations + " " + ticket.observations
ticket.sales.forEach { sale -> ticket.sales.forEach { sale ->
if (hasPickingOrder) { if (hasPickingOrder) {
@ -523,35 +370,12 @@ class CollectionFragmentPickerPreviousNew(
} }
} }
// sales = salesList.sortedWith(compareBy<Sale> { it.pickingOrderPrevia }.thenBy { it.itemFk })
sales = salesList.sortedWith(compareBy<Sale> { it.pickingOrderPrevia }.thenBy { it.itemFk })
//quitar comentarios FALTA AGRUPAR LAS PREVIAS //quitar comentarios FALTA AGRUPAR LAS PREVIAS
myGroupList = myGroupList =
salesList.sortedWith(compareBy<Sale> { it.pickingOrderPrevia }.thenBy { it.itemFk }) salesList.sortedWith(compareBy<Sale> { it.pickingOrderPrevia }.thenBy { it.itemFk })
// sales //sales porque no se ggrupan las previas hay que cambiar los estados. saleAdapter = SaleAdapterNew(myGroupList, pasillerosItemClickListener!!,
saleAdapter = SaleAdapterNew(
myGroupList,
pasillerosItemClickListener!!,
object : OnQuantityClickSaleListener {
override fun onQuantityClick(sale: Sale) {
sales.forEachIndexed { index, saleVO ->
if (saleVO.saleFk == sale.saleFk) {
if (sale.isPicked == 1) {
showErrorMessage(
title = getString(R.string.info),
text = getString(R.string.unmarkForModify)
)
}
}
}
}
},
object : OnSaleClickSaleListener { object : OnSaleClickSaleListener {
override fun onSaleClick(sale: Sale) { override fun onSaleClick(sale: Sale) {
@ -565,48 +389,13 @@ class CollectionFragmentPickerPreviousNew(
} }
} }
/* myGroupList.forEachIndexed { index, sale ->
//sales.forEachIndexed { index, sale ->
// println("Sacador la sale es ${sale.saleFk}")
// println("Sacador la sale picked es ${sale.isPicked}")
// println("Sacador la sale group es ${sale.saleGroupFk}")
// println("Sacador la sale reserved es ${sale.reservedQuantity}")
if (sale.itemShelvingSaleFk == 0) {
println("Sacador Que hacemos en este caso ?? ")
} else {
if (sale.itemShelvingSaleFk == mysale.itemShelvingSaleFk) {
println("Sacador **** itemShelvingSale es ${sale.itemShelvingSaleFk}")
println("Sacador **** isPicked es ${sale.isPicked}")
println("Sacador **** saleGroup es ${sale.saleGroupFk}")
//println("Sacador la sale es ${sale.saleFk}")
//println("Sacador la sale picked es ${sale.isPicked}")
//println("Sacador la sale group es ${sale.saleGroupFk}")
//println("Sacador la sale reserved es ${sale.reservedQuantity}")
//println("Sacador la sale dentro es ${sale.saleFk}")
if (sale.isPicked != 1 && sale.saleGroupFk == null) {
println("Sacador **** showScanner")
showScanner(index, sale)
} else {
println("Sacador **** desmarcar")
unMarkLine(index, myGroupList[index])
} }
} }, object : OnMistakeClickListener {
}
}*/
}
},
object : OnMistakeClickListener {
override fun onMistakeClickListener(sale: SaleVO) { override fun onMistakeClickListener(sale: SaleVO) {
} }
}, }, object : OnPackingClickSaleListener {
object : OnPackingClickSaleListener {
override fun onPackingClick(sale: Sale) { override fun onPackingClick(sale: Sale) {
goBack = true
if (!sale.code.isNullOrEmpty()) ma.onPasillerosItemClickListener( if (!sale.code.isNullOrEmpty()) ma.onPasillerosItemClickListener(
PasillerosItemVO( PasillerosItemVO(
@ -614,8 +403,7 @@ class CollectionFragmentPickerPreviousNew(
), entryPoint = sale.code ), entryPoint = sale.code
) )
} }
}, }, object : OnTicketClickSaleListener {
object : OnTicketClickSaleListener {
override fun onTicketClickListener(sale: Sale) { override fun onTicketClickListener(sale: Sale) {
val entryPoint = Gson().toJson( val entryPoint = Gson().toJson(
mutableMapOf( mutableMapOf(
@ -632,8 +420,7 @@ class CollectionFragmentPickerPreviousNew(
), entryPoint = entryPoint ), entryPoint = entryPoint
) )
} }
}, }, type = type
type = type
) )
@ -642,7 +429,7 @@ class CollectionFragmentPickerPreviousNew(
binding.fragmentSacadorCollections.layoutManager = lm binding.fragmentSacadorCollections.layoutManager = lm
setTotalLines() setTotalLines()
setStoredPosition() setListPosition()
setScrollListener(lm!!) setScrollListener(lm!!)
printObservations(observations) printObservations(observations)
} }
@ -652,7 +439,8 @@ class CollectionFragmentPickerPreviousNew(
binding.fragmentSacadorCollections.addOnScrollListener(object : binding.fragmentSacadorCollections.addOnScrollListener(object :
RecyclerView.OnScrollListener() { RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
storedBackPosition = lm.findFirstVisibleItemPosition() // storedBackPosition = lm.findFirstVisibleItemPosition()
storedPosition = lm.findFirstVisibleItemPosition()
super.onScrolled(recyclerView, dx, dy) super.onScrolled(recyclerView, dx, dy)
} }
}) })
@ -670,14 +458,12 @@ class CollectionFragmentPickerPreviousNew(
private fun findSale(txtscan: String) { private fun findSale(txtscan: String) {
var isFoundSale = false // markPrevia(txtscan) var isFoundSale = false
//Se busca la matricula en las lineas //Se busca la matricula en las lineas
for (indice in myGroupList.indices) { for (indice in myGroupList.indices) {
if (myGroupList[indice].isPicked != 1 && myGroupList[indice].code != null && myGroupList[indice].code!!.uppercase() == txtscan.uppercase()) { if (myGroupList[indice].isPicked != 1 && myGroupList[indice].code != null && myGroupList[indice].code!!.uppercase() == txtscan.uppercase()) {
mpok!!.start() mpok!!.start()
isFoundSale = true isFoundSale = true
positionMarkPrevia = indice
printShelvingResult(indice) printShelvingResult(indice)
break break
} }
@ -694,8 +480,6 @@ class CollectionFragmentPickerPreviousNew(
if (sale.code!!.uppercase() == txtscan.uppercase()) { if (sale.code!!.uppercase() == txtscan.uppercase()) {
mpok!!.start() mpok!!.start()
printShelvingResult(position) printShelvingResult(position)
//sale.isPicked = 1
//saleAdapter!!.notifyItemChanged(position)
} else { } else {
mperror!!.start() mperror!!.start()
} }
@ -704,30 +488,27 @@ class CollectionFragmentPickerPreviousNew(
private fun markLine(position: Int, quantity: Int, isItemShelvingSaleEmpty: Boolean?) { private fun markLine(position: Int, quantity: Int, isItemShelvingSaleEmpty: Boolean?) {
state = 0
isScanned = null isScanned = null
positionConfirm = position positionConfirm = position
quantityConfirm = quantity quantityConfirm = quantity
isMarking = true
runBlocking { runBlocking {
var sectorFk = mobileApplication.dataStoreApp.readDataStoreKey<Int>(SECTORFK) val sectorFk = mobileApplication.dataStoreApp.readDataStoreKey<Int>(SECTORFK)
viewModel.itemShelvingSaleSetQuantity( viewModel.itemShelvingSaleSetQuantity(
myGroupList[position].itemShelvingSaleFk, quantity, isItemShelvingSaleEmpty = isItemShelvingSaleEmpty, sectorFk = if (sectorFk == -1) null else sectorFk myGroupList[position].itemShelvingSaleFk,
quantity,
isItemShelvingSaleEmpty = isItemShelvingSaleEmpty,
sectorFk = if (sectorFk == -1) null else sectorFk
) )
} }
storedBackPosition = position/* var mySale = myGroupList[position].itemShelvingSaleFk // storedBackPosition = position
for (indice in myGroupList.indices) {
if (!myGroupList[indice].isParent && myGroupList[indice].itemShelvingSaleFk == mySale) {
storedBackPosition = indice
}
}*/
} }
private fun setListPosition() { private fun setListPosition() {
if (storedPosition == 0 && storedBackPosition == 0) { // se inicia lista, se busca porqué item vamos. //if (storedPosition == 0 && storedBackPosition == 0) { // se inicia lista, se busca porqué item vamos.
if (storedPosition == 0) {
for (indice in myGroupList.indices) { for (indice in myGroupList.indices) {
if (myGroupList[indice].isPicked == 0) { if (myGroupList[indice].isPicked == 0) {
//storedPosition = indice //storedPosition = indice
@ -737,12 +518,13 @@ class CollectionFragmentPickerPreviousNew(
} }
} else { } else {
lm!!.scrollToPositionWithOffset(storedBackPosition, 0) // lm!!.scrollToPositionWithOffset(storedBackPosition, 0)
lm!!.scrollToPositionWithOffset(storedPosition, 0)
} }
} }
private fun unMarkLine(position: Int, sale: Sale) { private fun unMarkLine(position: Int, sale: Sale) {
state = 0
customDialog.setTitle(getString(R.string.unmarkLine)).setDescription( customDialog.setTitle(getString(R.string.unmarkLine)).setDescription(
getString(R.string.goUnmark) + sale.itemFk + getString( getString(R.string.goUnmark) + sale.itemFk + getString(
R.string.sure R.string.sure
@ -750,17 +532,10 @@ class CollectionFragmentPickerPreviousNew(
).setOkButton(getString(R.string.unmark)) { ).setOkButton(getString(R.string.unmark)) {
if (!sale.isParent && sale.reservedQuantity == 0 && sale.originalQuantity != sale.saleQuantity) { if (!sale.isParent && sale.reservedQuantity == 0 && sale.originalQuantity != sale.saleQuantity) {
getString(R.string.unmarkError).toast(requireContext()) getString(R.string.unmarkError).toast(requireContext())
} else {/* saleAdapter!!.notifyDataSetChanged() } else {
var mySale = sale.saleFk //storedBackPosition = position
for (indice in myGroupList.indices) { //storedPosition = position
if (!myGroupList[indice].isParent && myGroupList[indice].saleFk == mySale) { // setListPosition()
d("VERDNATURA::", "la pos del index de la sale es" + indice)
storedBackPosition = indice
}
}*/
storedBackPosition = position
setListPosition()
viewModel.itemShelvingSaleUnpicked(myGroupList[position].itemShelvingSaleFk) viewModel.itemShelvingSaleUnpicked(myGroupList[position].itemShelvingSaleFk)
sale.isPicked = 0 sale.isPicked = 0
positionUnmarked = position positionUnmarked = position
@ -777,9 +552,8 @@ class CollectionFragmentPickerPreviousNew(
} }
//SHELVINGS
private fun printShelvingResult(pos: Int) { private fun printShelvingResult(pos: Int) {
storedPosition = pos storedPosition = pos
customDialogList.getEditTextTwo().inputType = InputType.TYPE_CLASS_TEXT customDialogList.getEditTextTwo().inputType = InputType.TYPE_CLASS_TEXT
customDialogList.getEditTextTwo().setRawInputType(InputType.TYPE_CLASS_NUMBER) customDialogList.getEditTextTwo().setRawInputType(InputType.TYPE_CLASS_NUMBER)
@ -789,7 +563,6 @@ class CollectionFragmentPickerPreviousNew(
val item = myGroupList[pos].itemFk val item = myGroupList[pos].itemFk
val longName = myGroupList[pos].longName val longName = myGroupList[pos].longName
val totalReserved = myGroupList[pos].reservedQuantity val totalReserved = myGroupList[pos].reservedQuantity
val itemShelvingFk = myGroupList[pos].itemShelvingSaleFk
try { try {
customDialogList.setTitle("$shelving($item) $totalReserved de $longName").setOkButton( customDialogList.setTitle("$shelving($item) $totalReserved de $longName").setOkButton(
@ -797,7 +570,7 @@ class CollectionFragmentPickerPreviousNew(
R.string.take R.string.take
) )
) { ) {
customDialogTakeAction(pos, itemShelvingFk, totalReserved, false) customDialogTakeAction(pos, totalReserved, false)
}.setKoButton(getString(R.string.close)) { }.setKoButton(getString(R.string.close)) {
requireActivity().hideKeyboard(customDialogList.getEditTextTwo()) requireActivity().hideKeyboard(customDialogList.getEditTextTwo())
@ -812,7 +585,6 @@ class CollectionFragmentPickerPreviousNew(
customDialogTakeAction( customDialogTakeAction(
pos, pos,
itemShelvingFk,
totalReserved, totalReserved,
event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
) )
@ -828,9 +600,8 @@ class CollectionFragmentPickerPreviousNew(
} }
private fun customDialogTakeAction( private fun customDialogTakeAction(
position: Int, itemShelvingFk: Int, totalReserved: Int, isItemScanned: Boolean? position: Int, totalReserved: Int, isItemScanned: Boolean?
) { ) {
goBack = false
isScanned = isItemScanned isScanned = isItemScanned
if (customDialogList.getValueTwo().isNotEmpty()) { if (customDialogList.getValueTwo().isNotEmpty()) {
@ -843,7 +614,7 @@ class CollectionFragmentPickerPreviousNew(
if (quantityToReserve < totalReserved) { if (quantityToReserve < totalReserved) {
if (customDialogList.getValueTwo() in sales[position].Barcodes || customDialogList.getValueTwo() == sales[position].itemFk.toString()) { if (customDialogList.getValueTwo() in myGroupList[position].Barcodes || customDialogList.getValueTwo() == myGroupList[position].itemFk.toString()) {
customDialogList.dismiss() customDialogList.dismiss()
showQuestionUbicationEmpty(position, quantityToReserve) showQuestionUbicationEmpty(position, quantityToReserve)
} else { } else {
@ -862,22 +633,19 @@ class CollectionFragmentPickerPreviousNew(
} }
if (quantityToReserve == totalReserved) { if (quantityToReserve == totalReserved) {
try { try {
originalItemScan = customDialogList.getValueTwo().toLong() if (checkItemScan(customDialogList.getValueTwo(), position)) {
if (checkItemScan(customDialogList.getValueTwo())) {
markLine(storedPosition, quantityToReserve, false) markLine(position, quantityToReserve, false)
mpok?.start() mpok?.start()
ma.hideKeyboard(customDialogList.getEditTextTwo()) ma.hideKeyboard(customDialogList.getEditTextTwo())
customDialogList.dismiss() customDialogList.dismiss()
showTicket(sales[position].ticketFk) showTicket(myGroupList[position].ticketFk)
scanRequest() scanRequest()
} else { } else {
itemShelvingFkStored = itemShelvingFk
quantityReserveToCheckItemScan = quantityToReserve quantityReserveToCheckItemScan = quantityToReserve
viewModel.getIdFromCodeSalix( viewModel.getIdFromCodeSalix(
code = customDialogList.getValueTwo(), code = customDialogList.getValueTwo(),
@ -895,29 +663,30 @@ class CollectionFragmentPickerPreviousNew(
} }
} }
private fun showTicket(ticketFk:Int) { private fun showTicket(ticketFk: Int) {
val inflater = LayoutInflater.from(requireContext())
val toast = Toast.makeText(requireContext(), "$ticketFk", Toast.LENGTH_LONG) val layout = inflater.inflate(R.layout.ticket_toast_layout, null)
val view = toast.view val text = layout.findViewById<TextView>(R.id.toast_text)
val text = view?.findViewById<TextView>(android.R.id.message) text.text = "$ticketFk"
text?.setTextColor(requireContext().getColor(R.color.verdnatura_orange_salix)) text.setTextColor(requireContext().getColor(R.color.verdnatura_orange_salix))
text?.textSize = 18f text.textSize = 18f
val background = GradientDrawable() val background = GradientDrawable()
background.setColor(Color.parseColor("#000000")) background.setColor(Color.parseColor("#000000"))
background.cornerRadius = 16f background.cornerRadius = 16f
view?.background = background layout.background = background
val toast = Toast(requireContext())
toast.duration = Toast.LENGTH_LONG
toast.view = layout
toast.setGravity(Gravity.CENTER, 0, 0) toast.setGravity(Gravity.CENTER, 0, 0)
toast.show() toast.show()
} }
private fun setStoredPosition() { private fun checkItemScan(valueToCheck: String, position: Int): Boolean {
setListPosition()/*if (goBack) setListPosition(storedBackPosition, isFromBack) else { println("CheckItemScan $valueToCheck")
setListPosition(storedPosition, isFromBack)*/ val saleToCheck = myGroupList[position]
} println("CheckItemScan saleTocheck$saleToCheck")
println("CheckItemScan saleTocheck Item ${saleToCheck.itemFk}")
private fun checkItemScan(valueToCheck: String): Boolean { println("CheckItemScan saleTocheck ItemBarcodes ${saleToCheck.Barcodes}")
val saleToCheck = myGroupList[storedPosition]
if (saleToCheck.itemFk.toString() == valueToCheck) return true if (saleToCheck.itemFk.toString() == valueToCheck) return true
else { else {
saleToCheck.Barcodes.forEach { barcode -> saleToCheck.Barcodes.forEach { barcode ->
@ -929,12 +698,11 @@ class CollectionFragmentPickerPreviousNew(
} }
private fun showQuestionUbicationEmpty(position: Int, quantity: Int = 0) { private fun showQuestionUbicationEmpty(position: Int, quantity: Int = 0) {
customDialogThreeButtonsQuantity.setTitle( customDialogThreeButtonsQuantity.setTitle(
getString( getString(
R.string.changeQuantity, quantity, sales[position].itemFk R.string.changeQuantity, quantity, myGroupList[position].itemFk
) )
).setDescription(getString(R.string.questionItemShelving, sales[position].itemFk)) ).setDescription(getString(R.string.questionItemShelving, myGroupList[position].itemFk))
.setValue("").setCustomDialogValue(View.GONE) .setValue("").setCustomDialogValue(View.GONE)
customDialogThreeButtonsQuantity.setOkButtonAdd(text = getString(R.string.yes)) { customDialogThreeButtonsQuantity.setOkButtonAdd(text = getString(R.string.yes)) {
scanRequest() scanRequest()
@ -942,7 +710,7 @@ class CollectionFragmentPickerPreviousNew(
getString(R.string.errorQuantityShelving).toast(requireContext()) getString(R.string.errorQuantityShelving).toast(requireContext())
customDialogThreeButtonsQuantity.dismiss() customDialogThreeButtonsQuantity.dismiss()
showQuestionUbicationEmpty(position, quantity) showQuestionUbicationEmpty(position, quantity)
}.setOkButtonTwo("NO") { }.setOkButtonTwo(getString(R.string.no)) {
scanRequest() scanRequest()
customDialogThreeButtonsQuantity.dismiss() customDialogThreeButtonsQuantity.dismiss()
if (quantity == 0) { if (quantity == 0) {
@ -959,25 +727,6 @@ class CollectionFragmentPickerPreviousNew(
customDialogThreeButtons.setFocusDialogValue() customDialogThreeButtons.setFocusDialogValue()
} }
//OPTIONS
private fun print() {
if (ma.havePrinter() && ma.haveSector()) {
showDialogLabelCount()
} else {
ma.messageWithSound(
getString(R.string.printerFault),
isError = true,
true,
getString(R.string.printError),
false
)
}
}
private fun addItem() { private fun addItem() {
listPlacementSupply = ArrayList() listPlacementSupply = ArrayList()
collection.tickets.forEach { collection.tickets.forEach {
@ -1023,7 +772,6 @@ class CollectionFragmentPickerPreviousNew(
} }
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) {
customDialogAddItem() customDialogAddItem()
@ -1096,26 +844,16 @@ class CollectionFragmentPickerPreviousNew(
} }
private fun setTotalLines() { private fun setTotalLines() {
val totalMark = myGroupList.count { it.isPicked == 1 }
val totalMark = sales.count { it.isPicked == 1 }
binding.mainToolbar.toolbarTitle.text = binding.mainToolbar.toolbarTitle.text =
if (collection.collectionFk != 0) collection.collectionFk.toString() else "" if (collection.collectionFk != 0) collection.collectionFk.toString() else ""
binding.mainToolbar.toolbarSubtitle.text = binding.mainToolbar.toolbarSubtitle.text =
getString(R.string.totalsPicker, totalMark, sales.size) getString(R.string.totalsPicker, totalMark, myGroupList.size)
if (totalMark == myGroupList.size) {
if (totalMark == sales.size) {
getString(R.string.Coleccióncompleta).toast(this.context, Toast.LENGTH_SHORT) getString(R.string.Coleccióncompleta).toast(this.context, Toast.LENGTH_SHORT)
changeTicketState()
}
}
private fun changeTicketState() {
viewModel.saleTrackingAddPrevOK(collection.collectionFk) viewModel.saleTrackingAddPrevOK(collection.collectionFk)
} }
}
private fun showScanner(index: Int, sale: Sale) { private fun showScanner(index: Int, sale: Sale) {
customDialogInput.getEditText().inputType = InputType.TYPE_CLASS_TEXT customDialogInput.getEditText().inputType = InputType.TYPE_CLASS_TEXT
@ -1150,7 +888,6 @@ class CollectionFragmentPickerPreviousNew(
scanInput.requestFocus() scanInput.requestFocus()
customDialogInput.dismiss() customDialogInput.dismiss()
scanInput.requestFocus() scanInput.requestFocus()
} }
private fun showErrorMessage(title: String = getString(R.string.errorMarkLine), text: String) { private fun showErrorMessage(title: String = getString(R.string.errorMarkLine), text: String) {
@ -1158,38 +895,4 @@ class CollectionFragmentPickerPreviousNew(
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()
} }
private fun showDialogLabelCount() {
var isTicket = false
for (t in collection.tickets) {
if (t.ticketFk == (collection.collectionFk)) {
isTicket = true
}
}
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 dialog = builder.create()
dialog.show()
} else {
viewModel.collectionStickerPrint(
collectionFk = collection.collectionFk, null
)
}
}
} }

View File

@ -44,14 +44,13 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val collectionTicketList: LiveData<CollectionVO> val collectionTicketList: LiveData<CollectionVO>
get() = _collectionTicketList get() = _collectionTicketList
private val _responseCollectionId by lazy { MutableLiveData<Int>() }
val responseCollectionId: LiveData<Int>
get() = _responseCollectionId
private val _responseExistsItemShelvingSale by lazy { MutableLiveData<ResponseItemExistsItemShelvingSale>() } private val _responseExistsItemShelvingSale by lazy { MutableLiveData<ResponseItemExistsItemShelvingSale>() }
val responseExistsItemShelvingSale: LiveData<ResponseItemExistsItemShelvingSale> val responseExistsItemShelvingSale: LiveData<ResponseItemExistsItemShelvingSale>
get() = _responseExistsItemShelvingSale get() = _responseExistsItemShelvingSale
val loadExistsResponse: LiveData<Event<ResponseItemExistsItemShelvingSale>> =
_responseExistsItemShelvingSale.map { Event(it) }
private val _collectionTicketSalix by lazy { MutableLiveData<CollectionTicket>() } private val _collectionTicketSalix by lazy { MutableLiveData<CollectionTicket>() }
val collectionTicketSalix: LiveData<CollectionTicket> val collectionTicketSalix: LiveData<CollectionTicket>
get() = _collectionTicketSalix get() = _collectionTicketSalix
@ -63,10 +62,6 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val loadCollectionTicketSalix: LiveData<Event<CollectionTicket>> = val loadCollectionTicketSalix: LiveData<Event<CollectionTicket>> =
_collectionTicketSalix.map { Event(it) } _collectionTicketSalix.map { Event(it) }
private val _collectionTicketListLocal by lazy { MutableLiveData<CollectionTicket>() }
val collectionTicketListLocal: LiveData<CollectionTicket>
get() = _collectionTicketListLocal
private val _placementSuppleyList by lazy { MutableLiveData<PlacementSupplyListVO>() } private val _placementSuppleyList by lazy { MutableLiveData<PlacementSupplyListVO>() }
val placementSuppleyList: LiveData<PlacementSupplyListVO> val placementSuppleyList: LiveData<PlacementSupplyListVO>
get() = _placementSuppleyList get() = _placementSuppleyList
@ -91,29 +86,27 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val responseSaleTracking_mark: LiveData<ResponseItemVO> val responseSaleTracking_mark: LiveData<ResponseItemVO>
get() = _responseSaleTracking_mark get() = _responseSaleTracking_mark
private val _responseConfirmReservedItemShelvingSale by lazy { MutableLiveData<ResponseItemVO>() } private val _responseConfirmReservedItemShelvingSale by lazy { MutableLiveData<Boolean>() }
val responseConfirmReservedItemShelvingSale: LiveData<ResponseItemVO> val responseConfirmReservedItemShelvingSale: LiveData<Boolean>
get() = _responseConfirmReservedItemShelvingSale get() = _responseConfirmReservedItemShelvingSale
val loadPicked: LiveData<Event<Boolean>> =
_responseConfirmReservedItemShelvingSale.map { Event(it) }
private val _responseItemShelvingSale by lazy { MutableLiveData<ResponseItemVO>() } private val _responseItemShelvingSale by lazy { MutableLiveData<ResponseItemVO>() }
val responseItemShelvingSale: LiveData<ResponseItemVO> val responseItemShelvingSale: LiveData<ResponseItemVO>
get() = _responseItemShelvingSale get() = _responseItemShelvingSale
private val _responseItemShelvingSaleUnPicked by lazy { MutableLiveData<ResponseItemVO>() } private val _responseItemShelvingSaleUnPicked by lazy { MutableLiveData<Boolean>() }
val responseItemShelvingSaleUnPicked: LiveData<ResponseItemVO> val responseItemShelvingSaleUnPicked: LiveData<Boolean>
get() = _responseItemShelvingSaleUnPicked get() = _responseItemShelvingSaleUnPicked
val loadUnpicked: LiveData<Event<ResponseItemVO>> = val loadUnpicked: LiveData<Event<Boolean>> = _responseItemShelvingSaleUnPicked.map { Event(it) }
_responseItemShelvingSaleUnPicked.map { Event(it) }
private val _responseCollectionAddItem by lazy { MutableLiveData<ResponseItemVO>() } private val _responseCollectionAddItem by lazy { MutableLiveData<Boolean>() }
val responseCollectionAddItem: LiveData<ResponseItemVO> val responseCollectionAddItem: LiveData<Boolean>
get() = _responseCollectionAddItem get() = _responseCollectionAddItem
private val _responseConfirmReservedUpdate by lazy { MutableLiveData<ResponseItemVO>() }
val responseConfirmReservedUpdate: LiveData<ResponseItemVO>
get() = _responseConfirmReservedUpdate
private val _responseParking by lazy { MutableLiveData<ResponseItemVO>() } private val _responseParking by lazy { MutableLiveData<ResponseItemVO>() }
val responseParking: LiveData<ResponseItemVO> val responseParking: LiveData<ResponseItemVO>
get() = _responseParking get() = _responseParking
@ -145,10 +138,6 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val responseItemShelvingSaleGroup: LiveData<ResponseItemVO> val responseItemShelvingSaleGroup: LiveData<ResponseItemVO>
get() = _responseItemShelvingSaleGroup get() = _responseItemShelvingSaleGroup
private val _responsecheckfully by lazy { MutableLiveData<ResponseItemVO>() }
val responsecheckfully: LiveData<ResponseItemVO>
get() = _responsecheckfully
private val _responseTicketClosure by lazy { MutableLiveData<ResponseItemVO>() } private val _responseTicketClosure by lazy { MutableLiveData<ResponseItemVO>() }
val responseTicketClosure: LiveData<ResponseItemVO> val responseTicketClosure: LiveData<ResponseItemVO>
get() = _responseTicketClosure get() = _responseTicketClosure
@ -157,10 +146,6 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val responseCollectionUnchecked: LiveData<ResponseItemVO> val responseCollectionUnchecked: LiveData<ResponseItemVO>
get() = _responseCollectionUnchecked get() = _responseCollectionUnchecked
/* private val _responseMissingTrash by lazy { MutableLiveData<ResponseItemVO>() }
val responseMissingTrash: LiveData<ResponseItemVO>
get() = _responseMissingTrash*/
private val _responseSplit by lazy { MutableLiveData<ResponseItemVO>() } private val _responseSplit by lazy { MutableLiveData<ResponseItemVO>() }
val responseSplit: LiveData<ResponseItemVO> val responseSplit: LiveData<ResponseItemVO>
get() = _responseSplit get() = _responseSplit
@ -187,7 +172,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val loadResponseDel: LiveData<Event<ResponseItemVO>> = _responseDel.map { Event(it) } val loadResponseDel: LiveData<Event<ResponseItemVO>> = _responseDel.map { Event(it) }
val loadResponseAddItem: LiveData<Event<ResponseItemVO>> = val loadResponseAddItem: LiveData<Event<Boolean>> =
_responseCollectionAddItem.map { Event(it) } _responseCollectionAddItem.map { Event(it) }
val loadResponseSaleTrackingMark: LiveData<Event<ResponseItemVO>> = val loadResponseSaleTrackingMark: LiveData<Event<ResponseItemVO>> =
@ -394,28 +379,14 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
) { ) {
salix.itemShelvingSaleSetquantitySalix( salix.itemShelvingSaleSetquantitySalix(
params = arrayListOf(itemShelvingSaleFk, quantity, isItemShelvingSaleEmpty, sectorFk) params = arrayListOf(itemShelvingSaleFk, quantity, isItemShelvingSaleEmpty, sectorFk)
//salix.itemShelvingSaleSetQuantity(
// params = ItemShelvingSaleSalix(itemShelvingSaleFk, quantity, isItemShelvingSaleEmpty)
).enqueue(object : SalixCallback<Any>(context) { ).enqueue(object : SalixCallback<Any>(context) {
override fun onError(t: Throwable) {
_responseConfirmReservedItemShelvingSale.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onSuccess(response: Response<Any>) { override fun onSuccess(response: Response<Any>) {
if (!response.isSuccessful) { _responseConfirmReservedItemShelvingSale.value = true
_responseConfirmReservedItemShelvingSale.value = ResponseItemVO(
isError = true, errorMessage = getMessageFromAllResponse( if (isItemShelvingSaleEmpty == true)
nameofFunction(this), response.message() _responseCollectionAddItem.value = true
)
)
} else {
_responseConfirmReservedItemShelvingSale.value =
ResponseItemVO(isError = false, response = "")
}
} }
}) })
} }
@ -429,44 +400,9 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
) )
).enqueue(object : SalixCallback<Any>(context) { ).enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) { override fun onSuccess(response: Response<Any>) {
_responseCollectionAddItem.value = ResponseItemVO(isError = false, response = "") _responseCollectionAddItem.value = true
} }
/* override fun onError(t: Throwable) {
_responseCollectionAddItem.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}*/
})
}
fun confirmItemShelvingReservedUpdate(
itemShelvingSaleFk: Int, isPicked: Boolean
) {
salix.itemShelvingsReservedUpdate(
id = itemShelvingSaleFk, params = hashMapOf("isPicked" to isPicked)
).enqueue(object : SalixCallback<Any>(context) {
override fun onError(t: Throwable) {
_responseConfirmReservedUpdate.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onSuccess(response: Response<Any>) {
if (!response.isSuccessful) {
_responseConfirmReservedUpdate.value = ResponseItemVO(
isError = true, errorMessage = getMessageFromAllResponse(
nameofFunction(this), response.message()
)
)
} else {
_responseConfirmReservedUpdate.value =
ResponseItemVO(isError = false, response = "")
}
}
}) })
} }
@ -562,15 +498,10 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
itemShelvingSaleFk itemShelvingSaleFk
) )
).enqueue(object : SalixCallback<Unit>(context) { ).enqueue(object : SalixCallback<Unit>(context) {
override fun onError(t: Throwable) {
_responseItemShelvingSaleUnPicked.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onSuccess(response: Response<Unit>) { override fun onSuccess(response: Response<Unit>) {
_responseItemShelvingSaleUnPicked.value = ResponseItemVO(isError = false) _responseItemShelvingSaleUnPicked.value = true
super.onSuccess(response)
} }
}) })
} }
@ -602,10 +533,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
saleGroupFk: Number saleGroupFk: Number
) { ) {
salix.saleGroupUpdate( salix.saleGroupUpdate(
id = saleGroupFk, id = saleGroupFk, params = hashMapOf("parkingFk" to null)
params = hashMapOf("parkingFk" to null) ).enqueue(object : SalixCallback<Any>(context) {
)
.enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) { override fun onSuccess(response: Response<Any>) {
} }
}) })
@ -671,8 +600,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
SaleTrackingDelSalix( SaleTrackingDelSalix(
saleFk = saleFk, stateCodes = listOf("CHECKED", "OK", "PREPARED") saleFk = saleFk, stateCodes = listOf("CHECKED", "OK", "PREPARED")
) )
) ).enqueue(object : SalixCallback<Any>(context) {
.enqueue(object : SalixCallback<Any>(context) {
override fun onError(t: Throwable) { override fun onError(t: Throwable) {
_responseDel.value = ResponseItemVO( _responseDel.value = ResponseItemVO(
isError = true, isError = true,
@ -746,8 +674,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
} }
fun getIdFromCodeSalix(code: String) { fun getIdFromCodeSalix(code: String) {
getItemFromBarcodeUseCase.execute(code) getItemFromBarcodeUseCase.execute(code).enqueue(object : SalixCallback<Int?>(context) {
.enqueue(object : SalixCallback<Int?>(context) {
override fun onSuccess(response: Response<Int?>) { override fun onSuccess(response: Response<Int?>) {
_responseCode.value = response.body() _responseCode.value = response.body()
@ -785,9 +712,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
salix.saleMistakeAdd( salix.saleMistakeAdd(
SaleMistakeSalix( SaleMistakeSalix(
userFk = (context as MobileApplication).userId!!, userFk = (context as MobileApplication).userId!!, saleFk = saleFk, typeFk = typeFk
saleFk = saleFk,
typeFk = typeFk
) )
).enqueue(object : SalixCallback<Any>(context) { ).enqueue(object : SalixCallback<Any>(context) {
override fun onError(t: Throwable) { override fun onError(t: Throwable) {
@ -807,12 +732,10 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
} }
fun mistakeType() { fun mistakeType() {
salix.getMistakeTypes() salix.getMistakeTypes().enqueue(object : SalixCallback<List<MistakeTypeVO>>(context) {
.enqueue(object : SalixCallback<List<MistakeTypeVO>>(context) {
override fun onSuccess(response: Response<List<MistakeTypeVO>>) { override fun onSuccess(response: Response<List<MistakeTypeVO>>) {
if (response.body() != null) { if (response.body() != null) {
_mistakeList.value = _mistakeList.value = response.body()?.let { MistakeTypeListVO(it) }
response.body()?.let { MistakeTypeListVO(it) }
} else { } else {
val listError: ArrayList<MistakeTypeVO> = ArrayList() val listError: ArrayList<MistakeTypeVO> = ArrayList()
listError.add(MistakeTypeVO(0, "")) listError.add(MistakeTypeVO(0, ""))
@ -885,9 +808,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
override fun onSuccess(response: Response<Any>) { override fun onSuccess(response: Response<Any>) {
_responseTicketClosure.value = ResponseItemVO( _responseTicketClosure.value = ResponseItemVO(
isError = false, isError = false, response = response.body()!!.toString(), errorMessage = ""
response = response.body()!!.toString(),
errorMessage = ""
) )
} }
@ -913,9 +834,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
if (response.body() != null) { if (response.body() != null) {
_responseCollectionUnchecked.value = ResponseItemVO( _responseCollectionUnchecked.value = ResponseItemVO(
isError = false, isError = false, response = response.body()!!, errorMessage = ""
response = response.body()!!,
errorMessage = ""
) )
} else { } else {
_responseCollectionUnchecked.value = ResponseItemVO( _responseCollectionUnchecked.value = ResponseItemVO(

View File

@ -22,7 +22,6 @@ import es.verdnatura.R
import es.verdnatura.databinding.ActivityMainBinding import es.verdnatura.databinding.ActivityMainBinding
import es.verdnatura.domain.ConstAndValues.MAINACTIVITY import es.verdnatura.domain.ConstAndValues.MAINACTIVITY
import es.verdnatura.domain.ConstAndValues.MENUBYDEFAULTSELECTED import es.verdnatura.domain.ConstAndValues.MENUBYDEFAULTSELECTED
import es.verdnatura.domain.ConstAndValues.PRECHECKERNEW
import es.verdnatura.domain.ConstAndValues.PREITEMPICKER import es.verdnatura.domain.ConstAndValues.PREITEMPICKER
import es.verdnatura.domain.ConstAndValues.PRINTERFK import es.verdnatura.domain.ConstAndValues.PRINTERFK
import es.verdnatura.domain.ConstAndValues.PRINTERFKDEFAULT import es.verdnatura.domain.ConstAndValues.PRINTERFKDEFAULT
@ -67,7 +66,6 @@ import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFra
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPickerNew import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPickerNew
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPickerPreviousNew import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPickerPreviousNew
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPreChecker import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPreChecker
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPreCheckerNew
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionShowTicketFragment import es.verdnatura.presentation.view.feature.collection.fragment.CollectionShowTicketFragment
import es.verdnatura.presentation.view.feature.controlador.fragment.ControladorFragment import es.verdnatura.presentation.view.feature.controlador.fragment.ControladorFragment
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoFragment import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoFragment
@ -513,8 +511,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
} }
getString(R.string.historicals) -> { getString(R.string.historicals) -> {
addFragmentOnTop( addFragmentOnTop(
PasilleroFragment.newInstance(itemTitle, isInitMenu = false), PasilleroFragment.newInstance(itemTitle, isInitMenu = false)
) )
} }
@ -658,7 +657,12 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
//Tarea 7855 //Tarea 7855
getString(R.string.scanPreparedExpedition) -> { getString(R.string.scanPreparedExpedition) -> {
addFragmentOnTop(ExpeditionPreparedStateFragment.newInstance()) addFragmentOnTop(
ExpeditionPreparedStateFragment.newInstance(
"PREPARED",
getString(R.string.scanExpeditions)
)
)
} }
getString(R.string.titleAuto) -> { getString(R.string.titleAuto) -> {
@ -674,8 +678,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
}*/ }*/
getString(R.string.titlePickers) -> { getString(R.string.titlePickers) -> {
//addFragmentOnTop(SacadorFragment.newInstance()) addFragmentOnTop(SacadorFragment.newInstance("PREPARED"))
addFragmentOnTop(ControlVehiculoFragment.newInstance("")) //addFragmentOnTop(ControlVehiculoFragment.newInstance(""))
} }
"Sacador Test" -> { "Sacador Test" -> {
@ -721,15 +725,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
addFragmentOnTop(PreControladorFragment.newInstance()) addFragmentOnTop(PreControladorFragment.newInstance())
} }
getString(R.string.titlePreControlTest) -> {
addFragmentOnTop(
CollectionFragmentPreCheckerNew.newInstance(
null,
type = PRECHECKERNEW
)
)
}
getString(R.string.titleShelvingHistorical) -> { getString(R.string.titleShelvingHistorical) -> {
addFragmentOnTop(ItemShelvingLogFragment.newInstance(itemTitle)) addFragmentOnTop(ItemShelvingLogFragment.newInstance(itemTitle))
@ -900,6 +895,12 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
getString(R.string.reviewBoxPicking) -> { getString(R.string.reviewBoxPicking) -> {
addFragmentOnTop(BoxPickingFragment.newInstance(itemTitle)) addFragmentOnTop(BoxPickingFragment.newInstance(itemTitle))
/* addFragmentOnTop(
ExpeditionPreparedStateFragment.newInstance(
"CHECKED",
getString(item.title)
)
)*/
} }
getString(R.string.pickerHelper) -> { getString(R.string.pickerHelper) -> {

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/verdnatura_black"
android:orientation="horizontal"
android:padding="8dp">
<TextView
android:id="@+id/toast_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/verdnatura_orange_salix"
android:textSize="16sp" />
</LinearLayout>