diff --git a/app/src/main/java/es/verdnatura/domain/SalixService.kt b/app/src/main/java/es/verdnatura/domain/SalixService.kt index 8d590a68..f025d4a6 100644 --- a/app/src/main/java/es/verdnatura/domain/SalixService.kt +++ b/app/src/main/java/es/verdnatura/domain/SalixService.kt @@ -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> @GET("MobileAppVersionControls/getVersion") @@ -916,6 +917,11 @@ interface SalixService { fun getWithPackaging( ): Call> + @GET("DmsTypes/findOne") + fun getDmsType( + @Query("filter") filter: String + ): Call + @GET("Entries") fun getEntriesFromSupplier( @Query("filter") filter: String diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/claim/fragment/reubication/fragment/ReubicationCollectionFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/claim/fragment/reubication/fragment/ReubicationCollectionFragment.kt index 8ca0d62e..4c07c8fc 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/claim/fragment/reubication/fragment/ReubicationCollectionFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/claim/fragment/reubication/fragment/ReubicationCollectionFragment.kt @@ -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 diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/claim/fragment/reubication/fragment/ReubicationFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/claim/fragment/reubication/fragment/ReubicationFragment.kt index 7c566e80..36fad302 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/claim/fragment/reubication/fragment/ReubicationFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/claim/fragment/reubication/fragment/ReubicationFragment.kt @@ -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(), ) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt index bf57bee5..2427615e 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt @@ -476,15 +476,15 @@ class UbicadorFragment : BaseFragment(context) { + + override fun onSuccess(response: Response) { + 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(context) { - - override fun onSuccess(response: Response) { - _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(context) { + + override fun onSuccess(response: Response) { + val myItemCode = response.body().let { it as ItemUbicador } + + itemShelvingAlternative( + myItemCode.id.toString() + ) + + } + }) + } + fun itemShelvingTransfer( itemShelvingFk: Number, shelvingFk: String