feat: refs #7920 shelvingFkMerge

This commit is contained in:
Sergio De la torre 2025-02-14 11:58:41 +01:00
parent aae791f721
commit 2295497e62
5 changed files with 64 additions and 32 deletions

View File

@ -50,6 +50,7 @@ import es.verdnatura.presentation.view.feature.login.model.OperatorSalix
import es.verdnatura.presentation.view.feature.login.model.RenewToken
import es.verdnatura.presentation.view.feature.login.model.VersionApp
import es.verdnatura.presentation.view.feature.login.model.WorkerData
import es.verdnatura.presentation.view.feature.packaging.model.DmsType
import es.verdnatura.presentation.view.feature.packaging.model.EntrySalix
import es.verdnatura.presentation.view.feature.packaging.model.ItemSupplier
import es.verdnatura.presentation.view.feature.packaging.model.NotificationQueue
@ -450,7 +451,7 @@ interface SalixService {
@GET("ItemShelvings/getAlternative")
fun itemShelvingAlternative(
@Query("shelvingFk") shelvingFk: String
@Query("shelvingCode") shelvingFk: String
): Call<ArrayList<Reubication>>
@GET("MobileAppVersionControls/getVersion")
@ -916,6 +917,11 @@ interface SalixService {
fun getWithPackaging(
): Call<List<Supplier>>
@GET("DmsTypes/findOne")
fun getDmsType(
@Query("filter") filter: String
): Call<DmsType>
@GET("Entries")
fun getEntriesFromSupplier(
@Query("filter") filter: String

View File

@ -181,9 +181,11 @@ class ReubicationCollectionFragment(
private fun customDialogMerge(itemReubication: Reubication) {
if (customDialogInputTwoValues.getValueTwo().isNotEmpty()) {
viewModel.itemShelvingMerge(
itemReubication.id, customDialogInputTwoValues.getValueTwo().uppercase()
viewModel.getMergeFromCode(
itemReubication.id,
customDialogInputTwoValues.getValueTwo().uppercase()
)
} else {
ma.messageWithSound(
getString(R.string.returnScan), isError = true, isPlayed = true, isToasted = true

View File

@ -56,6 +56,8 @@ class ReubicationFragment(var entrypoint: String) :
if (!binding.scanInput.text.isNullOrEmpty()) {
shelvingScaned = binding.scanInput.text.toString()
viewModel.itemShelvingAlternative(
shelvingFk = binding.scanInput.text.toString(),
)

View File

@ -476,15 +476,15 @@ class UbicadorFragment : BaseFragment<FragmentUbicadorBinding, UbicadorViewModel
private fun customDialogActionChange() {
//Tarea 7920
/* if (listItems.isNotEmpty()) {
viewModel.shelvingChangeSalix(
shelvingFk, customDialogInput.getValue()
)
} else {*/
viewModel.getShelvingFkFromCode(
listItems[0].shelvingFk, customDialogInput.getValue()
)
// }
if (listItems.isNotEmpty()) {
viewModel.getShelvingFkFromCode(
listItems[0].shelvingFk, customDialogInput.getValue()
)
} else {
getString(R.string.shelvingItems).toast(requireContext())
}
shelvingFk = customDialogInput.getValue()
customDialogInput.dismiss()
@ -1163,8 +1163,8 @@ class UbicadorFragment : BaseFragment<FragmentUbicadorBinding, UbicadorViewModel
}
).setOkButton(getString(R.string.delete)) {
if (!isAutoSelf) {
listItems.remove(item)
adapter!!.notifyItemRemoved(listItems.indexOf(item))
// listItems.remove(item)
//adapter!!.notifyItemRemoved(listItems.indexOf(item))
viewModel.itemShelvingDelete(
item.id
)

View File

@ -350,6 +350,26 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
})
}
fun getMergeFromCode(
vShelft: Int, shelvingCode: String
) {
salix.shelvingGetFromCode(
filter = """{"where":{"code":"$shelvingCode"}}"""
).enqueue(object : SalixCallback<ItemUbicador>(context) {
override fun onSuccess(response: Response<ItemUbicador>) {
val myItemCode = response.body().let { it as ItemUbicador }
itemShelvingMerge(
vShelft, myItemCode.id.toString()
)
}
})
}
fun itemShelvingMerge(
vShelf: Int, shelvingFk: String
@ -472,24 +492,6 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
})
}
fun shelvingChangeSalix(
shelvingFkIn: String, shelvingFkOut: String
) {
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)
}
})
}
//tarea 7920
fun shelvingChangeSalixNew(
shelvingFkIn: Number, shelvingFkOut: Number
@ -527,6 +529,26 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
})
}
fun itemShelvingAlternativeFromCode(
shelvingCode: String
) {
salix.shelvingGetFromCode(
filter = """{"where":{"code":"$shelvingCode"}}"""
).enqueue(object : SalixCallback<ItemUbicador>(context) {
override fun onSuccess(response: Response<ItemUbicador>) {
val myItemCode = response.body().let { it as ItemUbicador }
itemShelvingAlternative(
myItemCode.id.toString()
)
}
})
}
fun itemShelvingTransfer(
itemShelvingFk: Number, shelvingFk: String