From e6cf5ef2fbe250d82531b162d8c123ce7eb8149a Mon Sep 17 00:00:00 2001 From: Sergio De la torre Date: Tue, 24 Sep 2024 10:31:04 +0200 Subject: [PATCH] feat reservas refs #6861 --- .../es/verdnatura/domain/ConstAndValues.kt | 8 +- .../collection/adapter/SaleAdapterNew.kt | 48 +- .../fragment/CollectionFragmentPickerNew.kt | 87 +- .../CollectionFragmentPickerPreviousNew.kt | 491 ++----- .../CollectionFragmentPreCheckerNew.kt | 1180 ----------------- .../fragment/CollectionViewModel.kt | 199 +-- .../feature/main/activity/MainActivity.kt | 31 +- .../main/res/layout/ticket_toast_layout.xml | 16 + 8 files changed, 246 insertions(+), 1814 deletions(-) delete mode 100644 app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPreCheckerNew.kt create mode 100644 app/src/main/res/layout/ticket_toast_layout.xml diff --git a/app/src/main/java/es/verdnatura/domain/ConstAndValues.kt b/app/src/main/java/es/verdnatura/domain/ConstAndValues.kt index ee166162..c0914d4a 100644 --- a/app/src/main/java/es/verdnatura/domain/ConstAndValues.kt +++ b/app/src/main/java/es/verdnatura/domain/ConstAndValues.kt @@ -12,7 +12,6 @@ object ConstAndValues { const val SERIALNUMBER = "SERIALNUMBER" const val ON_CHECKING = "ON_CHECKING" const val PRECHECKER = "PRECHECKER" - const val PRECHECKERNEW = "PRECHECKERNEW" const val MAINACTIVITY = "MAIN" const val VERTICKET = "SHOWTICKET" const val SECTORFKDEFAULT = -1 @@ -67,11 +66,6 @@ object ConstAndValues { const val LIMITRECORDSSHELVINGLOG = 50 const val RESERVATIONMODE = "operatorReservationMode" const val MODELWORKERTYPEACTIVITY = "APP" - val ACTIONNAMES = listOf( - "STOP", - "ON_CHECKING", - "Delivery" - ) - + } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapterNew.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapterNew.kt index ac60ba19..0fbc3f48 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapterNew.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapterNew.kt @@ -14,12 +14,12 @@ import androidx.recyclerview.widget.RecyclerView import es.verdnatura.R import es.verdnatura.databinding.SaleRowFragmentBinding import es.verdnatura.domain.ConstAndValues.PREITEMPICKERTEST +import es.verdnatura.domain.ConstAndValues.PREPARED import es.verdnatura.domain.ConstAndValues.SACADOR import es.verdnatura.domain.toast import es.verdnatura.presentation.common.OnMistakeClickListener 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.view.feature.pasillero.model.PasillerosItemVO @@ -28,7 +28,6 @@ import es.verdnatura.presentation.view.feature.sacador.model.Sale class SaleAdapterNew( private val items: List, private val onPasillerosItemClickListener: OnPasillerosItemClickListener, - private val onQuantityClick: OnQuantityClickSaleListener, private val onSaleClickListener: OnSaleClickSaleListener, private val onMistakeClickListener: OnMistakeClickListener, private val onPackingClick: OnPackingClickSaleListener, @@ -66,7 +65,7 @@ class SaleAdapterNew( ) : RecyclerView.ViewHolder(binding.root) { fun bind(sale: Sale) { binding.apply { - // if (sale.reservedQuantity == null) sale.reservedQuantity = 0 + // if (sale.reservedQuantity == null) sale.reservedQuantity = 0 val childLayoutManager = LinearLayoutManager(context!!, RecyclerView.HORIZONTAL, false) @@ -121,10 +120,9 @@ class SaleAdapterNew( itemFirstToPicker.setOnClickListener { onPackingClick.onPackingClick(sale) - } - quantityReserved.setOnClickListener { - onQuantityClick.onQuantityClick(sale) - } + }/* quantityReserved.setOnClickListener { + onQuantityClick.onQuantityClick(sale) + }*/ linearLayoutItem.setOnClickListener { @@ -134,6 +132,7 @@ class SaleAdapterNew( } } + println("type es $type") imageErrorMessage.setOnClickListener { // onMistakeClickListener.onMistakeClickListener(sale) @@ -203,7 +202,9 @@ class SaleAdapterNew( txtdeNew.visibility = View.VISIBLE itemArticleQuantityPicked.visibility = View.VISIBLE itemArticleQuantityLine3.visibility = View.VISIBLE*/ - if (type != SACADOR) { + + imageErrorMessage.visibility = View.GONE + if (type != SACADOR && type != PREITEMPICKERTEST) { val colorRes = if (sale.hasMistake == true) R.color.verdnatura_red_salix else R.color.verdnatura_black imageErrorMessage.imageTintList = @@ -221,7 +222,6 @@ class SaleAdapterNew( adapter = SaleAdapterNew( sale.sonSales, onPasillerosItemClickListener, - onQuantityClick, onSaleClickListener, onMistakeClickListener, onPackingClick @@ -271,7 +271,8 @@ class SaleAdapterNew( 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) { textToConcat2 = "${(sale.saleQuantity - sale.accumulatedQuantity) / (sale.grouping ?: 1)} x ${sale.grouping ?: "1"}" @@ -315,12 +316,19 @@ class SaleAdapterNew( "${sale.reservedQuantity} de ${sale.saleQuantity}" if (sale.isPicked == 1) { - contentLayout.setBackgroundColor( - //lolass - getColor( - context!!, R.color.verdnatura_dark_sky_blue + if (type == PREPARED) { + contentLayout.setBackgroundColor( + getColor( + context!!, R.color.verdnatura_orange_salix + ) ) - ) + } else { + contentLayout.setBackgroundColor( + getColor( + context!!, R.color.verdnatura_dark_sky_blue + ) + ) + } } else { contentLayout.setBackgroundColor( getColor( @@ -330,8 +338,8 @@ class SaleAdapterNew( } - binding.itemParkingCode.text = if (type == PREITEMPICKERTEST) - sale.parkingCodePrevia else sale.parkingCode + binding.itemParkingCode.text = + if (type == PREITEMPICKERTEST) sale.parkingCodePrevia else sale.parkingCode this.sale = sale @@ -344,13 +352,11 @@ class SaleAdapterNew( if (color.isNullOrBlank()) { DrawableCompat.setTint( - backgroundDrawableTicket, - Color.TRANSPARENT + backgroundDrawableTicket, Color.TRANSPARENT ) } else { DrawableCompat.setTint( - backgroundDrawableTicket, - Color.parseColor(color) + backgroundDrawableTicket, Color.parseColor(color) ) } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPickerNew.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPickerNew.kt index d44f2094..dd31b066 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPickerNew.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPickerNew.kt @@ -32,7 +32,6 @@ 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 @@ -398,46 +397,37 @@ class CollectionFragmentPickerNew( responseConfirmReservedItemShelvingSale.observe(viewLifecycleOwner) { - if (it.isError) { - ma.messageWithSound( - it.errorMessage, - isError = true, - isPlayed = true - ) - } - if (!it.isError) { - myGroupList[positionConfirm].isPicked = 1 - saleAdapter!!.notifyDataSetChanged() - lm!!.scrollToPositionWithOffset(storedPosition, 0) - viewModel.collectionTicketGetSalix( - collection.collectionFk, print = false - ) - } - - } - - - responseItemShelvingSale.observe(viewLifecycleOwner) { myGroupList[positionConfirm].isPicked = 1 - myGroupList[positionConfirm].reservedQuantity = quantityConfirm - viewModel.collectionTicketGetSalix( - collection.collectionFk, print = false - ) - lm!!.scrollToPositionWithOffset(positionConfirm, 0) - ma.messageWithSound( - getString(R.string.operationSuccess), it.isError, !it.isError, isToasted = false - ) + saleAdapter!!.notifyDataSetChanged() + lm!!.scrollToPositionWithOffset(storedPosition, 0) + /* viewModel.collectionTicketGetSalix( + collection.collectionFk, print = false + )*/ + } - responseItemShelvingSaleUnPicked.observe(viewLifecycleOwner) { - myGroupList[positionUnmarked].isPicked = 1 - myGroupList[positionUnmarked].reservedQuantity = quantityConfirm - viewModel.collectionTicketGetSalix( - collection.collectionFk, print = false - ) - lm!!.scrollToPositionWithOffset(positionUnmarked, 0) - ma.messageWithSound( - getString(R.string.operationSuccess), it.isError, !it.isError, isToasted = false - ) + + /* + responseItemShelvingSale.observe(viewLifecycleOwner) { + myGroupList[positionConfirm].isPicked = 1 + myGroupList[positionConfirm].reservedQuantity = quantityConfirm + viewModel.collectionTicketGetSalix( + collection.collectionFk, print = false + ) + lm!!.scrollToPositionWithOffset(positionConfirm, 0) + ma.messageWithSound( + getString(R.string.operationSuccess), it.isError, !it.isError, isToasted = false + ) + }*/ + loadUnpicked.observe(viewLifecycleOwner) { event -> + event.getContentIfNotHandled().notNull { + + myGroupList[positionUnmarked].isPicked = 0 + myGroupList[positionUnmarked].reservedQuantity = quantityConfirm + saleAdapter!!.notifyItemChanged(positionUnmarked) + + lm!!.scrollToPositionWithOffset(positionUnmarked, 0) + + } } responseItemShelvingSaleGroup.observe(viewLifecycleOwner) { @@ -512,24 +502,7 @@ class CollectionFragmentPickerNew( 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 { override fun onSaleClick(mySale: Sale) { myGroupList.forEachIndexed { index, sale -> diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPickerPreviousNew.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPickerPreviousNew.kt index 7aa51b2d..1b095899 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPickerPreviousNew.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPickerPreviousNew.kt @@ -1,6 +1,5 @@ package es.verdnatura.presentation.view.feature.collection.fragment -import android.app.AlertDialog import android.content.Context import android.graphics.Color import android.graphics.drawable.Drawable @@ -10,6 +9,7 @@ import android.os.Bundle import android.text.InputType import android.view.Gravity import android.view.KeyEvent +import android.view.LayoutInflater import android.view.View import android.view.WindowManager import android.view.inputmethod.EditorInfo @@ -24,7 +24,6 @@ import es.verdnatura.R import es.verdnatura.databinding.FragmentCollectionNewBinding import es.verdnatura.domain.ConstAndValues.BASEURLSALIX import es.verdnatura.domain.ConstAndValues.PRESACADOR -import es.verdnatura.domain.ConstAndValues.PRINTERNAME import es.verdnatura.domain.ConstAndValues.SECTORFK import es.verdnatura.domain.notNull 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.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 @@ -68,7 +66,6 @@ class CollectionFragmentPickerPreviousNew( CollectionViewModel::class ) { private var sales: List = listOf() - private var salesParent: List = listOf() private var saleAdapter: SaleAdapterNew? = null private var lm: LinearLayoutManager? = null private var storedPosition: Int = 0 @@ -81,27 +78,15 @@ class CollectionFragmentPickerPreviousNew( private lateinit var customDialogThreeButtonsQuantity: CustomDialogThreeButtons private var ticketSelected: Int = 0 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 mpok: MediaPlayer? = null - private var itemShelvingFkStored: Int = 0 private var storedBackPosition: Int = 0 private var tickets: ArrayList = ArrayList() - private var mistakeSale: SaleVO? = null - private var isMarking = false - private lateinit var ticketScanTxt: String private var lastScanned: Int = 0 - private var buttonPushedGetCollection = false 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 positionConfirm = 0 private var quantityConfirm = 0 - private var positionMarkPrevia = 0 private lateinit var myGroupList: List private var quantityReserveToCheckItemScan = 0 @@ -119,11 +104,8 @@ class CollectionFragmentPickerPreviousNew( override fun getLayoutId(): Int = R.layout.fragment_collection_new override fun onCreate(savedInstanceState: Bundle?) { - mperror = MediaPlayer.create((activity as MainActivity), R.raw.error) mpok = MediaPlayer.create((activity as MainActivity), R.raw.ok) - println("create onRunning") - super.onCreate(savedInstanceState) } @@ -139,7 +121,7 @@ class CollectionFragmentPickerPreviousNew( customDialogThreeButtons = CustomDialogThreeButtons(requireContext()) customDialogThreeButtonsQuantity = CustomDialogThreeButtons(requireContext()) ma.hideBottomNavigation(View.GONE) - + println("type $type") setEvents() setToolBar() viewModel.collectionTicketGetSalix( @@ -149,13 +131,6 @@ class CollectionFragmentPickerPreviousNew( super.init() } - override fun onPause() { - super.onPause() - goBack = true - goBack2 = true - goMistakeBack = true - } - private fun setToolBar() { binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE @@ -165,47 +140,32 @@ class CollectionFragmentPickerPreviousNew( } val listIcons: ArrayList = ArrayList() - val iconPrint = ImageView(context) - iconPrint.setImageResource(R.drawable.ic_print_black_24dp) + val iconAdd = ImageView(context) 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) iconParking.setImageResource(R.drawable.ic_local_parking_black_24dp) val iconUpdate = ImageView(context) 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) - iconViewCollection.tooltipText = getTooltip(R.drawable.ic_collection) - iconPhone.tooltipText = getTooltip(R.drawable.phone_call) iconParking.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp) iconUpdate.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp) - // listIcons.add(iconPrint) listIcons.add(iconAdd) listIcons.add(iconParking) listIcons.add(iconUpdate) - // listIcons.remove(iconWorker) binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener { override fun onOptionsItemSelected(item: Drawable) { when (item) { - //iconViewCollection.drawable -> getCollection() - iconPrint.drawable -> print() iconAdd.drawable -> addItem() - iconWorker.drawable -> showUser() iconUpdate.drawable -> updateScreen() iconParking.drawable -> pasillerosItemClickListener?.onPasillerosItemClickListener( 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() { binding.scanInput.requestFocus() hideKeyboards() } - private fun showUser() { - - ma.onPasillerosItemClickListener( - PasillerosItemVO(title = R.string.titleUserControlVehicle), - workerFkFromTicket.toString() - ) - - } - private fun setEvents() { binding.mainToolbar.backButton.setOnClickListener { - println("reserva fuera") ma.onMyBackPressed() } //ESCANER ========= @@ -274,12 +204,8 @@ class CollectionFragmentPickerPreviousNew( if (itemScanIsQr(binding.scanInput.text.toString())) { val myQr = ItemScanned(JSONObject(binding.scanInput.text.toString())) when (myQr.table) { - "saleGroup" -> {/* if (type == CONTROLADOR) { - markPrevia(myQr.id.toString()) - } else {*/ + "saleGroup" -> { binding.scanInput.setText(myQr.id.toString()) - //findSale(binding.scanInput.text.toString()) - // } } "buy" -> binding.scanInput.setText(myQr.more) @@ -289,7 +215,6 @@ class CollectionFragmentPickerPreviousNew( ma.hideKeyboard(binding.scanInput) findSale(binding.scanInput.text.toString()) } - buttonPushedGetCollection = false } binding.scanInput.setText("") hideKeyboards() @@ -302,16 +227,8 @@ class CollectionFragmentPickerPreviousNew( //LISTA ========= binding.collectionSwipe.setOnRefreshListener { - isMarking = false binding.collectionSwipe.isRefreshing = false - - updateScreen()/* viewModel.collectionTicketGet( - collection.collectionFk, - mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK), - print = "0", - type - )*/ - buttonPushedGetCollection = false + updateScreen() binding.collectionSwipe.isRefreshing = false } @@ -336,11 +253,6 @@ class CollectionFragmentPickerPreviousNew( if (it.tickets.isNotEmpty()) { collection = it createCollectionList() - workerFkFromTicket = if (it.tickets[0].sales.isNotEmpty()) { - it.tickets[0].sales[0].workerFk.toString() - } else { - "" - } } else { binding.mainToolbar.toolbarSubtitle.text = "0/0" @@ -356,8 +268,18 @@ class CollectionFragmentPickerPreviousNew( } } - - responseExistsItemShelvingSale.observe(viewLifecycleOwner) { + loadExistsResponse.observe(viewLifecycleOwner) { event -> + 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 (it.exists) { 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 -> event.getContentIfNotHandled().notNull { updateScreen() @@ -387,117 +300,52 @@ class CollectionFragmentPickerPreviousNew( } - responsePrint.observe(viewLifecycleOwner) { - - if (!goBack) { - - if (it.isError) { - ma.messageWithSound( - it.errorMessage, isError = true, true - ) - } else { - (getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey( - PRINTERNAME - )).toast( - requireContext() - ) - } - } - - } - - responseConfirmReservedItemShelvingSale.observe(viewLifecycleOwner) { - - if (it.isError) { - ma.messageWithSound( - it.errorMessage, isError = true, true - ) - setTotalLines() - } else { + loadPicked.observe(viewLifecycleOwner) { event -> + event.getContentIfNotHandled().notNull { myGroupList[positionConfirm].isPicked = 1 saleAdapter!!.notifyItemChanged(positionConfirm) - //lolass - lm!!.scrollToPositionWithOffset(storedBackPosition, 0) - // lm!!.scrollToPositionWithOffset(storedBackPosition + 1, 0) - + lm!!.scrollToPositionWithOffset(positionConfirm, 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) - //saleAdapter!!.notifyDataSetChanged() - ma.messageWithSound( - "Confirmada acción", it.isError, !it.isError - ) - } loadUnpicked.observe(viewLifecycleOwner) { event -> event.getContentIfNotHandled().notNull { - myGroupList[positionUnmarked].isPicked = 1 + myGroupList[positionUnmarked].isPicked = 0 myGroupList[positionUnmarked].reservedQuantity = quantityConfirm - viewModel.collectionTicketGetSalix( - collection.collectionFk, print = false - ) + saleAdapter!!.notifyItemChanged(positionUnmarked) 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) { - if (!goBack2) { - if (it == null) { - showErrorMessage(text = getString(R.string.codeNotExist)) - if (mperror != null) mperror?.start() + if (it == null) { + showErrorMessage(text = getString(R.string.codeNotExist)) + if (mperror != null) mperror?.start() + } else { + if (checkItemScan(it.toString(), positionConfirm)) { + scanRequest() + customDialogList.dismiss() + mpok?.start() + markLine(positionConfirm, quantityReserveToCheckItemScan, false) } else { - if (checkItemScan(it.toString())) { - scanRequest() - customDialogList.dismiss() - mpok?.start() - markLine(storedPosition, quantityReserveToCheckItemScan, false) - } else { - customDialogList.setValueTwo("") - showErrorMessage(text = getString(R.string.lineNotExist)) - if (mperror != null) mperror?.start() - } + customDialogList.setValueTwo("") + showErrorMessage(text = getString(R.string.lineNotExist)) + if (mperror != null) mperror?.start() } } - goBack2 = false - } } } private fun createCollectionList() { - state = 0 binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString() collection.map(requireContext()) @@ -509,8 +357,7 @@ class CollectionFragmentPickerPreviousNew( val myPickingTo = mobileApplication.dataStoreApp.readDataStoreKey("PICKING_TO") collection.tickets.forEach { ticket -> - if (observations.isNotEmpty()) observations = - observations + " " + ticket.observations + if (observations.isNotEmpty()) observations = observations + " " + ticket.observations ticket.sales.forEach { sale -> if (hasPickingOrder) { @@ -523,35 +370,12 @@ class CollectionFragmentPickerPreviousNew( } } - - sales = salesList.sortedWith(compareBy { it.pickingOrderPrevia }.thenBy { it.itemFk }) - + // sales = salesList.sortedWith(compareBy { it.pickingOrderPrevia }.thenBy { it.itemFk }) //quitar comentarios FALTA AGRUPAR LAS PREVIAS myGroupList = salesList.sortedWith(compareBy { 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 { 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) { } - }, - object : OnPackingClickSaleListener { + }, object : OnPackingClickSaleListener { override fun onPackingClick(sale: Sale) { - goBack = true if (!sale.code.isNullOrEmpty()) ma.onPasillerosItemClickListener( PasillerosItemVO( @@ -614,8 +403,7 @@ class CollectionFragmentPickerPreviousNew( ), entryPoint = sale.code ) } - }, - object : OnTicketClickSaleListener { + }, object : OnTicketClickSaleListener { override fun onTicketClickListener(sale: Sale) { val entryPoint = Gson().toJson( mutableMapOf( @@ -632,8 +420,7 @@ class CollectionFragmentPickerPreviousNew( ), entryPoint = entryPoint ) } - }, - type = type + }, type = type ) @@ -642,7 +429,7 @@ class CollectionFragmentPickerPreviousNew( binding.fragmentSacadorCollections.layoutManager = lm setTotalLines() - setStoredPosition() + setListPosition() setScrollListener(lm!!) printObservations(observations) } @@ -652,7 +439,8 @@ class CollectionFragmentPickerPreviousNew( binding.fragmentSacadorCollections.addOnScrollListener(object : RecyclerView.OnScrollListener() { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { - storedBackPosition = lm.findFirstVisibleItemPosition() + // storedBackPosition = lm.findFirstVisibleItemPosition() + storedPosition = lm.findFirstVisibleItemPosition() super.onScrolled(recyclerView, dx, dy) } }) @@ -670,14 +458,12 @@ class CollectionFragmentPickerPreviousNew( private fun findSale(txtscan: String) { - var isFoundSale = false // markPrevia(txtscan) - + var isFoundSale = false //Se busca la matricula en las lineas for (indice in myGroupList.indices) { if (myGroupList[indice].isPicked != 1 && myGroupList[indice].code != null && myGroupList[indice].code!!.uppercase() == txtscan.uppercase()) { mpok!!.start() isFoundSale = true - positionMarkPrevia = indice printShelvingResult(indice) break } @@ -694,8 +480,6 @@ class CollectionFragmentPickerPreviousNew( if (sale.code!!.uppercase() == txtscan.uppercase()) { mpok!!.start() printShelvingResult(position) - //sale.isPicked = 1 - //saleAdapter!!.notifyItemChanged(position) } else { mperror!!.start() } @@ -704,30 +488,27 @@ class CollectionFragmentPickerPreviousNew( private fun markLine(position: Int, quantity: Int, isItemShelvingSaleEmpty: Boolean?) { - state = 0 isScanned = null positionConfirm = position quantityConfirm = quantity - isMarking = true runBlocking { - var sectorFk = mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK) + val sectorFk = mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK) 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 - for (indice in myGroupList.indices) { - if (!myGroupList[indice].isParent && myGroupList[indice].itemShelvingSaleFk == mySale) { - storedBackPosition = indice - } - }*/ + // storedBackPosition = position } 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) { if (myGroupList[indice].isPicked == 0) { //storedPosition = indice @@ -737,12 +518,13 @@ class CollectionFragmentPickerPreviousNew( } } else { - lm!!.scrollToPositionWithOffset(storedBackPosition, 0) + // lm!!.scrollToPositionWithOffset(storedBackPosition, 0) + lm!!.scrollToPositionWithOffset(storedPosition, 0) } } private fun unMarkLine(position: Int, sale: Sale) { - state = 0 + customDialog.setTitle(getString(R.string.unmarkLine)).setDescription( getString(R.string.goUnmark) + sale.itemFk + getString( R.string.sure @@ -750,17 +532,10 @@ class CollectionFragmentPickerPreviousNew( ).setOkButton(getString(R.string.unmark)) { if (!sale.isParent && sale.reservedQuantity == 0 && sale.originalQuantity != sale.saleQuantity) { getString(R.string.unmarkError).toast(requireContext()) - } else {/* saleAdapter!!.notifyDataSetChanged() - var mySale = sale.saleFk - for (indice in myGroupList.indices) { - if (!myGroupList[indice].isParent && myGroupList[indice].saleFk == mySale) { - d("VERDNATURA::", "la pos del index de la sale es" + indice) - storedBackPosition = indice - } - }*/ - storedBackPosition = position - setListPosition() - + } else { + //storedBackPosition = position + //storedPosition = position + // setListPosition() viewModel.itemShelvingSaleUnpicked(myGroupList[position].itemShelvingSaleFk) sale.isPicked = 0 positionUnmarked = position @@ -777,9 +552,8 @@ class CollectionFragmentPickerPreviousNew( } - //SHELVINGS - private fun printShelvingResult(pos: Int) { + storedPosition = pos customDialogList.getEditTextTwo().inputType = InputType.TYPE_CLASS_TEXT customDialogList.getEditTextTwo().setRawInputType(InputType.TYPE_CLASS_NUMBER) @@ -789,7 +563,6 @@ class CollectionFragmentPickerPreviousNew( val item = myGroupList[pos].itemFk val longName = myGroupList[pos].longName val totalReserved = myGroupList[pos].reservedQuantity - val itemShelvingFk = myGroupList[pos].itemShelvingSaleFk try { customDialogList.setTitle("$shelving($item) $totalReserved de $longName").setOkButton( @@ -797,7 +570,7 @@ class CollectionFragmentPickerPreviousNew( R.string.take ) ) { - customDialogTakeAction(pos, itemShelvingFk, totalReserved, false) + customDialogTakeAction(pos, totalReserved, false) }.setKoButton(getString(R.string.close)) { requireActivity().hideKeyboard(customDialogList.getEditTextTwo()) @@ -812,7 +585,6 @@ class CollectionFragmentPickerPreviousNew( customDialogTakeAction( pos, - itemShelvingFk, totalReserved, event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER ) @@ -828,9 +600,8 @@ class CollectionFragmentPickerPreviousNew( } private fun customDialogTakeAction( - position: Int, itemShelvingFk: Int, totalReserved: Int, isItemScanned: Boolean? + position: Int, totalReserved: Int, isItemScanned: Boolean? ) { - goBack = false isScanned = isItemScanned if (customDialogList.getValueTwo().isNotEmpty()) { @@ -843,7 +614,7 @@ class CollectionFragmentPickerPreviousNew( 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() showQuestionUbicationEmpty(position, quantityToReserve) } else { @@ -862,22 +633,19 @@ class CollectionFragmentPickerPreviousNew( } if (quantityToReserve == totalReserved) { try { - originalItemScan = customDialogList.getValueTwo().toLong() - if (checkItemScan(customDialogList.getValueTwo())) { + if (checkItemScan(customDialogList.getValueTwo(), position)) { - markLine(storedPosition, quantityToReserve, false) + markLine(position, quantityToReserve, false) mpok?.start() ma.hideKeyboard(customDialogList.getEditTextTwo()) customDialogList.dismiss() - showTicket(sales[position].ticketFk) + showTicket(myGroupList[position].ticketFk) scanRequest() } else { - itemShelvingFkStored = itemShelvingFk - quantityReserveToCheckItemScan = quantityToReserve viewModel.getIdFromCodeSalix( code = customDialogList.getValueTwo(), @@ -895,29 +663,30 @@ class CollectionFragmentPickerPreviousNew( } } - private fun showTicket(ticketFk:Int) { - - val toast = Toast.makeText(requireContext(), "$ticketFk", Toast.LENGTH_LONG) - val view = toast.view - val text = view?.findViewById(android.R.id.message) - text?.setTextColor(requireContext().getColor(R.color.verdnatura_orange_salix)) - text?.textSize = 18f + private fun showTicket(ticketFk: Int) { + val inflater = LayoutInflater.from(requireContext()) + val layout = inflater.inflate(R.layout.ticket_toast_layout, null) + val text = layout.findViewById(R.id.toast_text) + text.text = "$ticketFk" + text.setTextColor(requireContext().getColor(R.color.verdnatura_orange_salix)) + text.textSize = 18f val background = GradientDrawable() background.setColor(Color.parseColor("#000000")) 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.show() } - private fun setStoredPosition() { - setListPosition()/*if (goBack) setListPosition(storedBackPosition, isFromBack) else { - setListPosition(storedPosition, isFromBack)*/ - } - - private fun checkItemScan(valueToCheck: String): Boolean { - - val saleToCheck = myGroupList[storedPosition] + private fun checkItemScan(valueToCheck: String, position: Int): Boolean { + println("CheckItemScan $valueToCheck") + val saleToCheck = myGroupList[position] + println("CheckItemScan saleTocheck$saleToCheck") + println("CheckItemScan saleTocheck Item ${saleToCheck.itemFk}") + println("CheckItemScan saleTocheck ItemBarcodes ${saleToCheck.Barcodes}") if (saleToCheck.itemFk.toString() == valueToCheck) return true else { saleToCheck.Barcodes.forEach { barcode -> @@ -929,12 +698,11 @@ class CollectionFragmentPickerPreviousNew( } private fun showQuestionUbicationEmpty(position: Int, quantity: Int = 0) { - customDialogThreeButtonsQuantity.setTitle( 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) customDialogThreeButtonsQuantity.setOkButtonAdd(text = getString(R.string.yes)) { scanRequest() @@ -942,7 +710,7 @@ class CollectionFragmentPickerPreviousNew( getString(R.string.errorQuantityShelving).toast(requireContext()) customDialogThreeButtonsQuantity.dismiss() showQuestionUbicationEmpty(position, quantity) - }.setOkButtonTwo("NO") { + }.setOkButtonTwo(getString(R.string.no)) { scanRequest() customDialogThreeButtonsQuantity.dismiss() if (quantity == 0) { @@ -959,25 +727,6 @@ class CollectionFragmentPickerPreviousNew( 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() { listPlacementSupply = ArrayList() collection.tickets.forEach { @@ -1023,7 +772,6 @@ class CollectionFragmentPickerPreviousNew( } - customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event -> if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { customDialogAddItem() @@ -1096,27 +844,17 @@ class CollectionFragmentPickerPreviousNew( } private fun setTotalLines() { - - val totalMark = sales.count { it.isPicked == 1 } - + val totalMark = myGroupList.count { it.isPicked == 1 } binding.mainToolbar.toolbarTitle.text = if (collection.collectionFk != 0) collection.collectionFk.toString() else "" - - binding.mainToolbar.toolbarSubtitle.text = - getString(R.string.totalsPicker, totalMark, sales.size) - - if (totalMark == sales.size) { + getString(R.string.totalsPicker, totalMark, myGroupList.size) + if (totalMark == myGroupList.size) { getString(R.string.Coleccióncompleta).toast(this.context, Toast.LENGTH_SHORT) - changeTicketState() + viewModel.saleTrackingAddPrevOK(collection.collectionFk) } } - private fun changeTicketState() { - - viewModel.saleTrackingAddPrevOK(collection.collectionFk) - } - private fun showScanner(index: Int, sale: Sale) { customDialogInput.getEditText().inputType = InputType.TYPE_CLASS_TEXT customDialogInput.setTitle("" + sale.itemFk) @@ -1150,7 +888,6 @@ class CollectionFragmentPickerPreviousNew( scanInput.requestFocus() customDialogInput.dismiss() scanInput.requestFocus() - } private fun showErrorMessage(title: String = getString(R.string.errorMarkLine), text: String) { @@ -1158,38 +895,4 @@ class CollectionFragmentPickerPreviousNew( customDialog.dismiss() }.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( - PRINTERNAME - )).toast(requireContext()) - - } - val dialog = builder.create() - dialog.show() - } else { - viewModel.collectionStickerPrint( - collectionFk = collection.collectionFk, null - ) - - } - - } - -} - - +} \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPreCheckerNew.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPreCheckerNew.kt deleted file mode 100644 index 11f2b522..00000000 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPreCheckerNew.kt +++ /dev/null @@ -1,1180 +0,0 @@ -package es.verdnatura.presentation.view.feature.collection.fragment - -import android.app.AlertDialog -import android.content.Context -import android.graphics.drawable.Drawable -import android.media.MediaPlayer -import android.os.Bundle -import android.text.InputType -import android.view.KeyEvent -import android.view.View -import android.view.WindowManager -import android.view.inputmethod.EditorInfo -import android.widget.EditText -import android.widget.ImageView -import android.widget.Toast -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import com.google.gson.Gson -import es.verdnatura.R -import es.verdnatura.databinding.FragmentCollectionNewBinding -import es.verdnatura.domain.ConstAndValues.BASEURLSALIX -import es.verdnatura.domain.ConstAndValues.PRECHECKERNEW -import es.verdnatura.domain.ConstAndValues.PRINTERNAME -import es.verdnatura.domain.ConstAndValues.SECTORFK -import es.verdnatura.domain.notNull -import es.verdnatura.domain.toast -import es.verdnatura.presentation.base.BaseFragment -import es.verdnatura.presentation.common.ItemScanned -import es.verdnatura.presentation.common.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.CustomDialogInput -import es.verdnatura.presentation.view.component.CustomDialogList -import es.verdnatura.presentation.view.component.CustomDialogThreeButtons -import es.verdnatura.presentation.view.feature.articulo.adapter.BarcodeAdapter -import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO -import es.verdnatura.presentation.view.feature.collection.ItemVO -import es.verdnatura.presentation.view.feature.collection.adapter.SaleAdapterNew -import es.verdnatura.presentation.view.feature.collection.mapper.map -import es.verdnatura.presentation.view.feature.main.activity.MainActivity -import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO -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 kotlinx.coroutines.runBlocking -import org.json.JSONObject - -class CollectionFragmentPreCheckerNew( - var collection: CollectionTicket?, - var type: String = PRECHECKERNEW, - private var hasPickingOrder: Boolean = false -) : BaseFragment( - CollectionViewModel::class -) { - private var sales: List = listOf() - private var salesParent: List = listOf() - private var saleAdapter: SaleAdapterNew? = null - private var lm: LinearLayoutManager? = null - private var storedPosition: Int = 0 - private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null - private lateinit var customDialogList: CustomDialogList - private var placementSupplyAdapter: BarcodeAdapter? = null - private var listPlacementSupply: ArrayList = ArrayList() - private lateinit var customDialogInput: CustomDialogInput - private lateinit var customDialogThreeButtons: CustomDialogThreeButtons - private lateinit var customDialogThreeButtonsQuantity: CustomDialogThreeButtons - private var ticketSelected: Int = 0 - 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 mpok: MediaPlayer? = null - private var itemShelvingFkStored: Int = 0 - private var storedBackPosition: Int = 0 - private var tickets: ArrayList = ArrayList() - private var mistakeSale: SaleVO? = null - private var isMarking = false - private lateinit var ticketScanTxt: String - private var lastScanned: Int = 0 - private var buttonPushedGetCollection = false - 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 positionConfirm = 0 - private var quantityConfirm = 0 - private var positionMarkPrevia = 0 - private lateinit var myGroupList: List - private var quantityReserveToCheckItemScan = 0 - - companion object { - fun newInstance( - collection: CollectionTicket? = null, type: String, hasPickingOrder: Boolean = false - ) = CollectionFragmentPreCheckerNew(collection, type, hasPickingOrder) - } - - override fun onAttach(context: Context) { - if (context is OnPasillerosItemClickListener) pasillerosItemClickListener = context - super.onAttach(context) - } - - override fun getLayoutId(): Int = R.layout.fragment_collection_new - - override fun onCreate(savedInstanceState: Bundle?) { - - mperror = MediaPlayer.create((activity as MainActivity), R.raw.error) - mpok = MediaPlayer.create((activity as MainActivity), R.raw.ok) - println("create onRunning") - - super.onCreate(savedInstanceState) - } - - override fun onResume() { - super.onResume() - scanRequest() - } - - override fun init() { - customDialogList = CustomDialogList(requireContext()) - customDialogInput = CustomDialogInput(requireContext()) - customDialog = CustomDialog(requireContext()) - customDialogThreeButtons = CustomDialogThreeButtons(requireContext()) - customDialogThreeButtonsQuantity = CustomDialogThreeButtons(requireContext()) - ma.hideBottomNavigation(View.GONE) - - setEvents() - setToolBar() - /* viewModel.collectionTicketGetSalix( - collection.collectionFk, print = false - )*/ - - super.init() - } - - override fun onPause() { - super.onPause() - goBack = true - goBack2 = true - goMistakeBack = true - } - - private fun setToolBar() { - binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE - binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE - binding.mainToolbar.backButton.visibility = View.VISIBLE - collection?.collectionFk.let { - binding.mainToolbar.toolbarTitle.text = collection?.collectionFk.toString() - } - - val listIcons: ArrayList = ArrayList() - val iconPrint = ImageView(context) - iconPrint.setImageResource(R.drawable.ic_print_black_24dp) - val iconAdd = ImageView(context) - 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) - iconParking.setImageResource(R.drawable.ic_local_parking_black_24dp) - val iconUpdate = ImageView(context) - 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) - iconViewCollection.tooltipText = getTooltip(R.drawable.ic_collection) - iconPhone.tooltipText = getTooltip(R.drawable.phone_call) - iconParking.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp) - iconUpdate.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp) - - // listIcons.add(iconPrint) - listIcons.add(iconAdd) - listIcons.add(iconParking) - listIcons.add(iconUpdate) - // listIcons.remove(iconWorker) - - binding.mainToolbar.toolbarIcons.adapter = - ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener { - override fun onOptionsItemSelected(item: Drawable) { - - when (item) { - //iconViewCollection.drawable -> getCollection() - iconPrint.drawable -> print() - iconAdd.drawable -> addItem() - iconWorker.drawable -> showUser() - iconUpdate.drawable -> updateScreen() - iconParking.drawable -> pasillerosItemClickListener?.onPasillerosItemClickListener( - PasillerosItemVO( - title = R.string.Parking - ), "" - ) - } - - } - }) - binding.mainToolbar.toolbarIcons.layoutManager = - LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) - } - - private fun updateScreen() { - collection?.let { - viewModel.collectionTicketGetSalix( - it.collectionFk, print = false - ) - } - - } - - 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() { - binding.scanInput.requestFocus() - hideKeyboards() - } - - private fun showUser() { - - ma.onPasillerosItemClickListener( - PasillerosItemVO(title = R.string.titleUserControlVehicle), - workerFkFromTicket.toString() - ) - - } - - private fun setEvents() { - - binding.mainToolbar.backButton.setOnClickListener { - println("reserva fuera") - ma.onMyBackPressed() - } - //ESCANER ========= - - binding.scanInput.requestFocus() - binding.scanInput.setOnEditorActionListener { v, actionId, event -> - if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {//ID=0 ACTION_NEXT ID=5 ACTION_UNESPECEFIED) - if (binding.scanInput.text.toString().isNotEmpty()) { - binding.scanInput.setText(textScanned_filterDouble(binding.scanInput.text!!.toString())) - isScanned = - event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER - if (itemScanIsQr(binding.scanInput.text.toString())) { - val myQr = ItemScanned(JSONObject(binding.scanInput.text.toString())) - when (myQr.table) { - "saleGroup" -> {/* if (type == CONTROLADOR) { - markPrevia(myQr.id.toString()) - } else {*/ - binding.scanInput.setText(myQr.id.toString()) - //findSale(binding.scanInput.text.toString()) - // } - } - - "buy" -> binding.scanInput.setText(myQr.more) - } - - } else { - ma.hideKeyboard(binding.scanInput) - viewModel.collectionTicketGetSalix( - binding.scanInput.text.toString().toInt(), print = false - ) - //findSale(binding.scanInput.text.toString()) - } - buttonPushedGetCollection = false - } - binding.scanInput.setText("") - hideKeyboards() - return@setOnEditorActionListener true - } - true - } - - hideKeyboards() - - //LISTA ========= - binding.collectionSwipe.setOnRefreshListener { - isMarking = false - binding.collectionSwipe.isRefreshing = false - - updateScreen()/* viewModel.collectionTicketGet( - collection.collectionFk, - mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK), - print = "0", - type - )*/ - buttonPushedGetCollection = false - binding.collectionSwipe.isRefreshing = false - - } - } - - private fun hideKeyboards() { - try { - requireActivity().hideKeyboard() - } catch (e: Exception) { - println(e.message) - } - } - - override fun observeViewModel() { - - with(viewModel) { - - loadCollectionTicketSalix.observe(viewLifecycleOwner) { event -> - event.getContentIfNotHandled().notNull { - if (!it.isError) { - - if (it.tickets.isNotEmpty()) { - collection = it - createCollectionList() - workerFkFromTicket = if (it.tickets[0].sales.isNotEmpty()) { - it.tickets[0].sales[0].workerFk.toString() - } else { - "" - } - - } else { - binding.mainToolbar.toolbarSubtitle.text = "0/0" - } - } else { - customDialog.setTitle(getString(R.string.error)) - .setDescription(it.errorMessage) - .setOkButton(getString(R.string.accept)) { - customDialog.dismiss() - if (activity != null) ma.onMyBackPressed() - }.show() - } - - } - } - - responseExistsItemShelvingSale.observe(viewLifecycleOwner) { - if (!goBack) { - if (it.exists) { - markLine(it.position, it.quantity, true) - } else { - getString(R.string.updateSalesReserve).toast( - requireContext() - ) - viewModel.collectionTicketGetSalix(collection!!.collectionFk, false) - } - } - - } - responseParking.observe(viewLifecycleOwner) { - if (!goBack) { - ma.messageWithSound( - if (it.isError) it.errorMessage else getString(R.string.Aparcado), - it.isError, - true - ) - } - - } - loadResponseAddItem.observe(viewLifecycleOwner) { event -> - event.getContentIfNotHandled().notNull { - updateScreen() - } - - } - - responsePrint.observe(viewLifecycleOwner) { - - if (!goBack) { - - if (it.isError) { - ma.messageWithSound( - it.errorMessage, isError = true, true - ) - } else { - (getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey( - PRINTERNAME - )).toast( - requireContext() - ) - } - } - - } - - responseConfirmReservedItemShelvingSale.observe(viewLifecycleOwner) { - - if (it.isError) { - ma.messageWithSound( - it.errorMessage, isError = true, true - ) - setTotalLines() - } else { - myGroupList[positionConfirm].isPicked = 1 - 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) - //saleAdapter!!.notifyDataSetChanged() - ma.messageWithSound( - "Confirmada acción", it.isError, !it.isError - ) - } - loadUnpicked.observe(viewLifecycleOwner) { event -> - event.getContentIfNotHandled().notNull { - - myGroupList[positionUnmarked].isPicked = 1 - myGroupList[positionUnmarked].reservedQuantity = quantityConfirm - viewModel.collectionTicketGetSalix( - collection!!.collectionFk, print = false - ) - 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) { - - if (!goBack2) { - if (it == null) { - showErrorMessage(text = getString(R.string.codeNotExist)) - if (mperror != null) mperror?.start() - } else { - if (checkItemScan(it.toString())) { - scanRequest() - customDialogList.dismiss() - mpok?.start() - markLine(storedPosition, quantityReserveToCheckItemScan, null) - } else { - customDialogList.setValueTwo("") - showErrorMessage(text = getString(R.string.lineNotExist)) - if (mperror != null) mperror?.start() - } - } - } - - goBack2 = false - - } - - } - } - - private fun createCollectionList() { - state = 0 - binding.mainToolbar.toolbarTitle.text = collection?.collectionFk.toString() - - collection!!.map(requireContext()) - val salesList: ArrayList = ArrayList() - - tickets = ArrayList() - var observations = "" - val myPickingFrom = mobileApplication.dataStoreApp.readDataStoreKey("PICKING_FROM") - val myPickingTo = mobileApplication.dataStoreApp.readDataStoreKey("PICKING_TO") - collection!!.tickets.forEach { ticket -> - - if (observations.isNotEmpty()) observations = - observations + " " + ticket.observations - ticket.sales.forEach { sale -> - - if (hasPickingOrder) { - if (sale.pickingOrder != null && sale.pickingOrder in myPickingFrom..myPickingTo) { - salesList.add(sale) - } - } else { - salesList.add(sale) - } - - } - } - - sales = salesList.sortedWith(compareBy { it.pickingOrder }.thenBy { it.itemFk }) - - //quitar comentarios FALTA AGRUPAR LAS PREVIAS - myGroupList = - salesList.sortedWith(compareBy { it.pickingOrder }.thenBy { it.itemFk }) - // sales //sales porque no se ggrupan las previas hay que cambiar los estados. - - 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 { - override fun onSaleClick(sale: Sale) { - - val position = - myGroupList.indexOfFirst { it.itemShelvingSaleFk == sale.itemShelvingSaleFk } - if (position > -1) { - if (sale.isPicked == 1) { - unMarkLine(position, myGroupList[position]) - } else { - showScanner(position, sale) - } - } - - /* 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 { - override fun onMistakeClickListener(sale: SaleVO) { - } - }, - object : OnPackingClickSaleListener { - override fun onPackingClick(sale: Sale) { - goBack = true - - if (!sale.code.isNullOrEmpty()) ma.onPasillerosItemClickListener( - PasillerosItemVO( - title = R.string.titleUbicator, - ), entryPoint = sale.code - ) - } - }, - object : OnTicketClickSaleListener { - override fun onTicketClickListener(sale: Sale) { - val entryPoint = Gson().toJson( - mutableMapOf( - "entryPoint" to sale.ticketFk, "web" to "${ - mobileApplication.dataStoreApp.readDataStoreKey( - BASEURLSALIX - ) - }/#!/ticket/${sale.ticketFk}/sale" - ) - ) - ma.onPasillerosItemClickListener( - PasillerosItemVO( - title = R.string.titleWebViewer, - ), entryPoint = entryPoint - ) - } - }, - type = type - ) - - - lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) - binding.fragmentSacadorCollections.adapter = saleAdapter - binding.fragmentSacadorCollections.layoutManager = lm - - setTotalLines() - setStoredPosition() - setScrollListener(lm!!) - printObservations(observations) - } - - private fun setScrollListener(lm: LinearLayoutManager) { - binding.fragmentSacadorCollections.clearOnScrollListeners() - binding.fragmentSacadorCollections.addOnScrollListener(object : - RecyclerView.OnScrollListener() { - override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { - storedBackPosition = lm.findFirstVisibleItemPosition() - super.onScrolled(recyclerView, dx, dy) - } - }) - } - - private fun printObservations(observations: String) { - if (observations.trim().isNotEmpty()) { - customDialog.setTitle(getString(R.string.observations)).setDescription(observations) - .setOkButton(getString(R.string.accept)) { - customDialog.hide() - customDialog.dismiss() - }.show() - } - } - - private fun findSale(txtscan: String) { - - var isFoundSale = false // markPrevia(txtscan) - - //Se busca la matricula en las lineas - for (indice in myGroupList.indices) { - if (myGroupList[indice].isPicked != 1 && myGroupList[indice].code != null && myGroupList[indice].code!!.uppercase() == txtscan.uppercase()) { - mpok!!.start() - isFoundSale = true - positionMarkPrevia = indice - printShelvingResult(indice) - break - } - } - - if (!isFoundSale) mperror!!.start() - - } - - private fun findSale(txtscan: String, position: Int, sale: Sale) { - - storedPosition = position - - if (sale.code!!.uppercase() == txtscan.uppercase()) { - mpok!!.start() - printShelvingResult(position) - //sale.isPicked = 1 - //saleAdapter!!.notifyItemChanged(position) - } else { - mperror!!.start() - } - - } - - private fun markLine(position: Int, quantity: Int, isItemShelvingSaleEmpty: Boolean?) { - - state = 0 - isScanned = null - positionConfirm = position - quantityConfirm = quantity - isMarking = true - - runBlocking { - var sectorFk = mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK) - viewModel.itemShelvingSaleSetQuantity( - myGroupList[position].itemShelvingSaleFk, - quantity, - isItemShelvingSaleEmpty, - sectorFk = if (sectorFk == -1) null else sectorFk - ) - } - storedBackPosition = position/* var mySale = myGroupList[position].itemShelvingSaleFk - for (indice in myGroupList.indices) { - if (!myGroupList[indice].isParent && myGroupList[indice].itemShelvingSaleFk == mySale) { - storedBackPosition = indice - } - }*/ - - } - - private fun setListPosition() { - - if (storedPosition == 0 && storedBackPosition == 0) { // se inicia lista, se busca porqué item vamos. - for (indice in myGroupList.indices) { - if (myGroupList[indice].isPicked == 0) { - //storedPosition = indice - lm!!.scrollToPositionWithOffset(indice - 1, 0) - break - } - } - - } else { - lm!!.scrollToPositionWithOffset(storedBackPosition, 0) - } - } - - private fun unMarkLine(position: Int, sale: Sale) { - state = 0 - customDialog.setTitle(getString(R.string.unmarkLine)).setDescription( - getString(R.string.goUnmark) + sale.itemFk + getString( - R.string.sure - ) - ).setOkButton(getString(R.string.unmark)) { - if (!sale.isParent && sale.reservedQuantity == 0 && sale.originalQuantity != sale.saleQuantity) { - getString(R.string.unmarkError).toast(requireContext()) - } else {/* saleAdapter!!.notifyDataSetChanged() - var mySale = sale.saleFk - for (indice in myGroupList.indices) { - if (!myGroupList[indice].isParent && myGroupList[indice].saleFk == mySale) { - d("VERDNATURA::", "la pos del index de la sale es" + indice) - storedBackPosition = indice - } - }*/ - storedBackPosition = position - setListPosition() - - viewModel.itemShelvingSaleUnpicked(myGroupList[position].itemShelvingSaleFk) - sale.isPicked = 0 - positionUnmarked = position - setTotalLines() - scanRequest() - } - - - customDialog.dismiss() - }.setKoButton(getString(R.string.cancel)) { - scanRequest() - customDialog.dismiss() - }.show() - - } - - //SHELVINGS - - private fun printShelvingResult(pos: Int) { - storedPosition = pos - customDialogList.getEditTextTwo().inputType = InputType.TYPE_CLASS_TEXT - customDialogList.getEditTextTwo().setRawInputType(InputType.TYPE_CLASS_NUMBER) - customDialogList.getEditText().setRawInputType(InputType.TYPE_CLASS_NUMBER) - customDialogList.getEditTextTwo().requestFocus() - val shelving = myGroupList[pos].code - val item = myGroupList[pos].itemFk - val longName = myGroupList[pos].longName - val totalReserved = myGroupList[pos].reservedQuantity - val itemShelvingFk = myGroupList[pos].itemShelvingSaleFk - - try { - customDialogList.setTitle("$shelving($item) $totalReserved de $longName").setOkButton( - getString( - R.string.take - ) - ) { - customDialogTakeAction(pos, itemShelvingFk, totalReserved, false) - - }.setKoButton(getString(R.string.close)) { - requireActivity().hideKeyboard(customDialogList.getEditTextTwo()) - customDialogList.dismiss() - scanRequest() - - }.setHintValue(getString(R.string.quantitySelect)).setValue(totalReserved.toString()) - .setHintValueTwo(getString(R.string.scanItem)).setValueTwo("").show() - - customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event -> - if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { - - customDialogTakeAction( - pos, - itemShelvingFk, - totalReserved, - event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER - ) - - return@setOnEditorActionListener true - - } - false - } - } catch (e: Exception) { - ma.messageWithSound(e.message.toString(), isError = true, true) - } - } - - private fun customDialogTakeAction( - position: Int, itemShelvingFk: Int, totalReserved: Int, isItemScanned: Boolean? - ) { - goBack = false - isScanned = isItemScanned - if (customDialogList.getValueTwo().isNotEmpty()) { - - customDialogList.setValueTwo( - itemScanValue( - customDialogList.getValueTwo(), arrayOf("buy"), "more" - ).toString() - ) - val quantityToReserve = customDialogList.getValue().toInt() - - if (quantityToReserve < totalReserved) { - - if (customDialogList.getValueTwo() in sales[position].Barcodes || customDialogList.getValueTwo() == sales[position].itemFk.toString()) { - customDialogList.dismiss() - showQuestionUbicationEmpty(position, quantityToReserve) - } else { - ma.messageWithSound( - message = getString(R.string.errorItem), - isError = true, - isPlayed = true, - isToasted = false - ) - } - } - - if (quantityToReserve > totalReserved) { - ma.hideKeyboard(customDialogList.getEditTextTwo()) - getString(R.string.quantityHigh).toast(requireContext()) - } - if (quantityToReserve == totalReserved) { - originalItemScan = customDialogList.getValueTwo().toLong() - if (checkItemScan(customDialogList.getValueTwo())) { - - markLine(storedPosition, quantityToReserve, null) - - mpok?.start() - ma.hideKeyboard(customDialogList.getEditTextTwo()) - customDialogList.dismiss() - scanRequest() - - } else { - - itemShelvingFkStored = itemShelvingFk - - quantityReserveToCheckItemScan = quantityToReserve - viewModel.getIdFromCodeSalix( - code = customDialogList.getValueTwo(), - ) - customDialogList.dismiss() - } - } - - } else { - getString(R.string.scanItemValidate).toast(requireContext()) - } - } - - private fun setStoredPosition() { - setListPosition()/*if (goBack) setListPosition(storedBackPosition, isFromBack) else { - setListPosition(storedPosition, isFromBack)*/ - } - - private fun checkItemScan(valueToCheck: String): Boolean { - - val saleToCheck = myGroupList[storedPosition] - if (saleToCheck.itemFk.toString() == valueToCheck) return true - else { - saleToCheck.Barcodes.forEach { barcode -> - if (barcode == valueToCheck) return true - } - } - - return false - } - - private fun showQuestionUbicationEmpty(position: Int, quantity: Int = 0) { - - customDialogThreeButtonsQuantity.setTitle( - getString( - R.string.changeQuantity, quantity, sales[position].itemFk - ) - ).setDescription(getString(R.string.questionItemShelving, sales[position].itemFk)) - .setValue("").setCustomDialogValue(View.GONE) - customDialogThreeButtonsQuantity.setOkButtonAdd(text = getString(R.string.yes)) { - scanRequest() - customDialogThreeButtonsQuantity.dismiss() - getString(R.string.errorQuantityShelving).toast(requireContext()) - customDialogThreeButtonsQuantity.dismiss() - showQuestionUbicationEmpty(position, quantity) - }.setOkButtonTwo("NO") { - scanRequest() - customDialogThreeButtonsQuantity.dismiss() - if (quantity == 0) { - viewModel.itemShelvingSaleExists( - myGroupList[position].itemShelvingSaleFk, position, quantity - ) - } else { - markLine(position, quantity, true) - } - }.setKoButton(getString(R.string.cancel)) { - scanRequest() - customDialogThreeButtonsQuantity.dismiss() - }.show() - 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() { - listPlacementSupply = ArrayList() - collection!!.tickets.forEach { - listPlacementSupply.add(BarcodeVO(code = it.ticketFk.toString())) - } - if (listPlacementSupply.size == 1) { - ticketSelected = listPlacementSupply[0].code!!.toInt() - } - customDialogList.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) - customDialogList.getEditTextTwo().inputType = InputType.TYPE_CLASS_NUMBER - customDialogList.getEditText().setRawInputType(InputType.TYPE_CLASS_NUMBER) - customDialogList.setTitle(getString(R.string.Agregarartículoparaticket) + " " + ticketSelected) - .setOkButton(getString(R.string.Agregar)) { - customDialogAddItem() - }.setKoButton(getString(R.string.close)) { - scanRequest() - customDialogList.dismiss() - }.setHintValue(getString(R.string.Artículo)).setValue("") - .setHintValueTwo(getString(R.string.Cantidad)).setValueTwo("").show() - customDialogList.getEditText().requestFocus() - requireActivity().hideKeyboard() - - customDialogList.getEditText().setOnEditorActionListener { v, actionId, event -> - if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { - if (customDialogList.getValue().isNotEmpty()) { - try { - customDialogList.setValue( - itemScanValue( - customDialogList.getValue(), arrayOf("buy"), "more" - ).toString() - ) - - } catch (e: Exception) { - ma.messageWithSound(e.message.toString(), isError = true, true) - } - customDialogList.getEditTextTwo().requestFocus() - } - - return@setOnEditorActionListener true - - } - false - - } - - - customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event -> - if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { - customDialogAddItem() - return@setOnEditorActionListener true - - } - false - } - - placementSupplyAdapter = - BarcodeAdapter(listPlacementSupply, object : OnBarcodeRowClickListener { - override fun onBarcodeRowClickListener(item: BarcodeVO) { - customDialogInput.setTitle(getString(R.string.ArtículoparaTicket) + " " + item.code!!) - ticketSelected = item.code!!.toInt() - customDialogList.setTitle(getString(R.string.Agregarartículoparaticket) + " " + ticketSelected) - } - }, showDelete = false) - - customDialogList.getRecyclerView().adapter = placementSupplyAdapter - - customDialogList.getRecyclerView().layoutManager = - LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) - - } - - private fun customDialogAddItem() { - - if (customDialogList.getValueTwo().isNotEmpty()) { - if (ticketSelected == 0) { - getString(R.string.Seleccionaunticketdelaista).toast(requireContext()) - } else if (customDialogList.getValue().isEmpty() || customDialogList.getValueTwo() - .isEmpty() - ) { - getString(R.string.Todosloscampossonobligatorios).toast(requireContext()) - } else { - val saleGroupSelected = - collection!!.tickets.find { it.ticketFk == ticketSelected }?.sales?.get(0)?.saleGroupFk - ?: 0 - - runBlocking { - viewModel.collectionAddWithReservation( - customDialogList.getValue().toInt(), - customDialogList.getValueTwo().toInt(), - ticketSelected, - saleGroupFk = saleGroupSelected, - sectorFk = mobileApplication.dataStoreApp.readDataStoreKey( - SECTORFK - ) - ) - } - - customDialogList.dismiss() - hideKeyboards() - scanRequest() - } - } else { - getString(R.string.scanItem).toast(requireContext()) - } - - } - - private fun toastDisponibility(item: ItemVO) { - if (item.available.isEmpty()) { - item.available = "0" - } - customDialog.setTitle(getString(R.string.itemPoints) + item.id) - .setDescription(getString(R.string.available) + ":" + item.available) - .setOkButton(getString(R.string.accept)) { - scanRequest() - customDialog.dismiss() - }.show() - - } - - private fun setTotalLines() { - - val totalMark = sales.count { it.isPicked == 1 } - - binding.mainToolbar.toolbarTitle.text = - if (collection!!.collectionFk != 0) collection!!.collectionFk.toString() else "" - - - binding.mainToolbar.toolbarSubtitle.text = - getString(R.string.totalsPicker, totalMark, sales.size) - - if (totalMark == sales.size) { - getString(R.string.Coleccióncompleta).toast(this.context, Toast.LENGTH_SHORT) - changeTicketState() - } - } - - private fun changeTicketState() { - - viewModel.saleTrackingAddPrevOK(collection!!.collectionFk) - } - - private fun showScanner(index: Int, sale: Sale) { - customDialogInput.getEditText().inputType = InputType.TYPE_CLASS_TEXT - customDialogInput.setTitle("" + sale.itemFk) - .setDescription(getString(R.string.scanWagonForItem)) - .setOkButton(getString(R.string.accept)) { - findSaleAction(index, sale) - }.setKoButton(getString(R.string.cancel)) { - closeCustomDialog(binding.scanInput, customDialogInput) - }.setValue("").show() - - - customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event -> - if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { - findSaleAction(index, sale) - return@setOnEditorActionListener false - } - false - } - customDialogInput.getEditText().requestFocus() - } - - private fun findSaleAction(index: Int, sale: Sale) { - if (customDialogInput.getValue().isNotEmpty()) { - findSale(customDialogInput.getValue(), index, sale) - } - closeCustomDialog(binding.scanInput, customDialogInput) - } - - private fun closeCustomDialog(scanInput: EditText, customDialogInput: CustomDialogInput) { - requireContext().hideKeyboard(customDialogInput.getEditText()) - scanInput.requestFocus() - customDialogInput.dismiss() - scanInput.requestFocus() - - } - - private fun showErrorMessage(title: String = getString(R.string.errorMarkLine), text: String) { - customDialog.setTitle(title).setDescription(text).setKoButton(getString(R.string.close)) { - customDialog.dismiss() - }.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( - PRINTERNAME - )).toast(requireContext()) - - } - val dialog = builder.create() - dialog.show() - } else { - viewModel.collectionStickerPrint( - collectionFk = collection!!.collectionFk, null - ) - - } - - } - -} - - diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionViewModel.kt index a45e1270..02fe38e6 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionViewModel.kt @@ -44,14 +44,13 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) { val collectionTicketList: LiveData get() = _collectionTicketList - private val _responseCollectionId by lazy { MutableLiveData() } - val responseCollectionId: LiveData - get() = _responseCollectionId - private val _responseExistsItemShelvingSale by lazy { MutableLiveData() } val responseExistsItemShelvingSale: LiveData get() = _responseExistsItemShelvingSale + val loadExistsResponse: LiveData> = + _responseExistsItemShelvingSale.map { Event(it) } + private val _collectionTicketSalix by lazy { MutableLiveData() } val collectionTicketSalix: LiveData get() = _collectionTicketSalix @@ -63,10 +62,6 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) { val loadCollectionTicketSalix: LiveData> = _collectionTicketSalix.map { Event(it) } - private val _collectionTicketListLocal by lazy { MutableLiveData() } - val collectionTicketListLocal: LiveData - get() = _collectionTicketListLocal - private val _placementSuppleyList by lazy { MutableLiveData() } val placementSuppleyList: LiveData get() = _placementSuppleyList @@ -91,29 +86,27 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) { val responseSaleTracking_mark: LiveData get() = _responseSaleTracking_mark - private val _responseConfirmReservedItemShelvingSale by lazy { MutableLiveData() } - val responseConfirmReservedItemShelvingSale: LiveData + private val _responseConfirmReservedItemShelvingSale by lazy { MutableLiveData() } + val responseConfirmReservedItemShelvingSale: LiveData get() = _responseConfirmReservedItemShelvingSale + val loadPicked: LiveData> = + _responseConfirmReservedItemShelvingSale.map { Event(it) } + private val _responseItemShelvingSale by lazy { MutableLiveData() } val responseItemShelvingSale: LiveData get() = _responseItemShelvingSale - private val _responseItemShelvingSaleUnPicked by lazy { MutableLiveData() } - val responseItemShelvingSaleUnPicked: LiveData + private val _responseItemShelvingSaleUnPicked by lazy { MutableLiveData() } + val responseItemShelvingSaleUnPicked: LiveData get() = _responseItemShelvingSaleUnPicked - val loadUnpicked: LiveData> = - _responseItemShelvingSaleUnPicked.map { Event(it) } + val loadUnpicked: LiveData> = _responseItemShelvingSaleUnPicked.map { Event(it) } - private val _responseCollectionAddItem by lazy { MutableLiveData() } - val responseCollectionAddItem: LiveData + private val _responseCollectionAddItem by lazy { MutableLiveData() } + val responseCollectionAddItem: LiveData get() = _responseCollectionAddItem - private val _responseConfirmReservedUpdate by lazy { MutableLiveData() } - val responseConfirmReservedUpdate: LiveData - get() = _responseConfirmReservedUpdate - private val _responseParking by lazy { MutableLiveData() } val responseParking: LiveData get() = _responseParking @@ -145,10 +138,6 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) { val responseItemShelvingSaleGroup: LiveData get() = _responseItemShelvingSaleGroup - private val _responsecheckfully by lazy { MutableLiveData() } - val responsecheckfully: LiveData - get() = _responsecheckfully - private val _responseTicketClosure by lazy { MutableLiveData() } val responseTicketClosure: LiveData get() = _responseTicketClosure @@ -157,10 +146,6 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) { val responseCollectionUnchecked: LiveData get() = _responseCollectionUnchecked - /* private val _responseMissingTrash by lazy { MutableLiveData() } - val responseMissingTrash: LiveData - get() = _responseMissingTrash*/ - private val _responseSplit by lazy { MutableLiveData() } val responseSplit: LiveData get() = _responseSplit @@ -187,7 +172,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) { val loadResponseDel: LiveData> = _responseDel.map { Event(it) } - val loadResponseAddItem: LiveData> = + val loadResponseAddItem: LiveData> = _responseCollectionAddItem.map { Event(it) } val loadResponseSaleTrackingMark: LiveData> = @@ -394,28 +379,14 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) { ) { salix.itemShelvingSaleSetquantitySalix( params = arrayListOf(itemShelvingSaleFk, quantity, isItemShelvingSaleEmpty, sectorFk) - //salix.itemShelvingSaleSetQuantity( - // params = ItemShelvingSaleSalix(itemShelvingSaleFk, quantity, isItemShelvingSaleEmpty) ).enqueue(object : SalixCallback(context) { - override fun onError(t: Throwable) { - _responseConfirmReservedItemShelvingSale.value = ResponseItemVO( - isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) - ) - } override fun onSuccess(response: Response) { - if (!response.isSuccessful) { - _responseConfirmReservedItemShelvingSale.value = ResponseItemVO( - isError = true, errorMessage = getMessageFromAllResponse( - nameofFunction(this), response.message() - ) - ) - } else { - _responseConfirmReservedItemShelvingSale.value = - ResponseItemVO(isError = false, response = "") + _responseConfirmReservedItemShelvingSale.value = true + + if (isItemShelvingSaleEmpty == true) + _responseCollectionAddItem.value = true - } } }) } @@ -429,44 +400,9 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) { ) ).enqueue(object : SalixCallback(context) { override fun onSuccess(response: Response) { - _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(context) { - override fun onError(t: Throwable) { - _responseConfirmReservedUpdate.value = ResponseItemVO( - isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) - ) - } - - override fun onSuccess(response: Response) { - 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 ) ).enqueue(object : SalixCallback(context) { - override fun onError(t: Throwable) { - _responseItemShelvingSaleUnPicked.value = ResponseItemVO( - isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) - ) - } override fun onSuccess(response: Response) { - _responseItemShelvingSaleUnPicked.value = ResponseItemVO(isError = false) + _responseItemShelvingSaleUnPicked.value = true + super.onSuccess(response) } }) } @@ -602,13 +533,11 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) { saleGroupFk: Number ) { salix.saleGroupUpdate( - id = saleGroupFk, - params = hashMapOf("parkingFk" to null) - ) - .enqueue(object : SalixCallback(context) { - override fun onSuccess(response: Response) { - } - }) + id = saleGroupFk, params = hashMapOf("parkingFk" to null) + ).enqueue(object : SalixCallback(context) { + override fun onSuccess(response: Response) { + } + }) } fun itemShelvingSaleSetSaleGroup( @@ -671,20 +600,19 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) { SaleTrackingDelSalix( saleFk = saleFk, stateCodes = listOf("CHECKED", "OK", "PREPARED") ) - ) - .enqueue(object : SalixCallback(context) { - override fun onError(t: Throwable) { - _responseDel.value = ResponseItemVO( - isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) - ) - } + ).enqueue(object : SalixCallback(context) { + override fun onError(t: Throwable) { + _responseDel.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) + } - override fun onSuccess(response: Response) { - _responseDel.value = - ResponseItemVO(isError = false, response = response.message()) - } - }) + override fun onSuccess(response: Response) { + _responseDel.value = + ResponseItemVO(isError = false, response = response.message()) + } + }) } fun itemShelvingUpdateFromSale( @@ -746,13 +674,12 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) { } fun getIdFromCodeSalix(code: String) { - getItemFromBarcodeUseCase.execute(code) - .enqueue(object : SalixCallback(context) { - override fun onSuccess(response: Response) { - _responseCode.value = response.body() + getItemFromBarcodeUseCase.execute(code).enqueue(object : SalixCallback(context) { + override fun onSuccess(response: Response) { + _responseCode.value = response.body() - } - }) + } + }) } fun collectionIncreaseQuantitySalix( @@ -785,9 +712,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) { salix.saleMistakeAdd( SaleMistakeSalix( - userFk = (context as MobileApplication).userId!!, - saleFk = saleFk, - typeFk = typeFk + userFk = (context as MobileApplication).userId!!, saleFk = saleFk, typeFk = typeFk ) ).enqueue(object : SalixCallback(context) { override fun onError(t: Throwable) { @@ -807,25 +732,23 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) { } fun mistakeType() { - salix.getMistakeTypes() - .enqueue(object : SalixCallback>(context) { - override fun onSuccess(response: Response>) { - if (response.body() != null) { - _mistakeList.value = - response.body()?.let { MistakeTypeListVO(it) } - } else { - val listError: ArrayList = ArrayList() - listError.add(MistakeTypeVO(0, "")) - _mistakeList.value = MistakeTypeListVO(listError) - } - } - - override fun onError(t: Throwable) { + salix.getMistakeTypes().enqueue(object : SalixCallback>(context) { + override fun onSuccess(response: Response>) { + if (response.body() != null) { + _mistakeList.value = response.body()?.let { MistakeTypeListVO(it) } + } else { val listError: ArrayList = ArrayList() listError.add(MistakeTypeVO(0, "")) _mistakeList.value = MistakeTypeListVO(listError) } - }) + } + + override fun onError(t: Throwable) { + val listError: ArrayList = ArrayList() + listError.add(MistakeTypeVO(0, "")) + _mistakeList.value = MistakeTypeListVO(listError) + } + }) } fun ticketIsOutClosureZone( @@ -885,9 +808,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) { override fun onSuccess(response: Response) { _responseTicketClosure.value = ResponseItemVO( - isError = false, - response = response.body()!!.toString(), - errorMessage = "" + isError = false, response = response.body()!!.toString(), errorMessage = "" ) } @@ -913,9 +834,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) { if (response.body() != null) { _responseCollectionUnchecked.value = ResponseItemVO( - isError = false, - response = response.body()!!, - errorMessage = "" + isError = false, response = response.body()!!, errorMessage = "" ) } else { _responseCollectionUnchecked.value = ResponseItemVO( diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt index 77ad4f90..9760681a 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt @@ -22,7 +22,6 @@ import es.verdnatura.R import es.verdnatura.databinding.ActivityMainBinding import es.verdnatura.domain.ConstAndValues.MAINACTIVITY import es.verdnatura.domain.ConstAndValues.MENUBYDEFAULTSELECTED -import es.verdnatura.domain.ConstAndValues.PRECHECKERNEW import es.verdnatura.domain.ConstAndValues.PREITEMPICKER import es.verdnatura.domain.ConstAndValues.PRINTERFK 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.CollectionFragmentPickerPreviousNew 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.controlador.fragment.ControladorFragment import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoFragment @@ -513,8 +511,9 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL } getString(R.string.historicals) -> { + addFragmentOnTop( - PasilleroFragment.newInstance(itemTitle, isInitMenu = false), + PasilleroFragment.newInstance(itemTitle, isInitMenu = false) ) } @@ -658,7 +657,12 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL //Tarea 7855 getString(R.string.scanPreparedExpedition) -> { - addFragmentOnTop(ExpeditionPreparedStateFragment.newInstance()) + addFragmentOnTop( + ExpeditionPreparedStateFragment.newInstance( + "PREPARED", + getString(R.string.scanExpeditions) + ) + ) } getString(R.string.titleAuto) -> { @@ -674,8 +678,8 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL }*/ getString(R.string.titlePickers) -> { - //addFragmentOnTop(SacadorFragment.newInstance()) - addFragmentOnTop(ControlVehiculoFragment.newInstance("")) + addFragmentOnTop(SacadorFragment.newInstance("PREPARED")) + //addFragmentOnTop(ControlVehiculoFragment.newInstance("")) } "Sacador Test" -> { @@ -721,15 +725,6 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL addFragmentOnTop(PreControladorFragment.newInstance()) } - getString(R.string.titlePreControlTest) -> { - addFragmentOnTop( - CollectionFragmentPreCheckerNew.newInstance( - null, - type = PRECHECKERNEW - ) - ) - } - getString(R.string.titleShelvingHistorical) -> { addFragmentOnTop(ItemShelvingLogFragment.newInstance(itemTitle)) @@ -900,6 +895,12 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL getString(R.string.reviewBoxPicking) -> { addFragmentOnTop(BoxPickingFragment.newInstance(itemTitle)) + /* addFragmentOnTop( + ExpeditionPreparedStateFragment.newInstance( + "CHECKED", + getString(item.title) + ) + )*/ } getString(R.string.pickerHelper) -> { diff --git a/app/src/main/res/layout/ticket_toast_layout.xml b/app/src/main/res/layout/ticket_toast_layout.xml new file mode 100644 index 00000000..c9f2715e --- /dev/null +++ b/app/src/main/res/layout/ticket_toast_layout.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file