feat: refs #6861 reservas
This commit is contained in:
parent
86af06b3ce
commit
3109611794
|
@ -7,8 +7,10 @@ import android.os.Bundle
|
|||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.text.InputType
|
||||
import android.util.Log.d
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import android.view.View.VISIBLE
|
||||
import android.view.WindowManager
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
|
@ -71,6 +73,7 @@ import org.json.JSONObject
|
|||
3-VERIFICAR COLECCIÓN
|
||||
4-IMPRIMIR
|
||||
5-EL SACADOR PUEDE MARCAR PREVIA, EL PRESACADOR NO.
|
||||
6-EL PRE marca los estados del saleGroup con OK PREVIOUS (26) y el SACADOR con PREPARED (14)
|
||||
|
||||
variables:
|
||||
isVerifiedCollection
|
||||
|
@ -107,6 +110,7 @@ class CollectionFragmentPickerPreviousNew(
|
|||
private lateinit var myGroupList: List<Sale>
|
||||
private var quantityReserveToCheckItemScan = 0
|
||||
private var isVerifiedCollection = false
|
||||
private var stateCodeId: Number? = null
|
||||
|
||||
companion object {
|
||||
fun newInstance(
|
||||
|
@ -133,19 +137,18 @@ class CollectionFragmentPickerPreviousNew(
|
|||
}
|
||||
|
||||
override fun init() {
|
||||
println("Sacando test")
|
||||
customDialogList = CustomDialogList(requireContext())
|
||||
customDialogInput = CustomDialogInput(requireContext())
|
||||
customDialog = CustomDialog(requireContext())
|
||||
customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
|
||||
customDialogThreeButtonsQuantity = CustomDialogThreeButtons(requireContext())
|
||||
ma.hideBottomNavigation(View.GONE)
|
||||
println("type $type")
|
||||
setEvents()
|
||||
setToolBar()
|
||||
viewModel.collectionTicketGetSalix(
|
||||
collection.collectionFk, print = false
|
||||
)
|
||||
viewModel.getStateId(if (type == PREITEMPICKERTEST) "OK PREVIOUS" else "PREPARED")
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
@ -334,7 +337,6 @@ class CollectionFragmentPickerPreviousNew(
|
|||
//lm!!.scrollToPositionWithOffset(storedBackPosition + 1, 0)
|
||||
setTotalLines()
|
||||
} else {
|
||||
println("updating")
|
||||
updateScreen()
|
||||
}
|
||||
}
|
||||
|
@ -350,6 +352,20 @@ class CollectionFragmentPickerPreviousNew(
|
|||
|
||||
}
|
||||
}
|
||||
loadResponseStateId.observe(viewLifecycleOwner) { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
stateCodeId = it
|
||||
}
|
||||
}
|
||||
loadResponseReserveAddPrevOK.observe(viewLifecycleOwner) { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
}
|
||||
}
|
||||
loadSetStateResponse.observe(viewLifecycleOwner) { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
// updateScreen()
|
||||
}
|
||||
}
|
||||
|
||||
loadResponseCode.observe(viewLifecycleOwner) { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
|
@ -493,21 +509,20 @@ class CollectionFragmentPickerPreviousNew(
|
|||
}
|
||||
|
||||
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)) {
|
||||
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()
|
||||
viewModel.itemShelvingSaleDeleteIsAdded(sale.itemShelvingSaleFk)
|
||||
scanRequest()
|
||||
customDialog.dismiss()
|
||||
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
scanRequest()
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
scanRequest()
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
|
||||
}
|
||||
|
||||
|
@ -539,11 +554,24 @@ class CollectionFragmentPickerPreviousNew(
|
|||
//Se busca la matricula en las lineas
|
||||
for (indice in myGroupList.indices) {
|
||||
//como cuando es presacador no hay parent no entrará
|
||||
if (myGroupList[indice].isParent && myGroupList[indice].saleGroupFk == txtscan.toInt()) {
|
||||
isFoundSale = true
|
||||
storedPosition = indice
|
||||
viewModel.itemShelvingSaleSetSaleGroup(txtscan.toInt())
|
||||
break
|
||||
try {
|
||||
if (myGroupList[indice].isParent && myGroupList[indice].saleGroupFk == txtscan.toInt() || (type == PREPARED && myGroupList[indice].saleGroupFk == txtscan.toInt())) {
|
||||
isFoundSale = true
|
||||
storedPosition = indice
|
||||
viewModel.itemShelvingSaleSetSaleGroup(txtscan.toInt())
|
||||
setStateSaleGroup(txtscan.toInt())
|
||||
myGroupList[indice].stateCode =
|
||||
if (myGroupList[indice].stateCode == "PREPARED") {
|
||||
"OK PREVIOUS"
|
||||
} else {
|
||||
"PREPARED"
|
||||
}
|
||||
saleAdapter!!.notifyDataSetChanged()
|
||||
break
|
||||
|
||||
}
|
||||
} catch (ex: Exception) {
|
||||
d("Verdnatura", "not find")
|
||||
}
|
||||
if (myGroupList[indice].isPicked != 1 && myGroupList[indice].code != null && myGroupList[indice].code!!.uppercase() == txtscan.uppercase()) {
|
||||
isFoundSale = true
|
||||
|
@ -562,6 +590,7 @@ class CollectionFragmentPickerPreviousNew(
|
|||
for (indice in sales.indices) {
|
||||
if (sales[indice].saleGroupFk != null && sales[indice].saleGroupFk == saleGroupScanned.toInt()) {
|
||||
viewModel.itemShelvingSaleSetSaleGroup(saleGroupScanned.toInt())
|
||||
setStateSaleGroup(saleGroupScanned.toInt())
|
||||
storedPosition = indice
|
||||
mpok!!.start()
|
||||
return true
|
||||
|
@ -808,15 +837,13 @@ class CollectionFragmentPickerPreviousNew(
|
|||
showQuestionUbicationEmpty(position, quantity)
|
||||
}.setOkButtonTwo(getString(R.string.no)) {
|
||||
scanRequest()
|
||||
customDialogThreeButtonsQuantity.dismiss()
|
||||
/* viewModel.itemShelvingSaleExists(
|
||||
customDialogThreeButtonsQuantity.dismiss()/* viewModel.itemShelvingSaleExists(
|
||||
myGroupList[position].itemShelvingSaleFk,
|
||||
myGroupList[position].itemShelvingFk,
|
||||
position,
|
||||
quantity
|
||||
)*/
|
||||
markLine(position, quantity, true)
|
||||
/* if (quantity == 0) {
|
||||
markLine(position, quantity, true)/* if (quantity == 0) {
|
||||
|
||||
/* viewModel.itemShelvingGet(
|
||||
myGroupList[position].itemShelvingFk,
|
||||
|
@ -925,8 +952,7 @@ class CollectionFragmentPickerPreviousNew(
|
|||
ticketSelected,
|
||||
saleGroupFk = if (type == PREPARED) null else collection.tickets.find { it.ticketFk == ticketSelected }?.sales?.get(
|
||||
0
|
||||
)?.saleGroupFk
|
||||
?: 0,
|
||||
)?.saleGroupFk ?: 0,
|
||||
sectorFk = if (type == PREPARED) null else mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
||||
SECTORFK
|
||||
)
|
||||
|
@ -952,6 +978,7 @@ class CollectionFragmentPickerPreviousNew(
|
|||
R.string.addItemQuantity, sale.itemFk
|
||||
)
|
||||
)
|
||||
customDialogThreeButtonsQuantity.setCustomDialogValue(VISIBLE)
|
||||
customDialogThreeButtonsQuantity.setOkButtonAdd(text = getString(R.string.add)) {
|
||||
ticketSelected = sale.ticketFk
|
||||
if (customDialogThreeButtonsQuantity.getValue().isNotEmpty()) {
|
||||
|
@ -961,8 +988,7 @@ class CollectionFragmentPickerPreviousNew(
|
|||
ticketSelected = sale.ticketFk,
|
||||
saleGroupFk = if (type == PREPARED) null else collection.tickets.find { it.ticketFk == ticketSelected }?.sales?.get(
|
||||
0
|
||||
)?.saleGroupFk
|
||||
?: 0,
|
||||
)?.saleGroupFk ?: 0,
|
||||
sectorFk = if (type == PREPARED) null else mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
||||
SECTORFK
|
||||
)
|
||||
|
@ -1003,8 +1029,6 @@ 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 ""
|
||||
|
@ -1019,17 +1043,34 @@ class CollectionFragmentPickerPreviousNew(
|
|||
ticketFk = it.toInt(), state = "PREPARED"
|
||||
)
|
||||
}
|
||||
//setStateSaleGroup()
|
||||
}
|
||||
|
||||
PREITEMPICKERTEST -> {
|
||||
//viewModel.saleTrackingAddPrevOK(collection.collectionFk)
|
||||
viewModel.saleTrackingSectorCollectionAddPrevOK(collection.collectionFk)
|
||||
viewModel.saleTrackingAddPrevOK(collection.collectionFk)
|
||||
//viewModel.saleTrackingSectorCollectionAddPrevOK(collection.collectionFk)
|
||||
val distinctSaleGroups = mutableSetOf<Int>()
|
||||
myGroupList.forEach { sale ->
|
||||
sale.saleGroupFk?.let {
|
||||
distinctSaleGroups.add(it)
|
||||
} ?: run {
|
||||
println("No hay salegroup")
|
||||
}
|
||||
}
|
||||
if (distinctSaleGroups.isNotEmpty())
|
||||
distinctSaleGroups.forEach { saleGroup ->
|
||||
setStateSaleGroup(saleGroup)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setStateSaleGroup(saleGroup: Number) {
|
||||
viewModel.saleGroupUpdateState(saleGroup, stateCodeId!!)
|
||||
}
|
||||
|
||||
private fun showScanner(index: Int, sale: Sale) {
|
||||
customDialogInput.getEditText().inputType = InputType.TYPE_CLASS_TEXT
|
||||
customDialogInput.setTitle("" + sale.itemFk)
|
||||
|
@ -1157,10 +1198,9 @@ class CollectionFragmentPickerPreviousNew(
|
|||
).toString()
|
||||
)
|
||||
|
||||
val foundTicketInCollection =
|
||||
collection.tickets.find {
|
||||
it.ticketFk == customDialogList.getValue().toInt()
|
||||
}
|
||||
val foundTicketInCollection = collection.tickets.find {
|
||||
it.ticketFk == customDialogList.getValue().toInt()
|
||||
}
|
||||
if (foundTicketInCollection != null) {
|
||||
isVerifiedCollection = true
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
|
@ -1217,17 +1257,14 @@ class CollectionFragmentPickerPreviousNew(
|
|||
}
|
||||
if (isTicket) {
|
||||
val labelDialogHelper = LabelDialogHelper(requireContext())
|
||||
labelDialogHelper.showLabelDialog(
|
||||
onItemSelected = { labelCount ->
|
||||
viewModel.collectionStickerPrint(
|
||||
collectionFk = collection.collectionFk,
|
||||
labelCount = labelCount
|
||||
)
|
||||
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
||||
PRINTERNAME
|
||||
)).toast(requireContext())
|
||||
}
|
||||
)
|
||||
labelDialogHelper.showLabelDialog(onItemSelected = { labelCount ->
|
||||
viewModel.collectionStickerPrint(
|
||||
collectionFk = collection.collectionFk, labelCount = labelCount
|
||||
)
|
||||
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
||||
PRINTERNAME
|
||||
)).toast(requireContext())
|
||||
})
|
||||
} else {
|
||||
viewModel.collectionStickerPrint(
|
||||
collectionFk = collection.collectionFk, null
|
||||
|
|
|
@ -70,7 +70,7 @@ class PreControladorFragment :
|
|||
"id"
|
||||
).toString().toInt(),
|
||||
print = false,
|
||||
source = type
|
||||
source = if (type == "PRECHECKER") "PREVIOUS_CONTROL" else type
|
||||
)
|
||||
} catch (ex: Exception) {
|
||||
getString(R.string.errorInput)
|
||||
|
|
|
@ -736,6 +736,7 @@
|
|||
<string name="imageToSend">Imágenes adjuntas:</string>
|
||||
<string name="addWorkForm">Añadir…</string>
|
||||
<string name="itemOlderInfo">¿Estás seguro que quieres %1$s? Tienes material más nuevo en la cámara.</string>
|
||||
<string name="itemsOlderInfo">¿Estás seguro de %1$s? Tienes ubicado material más viejo detrás de donde vas a %1$s.</string>
|
||||
<string name="quantityReviewed">Cantidad revisada a sumar/restar del total</string>
|
||||
<string name="deleteEntryReviewed">Borrar entrada</string>
|
||||
<string name="quantityToReview">Cantidad a revisar</string>
|
||||
|
@ -755,7 +756,7 @@
|
|||
<string name="editParking">Permite modificar los parkings seleccionados</string>
|
||||
<string name="resetParking">Resetea los parkings seleccionados</string>
|
||||
<string name="itemDiarySelected">Histórico : %1$s</string>
|
||||
<string name="titlePrePickerTest">Pre Sacador TEST</string>
|
||||
<string name="titlePrePickerTest">Pre Sacador</string>
|
||||
<string name="ticketWithoutWorker">Ticket sin trabajador asignado</string>
|
||||
<string name="reviewData">Revisa datos insertados</string>
|
||||
<string name="ticketNotes">Notas del ticket</string>
|
||||
|
@ -826,7 +827,7 @@
|
|||
<string name="selectHour">Seleccionar Hora</string>
|
||||
<string name="dateTime">%1$s %2$d:%3$d</string>
|
||||
<string name="lastChecking">VER ÚLTIMA REVISIÓN %1$s→%2$s</string>
|
||||
<string name="listItems">\nLista de ítems:\n</string>
|
||||
<string name="listItems">\nLista de artículos:\n</string>
|
||||
<string name="errorParking">No se ha encontrado parking</string>
|
||||
<string name="scanParkingTxt">Escanea parking</string>
|
||||
<string name="reviewBoxPicking">Revisar sacado por cajas</string>
|
||||
|
@ -912,6 +913,10 @@
|
|||
<string name="snack">Merienda</string>
|
||||
<string name="register">Registro:</string>
|
||||
<string name="titleShelvingHistNew">Histórico ítems del carro</string>
|
||||
<string name="ubicatorNew">ubicador nuevo</string>
|
||||
<string name="ubicatorNew">Ubicador</string>
|
||||
<string name="selectItemType">Seleccionar tipo de ítem</string>
|
||||
<string name="allText">Todos</string>
|
||||
<string name="ubicationItemNewer">\nTienes ubicado material más nuevo detrás de donde vas a PARKINEAR \n %1$s</string>
|
||||
<string name="ubicationItemOlder">\nTienes ubicado material más viejo delante de donde vas a PARKINEAR \n %1$s</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue