feat: refs #7920 itemShelvingGet

This commit is contained in:
Sergio De la torre 2024-12-02 18:15:53 +01:00
parent a1c01d1154
commit f16bb64b49
2 changed files with 13 additions and 12 deletions

View File

@ -38,8 +38,6 @@ import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import org.json.JSONObject
import java.time.LocalDate
import java.time.format.DateTimeFormatter
class ItemCardFragment(
var itemFk: String = ""
@ -59,7 +57,7 @@ class ItemCardFragment(
private var quantityToDiscard = 0
private var itemInfoG: ItemCardVO? = null
private var positionToReturnY = 0
private var originalScan: String? = null
private var originalScan: Long? = null
private var buyToPrint: Long? = null
companion object {
@ -216,9 +214,9 @@ class ItemCardFragment(
try {
originalScan = itemScanValue(
binding.editItemFk.text.toString(), arrayOf("buy"), "more"
).toString()
).toString().toLong()
getItemCard(
originalScan!!
originalScan!!.toString()
)
} catch (ex: Exception) {
ma.messageWithSound(ex.message.toString(), isError = true, isPlayed = true)
@ -268,13 +266,11 @@ class ItemCardFragment(
binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE
// Tarea 7266
if (originalScan == null || it.id == originalScan!!.toInt()) {
viewModel.buyUltimate(
viewModel.buyGetLastWithoutInventory(
itemFk = it.id,
warehouseFk = mobileApplication.dataStoreApp.readDataStoreKey(
WAREHOUSEFK
),
dated = LocalDate.now()
.format(DateTimeFormatter.ofPattern("yyyy-dd-MM"))
)
)
} else {
buyToPrint = originalScan!!.toLong()

View File

@ -239,10 +239,15 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
})
}
fun buyUltimate(
itemFk: Int, warehouseFk: Int, dated: String
fun buyGetLastWithoutInventory(
itemFk: Int, warehouseFk: Int,
) {
salix.buyUltimate(params = arrayListOf(itemFk, warehouseFk, dated).formatWithQuotes())
salix.buyGetLastWithoutInventory(
params = arrayListOf(
itemFk,
warehouseFk
).formatWithQuotes()
)
.enqueue(object : SalixCallback<Long>(context) {
override fun onSuccess(response: Response<Long>) {
_buyUltimateResponse.value = response.body()