feat reservas refs #6861

This commit is contained in:
Sergio De la torre 2024-08-08 17:31:43 +02:00
parent 60bdd285bf
commit 6331fee2e1
5 changed files with 71 additions and 16 deletions

View File

@ -109,7 +109,7 @@ interface OnEditSubQuantityListener {
fun OnEditSubQuantityListener(item: Any, text: String)
}
interface AdapterCallback {
fun getPosition():Int
fun getPosition(): Int
}
interface OnItemClickListener {
@ -151,6 +151,7 @@ interface OnClientHistoricItemClickListener {
interface OnVisibleClickListener {
fun onVisibleClickListener(item: ItemUbicadorVO)
}
interface OnVisibleClickListenerNew {
fun onVisibleClickListener(item: ItemUbicador)
}
@ -162,21 +163,32 @@ interface OnVisibleInventoryClickListener {
interface OnMoreClickListener {
fun onMoreClickListener(item: ItemUbicadorVO)
}
interface OnMoreClickListenerNew {
fun onMoreClickListener(item: ItemUbicador)
}
interface OnTruckClickListener {
fun onTruckClickListener(item: ItemExpeditionTruckVO, entryPoint: String)
}
interface OnRoadMapClickListener {
fun onRoadMapClickListener(item: RoadMapTruck, entryPoint: String)
}
interface OnStopMapClickListener {
fun onStopMapClickListener(item: RoadStopMapTruck, entryPoint: String, action:TruckAction, view: View? = null)
fun onStopMapClickListener(
item: RoadStopMapTruck,
entryPoint: String,
action: TruckAction,
view: View? = null
)
}
interface OnStopMapLoadClickListener {
fun onStopMapClickListener(item: RoadStopMapTruck, entryPoint: String)
}
interface OnStopMapUnloadClickListener {
fun onStopMapClickListener(item: RoadStopMapTruck, entryPoint: String)
}
@ -185,7 +197,6 @@ interface OnPrintClickListener {
fun onPrintClickListener(item: StopMapTruckPallet, entryPoint: String)
}
interface OnPalletClickListener {
fun onPalletClickListener(itemTruck: ItemExpeditionTruckVO, itemPallet: ItemPalletVO)
}
@ -206,7 +217,12 @@ interface OnCollectionSelectedListener {
}
interface OnCollectionTicketSelectedListener {
fun onCollectionSelected(collection: CollectionTicket, type: String, hasPicking:Boolean = false)
fun onCollectionSelected(
collection: CollectionTicket,
type: String,
hasPicking: Boolean = false,
hasToAdd: Boolean = false
)
}
interface OnQuantityClickListener {

View File

@ -1941,12 +1941,15 @@ class CollectionFragmentPicker(
getString(R.string.Todosloscampossonobligatorios).toast(requireContext())
} else {
viewModel.collectionAddItem(
itemFk = customDialogList.getValue().toInt(),
ticketFk = ticketSelected,
quantity = customDialogList.getValueTwo().toInt()
)
try {
viewModel.collectionAddItem(
itemFk = customDialogList.getValue().toInt(),
ticketFk = ticketSelected,
quantity = customDialogList.getValueTwo().toInt()
)
}catch (ex:Exception){
ma.messageWithSound(message = getString(R.string.errorScanItem), isError = true, isToasted = true, isPlayed = true)
}
scanRequest()
customDialogList.dismiss()

View File

@ -991,7 +991,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
}
override fun onCollectionSelected(
collection: CollectionTicket, type: String, hasPicking: Boolean
collection: CollectionTicket, type: String, hasPicking: Boolean, hasToAdd:Boolean
) {
when (type) {
"PREITEMPICKERTEST" -> {
@ -999,7 +999,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
//addFragmentOnTop(EndSacadorFragment.newInstance(collection, type))
addFragmentOnTop(
SectorCollectionReserveFragment.newInstance(
"PREITEMPICKERTEST", collection.collectionFk
"PREITEMPICKERTEST", collection.collectionFk, hasToAdd
)
)
@ -1205,9 +1205,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
action: TruckAction,
view: View?
) {
println("stopMapList ${item.description}")
println("stopMapList id ${item.id}")
println("action $action")
addFragmentOnTop(
StopMapPalletListFragment.newInstance(
title = item.description ?: "", item, action

View File

@ -98,6 +98,11 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
val loadResponseReserveSectorCollection: LiveData<Event<ResponseItemVO>> =
_responseReserveSectorCollection.map { Event(it) }
private val _responseReserveSaleGroup by lazy { MutableLiveData<ResponseItemVO>() }
val responseReserveSaleGroup: LiveData<ResponseItemVO> = _responseReserveSaleGroup
val loadResponseReserveSaleGroup: LiveData<Event<ResponseItemVO>> =
_responseReserveSaleGroup.map { Event(it) }
private val _responseSaleAddPrevOK by lazy { MutableLiveData<ResponseItemVO>() }
val responseSaleAddPrevOK: LiveData<ResponseItemVO>
get() = _responseSaleAddPrevOK
@ -371,6 +376,33 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
})
}
fun getReserveBySaleGroup(
saleGroup: Int
) {
salix.getReserveBySaleGroup(
params = arrayListOf(
saleGroup
).formatWithQuotes()
).enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
_responseReserveSectorCollection.value = ResponseItemVO(
isError = false, errorMessage = "" + getMessageFromAllResponse(
nameofFunction(this), response.message()
)
)
}
override fun onError(t: Throwable) {
_responseReserveSectorCollection.value = ResponseItemVO(
isError = true, errorMessage = getMessageFromAllResponse(
nameofFunction(this), t.message!!
)
)
}
})
}
fun saleTrackingAddPrevOK(
sectorCollectionFk: Int
) {

View File

@ -3,7 +3,9 @@ package es.verdnatura.presentation.view.feature.sacador.adapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.R
import es.verdnatura.databinding.ItemCollectionRowNewBinding
import es.verdnatura.presentation.common.OnCollectionTicketSelectedListener
import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
@ -11,7 +13,7 @@ import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
class CollectionAdapterNew(
private val items: List<CollectionTicket>,
private val onCollectionTicketSelected: OnCollectionTicketSelectedListener,
private val type: String
private val type: String,
) : RecyclerView.Adapter<CollectionAdapterNew.AjustesItemHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AjustesItemHolder {
@ -28,6 +30,9 @@ class CollectionAdapterNew(
holder.binding.root.setOnClickListener {
onCollectionTicketSelected.onCollectionSelected(items[position], type)
}
holder.binding.itemImage.setOnClickListener {
onCollectionTicketSelected.onCollectionSelected(items[position], type, hasToAdd = true )
}
}
class AjustesItemHolder(
@ -39,6 +44,7 @@ class CollectionAdapterNew(
binding.apply {
if (item.ticketTotalCount == null || type == "PREITEMPICKERTEST") {
binding.totalTicketsId.visibility = View.GONE
binding.itemImage.setImageDrawable(ContextCompat.getDrawable(root.context, R.drawable.ic_add_black_24dp))
}
this.item = item
}