feat ticketQr #refs 6602

This commit is contained in:
Sergio De la torre 2024-05-28 10:46:12 +02:00
parent d20f300a43
commit aa00a6343f
7 changed files with 247 additions and 239 deletions

View File

@ -8,39 +8,48 @@ import com.google.android.material.textfield.TextInputEditText
import es.verdnatura.R
import es.verdnatura.databinding.ComponentCustomEditDialogBinding
class CustomDialogInput(context: Context) : Dialog(context, R.style.DialogTheme) {
private var binding: ComponentCustomEditDialogBinding =
ComponentCustomEditDialogBinding.inflate(layoutInflater)
init {
setContentView(binding.root)
//setContentView(R.layout.component_custom_edit_dialog)
}
fun getEditText(): TextInputEditText {
return binding.customDialogValue
//return custom_dialog_value
}
fun getEditTextTwo(): TextInputEditText {
return binding.customDialogValueTwo
}
fun getValue(): String {
return binding.customDialogValue.text.toString()
//return custom_dialog_value.text.toString()
}
fun getValueTwo(): String {
return binding.customDialogValueTwo.text.toString()
}
fun setValue(value: String): CustomDialogInput {
binding.customDialogValue.setText(value)
binding.customDialogValue.visibility = View.VISIBLE
return this
}
fun setValueTwo(value: String): CustomDialogInput {
binding.customDialogValueTwo.setText(value)
binding.customDialogValueTwo.visibility = View.VISIBLE
// custom_dialog_value.setText(value)
// custom_dialog_value.visibility = View.VISIBLE
return this
}
@ -48,8 +57,6 @@ class CustomDialogInput(context: Context) : Dialog(context, R.style.DialogTheme)
binding.customDialogTitle.visibility = View.VISIBLE
binding.customDialogTitle.text = title
// custom_dialog_title.visibility = View.VISIBLE
// custom_dialog_title.text = title
return this
}
@ -58,8 +65,6 @@ class CustomDialogInput(context: Context) : Dialog(context, R.style.DialogTheme)
binding.customDialogDescription.visibility = View.VISIBLE
binding.customDialogDescription.text = description
/*custom_dialog_description.visibility = View.VISIBLE
custom_dialog_description.text = description*/
return this
}
@ -69,9 +74,6 @@ class CustomDialogInput(context: Context) : Dialog(context, R.style.DialogTheme)
binding.customDialogButtonOk.text = text
binding.customDialogButtonOk.setOnClickListener { onButtonClicked() }
/* custom_dialog_button_ok.visibility = View.VISIBLE
custom_dialog_button_ok.text = text
custom_dialog_button_ok.setOnClickListener { onButtonClicked() }*/
return this
}
@ -81,11 +83,6 @@ class CustomDialogInput(context: Context) : Dialog(context, R.style.DialogTheme)
binding.customDialogButtonKo.text = text
binding.customDialogButtonKo.setOnClickListener { onButtonClicked() }
// binding.customDialogButtonKo.setOnClickListener { dismiss() }
/*custom_dialog_button_ko.visibility = View.VISIBLE
custom_dialog_button_ko.text = text
custom_dialog_button_ko.setOnClickListener { onButtonClicked() }*/
return this
}

View File

@ -423,6 +423,7 @@ class CollectionFragment(
}
"buy" -> binding.scanInput.setText(myQr.more)
"ticket" -> findSale(myQr.id.toString())
}

View File

@ -72,8 +72,7 @@ import org.json.JSONObject
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
class CollectionFragmentPicker(
var collection: CollectionVO = CollectionVO(0),
var type: String = SACADOR
var collection: CollectionVO = CollectionVO(0), var type: String = SACADOR
) : BaseFragment<FragmentCollectionBinding, CollectionViewModel>(CollectionViewModel::class) {
private lateinit var dataMessageSalix: DataMessageSalix
@ -387,7 +386,10 @@ class CollectionFragmentPicker(
}
"buy" -> binding.scanInput.setText(myQr.more)
"ticket" -> {
binding.scanInput.setText(myQr.id)
findSale(binding.scanInput.text.toString())
}
}
} else {
@ -474,7 +476,8 @@ class CollectionFragmentPicker(
if (!goBack) {
ma.messageWithSound(
if (it.isError) it.errorMessage else getString(R.string.savedShelves),
it.isError, true
it.isError,
true
)
}
@ -485,7 +488,8 @@ class CollectionFragmentPicker(
ma.messageWithSound(
if (it.isError) it.errorMessage else getString(R.string.Aparcado),
it.isError, true
it.isError,
true
)
}
@ -497,8 +501,7 @@ class CollectionFragmentPicker(
if (it.isError) {
ma.messageWithSound(
it.errorMessage,
it.isError, true
it.errorMessage, it.isError, true
)
} else {
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(
@ -517,13 +520,11 @@ class CollectionFragmentPicker(
if (it.isError) {
ma.messageWithSound(
it.errorMessage,
it.isError, true
it.errorMessage, it.isError, true
)
} else {
ma.messageWithSound(
getString(R.string.splitOk),
it.isError, true
getString(R.string.splitOk), it.isError, true
)
//responseSaleMoveSuccesful()
}
@ -672,16 +673,13 @@ class CollectionFragmentPicker(
} else {
ma.messageWithSound(
getString(R.string.errorRegistered),
isError = false,
false
getString(R.string.errorRegistered), isError = false, false
)
goBack = true
}
}
})
/* responseSaleMove.observe(viewLifecycleOwner, Observer {
})/* responseSaleMove.observe(viewLifecycleOwner, Observer {
if (it.isError) {
ma.messageWithSound(it.errorMessage, isError = true, true)
@ -696,16 +694,14 @@ class CollectionFragmentPicker(
responseGetExtensionFromUserId.observe(viewLifecycleOwner, Observer {
if (it.isError) {
if (!goMistakeBack)
ma.messageWithSound(
getString(R.string.noSIP) + it.errorMessage + getString(R.string.user) + workerFkFromTicket,
isError = true,
true
)
if (!goMistakeBack) ma.messageWithSound(
getString(R.string.noSIP) + it.errorMessage + getString(R.string.user) + workerFkFromTicket,
isError = true,
true
)
} else {
if (!goMistakeBack)
callPicker(it.response)
if (!goMistakeBack) callPicker(it.response)
}
goMistakeBack = true
@ -715,8 +711,7 @@ class CollectionFragmentPicker(
mistakeList.observe(viewLifecycleOwner, Observer {
/*sergio:se quita y se pone esta comprobacion porque si no aparece de nuevo otra vez al volver atrás */
if (!goMistakeBack)
showMistakeList(it.list)
if (!goMistakeBack) showMistakeList(it.list)
goMistakeBack = true
})
//sergio: para si hay algun ticket por revisar antes de parkinear
@ -734,8 +729,7 @@ class CollectionFragmentPicker(
.setOkButton(getString(R.string.accept)) {
customDialog.dismiss()
}
.setKoButton(getString(R.string.review)) {
}.setKoButton(getString(R.string.review)) {
viewModel.collectionTicketGet(
it.response.toInt(),
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
@ -747,8 +741,7 @@ class CollectionFragmentPicker(
customDialog.show()
} else {
viewModel.setParking(
ticketFk = tickets[0].toInt(),
parking = ticketScanTxt
ticketFk = tickets[0].toInt(), parking = ticketScanTxt
)
}
// if (!goBack)navigateToCollectionList(it)
@ -893,8 +886,7 @@ class CollectionFragmentPicker(
private fun responseSaleMoveSuccesful() {
sales[positionCollectionSplit].quantity = quantityCollectionSplit
if (quantityCollectionSplit == 0)
markLine(positionCollectionSplit, type)
if (quantityCollectionSplit == 0) markLine(positionCollectionSplit, type)
saleAdapter!!.notifyDataSetChanged()
}
@ -938,17 +930,19 @@ class CollectionFragmentPicker(
ticket.sales.forEach { saleVO ->
if (type == SACADOR && saleVO.quantity != 0) {
salesList.add(saleVO)
if (tickets.firstOrNull { it == saleVO.ticketFk }.isNullOrEmpty())
tickets.add(saleVO.ticketFk)
if (tickets.firstOrNull { it == saleVO.ticketFk }.isNullOrEmpty()) tickets.add(
saleVO.ticketFk
)
} else if (type == CONTROLADOR) {
salesList.add(saleVO)
if (tickets.firstOrNull { it == saleVO.ticketFk }.isNullOrEmpty())
tickets.add(saleVO.ticketFk)
if (tickets.firstOrNull { it == saleVO.ticketFk }.isNullOrEmpty()) tickets.add(
saleVO.ticketFk
)
} else if (type == PRECHECKER) {
if (saleVO.saleGroupFk != "") {
salesList.add(saleVO)
if (tickets.firstOrNull { it == saleVO.ticketFk }.isNullOrEmpty())
tickets.add(saleVO.ticketFk)
if (tickets.firstOrNull { it == saleVO.ticketFk }
.isNullOrEmpty()) tickets.add(saleVO.ticketFk)
}
}
}
@ -966,85 +960,83 @@ class CollectionFragmentPicker(
}
saleAdapter =
SaleAdapter(
myGroupList,
pasillerosItemClickListener!!,
object : OnQuantityClickListener {
saleAdapter = SaleAdapter(myGroupList,
pasillerosItemClickListener!!,
object : OnQuantityClickListener {
override fun onQuantityClick(sale: SaleVO) {
override fun onQuantityClick(sale: SaleVO) {
sales.forEachIndexed { index, saleVO ->
if (saleVO.saleFk == sale.saleFk) {
if (type != "PRECHECKER") {
showQuantityDialog(index)
sales.forEachIndexed { index, saleVO ->
if (saleVO.saleFk == sale.saleFk) {
if (type != "PRECHECKER") {
showQuantityDialog(index)
}
}
}
}
},
object : OnSaleClickListener {
override fun onSaleClick(sale: SaleVO) {
sales.forEachIndexed { index, saleVO ->
if (saleVO.saleFk == sale.saleFk) {
if (type == CONTROLADOR || type == PRECHECKER) {// sergio:cuidado , esta es de lo último para marcar colores
isScanned = false
markLine(index, type)
/// Log.i("VERDNATURA:","marcamos linea")
} else if (type == SACADOR) {
if (sale.isPrepared == "0" || sale.isPrepared.isNullOrEmpty()) {
showScanner(index, sale)
} else {
unMarkLine(index, OK)
}
}
}
}
},
object : OnSaleClickListener {
override fun onSaleClick(sale: SaleVO) {
}
sales.forEachIndexed { index, saleVO ->
if (saleVO.saleFk == sale.saleFk) {
},
object : OnMistakeClickListener {
override fun onMistakeClickListener(sale: SaleVO) {
//Tarea #4969
viewModel.mistakeType()
mistakeSale = sale
goMistakeBack = false
if (type == CONTROLADOR || type == PRECHECKER) {// sergio:cuidado , esta es de lo último para marcar colores
isScanned = false
markLine(index, type)
/// Log.i("VERDNATURA:","marcamos linea")
} else if (type == SACADOR) {
}
},
object : onPackingClickListener {
override fun onPackingClick(sale: SaleVO) {
}
},
object : OnTicketClickListener {
override fun onTicketClickListener(sale: SaleVO) {
if (type == CONTROLADOR) {
//var ticketFk = sale.ticketFk
if (sale.isPrepared == "0" || sale.isPrepared.isNullOrEmpty()) {
showScanner(index, sale)
} else {
unMarkLine(index, OK)
}
}
}
}
}
},
object : OnMistakeClickListener {
override fun onMistakeClickListener(sale: SaleVO) {
//Tarea #4969
viewModel.mistakeType()
mistakeSale = sale
goMistakeBack = false
}
},
object : onPackingClickListener {
override fun onPackingClick(sale: SaleVO) {
}
},
object : OnTicketClickListener {
override fun onTicketClickListener(sale: SaleVO) {
if (type == CONTROLADOR) {
//var ticketFk = sale.ticketFk
var entryPoint = Gson().toJson(
mutableMapOf(
"entryPoint" to sale.ticketFk,
"web" to "${
mobileApplication.dataStoreApp.getServerSalix()
}/#!/ticket/${sale.ticketFk}/sale"
)
var entryPoint = Gson().toJson(
mutableMapOf(
"entryPoint" to sale.ticketFk, "web" to "${
mobileApplication.dataStoreApp.getServerSalix()
}/#!/ticket/${sale.ticketFk}/sale"
)
ma.onPasillerosItemClickListener(
PasillerosItemVO(
title = getString(R.string.titleWebViewer),
), entryPoint = entryPoint
)
}
)
ma.onPasillerosItemClickListener(
PasillerosItemVO(
title = getString(R.string.titleWebViewer),
), entryPoint = entryPoint
)
}
}, type = type
)
}
},
type = type
)
@ -1070,10 +1062,8 @@ class CollectionFragmentPicker(
//nuevo
setScrollListener(lm!!)
} else {
if (storedPosition != 0)
setListPosition(storedPosition, true)
else if (storedBackPosition != 0)
setListPosition(storedBackPosition, true)
if (storedPosition != 0) setListPosition(storedPosition, true)
else if (storedBackPosition != 0) setListPosition(storedBackPosition, true)
}
}
@ -1097,12 +1087,9 @@ class CollectionFragmentPicker(
ma.hideKeyboard(customDialogList.getEditText())
customDialogList.dismiss()
ma.onMyBackPressed()
}.setValue("")
.setOkButton(getString(R.string.print)) {
}.setValue("").setOkButton(getString(R.string.print)) {
print()
}
.show()
}.show()
customDialogList.getEditText().requestFocus()
ma.hideKeyboard(customDialogList.getEditText())
@ -1111,6 +1098,11 @@ class CollectionFragmentPicker(
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(), "ticket", "id"
).toString()
)
var foundTicketInCollection =
collection.tickets.find { it.ticketFk == customDialogList.getValue() }
@ -1127,10 +1119,7 @@ class CollectionFragmentPicker(
} catch (ex: Exception) {
ma.messageWithSound(
ex.message.toString(),
isError = true,
isPlayed = true,
isToasted = true
ex.message.toString(), isError = true, isPlayed = true, isToasted = true
)
//listSalesGroup.removeAt(0)
}
@ -1241,8 +1230,7 @@ class CollectionFragmentPicker(
if (tickets.size > 0) {
viewModel.setParking(
ticketFk = tickets[0].toInt(),
parking = txtscan
ticketFk = tickets[0].toInt(), parking = txtscan
)
}
@ -1310,9 +1298,7 @@ class CollectionFragmentPicker(
} catch (ex: Exception) {
ma.messageWithSound(
getString(R.string.error),
isError = false,
isPlayed = false
getString(R.string.error), isError = false, isPlayed = false
)
}
@ -1370,8 +1356,7 @@ class CollectionFragmentPicker(
if (txtscan.contains("-")) {
tickets.forEach {
viewModel.setParking(
ticketFk = it.toInt(),
parking = txtscan
ticketFk = it.toInt(), parking = txtscan
)
}
@ -1558,13 +1543,11 @@ class CollectionFragmentPicker(
private fun unMarkLine(position: Int, newType: String) {
state = 0
if ((sales[position].isPrepared == "1") || (sales[position].quantity!! > 0)) {
customDialog.setTitle(getString(R.string.unmarkLine))
.setDescription(
customDialog.setTitle(getString(R.string.unmarkLine)).setDescription(
getString(R.string.goUnmark) + sales[position].itemFk + getString(
R.string.sure
)
)
.setOkButton(getString(R.string.unmark)) {
).setOkButton(getString(R.string.unmark)) {
sales[position].isPrepared = "0"
sales[position].pickedQuantity = 0
@ -1606,8 +1589,7 @@ class CollectionFragmentPicker(
var quantityGet = 0
try {
quantityGet =
(sales[position].quantity!! - sales[position].pickedQuantity!!.toInt())
quantityGet = (sales[position].quantity!! - sales[position].pickedQuantity!!.toInt())
} catch (e: Exception) {
}
viewModel.itemPlacementSupplyAiming(
@ -1630,8 +1612,7 @@ class CollectionFragmentPicker(
if (!placementSupplyListVO.list.isEmpty()) {
var placement: PlacementSupplyVO? = null
placementSupplyListVO.list.forEach { placementVO ->
if (placementVO.stock != "0" && placement == null)
placement = placementVO
if (placementVO.stock != "0" && placement == null) placement = placementVO
}
if (placement != null) {
shelving = placement!!.shelving
@ -1644,8 +1625,7 @@ class CollectionFragmentPicker(
}
listPlacementSupply = ArrayList()
placementSupplyListVO.list.forEach {
if (it.stock != "0")
listPlacementSupply.add(BarcodeVO(code = it.proposal))
if (it.stock != "0") listPlacementSupply.add(BarcodeVO(code = it.proposal))
//////Log.i("VERDNATURA:","Array de placementsupply")
}
try {
@ -1658,13 +1638,10 @@ class CollectionFragmentPicker(
) {
if (customDialogList.getValueTwo().isNotEmpty()) {
isScanned = false
/*Tarea #5109*/
isScanned = false/*Tarea #5109*/
customDialogList.setValueTwo(
itemScanValue(
customDialogList.getValueTwo(),
"buy",
"more"
customDialogList.getValueTwo(), "buy", "more"
).toString()
)
@ -1718,8 +1695,7 @@ class CollectionFragmentPicker(
hideKeyboards()
customDialogList.dismiss()
}.setHintValue(getString(R.string.quantitySelect)).setValue(total)
.setHintValueTwo(getString(R.string.scanItem))
.setValueTwo("").show()
.setHintValueTwo(getString(R.string.scanItem)).setValueTwo("").show()
} catch (e: Exception) {
ma.messageWithSound(e.message.toString(), true, true)
}
@ -1750,9 +1726,7 @@ class CollectionFragmentPicker(
customDialogList.setValueTwo(
itemScanValue(
customDialogList.getValueTwo(),
"buy",
"more"
customDialogList.getValueTwo(), "buy", "more"
).toString()
)
@ -1813,22 +1787,20 @@ class CollectionFragmentPicker(
ma.messageWithSound(e.message.toString(), true, true)
}
placementSupplyAdapter =
BarcodeAdapter(
listPlacementSupply,
object : OnBarcodeRowClickListener {
override fun onBarcodeRowClickListener(item: BarcodeVO) {
placementSupplyListVO.list.forEach {
if (it.proposal == item.code) {
customDialogList.setValue(it.total)
total = it.total
itemShelvingFk = it.itemShelvingFk
}
placementSupplyAdapter = BarcodeAdapter(
listPlacementSupply, object : OnBarcodeRowClickListener {
override fun onBarcodeRowClickListener(item: BarcodeVO) {
placementSupplyListVO.list.forEach {
if (it.proposal == item.code) {
customDialogList.setValue(it.total)
total = it.total
itemShelvingFk = it.itemShelvingFk
}
}
}, showDelete = false
)
}
}, showDelete = false
)
customDialogList.getRecyclerView().adapter = placementSupplyAdapter
@ -1838,8 +1810,7 @@ class CollectionFragmentPicker(
}
private fun ReviewQuantityForRefreshingAndSorting(
quantityTotal: Int,
quantityPicked: Int
quantityTotal: Int, quantityPicked: Int
) {
if (quantityPicked < quantityTotal) {
@ -1858,8 +1829,7 @@ class CollectionFragmentPicker(
}
private fun setStoredPosition(isFromBack: Boolean) {
/* if (type == SACADOR) {
private fun setStoredPosition(isFromBack: Boolean) {/* if (type == SACADOR) {
for (indice in myGroupList.indices) {
if (myGroupList[indice].isPrepared == "0") {
@ -1880,12 +1850,10 @@ class CollectionFragmentPicker(
if (storedPosition >= 0 && sales.size > storedPosition) {
val saleToCheck = sales[storedPosition]
if (saleToCheck.itemFk.toString() == valueToCheck)
return true
if (saleToCheck.itemFk.toString() == valueToCheck) return true
else {
saleToCheck.barcodes.forEach { barcode ->
if (barcode == valueToCheck)
return true
if (barcode == valueToCheck) return true
}
}
}
@ -1898,8 +1866,7 @@ class CollectionFragmentPicker(
try {
val shelvingVisible =
sales[storedPosition].placements[storedShelvingPosition].visible.substring(
1,
sales[storedPosition].placements[storedShelvingPosition].visible.indexOf(")")
1, sales[storedPosition].placements[storedShelvingPosition].visible.indexOf(")")
)
if (quantity == 0) {
@ -1918,12 +1885,10 @@ class CollectionFragmentPicker(
try {
if (quantity == 0) {
sales[storedPosition].pickedQuantity =
(sales[storedPosition].pickedQuantity!! + customDialogList.getValue()
.toInt())
(sales[storedPosition].pickedQuantity!! + customDialogList.getValue().toInt())
} else {
sales[storedPosition].pickedQuantity =
(sales[storedPosition].pickedQuantity!! + quantity
.toInt())
(sales[storedPosition].pickedQuantity!! + quantity.toInt())
}
} catch (e: Exception) {
}
@ -2019,9 +1984,7 @@ class CollectionFragmentPicker(
try {
customDialogList.setValue(
itemScanValue(
customDialogList.getValue(),
"buy",
"more"
customDialogList.getValue(), "buy", "more"
).toString()
)
@ -2117,8 +2080,7 @@ class CollectionFragmentPicker(
totalMark += 1
}
} else if (type == CONTROLADOR) {
if ((it.isControlled == "1" || it.isControlled == "2") && !it.isParent)
totalMark += 1
if ((it.isControlled == "1" || it.isControlled == "2") && !it.isParent) totalMark += 1
}//Refactor #4030
else if (type == PRECHECKER) {
@ -2143,8 +2105,7 @@ class CollectionFragmentPicker(
getString(R.string.Coleccióncompleta).toast(this.context, Toast.LENGTH_SHORT)
saleAdapter!!.notifyDataSetChanged()
if (!goBack)
ticketCollection_setUsedShelves()
if (!goBack) ticketCollection_setUsedShelves()
goBack = false
if (canChangeState) changeTicketState()
@ -2162,8 +2123,7 @@ class CollectionFragmentPicker(
SECTORDESCRIP
).uppercase() != getString(
R.string.sectorALGEMESINEW
)
))
)))
) {
customDialogInput.setTitle(getString(R.string.shlevesNumber))
@ -2225,8 +2185,7 @@ class CollectionFragmentPicker(
//FALTAS / BASURA / SPLIT
private fun showQuantityDialog(position: Int) {
customDialogThreeButtons.setDescription(getString(R.string.itemSaleQuantity))
.setValue("")
customDialogThreeButtons.setDescription(getString(R.string.itemSaleQuantity)).setValue("")
.setOkButtonAdd(getString(R.string.Agregar)) {
@ -2254,8 +2213,7 @@ class CollectionFragmentPicker(
sales[positionCollectionMissing].quantity = quantityCollectionMissing
saleAdapter!!.notifyDataSetChanged()
if (quantityCollectionMissing == 0)
markLine(positionCollectionMissing, type)
if (quantityCollectionMissing == 0) markLine(positionCollectionMissing, type)
var totalQuantity: Int = 0
try {
@ -2297,8 +2255,7 @@ class CollectionFragmentPicker(
quantityIncrease = quantity
viewModel.collectionIncreaseQuantitySalix(
saleFk = sales[position].saleFk,
quantity = quantity.toString()
saleFk = sales[position].saleFk, quantity = quantity.toString()
)
}
@ -2308,15 +2265,13 @@ class CollectionFragmentPicker(
if (type == CONTROLADOR) {
tickets.forEach {
viewModel.ticketStateTodaySetState(
ticketFk = it.toInt(),
state = "CHECKED"
ticketFk = it.toInt(), state = "CHECKED"
)
}
} else if (type == SACADOR) {
tickets.forEach {
viewModel.ticketStateTodaySetState(
ticketFk = it.toInt(),
state = "PREPARED"
ticketFk = it.toInt(), state = "PREPARED"
)
}
////Refactor #4030
@ -2324,8 +2279,7 @@ class CollectionFragmentPicker(
} else if (type == PRECHECKER) {
tickets.forEach {
viewModel.ticketStateTodaySetState(
ticketFk = it.toInt(),
state = "PREVIOUS_CONTROLLED"
ticketFk = it.toInt(), state = "PREVIOUS_CONTROLLED"
)
}
}
@ -2337,19 +2291,13 @@ class CollectionFragmentPicker(
customDialogInput.setTitle("" + sale.itemFk)
.setDescription(getString(R.string.scanWagonForItem))
.setOkButton(getString(R.string.accept)) {
if (!customDialogInput.getValue()
.isNullOrEmpty()
) {
if (!customDialogInput.getValue().isNullOrEmpty()) {
//Tarea 5675
findSale(customDialogInput.getValue(), index)
} else {
ma.messageWithSound(
getString(R.string.shelvingError),
true,
true,
"Error",
true
getString(R.string.shelvingError), true, true, "Error", true
)
}
customDialogInput.setValue("")
@ -2398,8 +2346,7 @@ class CollectionFragmentPicker(
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)
collectionFk = collection.collectionFk, labelCount = (which + 1)
)
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(
PRINTERNAME
@ -2410,8 +2357,7 @@ class CollectionFragmentPicker(
dialog.show()
} else {
viewModel.collectionStickerPrint(
collectionFk = collection.collectionFk,
null
collectionFk = collection.collectionFk, null
)
}
@ -2427,8 +2373,7 @@ class CollectionFragmentPicker(
}
customDialogList.setTitle(getString(R.string.errorCause))
customDialogList.hideTextInput()
.setKoButton(getString(R.string.cancel)) {
customDialogList.hideTextInput().setKoButton(getString(R.string.cancel)) {
scanRequest()
hideKeyboards()
listPlacementSupply.clear()
@ -2444,8 +2389,7 @@ class CollectionFragmentPicker(
if (it.description == item.code) {
viewModel.saleMistakeAdd(
saleFk = mistakeSale?.saleFk!!,
typeFk = it.id
saleFk = mistakeSale?.saleFk!!, typeFk = it.id
)

View File

@ -24,6 +24,7 @@ import es.verdnatura.presentation.common.OnQuantityClickListener
import es.verdnatura.presentation.common.OnSaleClickListener
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
import es.verdnatura.presentation.common.hideKeyboard
import es.verdnatura.presentation.common.itemScanValue
import es.verdnatura.presentation.common.onPackingClickListener
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.collection.adapter.SaleAdapter
@ -169,8 +170,18 @@ class CollectionShowTicketFragment(
buttonPushedGetCollection = false
try {
viewModel.getSales(
binding.scanInput.text.toString().toInt(), print = "0", type
collectionFk = itemScanValue(
binding.scanInput.text.toString(), "ticket", "id"
).toString().toInt(),
print = "0",
source = type
)
println("qrTest2")
/* viewModel.getSales(
binding.scanInput.text.toString().toInt(), print = "0", type
)*/
} catch (ex: Exception) {
getString(R.string.scanLabelTicket).toast(requireContext())
}

View File

@ -9,6 +9,7 @@ import es.verdnatura.databinding.FragmentGeneralBlackBinding
import es.verdnatura.domain.ConstAndValues
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnCollectionSelectedListener
import es.verdnatura.presentation.common.itemScanValue
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionViewModel
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
@ -58,9 +59,35 @@ class ControladorFragment :
if (!binding.scanInput.text.isNullOrEmpty()) {
binding.scanInput.setText(textScanned_filterDouble(binding.scanInput.text!!.toString()))
try {
binding.scanInput.setText(
itemScanValue(
binding.scanInput.text.toString(), "ticket", "id"
).toString().toInt().toString(),
)
} catch (ex: Exception) {
ma.messageWithSound(
message = ex.message.toString(),
isError = true,
isPlayed = true
)
}
//Tarea 6458 descomentar si ok
collectionViewModel = CollectionViewModel(mobileApplication)
collectionViewModel!!.ticketState(binding.scanInput.text.toString().toInt())
try {
collectionViewModel!!.ticketState(
itemScanValue(
binding.scanInput.text.toString(), "ticket", "id"
).toString().toInt()
)
} catch (ex: Exception) {
ma.messageWithSound(
getString(R.string.errorInput),
isPlayed = true,
isError = true
)
}
collectionViewModel!!.responseTicketState.observe(
viewLifecycleOwner,
Observer { it ->
@ -77,12 +104,22 @@ class ControladorFragment :
)
.setOkButton(getString(R.string.aware)) {
customDialogWarning.dismiss()
viewModel.getSales(
collectionFk = binding.scanInput.text.toString()
.toInt(),
collectionFk = itemScanValue(
binding.scanInput.text.toString(), "ticket", "id"
).toString().toInt(),
print = false,
source = ConstAndValues.ON_CHECKING
)
println("Qrtest4")
/* viewModel.getSales(
collectionFk = binding.scanInput.text.toString()
.toInt(),
print = false,
source = ConstAndValues.ON_CHECKING
)*/
}.setKoButton(getString(R.string.cancel)) {
binding.scanInput.setText("")
binding.scanInput.requestFocus()
@ -91,10 +128,19 @@ class ControladorFragment :
customDialogWarning.currentFocus
} else {
viewModel.getSales(
collectionFk = binding.scanInput.text.toString().toInt(),
collectionFk = itemScanValue(
binding.scanInput.text.toString(), "ticket", "id"
).toString().toInt(),
print = false,
source = ConstAndValues.ON_CHECKING
)
println("Qrtest3")
/* viewModel.getSales(
collectionFk = binding.scanInput.text.toString().toInt(),
print = false,
source = ConstAndValues.ON_CHECKING
)*/
}
})

View File

@ -11,6 +11,7 @@ import es.verdnatura.databinding.FragmentShowTicketBinding
import es.verdnatura.domain.ConstAndValues
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnCollectionSelectedListener
import es.verdnatura.presentation.common.itemScanValue
import es.verdnatura.presentation.view.feature.sacador.adapter.TicketLastStateAdapter
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
import es.verdnatura.presentation.view.feature.sacador.model.TicketStateSalix
@ -82,14 +83,16 @@ class ShowTicketFragment(var menuOrigin: String) :
try {
//Tarea 6276
viewModel.getSales(
collectionFk = binding.scanInput.text.toString().toInt(),
viewModel.getSales(
collectionFk = itemScanValue(
binding.scanInput.text.toString(), "ticket", "id"
).toString().toInt(),
print = false,
source= type
source = type
)
} catch (ex: Exception) {
ma.messageWithSound(
getString(R.string.errorReviewItem),
true,
@ -138,7 +141,10 @@ class ShowTicketFragment(var menuOrigin: String) :
}
private fun navigateToCollectionList(collection: CollectionVO) {
if (collection.collectionFk != 0) onCollectionSelectedListener?.onCollectionSelected(collection, ConstAndValues.VERTICKET)
if (collection.collectionFk != 0) onCollectionSelectedListener?.onCollectionSelected(
collection,
ConstAndValues.VERTICKET
)
}
}

View File

@ -5,6 +5,7 @@ import android.view.inputmethod.EditorInfo
import es.verdnatura.R
import es.verdnatura.databinding.FragmentGeneralBlackBinding
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.itemScanValue
class TicketAdvanceFragment(var title: String) :
BaseFragment<FragmentGeneralBlackBinding, TicketViewModel>(
@ -40,7 +41,9 @@ class TicketAdvanceFragment(var title: String) :
try {
viewModel.ticketAdvancePackaging(
binding.scanInput.text.toString().toInt(),
itemScanValue(
binding.scanInput.text.toString(), "ticket", "id"
).toString().toInt(),
mobileApplication.userId!!
)
} catch (ex: Exception) {