feat: refs #6861 reservas
This commit is contained in:
parent
0c198b4101
commit
02306e8351
|
@ -7,7 +7,9 @@ import es.verdnatura.presentation.view.feature.buffer.fragment.BufferFragmentVie
|
|||
import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemViewModel
|
||||
import es.verdnatura.presentation.view.feature.category.ChangeCategoryViewModel
|
||||
import es.verdnatura.presentation.view.feature.claim.fragment.ubication.ClaimViewModel
|
||||
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionCheckerViewModel
|
||||
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionViewModel
|
||||
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionViewModelCheckerPreviosNew
|
||||
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoViewModel
|
||||
import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewModel
|
||||
import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleViewModel
|
||||
|
@ -137,6 +139,12 @@ val viewModelModule = module {
|
|||
viewModel {
|
||||
CollectionViewModel(androidContext())
|
||||
}
|
||||
viewModel {
|
||||
CollectionViewModelCheckerPreviosNew(androidContext())
|
||||
}
|
||||
viewModel {
|
||||
CollectionCheckerViewModel(androidContext())
|
||||
}
|
||||
|
||||
viewModel {
|
||||
ParkingViewModel(androidContext())
|
||||
|
|
|
@ -18,6 +18,7 @@ object ConstAndValues {
|
|||
const val PRINTERFKDEFAULT = -1
|
||||
const val WAREHOUSEFKDEFAULT = 60
|
||||
const val SECTORFK = "sectorFk"
|
||||
const val SECTORISONRESERVATIONMODE = "sectorIsOnReservationMode"
|
||||
const val TAG = "VERDNATURA::"
|
||||
const val USERFK = "userFk"
|
||||
const val USER = "user"
|
||||
|
@ -26,6 +27,7 @@ object ConstAndValues {
|
|||
const val TTL = "ttl"
|
||||
const val TOKENCREATED = "tokenCreated"
|
||||
const val SECTORDESCRIP = "sectordescrip"
|
||||
const val HOLDPOSITION = "holdPosition"
|
||||
const val NUMBEROFWAGONS = "operatorNumberOfWagons"
|
||||
const val PRINTERNAME = "printername"
|
||||
const val PRINTERFK = "printerFk"
|
||||
|
|
|
@ -38,11 +38,19 @@ data class ItemShelvingSaleSalix(
|
|||
var isItemShelvingSaleEmpty: Boolean?
|
||||
)
|
||||
|
||||
data class ItemShelving(
|
||||
var id: Int,
|
||||
var itemFk: Int,
|
||||
var shelvingFk: String,
|
||||
var position: Int,
|
||||
var quantity: Int
|
||||
)
|
||||
|
||||
data class ItemShelvingSalix(
|
||||
var visible: Int,
|
||||
var packing: Int?,
|
||||
var grouping: Int?,
|
||||
var available : Int?
|
||||
var available: Int?
|
||||
|
||||
)
|
||||
|
||||
|
@ -65,12 +73,13 @@ data class CollectionItemSalix(
|
|||
var warehouseFk: Int
|
||||
|
||||
)
|
||||
|
||||
//Tarea 6889
|
||||
data class ItemAddSale(
|
||||
var barcode: String,
|
||||
var quantity: Int,
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
data class TicketState(
|
||||
val ticketFk: Int = 0,
|
||||
|
@ -82,8 +91,9 @@ data class TicketState(
|
|||
val username: String = ""
|
||||
)
|
||||
}
|
||||
|
||||
data class ExpeditionPrintOut(
|
||||
val expeditionFk:Long,
|
||||
val itemFk:Int,
|
||||
val expeditionFk: Long,
|
||||
val itemFk: Int,
|
||||
val isChecked: Boolean
|
||||
)
|
|
@ -267,6 +267,10 @@ interface OnTicketClickSaleListener {
|
|||
fun onTicketClickListener(sale: Sale)
|
||||
}
|
||||
|
||||
interface OnSaleReserveClickListener {
|
||||
fun onSaleReserveListener(sale: Sale)
|
||||
}
|
||||
|
||||
interface OnBuyerSelectedListener {
|
||||
fun onBuyerSelected(userFk: String)
|
||||
}
|
||||
|
|
|
@ -6,6 +6,9 @@ import android.graphics.Color
|
|||
import android.graphics.drawable.Drawable
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.View.GONE
|
||||
import android.view.View.INVISIBLE
|
||||
import android.view.View.VISIBLE
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat.getColor
|
||||
import androidx.core.graphics.drawable.DrawableCompat
|
||||
|
@ -21,6 +24,7 @@ import es.verdnatura.presentation.common.OnMistakeClickListener
|
|||
import es.verdnatura.presentation.common.OnPackingClickSaleListener
|
||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||
import es.verdnatura.presentation.common.OnSaleClickSaleListener
|
||||
import es.verdnatura.presentation.common.OnSaleReserveClickListener
|
||||
import es.verdnatura.presentation.common.OnTicketClickSaleListener
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.Sale
|
||||
|
@ -33,6 +37,7 @@ class SaleAdapterNew(
|
|||
private val onPackingClick: OnPackingClickSaleListener,
|
||||
private var onTicketClick: OnTicketClickSaleListener? = null,
|
||||
private var saleAdapter: SaleAdapterNew? = null,
|
||||
private var onReserveSaleClick: OnSaleReserveClickListener? = null,
|
||||
private var type: String? = null,
|
||||
|
||||
) : RecyclerView.Adapter<SaleAdapterNew.AjustesItemHolder>() {
|
||||
|
@ -117,16 +122,15 @@ class SaleAdapterNew(
|
|||
itemArticleFirstAccumulate.setOnClickListener {
|
||||
//onQuantityClick.onQuantityClick(sale)
|
||||
}
|
||||
itemFirstToPicker.setOnClickListener {
|
||||
onPackingClick.onPackingClick(sale)
|
||||
/* itemFirstToPicker.setOnClickListener {
|
||||
onPackingClick.onPackingClick(sale)
|
||||
|
||||
}/* quantityReserved.setOnClickListener {
|
||||
onQuantityClick.onQuantityClick(sale)
|
||||
}*/
|
||||
}/* quantityReserved.setOnClickListener {
|
||||
onQuantityClick.onQuantityClick(sale)
|
||||
}*/*/
|
||||
|
||||
linearLayoutItem.setOnClickListener {
|
||||
|
||||
println("El ticket es ${sale.ticketFk}")
|
||||
if (onTicketClick != null) {
|
||||
onTicketClick!!.onTicketClickListener(sale)
|
||||
}
|
||||
|
@ -139,27 +143,31 @@ class SaleAdapterNew(
|
|||
}
|
||||
|
||||
//ERROR
|
||||
println("Sacador sale item ${sale.itemFk} sale ${sale.saleFk} cantidad ${sale.saleQuantity} original ${sale.originalQuantity}")
|
||||
|
||||
if (sale.originalQuantity != sale.saleQuantity && sale.originalQuantity != null && !sale.isParent) {
|
||||
layoutError.visibility = View.VISIBLE
|
||||
layoutError.visibility = VISIBLE
|
||||
txtError.text =
|
||||
binding.root.context.getString(R.string.originalQuantity) + sale.originalQuantity
|
||||
|
||||
} else {
|
||||
layoutError.visibility = View.GONE
|
||||
layoutError.visibility = GONE
|
||||
}
|
||||
|
||||
binding.deleteReserve.visibility = if (sale.isAdded == 1) VISIBLE else INVISIBLE
|
||||
|
||||
if (sale.isAdded == 1) {
|
||||
layoutError.visibility = View.VISIBLE
|
||||
layoutError.visibility = VISIBLE
|
||||
txtError.text = binding.root.context.getString(R.string.newItem)
|
||||
binding.deleteReserve.setOnClickListener {
|
||||
onReserveSaleClick!!.onSaleReserveListener(sale)
|
||||
}
|
||||
}
|
||||
|
||||
paintTicketcolor(sale.rgb, binding.itemTicketColor.background)
|
||||
|
||||
if (sale.isAdded == 1 && sale.reservedQuantity != sale.saleQuantity) {
|
||||
layoutError.visibility = View.GONE
|
||||
}
|
||||
/*if (sale.isAdded == 1 && sale.reservedQuantity != sale.saleQuantity) {
|
||||
layoutError.visibility = GONE
|
||||
}*/
|
||||
|
||||
|
||||
if (isExpanded) {
|
||||
|
@ -339,9 +347,13 @@ class SaleAdapterNew(
|
|||
}
|
||||
|
||||
binding.itemParkingCode.text =
|
||||
if (type == PREITEMPICKERTEST) sale.parkingCodePrevia else sale.parkingCode
|
||||
// if (type == PREITEMPICKERTEST) sale.parkingCodePrevia else sale.parkingCode
|
||||
sale.parkingCodePrevia
|
||||
|
||||
|
||||
println("parkingCodePrevia ${sale.parkingCodePrevia}")
|
||||
println("parkingCode ${sale.parkingCode}")
|
||||
|
||||
this.sale = sale
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
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
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.media.MediaPlayer
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.text.InputType
|
||||
import android.view.Gravity
|
||||
import android.view.KeyEvent
|
||||
|
@ -13,6 +16,7 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.EditText
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
|
@ -22,8 +26,12 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import com.google.gson.Gson
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentCollectionNewBinding
|
||||
import es.verdnatura.domain.ConstAndValues
|
||||
import es.verdnatura.domain.ConstAndValues.BASEURLSALIX
|
||||
import es.verdnatura.domain.ConstAndValues.PREITEMPICKERTEST
|
||||
import es.verdnatura.domain.ConstAndValues.PREPARED
|
||||
import es.verdnatura.domain.ConstAndValues.PRESACADOR
|
||||
import es.verdnatura.domain.ConstAndValues.SACADOR
|
||||
import es.verdnatura.domain.ConstAndValues.SECTORFK
|
||||
import es.verdnatura.domain.notNull
|
||||
import es.verdnatura.domain.toast
|
||||
|
@ -35,6 +43,7 @@ import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
|||
import es.verdnatura.presentation.common.OnPackingClickSaleListener
|
||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||
import es.verdnatura.presentation.common.OnSaleClickSaleListener
|
||||
import es.verdnatura.presentation.common.OnSaleReserveClickListener
|
||||
import es.verdnatura.presentation.common.OnTicketClickSaleListener
|
||||
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||
import es.verdnatura.presentation.common.hideKeyboard
|
||||
|
@ -58,6 +67,16 @@ import kotlinx.coroutines.runBlocking
|
|||
import org.json.JSONObject
|
||||
|
||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||
|
||||
/*CAMBIO DEL SACADOR AL PRESACADOR, FUNCIONES EXTRA AL FINAL DEL FICHERO
|
||||
1- EL SACADOR AGRUPA LINEAS EL PRESACADOR NO
|
||||
2- AL AÑADIR ITEM A A LA COLECCIÓN , EL SACADOR SALEGROUPFK Y SECTORFK SON NULOS.
|
||||
3-VERIFICAR COLECCIÓN
|
||||
4-IMPRIMIR
|
||||
|
||||
variables:
|
||||
isVerifiedCollection
|
||||
*/
|
||||
class CollectionFragmentPickerPreviousNew(
|
||||
var collection: CollectionTicket,
|
||||
var type: String = PRESACADOR,
|
||||
|
@ -89,6 +108,7 @@ class CollectionFragmentPickerPreviousNew(
|
|||
private var quantityConfirm = 0
|
||||
private lateinit var myGroupList: List<Sale>
|
||||
private var quantityReserveToCheckItemScan = 0
|
||||
private var isVerifiedCollection = false
|
||||
|
||||
companion object {
|
||||
fun newInstance(
|
||||
|
@ -147,20 +167,25 @@ class CollectionFragmentPickerPreviousNew(
|
|||
iconParking.setImageResource(R.drawable.ic_local_parking_black_24dp)
|
||||
val iconUpdate = ImageView(context)
|
||||
iconUpdate.setImageResource(R.drawable.ic_autorenew_black_24dp)
|
||||
val iconPrint = ImageView(context)
|
||||
iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
|
||||
|
||||
iconAdd.tooltipText = getTooltip(R.drawable.ic_playlist_add_black_24dp)
|
||||
iconParking.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp)
|
||||
iconUpdate.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
|
||||
iconPrint.tooltipText = getTooltip(R.drawable.ic_print_black_24dp)
|
||||
|
||||
|
||||
listIcons.add(iconAdd)
|
||||
listIcons.add(iconParking)
|
||||
listIcons.add(iconUpdate)
|
||||
if (type == PREPARED) listIcons.add(iconPrint) else listIcons.add(iconParking)
|
||||
|
||||
binding.mainToolbar.toolbarIcons.adapter =
|
||||
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
||||
override fun onOptionsItemSelected(item: Drawable) {
|
||||
|
||||
when (item) {
|
||||
iconPrint.drawable -> print()
|
||||
iconAdd.drawable -> addItem()
|
||||
iconUpdate.drawable -> updateScreen()
|
||||
iconParking.drawable -> pasillerosItemClickListener?.onPasillerosItemClickListener(
|
||||
|
@ -268,30 +293,31 @@ class CollectionFragmentPickerPreviousNew(
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
} else {
|
||||
getString(R.string.updateSalesReserve).toast(
|
||||
requireContext()
|
||||
)
|
||||
viewModel.collectionTicketGetSalix(collection.collectionFk, false)
|
||||
}
|
||||
}
|
||||
|
||||
}*/
|
||||
getString(R.string.updateSalesReserve).toast(
|
||||
requireContext()
|
||||
)
|
||||
updateScreen()
|
||||
}
|
||||
}
|
||||
|
||||
loadFindItemShelvingResponse.observe(viewLifecycleOwner) { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
|
||||
if (it.shelvingFk != myGroupList[it.position].code) {
|
||||
getString(R.string.updateSalesReserve).toast(
|
||||
requireContext()
|
||||
)
|
||||
updateScreen()
|
||||
} else {
|
||||
markLine(it.position, it.quantity, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
loadResponseAddItem.observe(viewLifecycleOwner) { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
|
@ -372,8 +398,21 @@ class CollectionFragmentPickerPreviousNew(
|
|||
}
|
||||
// sales = salesList.sortedWith(compareBy<Sale> { it.pickingOrderPrevia }.thenBy { it.itemFk })
|
||||
//quitar comentarios FALTA AGRUPAR LAS PREVIAS
|
||||
myGroupList =
|
||||
salesList.sortedWith(compareBy<Sale> { it.pickingOrderPrevia }.thenBy { it.itemFk })
|
||||
|
||||
when (type) {
|
||||
PREITEMPICKERTEST -> {
|
||||
myGroupList =
|
||||
salesList.sortedWith(compareBy<Sale> { it.pickingOrderPrevia }.thenBy { it.itemFk })
|
||||
}
|
||||
|
||||
SACADOR -> {
|
||||
myGroupList =
|
||||
groupSaleGroup(salesList).sortedWith(compareBy<Sale> { it.pickingOrder }.thenBy { it.itemFk })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
saleAdapter = SaleAdapterNew(myGroupList, pasillerosItemClickListener!!,
|
||||
|
||||
object : OnSaleClickSaleListener {
|
||||
|
@ -420,6 +459,11 @@ class CollectionFragmentPickerPreviousNew(
|
|||
), entryPoint = entryPoint
|
||||
)
|
||||
}
|
||||
}, onReserveSaleClick = object : OnSaleReserveClickListener {
|
||||
override fun onSaleReserveListener(sale: Sale) {
|
||||
showDeleteItemShelving(sale)
|
||||
}
|
||||
|
||||
}, type = type
|
||||
)
|
||||
|
||||
|
@ -432,6 +476,29 @@ class CollectionFragmentPickerPreviousNew(
|
|||
setListPosition()
|
||||
setScrollListener(lm!!)
|
||||
printObservations(observations)
|
||||
if (!isVerifiedCollection && type == PREPARED) {
|
||||
binding.fragmentSacadorCollections.visibility = View.INVISIBLE
|
||||
verifyCollection()
|
||||
}
|
||||
}
|
||||
|
||||
private fun showDeleteItemShelving(sale: Sale) {
|
||||
customDialog.setTitle(getString(R.string.deleteSale))
|
||||
.setDescription(
|
||||
getString(R.string.deleteSaleDescrip) + getString(
|
||||
R.string.sure
|
||||
)
|
||||
).setOkButton(getString(R.string.delete)) {
|
||||
|
||||
viewModel.itemShelvingSaleDeleteIsAdded(sale.itemShelvingSaleFk)
|
||||
scanRequest()
|
||||
customDialog.dismiss()
|
||||
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
scanRequest()
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
|
||||
}
|
||||
|
||||
private fun setScrollListener(lm: LinearLayoutManager) {
|
||||
|
@ -555,6 +622,7 @@ class CollectionFragmentPickerPreviousNew(
|
|||
private fun printShelvingResult(pos: Int) {
|
||||
|
||||
storedPosition = pos
|
||||
customDialogList = CustomDialogList(requireContext())
|
||||
customDialogList.getEditTextTwo().inputType = InputType.TYPE_CLASS_TEXT
|
||||
customDialogList.getEditTextTwo().setRawInputType(InputType.TYPE_CLASS_NUMBER)
|
||||
customDialogList.getEditText().setRawInputType(InputType.TYPE_CLASS_NUMBER)
|
||||
|
@ -713,13 +781,27 @@ class CollectionFragmentPickerPreviousNew(
|
|||
}.setOkButtonTwo(getString(R.string.no)) {
|
||||
scanRequest()
|
||||
customDialogThreeButtonsQuantity.dismiss()
|
||||
if (quantity == 0) {
|
||||
viewModel.itemShelvingSaleExists(
|
||||
myGroupList[position].itemShelvingSaleFk, position, quantity
|
||||
)
|
||||
} else {
|
||||
markLine(position, quantity, true)
|
||||
}
|
||||
viewModel.itemShelvingSaleExists(
|
||||
myGroupList[position].itemShelvingSaleFk,
|
||||
myGroupList[position].itemShelvingFk,
|
||||
position,
|
||||
quantity
|
||||
)
|
||||
/* if (quantity == 0) {
|
||||
|
||||
/* viewModel.itemShelvingGet(
|
||||
myGroupList[position].itemShelvingFk,
|
||||
position = position,
|
||||
quantity = quantity
|
||||
)*/
|
||||
} else {
|
||||
//markLine(position, quantity, true)
|
||||
viewModel.itemShelvingGet(
|
||||
myGroupList[position].itemShelvingFk,
|
||||
position = position,
|
||||
quantity = quantity
|
||||
)
|
||||
}*/
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
scanRequest()
|
||||
customDialogThreeButtonsQuantity.dismiss()
|
||||
|
@ -742,13 +824,13 @@ class CollectionFragmentPickerPreviousNew(
|
|||
.setOkButton(getString(R.string.Agregar)) {
|
||||
customDialogAddItem()
|
||||
}.setKoButton(getString(R.string.close)) {
|
||||
scanRequest()
|
||||
customDialogList.dismiss()
|
||||
scanRequest()
|
||||
hideKeyboardFragment()
|
||||
}.setHintValue(getString(R.string.Artículo)).setValue("")
|
||||
.setHintValueTwo(getString(R.string.Cantidad)).setValueTwo("").show()
|
||||
customDialogList.getEditText().requestFocus()
|
||||
requireActivity().hideKeyboard()
|
||||
|
||||
hideKeyboardFragment()
|
||||
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()) {
|
||||
|
@ -807,22 +889,24 @@ class CollectionFragmentPickerPreviousNew(
|
|||
) {
|
||||
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<Int>(SECTORFK)
|
||||
viewModel.collectionAddWithReservation(
|
||||
customDialogList.getValue().toInt(),
|
||||
customDialogList.getValueTwo().toInt(),
|
||||
ticketSelected,
|
||||
saleGroupFk = if (type == PREPARED) null else collection.tickets.find { it.ticketFk == ticketSelected }?.sales?.get(
|
||||
0
|
||||
)?.saleGroupFk
|
||||
?: 0,
|
||||
sectorFk = if (type == PREPARED) null else mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
||||
SECTORFK
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
customDialogList.dismiss()
|
||||
hideKeyboards()
|
||||
scanRequest()
|
||||
customDialogList.cancel()
|
||||
binding.scanInput.requestFocus()
|
||||
hideKeyboardFragment()
|
||||
}
|
||||
} else {
|
||||
getString(R.string.scanItem).toast(requireContext())
|
||||
|
@ -830,6 +914,14 @@ class CollectionFragmentPickerPreviousNew(
|
|||
|
||||
}
|
||||
|
||||
private fun hideKeyboardFragment() {
|
||||
Handler(Looper.getMainLooper()).postDelayed({
|
||||
val inputMethodManager =
|
||||
requireContext().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
inputMethodManager.hideSoftInputFromWindow(binding.scanInput.windowToken, 0)
|
||||
}, 300L)
|
||||
}
|
||||
|
||||
private fun toastDisponibility(item: ItemVO) {
|
||||
if (item.available.isEmpty()) {
|
||||
item.available = "0"
|
||||
|
@ -844,6 +936,8 @@ class CollectionFragmentPickerPreviousNew(
|
|||
}
|
||||
|
||||
private fun setTotalLines() {
|
||||
println("total Mark ${myGroupList.count { it.isPicked == 1 }}")
|
||||
println("total size ${myGroupList.size}")
|
||||
val totalMark = myGroupList.count { it.isPicked == 1 }
|
||||
binding.mainToolbar.toolbarTitle.text =
|
||||
if (collection.collectionFk != 0) collection.collectionFk.toString() else ""
|
||||
|
@ -851,7 +945,20 @@ class CollectionFragmentPickerPreviousNew(
|
|||
getString(R.string.totalsPicker, totalMark, myGroupList.size)
|
||||
if (totalMark == myGroupList.size) {
|
||||
getString(R.string.Coleccióncompleta).toast(this.context, Toast.LENGTH_SHORT)
|
||||
viewModel.saleTrackingAddPrevOK(collection.collectionFk)
|
||||
when (type) {
|
||||
PREPARED -> {
|
||||
tickets.forEach {
|
||||
viewModel.ticketStateTodaySetState(
|
||||
ticketFk = it.toInt(), state = "PREPARED"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
PREITEMPICKERTEST -> {
|
||||
viewModel.saleTrackingAddPrevOK(collection.collectionFk)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -895,4 +1002,171 @@ class CollectionFragmentPickerPreviousNew(
|
|||
customDialog.dismiss()
|
||||
}.show()
|
||||
}
|
||||
|
||||
private fun groupSaleGroup(salesList: ArrayList<Sale>): MutableList<Sale> {
|
||||
val myMap = salesList.groupBy { it.saleGroupFk }
|
||||
val myList: MutableList<Sale> = mutableListOf()
|
||||
|
||||
for ((key, value) in myMap.entries) {
|
||||
if (key == null) { // si no tiene saleGroup se añaden las líneas
|
||||
for (s in value) {
|
||||
myList.add(s)
|
||||
}
|
||||
} else { // si tiene saleGroup se crea el padre con el tamaño e indicando que es padre, como ejemplo se toma el primer elemento
|
||||
/*crea padre*/
|
||||
if (value.size > 1) {
|
||||
val mySale = //= value[0]
|
||||
Sale(
|
||||
level = value[0].level,
|
||||
isPicked = value[0].isPicked,
|
||||
parkingCode = getString(R.string.linesSaelGroup, value.size),
|
||||
pickingOrder = value[0].pickingOrder,
|
||||
workerFk = value[0].workerFk,
|
||||
originalQuantity = value[0].originalQuantity,
|
||||
saleQuantity = 0,
|
||||
saleFk = value[0].saleFk,
|
||||
saleGroupFk = value[0].saleGroupFk,
|
||||
semaphore = value[0].semaphore,
|
||||
ticketFk = value[0].ticketFk,
|
||||
itemFk = value[0].saleGroupFk!!,
|
||||
isAdded = value[0].isAdded,
|
||||
hasMistake = value[0].hasMistake,
|
||||
origin = value[0].origin,
|
||||
size = value[0].size,
|
||||
itemShelvingSaleFk = value[0].itemShelvingSaleFk,
|
||||
longName = value[0].parkingCode ?: "",
|
||||
itemShelvingFk = 0
|
||||
)
|
||||
|
||||
//prime elemento//hay que hacer una copia si no queda la referencia
|
||||
mySale.totalSales = value.size //total líneas
|
||||
mySale.isParent = true
|
||||
value as MutableList<Sale>
|
||||
mySale.sonSales =
|
||||
value.sortedWith(compareBy { it.isPicked }) as MutableList<Sale>
|
||||
|
||||
myList.add(mySale)
|
||||
} else {
|
||||
for (s in value) {
|
||||
myList.add(s)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return myList
|
||||
}
|
||||
|
||||
/* FUNCIONES PROPIAS DE LOS SACADORES */
|
||||
private fun verifyCollection() {
|
||||
|
||||
customDialogList.setTitle(
|
||||
getString(R.string.verifyCollection)
|
||||
)
|
||||
customDialogList.setDescription(
|
||||
|
||||
getString(R.string.scanTicketsVerifyCollection, collection.collectionFk)
|
||||
).setKoButton(getString(R.string.cancel)) {
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
customDialogList.dismiss()
|
||||
ma.onMyBackPressed()
|
||||
}.setValue("").setOkButton(getString(R.string.print)) {
|
||||
print()
|
||||
}.show()
|
||||
|
||||
customDialogList.getEditText().requestFocus()
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
|
||||
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("ticket", "saleGroup"), "id"
|
||||
).toString()
|
||||
)
|
||||
|
||||
val foundTicketInCollection =
|
||||
collection.tickets.find {
|
||||
it.ticketFk == customDialogList.getValue().toInt()
|
||||
}
|
||||
if (foundTicketInCollection != null) {
|
||||
isVerifiedCollection = true
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
binding.fragmentSacadorCollections.visibility = View.VISIBLE
|
||||
customDialogList.dismiss()
|
||||
binding.scanInput.requestFocus()
|
||||
} else {
|
||||
|
||||
throw Exception(getString(R.string.ticketErrorCollection))
|
||||
}
|
||||
|
||||
} catch (ex: Exception) {
|
||||
ma.messageWithSound(
|
||||
ex.message.toString(), isError = true, isPlayed = true, isToasted = true
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
customDialogList.setValue("")
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
|
||||
customDialogList.getRecyclerView().layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
|
||||
}
|
||||
|
||||
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 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>(
|
||||
ConstAndValues.PRINTERNAME
|
||||
)).toast(requireContext())
|
||||
|
||||
}
|
||||
val dialog = builder.create()
|
||||
dialog.show()
|
||||
} else {
|
||||
viewModel.collectionStickerPrint(
|
||||
collectionFk = collection.collectionFk, null
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ import es.verdnatura.presentation.base.BaseViewModel
|
|||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.common.Event
|
||||
import es.verdnatura.presentation.common.ResponseItemExistsItemShelvingSale
|
||||
import es.verdnatura.presentation.common.ItemShelving
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import es.verdnatura.presentation.common.SaleTrackingReplaceSalix
|
||||
import es.verdnatura.presentation.common.SaleTrackingSalix
|
||||
|
@ -44,13 +44,20 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
val collectionTicketList: LiveData<CollectionVO>
|
||||
get() = _collectionTicketList
|
||||
|
||||
private val _responseExistsItemShelvingSale by lazy { MutableLiveData<ResponseItemExistsItemShelvingSale>() }
|
||||
val responseExistsItemShelvingSale: LiveData<ResponseItemExistsItemShelvingSale>
|
||||
private val _responseExistsItemShelvingSale by lazy { MutableLiveData<Boolean>() }
|
||||
val responseExistsItemShelvingSale: LiveData<Boolean>
|
||||
get() = _responseExistsItemShelvingSale
|
||||
|
||||
val loadExistsResponse: LiveData<Event<ResponseItemExistsItemShelvingSale>> =
|
||||
val loadExistsResponse: LiveData<Event<Boolean>> =
|
||||
_responseExistsItemShelvingSale.map { Event(it) }
|
||||
|
||||
private val _responseItemShelvingFind by lazy { MutableLiveData<ItemShelving>() }
|
||||
val responseItemShelvingFind: LiveData<ItemShelving>
|
||||
get() = _responseItemShelvingFind
|
||||
|
||||
val loadFindItemShelvingResponse: LiveData<Event<ItemShelving>> =
|
||||
_responseItemShelvingFind.map { Event(it) }
|
||||
|
||||
private val _collectionTicketSalix by lazy { MutableLiveData<CollectionTicket>() }
|
||||
val collectionTicketSalix: LiveData<CollectionTicket>
|
||||
get() = _collectionTicketSalix
|
||||
|
@ -73,6 +80,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
private val _responseSaleMistakeAdd by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseSaleMistakeAdd: LiveData<ResponseItemVO>
|
||||
get() = _responseSaleMistakeAdd
|
||||
val loadSaleMistakeAdd: LiveData<Event<ResponseItemVO>> =
|
||||
_responseSaleMistakeAdd.map { Event(it) }
|
||||
|
||||
private val _responseItemShelvingSaleSupplyAdd by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseItemShelvingSaleSupplyAdd: LiveData<ResponseItemVO>
|
||||
|
@ -107,10 +116,17 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
val responseCollectionAddItem: LiveData<Boolean>
|
||||
get() = _responseCollectionAddItem
|
||||
|
||||
private val _responseItemShelvingSaleDelete by lazy { MutableLiveData<Boolean>() }
|
||||
val responseItemShelvingSaleDelete: LiveData<Boolean> = _responseItemShelvingSaleDelete
|
||||
val loadResponseDelete: LiveData<Event<Boolean>> =
|
||||
_responseItemShelvingSaleDelete.map { Event(it) }
|
||||
|
||||
private val _responseParking by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseParking: LiveData<ResponseItemVO>
|
||||
get() = _responseParking
|
||||
|
||||
val loadParking: LiveData<Event<ResponseItemVO>> = _responseParking.map { Event(it) }
|
||||
|
||||
private val _responsePrint by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responsePrint: LiveData<ResponseItemVO>
|
||||
get() = _responsePrint
|
||||
|
@ -126,6 +142,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
private val _responseTicketState by lazy { MutableLiveData<TicketState>() }
|
||||
val responseTicketState: LiveData<TicketState> = _responseTicketState
|
||||
|
||||
val loadTicketState: LiveData<Event<TicketState>> = _responseTicketState.map { Event(it) }
|
||||
|
||||
private val _responseUsedShelves by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseUsedShelves: LiveData<ResponseItemVO>
|
||||
get() = _responseUsedShelves
|
||||
|
@ -134,6 +152,9 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
val responseSaleGroup: LiveData<ResponseItemVO>
|
||||
get() = _responseSaleGroup
|
||||
|
||||
val loadResponseSaleGroup: LiveData<Event<ResponseItemVO>> =
|
||||
_responseSaleGroup.map { Event(it) }
|
||||
|
||||
private val _responseItemShelvingSaleGroup by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseItemShelvingSaleGroup: LiveData<ResponseItemVO>
|
||||
get() = _responseItemShelvingSaleGroup
|
||||
|
@ -141,6 +162,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
private val _responseTicketClosure by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseTicketClosure: LiveData<ResponseItemVO>
|
||||
get() = _responseTicketClosure
|
||||
val loadTicketClousure: LiveData<Event<ResponseItemVO>> =
|
||||
_responseTicketClosure.map { Event(it) }
|
||||
|
||||
private val _responseCollectionUnchecked by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseCollectionUnchecked: LiveData<ResponseItemVO>
|
||||
|
@ -154,6 +177,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
val responseNew: LiveData<ResponseItemVO>
|
||||
get() = _responseNew
|
||||
|
||||
val loadAddNew: LiveData<Event<ResponseItemVO>> = _responseNew.map { Event(it) }
|
||||
|
||||
private val _responseCode by lazy { MutableLiveData<Int?>() }
|
||||
val responseCode: LiveData<Int?>
|
||||
get() = _responseCode
|
||||
|
@ -161,6 +186,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
private val _responseIncQuantity by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseIncQuantity: LiveData<ResponseItemVO>
|
||||
get() = _responseIncQuantity
|
||||
val loadIncQuantity: LiveData<Event<ResponseItemVO>> = _responseIncQuantity.map { Event(it) }
|
||||
|
||||
private val _mistakeList by lazy { MutableLiveData<MistakeTypeListVO>() }
|
||||
val mistakeList: LiveData<MistakeTypeListVO>
|
||||
|
@ -286,7 +312,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
|
||||
fun itemShelvingSaleExists(
|
||||
itemShelvingSaleFk: Number, position: Int, quantity: Int
|
||||
itemShelvingSaleFk: Number, itemShelvingFk: Number, position: Int, quantity: Int
|
||||
|
||||
) {
|
||||
salix.itemShelvingSaleExists(
|
||||
|
@ -294,9 +320,39 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
).enqueue(object : SalixCallback<JsonObject>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<JsonObject>) {
|
||||
_responseExistsItemShelvingSale.value = ResponseItemExistsItemShelvingSale(
|
||||
|
||||
if (response.body()!!.entrySet().first().value.asBoolean) {
|
||||
itemShelvingGet(itemShelvingFk, position, quantity)
|
||||
} else {
|
||||
_responseExistsItemShelvingSale.value = false
|
||||
}
|
||||
/*_responseExistsItemShelvingSale.value = ResponseItemExistsItemShelvingSale(
|
||||
response.body()!!.entrySet().first().value.asBoolean, position, quantity
|
||||
)*/
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun itemShelvingGet(
|
||||
itemShelvingFk: Number, position: Int, quantity: Int
|
||||
|
||||
) {
|
||||
salix.itemShelvingGet(
|
||||
id = itemShelvingFk
|
||||
).enqueue(object : SalixCallback<ItemShelving>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<ItemShelving>) {
|
||||
val itemShelving: ItemShelving = response.body()!!
|
||||
itemShelving.position = position
|
||||
itemShelving.quantity = quantity
|
||||
_responseItemShelvingFind.value = ItemShelving(
|
||||
itemShelving.id,
|
||||
itemFk = itemShelving.itemFk,
|
||||
shelvingFk = itemShelving.shelvingFk,
|
||||
position = position,
|
||||
quantity = quantity
|
||||
)
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -391,6 +447,21 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun itemShelvingSaleDeleteIsAdded(
|
||||
itemShelvingSale: Number
|
||||
) {
|
||||
salix.itemShelvingSaleDeleteAdded(
|
||||
params = arrayListOf(
|
||||
itemShelvingSale
|
||||
)
|
||||
).enqueue(object : SalixCallback<Any>(context) {
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_responseCollectionAddItem.value = true
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun collectionAddWithReservation(
|
||||
item: Int, quantity: Int, ticketSelected: Int, saleGroupFk: Int?, sectorFk: Int?
|
||||
) {
|
||||
|
@ -523,7 +594,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
|
||||
override fun onSuccess(response: Response<Unit>) {
|
||||
//Tarea 7926
|
||||
updateParkingFromSaleGroup(saleGroupFk)
|
||||
// updateParkingFromSaleGroup(saleGroupFk)
|
||||
_responseSaleGroup.value = ResponseItemVO(isError = false)
|
||||
}
|
||||
})
|
||||
|
|
|
@ -31,7 +31,6 @@ class ControladorFragment :
|
|||
}
|
||||
|
||||
override fun init() {
|
||||
|
||||
binding.scanInput.visibility = VISIBLE
|
||||
binding.mainToolbar.toolbarTitle.text = getString(R.string.controlticket)
|
||||
setEvents()
|
||||
|
@ -107,7 +106,7 @@ class ControladorFragment :
|
|||
|
||||
}
|
||||
responseTicketState.observe(
|
||||
viewLifecycleOwner
|
||||
viewLifecycleOwner
|
||||
) {
|
||||
if ((it.code == "ON_CHECKING" || it.code == "CHECKED") && it.user.id != mobileApplication.userId) {
|
||||
val customDialogWarning = CustomDialog(requireContext())
|
||||
|
|
|
@ -11,7 +11,6 @@ import es.verdnatura.R
|
|||
import es.verdnatura.databinding.FragmentGeneralBlackBinding
|
||||
import es.verdnatura.domain.ConstAndValues
|
||||
import es.verdnatura.domain.notNull
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
|
||||
import es.verdnatura.presentation.common.OnCollectionTicketSelectedListener
|
||||
|
@ -38,6 +37,8 @@ class SectorCollectionReserveFragment(
|
|||
private var listSaleGroupAdapter: BarcodeAdapter? = null
|
||||
private var onBack = false
|
||||
private var isReserved = false
|
||||
private var listTickets: ArrayList<BarcodeVO> = ArrayList()
|
||||
private var listTicketsAdapter: BarcodeAdapter? = null
|
||||
|
||||
val listIcons: ArrayList<ImageView> = ArrayList()
|
||||
|
||||
|
@ -146,9 +147,18 @@ class SectorCollectionReserveFragment(
|
|||
try {
|
||||
//Reservar colección
|
||||
if (!hasToAdd) {
|
||||
/* if (listTickets.isNotEmpty()) {
|
||||
listTickets.forEach { item ->
|
||||
viewModel.getReserveBySectorCollection(item.code!!.toInt())
|
||||
}
|
||||
}*/
|
||||
viewModel.getReserveBySectorCollection(collectionFk)
|
||||
|
||||
} else {
|
||||
gotoPicker()
|
||||
hasToAdd = false
|
||||
viewModel.getReserveBySectorCollection(collectionFk)
|
||||
|
||||
//gotoPicker()
|
||||
}
|
||||
} catch (ex: Exception) {
|
||||
ma.messageWithSound(
|
||||
|
@ -235,27 +245,27 @@ class SectorCollectionReserveFragment(
|
|||
}
|
||||
|
||||
binding.scanInput.requestFocus()
|
||||
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||
/* binding.scanInput.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||
|
||||
if (binding.scanInput.text.toString().isNotEmpty()) {
|
||||
if (binding.scanInput.text.toString().isNotEmpty()) {
|
||||
|
||||
try {
|
||||
navigateToCollectionList(binding.scanInput.text.toString().toInt())
|
||||
try {
|
||||
navigateToCollectionList(binding.scanInput.text.toString().toInt())
|
||||
|
||||
} catch (ex: Exception) {
|
||||
ex.message!!.toast(requireContext())
|
||||
} catch (ex: Exception) {
|
||||
ex.message!!.toast(requireContext())
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
binding.scanInput.setText("")
|
||||
ma.hideKeyboard(binding.scanInput)
|
||||
}
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
return@setOnEditorActionListener false
|
||||
}
|
||||
binding.scanInput.setText("")
|
||||
ma.hideKeyboard(binding.scanInput)
|
||||
}
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
return@setOnEditorActionListener false
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
|
@ -310,7 +320,7 @@ class SectorCollectionReserveFragment(
|
|||
listSaleGroupAdapter!!.notifyItemInserted(listSalesGroup.size - 1)
|
||||
|
||||
if (hasToAdd) {
|
||||
viewModel.getReserveBySaleGroup(it)
|
||||
// viewModel.getReserveBySaleGroup(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,8 +27,7 @@ import java.util.Calendar
|
|||
|
||||
class SacadorFragmentNew(
|
||||
var type: String
|
||||
) :
|
||||
BaseFragment<FragmentSacadorBinding, SacadorViewModel>(SacadorViewModel::class) {
|
||||
) : BaseFragment<FragmentSacadorBinding, SacadorViewModel>(SacadorViewModel::class) {
|
||||
|
||||
private var onCollectionSelectedListener: OnCollectionTicketSelectedListener? = null
|
||||
private var goBack: Boolean = false
|
||||
|
@ -107,7 +106,7 @@ class SacadorFragmentNew(
|
|||
iconPrint.tooltipText = getTooltip(R.drawable.ic_print_black_24dp)
|
||||
|
||||
if (type == "PREPARED") {
|
||||
listIcons.add(iconVehicleIn)
|
||||
// listIcons.add(iconVehicleIn)
|
||||
} else {
|
||||
listIcons.add(iconPrint)
|
||||
}
|
||||
|
@ -122,12 +121,10 @@ class SacadorFragmentNew(
|
|||
iconAdd.drawable -> {
|
||||
|
||||
if (type == "PREPARED") {
|
||||
if (hasSector())
|
||||
viewModel.collection_assignNew(
|
||||
if (hasSector()) viewModel.collection_assignNew(
|
||||
)
|
||||
} else {
|
||||
if (hasSector())
|
||||
viewModel.sectorCollectionNew(
|
||||
if (hasSector()) viewModel.sectorCollectionNew(
|
||||
mobileApplication.dataStoreApp.readDataStoreKey(
|
||||
SECTORFK
|
||||
)
|
||||
|
@ -151,8 +148,7 @@ class SacadorFragmentNew(
|
|||
|
||||
customDialogInput.setInputText(InputType.TYPE_CLASS_NUMBER)
|
||||
customDialogInput.setTitle(getString(R.string.printTicket))
|
||||
customDialogInput.setDescription(getString(R.string.printPreviousGroup))
|
||||
.setValue("")
|
||||
customDialogInput.setDescription(getString(R.string.printPreviousGroup)).setValue("")
|
||||
.setOkButton(getString(R.string.print)) {
|
||||
|
||||
print()
|
||||
|
@ -178,8 +174,7 @@ class SacadorFragmentNew(
|
|||
private fun print() {
|
||||
|
||||
try {
|
||||
if (customDialogInput.getValue().isNotEmpty()
|
||||
) {
|
||||
if (customDialogInput.getValue().isNotEmpty()) {
|
||||
if (ma.havePrinter()) {
|
||||
viewModel.ticketPrintLabelPrevious(customDialogInput.getValue().toInt())
|
||||
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
||||
|
@ -224,7 +219,8 @@ class SacadorFragmentNew(
|
|||
it.list.forEach {
|
||||
//lolass
|
||||
|
||||
var myDate = getCalendarForDateMinusOneDay(requireContext()).convertToDateString()
|
||||
var myDate =
|
||||
getCalendarForDateMinusOneDay(requireContext()).convertToDateString()
|
||||
if (!it.created.contains(myDate)) {
|
||||
myCollectionsList.add(CollectionTicket(it.collectionFk, it.created))
|
||||
}
|
||||
|
@ -236,11 +232,20 @@ class SacadorFragmentNew(
|
|||
response.observe(viewLifecycleOwner) {
|
||||
|
||||
if (it.isError) {
|
||||
ma.messageWithSound(it.errorMessage, isError = true, isPlayed = false)
|
||||
ma.messageWithSound(
|
||||
it.errorMessage,
|
||||
isError = true,
|
||||
isPlayed = true,
|
||||
isToasted = true
|
||||
)
|
||||
|
||||
} else {
|
||||
if (it.response.isNotBlank()) {
|
||||
addCollectionToList(it.response.toInt())
|
||||
if (collectionsList.isNotEmpty()) {
|
||||
addCollectionToList(it.response.toInt())
|
||||
} else {
|
||||
callBack(type)
|
||||
}
|
||||
|
||||
} else {
|
||||
when (type) {
|
||||
|
@ -306,8 +311,7 @@ class SacadorFragmentNew(
|
|||
if (isNew) {
|
||||
collectionsList.add(
|
||||
CollectionTicket(
|
||||
collectionFk = collection,
|
||||
created = getString(R.string.newCreated)
|
||||
collectionFk = collection, created = getString(R.string.newCreated)
|
||||
)
|
||||
)
|
||||
} else {
|
||||
|
@ -319,6 +323,7 @@ class SacadorFragmentNew(
|
|||
}
|
||||
adapter?.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
private fun hasSector(): Boolean {
|
||||
return if (ma.haveSector()) {
|
||||
true
|
||||
|
|
|
@ -123,7 +123,6 @@ class SacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
|
||||
fun collection_assignNew() {
|
||||
salix.collectionAssigned()
|
||||
// silex.collection_assign()
|
||||
.enqueue(
|
||||
object :
|
||||
SalixCallback<Int>(context) {
|
||||
|
|
|
@ -30,6 +30,7 @@ data class Ticket(
|
|||
|
||||
data class Sale(
|
||||
val itemShelvingSaleFk: Int,
|
||||
val itemShelvingFk: Int,
|
||||
val ticketFk: Int,
|
||||
val saleGroupFk: Int?,
|
||||
val saleFk: Int,
|
||||
|
|
|
@ -51,11 +51,12 @@
|
|||
android:id="@+id/fragment_sacador_collections"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginTop="4dp"
|
||||
tools:listitem="@layout/item_article_row_fragment" />
|
||||
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/main_toolbar"
|
||||
layout="@layout/toolbar_fragment"
|
||||
|
|
|
@ -31,15 +31,7 @@
|
|||
android:id="@+id/item_row_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvHeadlines"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:visibility="visible"
|
||||
/>
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
|
||||
|
@ -48,14 +40,12 @@
|
|||
android:background="@color/verdnatura_white"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/layout_margin_min"
|
||||
android:textColor="@color/verdnatura_black"
|
||||
>
|
||||
android:textColor="@color/verdnatura_black">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -100,22 +90,24 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivArrow"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:rotation="180"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:src="@drawable/ic_arrow_down"
|
||||
android:contentDescription="@string/selectAction"/>
|
||||
android:contentDescription="@string/selectAction"
|
||||
android:rotation="180"
|
||||
android:src="@drawable/ic_arrow_down" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageErrorMessage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentEnd="true"
|
||||
app:srcCompat="@drawable/emoticon_error_fragment"
|
||||
android:contentDescription="@string/error"/>
|
||||
android:contentDescription="@string/error"
|
||||
app:srcCompat="@drawable/emoticon_error_fragment" />
|
||||
|
||||
<View
|
||||
android:id="@+id/item_article_row_semaforo_pre"
|
||||
|
@ -155,7 +147,6 @@
|
|||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:layout_marginEnd="@dimen/layout_margin_min"
|
||||
android:text="@{sale.agencyName}"
|
||||
android:textSize="@dimen/h8"
|
||||
|
@ -183,9 +174,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
>
|
||||
</LinearLayout>
|
||||
app:layout_constraintTop_toTopOf="parent"></LinearLayout>
|
||||
|
||||
<!--CONTENIDO=================================================-->
|
||||
<!--app:layout_constraintEnd_toStartOf="@+id/item_article_quantity_picked"-->
|
||||
|
@ -226,9 +215,9 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/layout_margin_min"
|
||||
android:text="@string/de"
|
||||
android:visibility="gone"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/body1"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toStartOf="@+id/item_article_quantityOld"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
@ -239,12 +228,12 @@
|
|||
android:layout_marginEnd="22dp"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:visibility="gone"
|
||||
|
||||
android:text="@{Integer.toString(sale.quantity)}"
|
||||
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/body1"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tool:text="10" />
|
||||
|
@ -354,8 +343,8 @@
|
|||
android:text="@{sale.cel2}"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/body3"
|
||||
android:visibility="gone"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="@+id/item_article_quantity_line2"
|
||||
app:layout_constraintTop_toTopOf="@+id/item_article_quantity_line2"
|
||||
tool:text="cel2" />
|
||||
|
@ -365,17 +354,16 @@
|
|||
android:id="@+id/item_article_quantity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/layout_collection_quantity"
|
||||
android:paddingTop="@dimen/layout_margin_minest"
|
||||
android:paddingBottom="@dimen/default_layout_margin"
|
||||
android:paddingStart="@dimen/layout_collection_quantity"
|
||||
android:text="@{Integer.toString(sale.quantity)}"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/body3"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="@+id/item_article_quantity_line2"
|
||||
app:layout_constraintTop_toTopOf="@+id/item_article_quantity_line2"
|
||||
tool:text="100"
|
||||
/>
|
||||
tool:text="100" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_article_quantity_line3"
|
||||
|
@ -449,7 +437,7 @@
|
|||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/item_article_placements"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/verdnatura_background_item_picker"
|
||||
android:clipToPadding="false"
|
||||
|
||||
|
|
|
@ -27,12 +27,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvHeadlines"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:visibility="visible" />
|
||||
|
||||
<LinearLayout
|
||||
|
||||
|
@ -173,7 +167,8 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/layout_margin_prepicker">
|
||||
android:layout_height="@dimen/layout_margin_prepicker"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_parking_code"
|
||||
|
@ -181,7 +176,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="1dp"
|
||||
android:layout_marginEnd="@dimen/layout_margin_min"
|
||||
android:layout_weight="0.5"
|
||||
android:maxLines="1"
|
||||
android:text=""
|
||||
android:textColor="@color/verdnatura_white"
|
||||
|
@ -189,22 +183,8 @@
|
|||
android:textStyle="bold"
|
||||
tool:text="A-01-1" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_first_to_picker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="1dp"
|
||||
android:layout_weight="0.5"
|
||||
android:gravity="end"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/body1"
|
||||
android:textStyle="bold"
|
||||
android:visibility="invisible"
|
||||
tool:text="25 x 5" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -262,7 +242,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/layout_margin_min_to_modify"
|
||||
android:layout_weight="2"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@{Long.toString(sale.itemFk)}"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
|
@ -456,15 +435,30 @@
|
|||
android:id="@+id/layout_error"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone">
|
||||
android:visibility="gone"
|
||||
tool:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_error"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="5"
|
||||
android:background="@color/verdnatura_red"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
tool:text="Cantidad original 100" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/delete_reserve"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/verdnatura_red"
|
||||
android:gravity="end"
|
||||
android:src="@drawable/ic_delete_black_24dp"
|
||||
android:visibility="invisible"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<dimen name="layout_margin_min_to_modify">2dp</dimen>
|
||||
<dimen name="layout_margin_minest">1dp</dimen>
|
||||
<dimen name="layout_margin_min">4dp</dimen>
|
||||
<dimen name="layout_margin_1">8dp</dimen>
|
||||
<dimen name="layout_margin_1">4dp</dimen>
|
||||
<dimen name="layout_collection_quantity">10dp</dimen>
|
||||
<dimen name="default_layout_margin">16dp</dimen>
|
||||
<dimen name="layout_end_ticket_color">20dp</dimen>
|
||||
|
@ -118,7 +118,7 @@
|
|||
|
||||
|
||||
<!-- Pintar ticket -->
|
||||
<dimen name="ticketColor_height">90dp</dimen>
|
||||
<dimen name="ticketColor_height">80dp</dimen>
|
||||
<dimen name="ticketColor_width">10dp</dimen>
|
||||
|
||||
<!-- Elements of RecyclerViewer -->
|
||||
|
|
Loading…
Reference in New Issue