refs #6672 feat: orderItem
This commit is contained in:
parent
314a1d6f16
commit
50836956f8
|
@ -328,7 +328,7 @@ class UbicadorFragmentNew(
|
|||
}
|
||||
|
||||
binding.editImg.setOnClickListener {
|
||||
if (shelvingFk.isNotBlank()) {
|
||||
if (shelvingFk.isNotBlank()) {
|
||||
customDialogInput.setTitle(getString(R.string.changeShelving)).setValue("")
|
||||
.setOkButton(getString(R.string.save)) {
|
||||
if (customDialogInput.getValue().isNotBlank()) {
|
||||
|
@ -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) {
|
||||
viewModel.itemShelvingAdd(
|
||||
shelving = shelvingFk,
|
||||
item = customDialogUbicador.getItemValue().toLong(),
|
||||
quantity = customDialogUbicador.getVisibleValue().toIntOrNull()!!,
|
||||
packing = customDialogUbicador.getPackingValue().toIntOrNull(),
|
||||
warehouse = mobileApplication.dataStoreApp.readDataStoreKey(WAREHOUSEFK),
|
||||
grouping = null
|
||||
)
|
||||
try {
|
||||
|
||||
viewModel.itemShelvingAdd(
|
||||
shelving = shelvingFk,
|
||||
item = customDialogUbicador.getItemValue().toLong(),
|
||||
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()!!,
|
||||
|
|
Loading…
Reference in New Issue