refs #6672 feat: orderItem

This commit is contained in:
Sergio De la torre 2024-04-15 08:51:41 +02:00
parent 314a1d6f16
commit 50836956f8
1 changed files with 27 additions and 9 deletions

View File

@ -577,6 +577,14 @@ class UbicadorFragmentNew(
}
private fun setAdapter(listItems: MutableList<ItemUbicador>) {
listItems.sortWith { item1, item2 ->
val compareItem = item1.item.compareTo(item2.item)
if (compareItem == 0) {
item2.visible.compareTo(item1.visible) // Invertir el orden
} else {
compareItem
}
}
adapter = UbicadorAdapterNew(listItems.sortedBy { it.isChecked },
onPasillerosItemClickListener = pasillerosItemClickListener!!,
onVisibleClickListener = object : OnVisibleClickListenerNew {
@ -729,15 +737,25 @@ class UbicadorFragmentNew(
) {
if (itemUbicador?.id == null) {
try {
viewModel.itemShelvingAdd(
shelving = shelvingFk,
item = customDialogUbicador.getItemValue().toLong(),
quantity = customDialogUbicador.getVisibleValue().toIntOrNull()!!,
quantity = customDialogUbicador.getVisibleValue()
.toIntOrNull()!! / customDialogUbicador.getPackingValue().toIntOrNull()!!,
packing = customDialogUbicador.getPackingValue().toIntOrNull(),
warehouse = mobileApplication.dataStoreApp.readDataStoreKey(WAREHOUSEFK),
grouping = null
)
} catch (ex: Exception) {
ma.messageWithSound(
getString(R.string.reviewData),
isError = true,
isPlayed = true,
isToasted = true
)
}
} else {
viewModel.itemShelvingMakeEdit(
customDialogUbicador.getVisibleValue().toIntOrNull()!!,