feat: refs #7920 itemShelvingGet

This commit is contained in:
Sergio De la torre 2024-11-22 06:27:22 +01:00
parent d4ed3d3a92
commit c45d9f4f09
4 changed files with 67 additions and 12 deletions

View File

@ -707,10 +707,15 @@ interface SalixService {
): Call<List<ItemUbicador>>
@GET("Shelvings")
fun itemShelvingGet(
fun shelvingGet(
@Query("filter") filter: Any,
): Call<List<ItemUbicador>>
@GET("Shelvings/findOne")
fun shelvingGetFromCode(
@Query("filter") filter: Any,
): Call<ItemUbicador>
@POST("Applications/expedition_scan/execute-proc")
fun expeditionScan(
@Query("schema") schema: String = "srt",

View File

@ -426,10 +426,13 @@ class UbicadorFragmentNew : BaseFragment<FragmentUbicadorBinding, UbicadorViewMo
customDialogDelete.setTitle(getString(R.string.empty))
.setDescription(getString(R.string.operationNoReturn))
.setOkButton(getString(R.string.empty)) {
if (listItems.isNotEmpty()) {
viewModel.clearShelvingList(
//Tarea 7920
listItems[0].shelvingFk?.toString() ?: shelvingFk
)
}
viewModel.clearShelvingList(
shelvingFk
)
listItems.forEach {
it.stickers = 0
it.visible = 0
@ -467,9 +470,18 @@ class UbicadorFragmentNew : BaseFragment<FragmentUbicadorBinding, UbicadorViewMo
}
private fun customDialogActionChange() {
viewModel.shelvingChangeSalix(
shelvingFk, customDialogInput.getValue()
)
//Tarea 7920
if (listItems.isNotEmpty() && listItems[0].shelvingFk == null) {
viewModel.shelvingChangeSalix(
shelvingFk, customDialogInput.getValue()
)
} else {
viewModel.getShelvingFkFromCode(
listItems[0].shelvingFk!!,
customDialogInput.getValue()
)
}
shelvingFk = customDialogInput.getValue()
customDialogInput.dismiss()

View File

@ -87,7 +87,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
fun itemShelvingGet(
shelvingFk: String
) {
salix.itemShelvingGet(
salix.shelvingGet(
filter = """{
"fields":[
"priority",
@ -412,6 +412,42 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
})
}
//tarea 7920
fun shelvingChangeSalixNew(
shelvingFkIn: Number, shelvingFkOut: Number
) {
salix.itemShelvingsUpdate(
where = JsonObject().apply { addProperty("shelvingFk", shelvingFkIn) },
hashMapOf("shelvingFk" to shelvingFkOut)
).enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
_responseUbicator.value = true
super.onSuccess(response)
}
})
}
fun getShelvingFkFromCode(
shelvingFkIn: Number, codeOut: String
) {
salix.shelvingGetFromCode(
filter = """{"where":{"code":"$codeOut"}}"""
).enqueue(object : SalixCallback<ItemUbicador>(context) {
override fun onSuccess(response: Response<ItemUbicador>) {
val myItemCode = response.body().let { it as ItemUbicador }
shelvingChangeSalixNew(
shelvingFkIn = shelvingFkIn,
myItemCode.id.toLong()
)
}
})
}
fun itemShelvingTransfer(
itemFk: Int, shelvingFk: String

View File

@ -17,7 +17,8 @@ class ItemUbicadorVO(
var checked: Boolean = false,
var isNew: Boolean = false,
var isChecked: Int? = null,
var url: String = ""
var url: String = "",
var shelvingFk: Long? = null
)
class ItemUbicador(
@ -33,7 +34,7 @@ class ItemUbicador(
var available: Int? = null,
var code: String? = "",
var created: String? = null,
var shelvingFk: String? = null,
var shelvingFk: Long? = null,
var id: Int = 0,
var priority: Int = 0,
var isError: Boolean = false,
@ -43,8 +44,9 @@ class ItemUbicador(
var isChecked: Int? = null,
var url: String = "",
var units: Int = 0,
var buyFk: Long? = null
)
var buyFk: Long? = null,
)
class ItemEscanerVO(
var item: Long