Version 9.8Beta. Borrados UserCase y uso de SilexCallBack
This commit is contained in:
parent
2469e2e368
commit
e52d7cb7e8
|
@ -44,8 +44,8 @@
|
|||
</shared>
|
||||
</component>
|
||||
<component name="AndroidLogFilters">
|
||||
<option name="TOOL_WINDOW_CUSTOM_FILTER" value="verdnatura" />
|
||||
<option name="TOOL_WINDOW_LOG_LEVEL" value="error" />
|
||||
<option name="TOOL_WINDOW_CUSTOM_FILTER" value="verdnatura:" />
|
||||
<option name="TOOL_WINDOW_LOG_LEVEL" value="debug" />
|
||||
<option name="TOOL_WINDOW_CONFIGURED_FILTER" value="No Filters" />
|
||||
<option name="TOOL_WINDOW_REGEXP_FILTER" value="false" />
|
||||
</component>
|
||||
|
@ -83,9 +83,60 @@
|
|||
</select>
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="Version 9.6Beta.Modificadas llamadas y fallo en checkItemScan">
|
||||
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="Version 9.7Beta. Versiones en servidor">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/app/build.gradle" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/AndroidManifest.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/AndroidManifest.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetAjustesUserCase.kt" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetBuscarItemAllUserCase.kt" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetBuscarItemUserCase.kt" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetClaimUserCase.kt" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetDayOfSaleUSerCase.kt" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetInventaryUserCase.kt" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetItemCardUserCase.kt" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetPaletizadoresUserCase.kt" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetPreControladorUserCase.kt" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetPreSacadorUseCase.kt" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetQualityUserCase.kt" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetShelvingParkingUserCase.kt" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetVehicleControlTimeUserCase.kt" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetWokerMistakeUSerCase.kt" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SalixService.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SalixService.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/itemShelvingLogUSerCase.kt" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/testing/testPrint.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/testing/testPrint.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapter.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapter.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/packaging/fragment/PackagingViewModel/SupplierViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/packaging/fragment/PackagingViewModel/SupplierViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/CmrExpeditionPalletFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/CmrExpeditionPalletFragment.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/CmrExpeditionPalletViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/CmrExpeditionPalletViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanSorterFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanSorterFragment.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanSorterViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanSorterViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionStateViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionStateViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionTruckListViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionTruckListViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/PalletScanViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/PalletScanViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/parking/fragment/ParkingViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/parking/fragment/ParkingViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/parkingSale/fragment/ParkingViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/parkingSale/fragment/ParkingViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/precontrol/PreControladorViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/precontrol/PreControladorViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/qr/QrFragmentViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/qr/QrFragmentViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/fragment/ReposicionViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/fragment/ReposicionViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/shelvingparking/fragment/ShelvingParkingFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/shelvingparking/fragment/ShelvingParkingFragment.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/shelvingparking/fragment/ShelvingParkingViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/shelvingparking/fragment/ShelvingParkingViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/transferencia/fragment/TransferenciaViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/transferencia/fragment/TransferenciaViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -253,7 +304,7 @@
|
|||
<property name="cidr.known.project.marker" value="true" />
|
||||
<property name="com.developerphil.adbidea.selecteddevices" value="21114523025303" />
|
||||
<property name="last_directory_selection" value="$PROJECT_DIR$/app/src/main/res/drawable" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/app/src/main/res/drawable" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/../Rocket.Chat.Android" />
|
||||
<property name="multi-representation-previewC:/Users/sergiodt/.gradle/caches/modules-2/files-2.1/androidx.recyclerview/recyclerview/1.0.0/2151d26c3b241f0a887f2dadb9ab091649fcf020/recyclerview-1.0.0-sources.jar!/androidx/recyclerview/widget/RecyclerView.java_selected" value="Custom views" />
|
||||
<property name="multi-representation-previewC:/Users/sergiodt/AppData/Local/Android/Sdk/sources/android-29/android/view/View.java_selected" value="Custom views" />
|
||||
<property name="multi-representation-previewC:/Users/sergiodt/AppData/Local/Android/Sdk/sources/android-29/android/widget/TextView.java_selected" value="Custom views" />
|
||||
|
|
|
@ -13,11 +13,12 @@ android {
|
|||
applicationId "es.verdnatura"
|
||||
minSdkVersion 24 //21
|
||||
targetSdkVersion 30
|
||||
versionCode 144
|
||||
versionCode 148
|
||||
//versionName = "9.4" versionCode 143
|
||||
//versionName = "9.5Beta" versionCode 143
|
||||
versionName = "9.6Beta"
|
||||
|
||||
//versionName = "9.6Beta" version 144
|
||||
//versionName = "9.7Beta" version 145
|
||||
versionName = "9.8Beta"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||
<uses-permission android:name="android.permission.PREVENT_POWER_KEY" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.LAUNCH_APPS" />
|
||||
<!--
|
||||
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import es.verdnatura.presentation.view.feature.ajustes.model.Printers
|
||||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||
import es.verdnatura.presentation.view.feature.ajustes.model.Train
|
||||
import retrofit2.Call
|
||||
|
||||
class GetAjustesUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun getSectors(): Call<List<SectorItemVO>> {
|
||||
return restClient!!.getSectors()
|
||||
}
|
||||
|
||||
fun getSectorsSalix(): Call<List<SectorItemVO>> {
|
||||
return salixClient!!.getSectorsSalix(
|
||||
)
|
||||
}
|
||||
|
||||
fun worker_updateSector(sectorFk: String): Call<Unit> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(sectorFk)
|
||||
return restClient!!.worker_updateSector(
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun operator_updateItemPackingType(
|
||||
itemPackingTypeFk: String
|
||||
): Call<Unit> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemPackingTypeFk)
|
||||
return restClient!!.operator_updateItemPackingType(
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun worker_updatePrinter(labelerFk: String): Call<Unit> {
|
||||
|
||||
return restClient!!.worker_updatePrinter(
|
||||
labelerFk
|
||||
)
|
||||
}
|
||||
|
||||
fun printer_get(): Call<List<Printers>> {
|
||||
return restClient!!.printer_get()
|
||||
}
|
||||
|
||||
fun train_get(): Call<List<Train>> {
|
||||
return restClient!!.train_get()
|
||||
}
|
||||
|
||||
fun operator_getTrain(): Call<String?> {
|
||||
return restClient!!.operator_getTrain()
|
||||
}
|
||||
|
||||
fun operator_getItemPackingType(): Call<String?> {
|
||||
return restClient!!.operator_getItemPackingType()
|
||||
}
|
||||
|
||||
fun worker_isF11Allowed(): Call<Boolean> {
|
||||
return restClient!!.worker_isF11Allowed()
|
||||
}
|
||||
fun operator_updateTrain( trainFk: String): Call<Unit> {
|
||||
return restClient!!.operator_updateTrain(
|
||||
trainFk
|
||||
)
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
//import es.verdnatura.presentation.view.feature.buscaritemall.model.ItemLocationAll
|
||||
import retrofit2.Call
|
||||
|
||||
class GetBuscarItemAllUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
/* fun searchItemsUbicadorAll(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String
|
||||
): Call<List<ItemLocationAll>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
return restClient!!.searchItemsUbicadorAll(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params
|
||||
)
|
||||
}*/
|
||||
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
|
||||
import retrofit2.Call
|
||||
|
||||
class GetBuscarItemUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun searchItemsUbicador(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String
|
||||
): Call<List<ItemLocationVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
return restClient!!.searchItemsUbicador(
|
||||
)
|
||||
}
|
||||
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import retrofit2.Call
|
||||
|
||||
class GetClaimUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun itemShelving_addByClaim(usuario: String, password: String,claimFK:String, shelvingFk: String): Call<Void> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(claimFK)
|
||||
params.add(shelvingFk)
|
||||
return restClient!!.itemShelving_addByClaim(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import es.verdnatura.presentation.view.feature.diadeventa.model.ItemShelvingSaleDate
|
||||
import retrofit2.Call
|
||||
|
||||
class GetDayOfSaleUSerCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun itemShelving_getSaleDate(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vShelvingFk: String
|
||||
): Call<List<ItemShelvingSaleDate>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vShelvingFk)
|
||||
return restClient!!.itemShelving_getSaleDate(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
//mirar abans el fragment Parking per a llevar el paramssdl
|
||||
|
||||
fun shelvingPark(
|
||||
shelving: String,
|
||||
parking: String
|
||||
): Call<Any> {
|
||||
return restClient!!.shelvingPark(shelving,parking)
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
|
||||
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
|
||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
||||
import retrofit2.Call
|
||||
|
||||
class GetInventaryUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun itemShelvingRadarFilterBuyer(
|
||||
buyerFk: Int,
|
||||
warehouseFk: Int
|
||||
): Call<List<ItemInventaryVO>> {
|
||||
val params: ArrayList<Int> = ArrayList()
|
||||
params.add(buyerFk)
|
||||
params.add(warehouseFk)
|
||||
return restClient!!.itemShelvingRadarFilterBuyer(
|
||||
buyerFk, warehouseFk
|
||||
)
|
||||
}
|
||||
|
||||
fun faultsReview(
|
||||
usuario: String,
|
||||
password: String,
|
||||
warehouseFk: String
|
||||
): Call<List<ItemFaltasVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(warehouseFk)
|
||||
return restClient!!.faultsReview(
|
||||
/* "json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params*/
|
||||
)
|
||||
}
|
||||
|
||||
fun faultsReview_isChecked(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String,
|
||||
warehouseFk: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(warehouseFk)
|
||||
return restClient!!.faultsReview_isChecked(
|
||||
/* "json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params*/
|
||||
)
|
||||
}
|
||||
|
||||
fun itemShelvingBuyerGet(): Call<List<BuyerVO>> {
|
||||
return restClient!!.itemShelvingBuyerGet()
|
||||
}
|
||||
|
||||
}
|
|
@ -1,230 +0,0 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import es.verdnatura.presentation.common.itemBarCodeSalix
|
||||
import es.verdnatura.presentation.common.itemPackingTypeSalix
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemProposal
|
||||
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO
|
||||
import retrofit2.Call
|
||||
|
||||
class GetItemCardUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun getItemCard(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String,
|
||||
warehouseFk: Int
|
||||
): Call<ItemCardVO> {
|
||||
val params: ArrayList<Any> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(warehouseFk)
|
||||
return restClient!!.getItemCard(
|
||||
/* "json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params*/
|
||||
)
|
||||
}
|
||||
|
||||
/* fun item_getSimilar(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String,
|
||||
warehouseFk: String,
|
||||
vshipped: String,
|
||||
vIsShowedByType: String
|
||||
): Call<List<ItemProposal>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(warehouseFk)
|
||||
params.add(vshipped)
|
||||
params.add(vIsShowedByType)
|
||||
|
||||
return restClient!!.item_getSimilar(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params
|
||||
)
|
||||
}*/
|
||||
|
||||
fun getItemPackingType(usuario: String, password: String): Call<List<ItemPackingType>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
return restClient!!.getItemPackingType(
|
||||
/* "json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params*/
|
||||
)
|
||||
}
|
||||
|
||||
fun getItemPackingTypeSalix(): Call<List<ItemPackingType>> {
|
||||
return salixClient!!.get_ItemPackingType(
|
||||
)
|
||||
}
|
||||
|
||||
fun itemStockUpdate(
|
||||
itemFk: String,
|
||||
warehouseFk: String,
|
||||
newVisible: String,
|
||||
isTrash: String
|
||||
): Call<Any> {
|
||||
|
||||
//sergio: se modifica por CAU a itemTrash// Faltas también accede a itemStockUpdate)
|
||||
|
||||
//return restClient!!.itemStockUpdate("json","1",usuario,password,"application/json",params = params)
|
||||
return restClient!!.itemTrash(itemFk,warehouseFk,newVisible,isTrash
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
fun itemTrash(
|
||||
itemFk: Int,
|
||||
warehouseFk: Int,
|
||||
newVisible: Int,
|
||||
isTrash: Boolean
|
||||
): Call<Any> {
|
||||
return restClient!!.itemTrash(itemFk,warehouseFk,newVisible,isTrash)
|
||||
}
|
||||
|
||||
fun updateGrouping(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: Int,
|
||||
value: Int,
|
||||
warehouseFk: Int
|
||||
): Call<Any> {
|
||||
val params: ArrayList<Int> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(value)
|
||||
params.add(warehouseFk)
|
||||
return restClient!!.updateGrouping(
|
||||
/* "json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params*/
|
||||
)
|
||||
}
|
||||
|
||||
fun updatePacking(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: Int,
|
||||
value: Int,
|
||||
warehouseFk: Int
|
||||
): Call<Any> {
|
||||
val params: ArrayList<Any> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(value)
|
||||
params.add(warehouseFk)
|
||||
return restClient!!.updatePacking(
|
||||
/* "json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params*/
|
||||
)
|
||||
}
|
||||
|
||||
fun updatePackingTypeSalix(
|
||||
itemFk: String,
|
||||
ItemPackingType: String
|
||||
): Call<Any> {
|
||||
return salixClient!!.update_ItemPackingType(
|
||||
itemFk = itemFk,
|
||||
params = itemPackingTypeSalix(ItemPackingType)
|
||||
)
|
||||
}
|
||||
|
||||
fun item_saveStems(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: Int,
|
||||
value: Int
|
||||
): Call<Any> {
|
||||
val params: ArrayList<Int> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(value)
|
||||
return restClient!!.item_saveStems(
|
||||
/* "json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params*/
|
||||
)
|
||||
}
|
||||
|
||||
fun item_saveReference(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: Int,
|
||||
value: Int
|
||||
): Call<Any> {
|
||||
val params: ArrayList<Int> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(value)
|
||||
return restClient!!.item_saveReference(
|
||||
/* "json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params*/
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
fun barcodes_edit(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String,
|
||||
value: String,
|
||||
delete: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(value)
|
||||
params.add(itemFk)
|
||||
params.add(delete)
|
||||
return restClient!!.barcodes_edit(
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
fun barcodes_editSalix(
|
||||
itemFk: Int,
|
||||
value: String,
|
||||
|
||||
): Call<Any> {
|
||||
|
||||
return salixClient!!.barcodes_edit(
|
||||
|
||||
itemBarCodeSalix(itemFk, value)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
fun itemDiary(
|
||||
itemFk: String,
|
||||
warehouseFk: String
|
||||
): Call<List<ItemHistoricoVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(warehouseFk)
|
||||
return restClient!!.itemDiary(
|
||||
params
|
||||
)
|
||||
}
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import es.verdnatura.presentation.view.feature.ajustes.model.Printers
|
||||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||
import es.verdnatura.presentation.view.feature.login.model.*
|
||||
import retrofit2.Call
|
||||
|
||||
class GetLoginUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun device_checkLogin(
|
||||
usuario: String,
|
||||
android_id: String
|
||||
): Call<LoginDevice> {
|
||||
return restClient!!.device_checkLogin(
|
||||
usuario, android_id
|
||||
)
|
||||
}
|
||||
|
||||
fun deviceLog_add(
|
||||
app: String,
|
||||
versionApp: String,
|
||||
android_id: String
|
||||
): Call<Void> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(app)
|
||||
params.add(versionApp)
|
||||
params.add(android_id)
|
||||
return restClient!!.deviceLog_add(
|
||||
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun salixLogin(usuario: String, password: String): Call<LoginSalixVO> {
|
||||
return salixClient!!.login("application/json", LoginSalixVO(usuario, password))
|
||||
}
|
||||
//NODEJS TEST
|
||||
|
||||
/*fun nodeJsTest(
|
||||
smarttag: String,
|
||||
wagon: String,
|
||||
shelving: String
|
||||
): Call<NodeJsService.SmartTagNode>
|
||||
{
|
||||
//https://smart-tag.verdnatura.es/bindShelving/A0A3B8224DBF&ABC&1
|
||||
return nodejsClient!!.bindShelving("application/json", "A0A3B8224DBF", "AAA", "1")
|
||||
// return nodejsClient!!.bindShelving("application/json", NodeJsService.SmartTagNode(smarttag, wagon, shelving),"A0A3B8224DBF","ABC","2")
|
||||
|
||||
}*/
|
||||
// SALIX SERGIO MENSAJE : PARA NO ENVIAR MENSAJES A COMERCIALES PONGO QUE LAS MODIFICACIONES SE ENVIAN AL CANAL CREADO.
|
||||
// SE CAMBIA VARIABLE A TRUE/FALSE
|
||||
|
||||
|
||||
fun sendChekingPresence(token: String, workerId: Int, message: String): Call<Boolean> {
|
||||
|
||||
var working_in_test = false // Enviar a grupo test Android o a los usuarios
|
||||
if (!working_in_test) {
|
||||
|
||||
return salixClient.sendChekingPresence(
|
||||
params = SalixMessageVO(workerId = workerId, message = message)
|
||||
)
|
||||
} else {
|
||||
|
||||
return salixClientSend.sendGroup(
|
||||
params = SalixGrupo(to = "#android-test", message = message)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*fun sendChekingPresence(token: String, workerId: Int, message: String): Call<Boolean>
|
||||
{
|
||||
return salixClient!!.sendGroup(
|
||||
content_type = "application/json",
|
||||
authorization = token,
|
||||
params = SalixGrupo(to = "#android-test", message = message)
|
||||
)
|
||||
}*/
|
||||
|
||||
fun checkVersion(nameApp: String): Call<versionApp> {
|
||||
return restClient!!.getVersion(nameApp)
|
||||
}
|
||||
|
||||
fun worker_getSector(usuario: String, password: String): Call<SectorItemVO> {
|
||||
|
||||
|
||||
return restClient!!.worker_getSector("json", "1", usuario, password, "application/json")
|
||||
}
|
||||
|
||||
fun operator_getNumberOfWagons(): Call<Int?> {
|
||||
return restClient!!.operator_getNumberOfWagons(
|
||||
)
|
||||
}
|
||||
|
||||
/*fun operator_add(usuario: String, password: String): Call<Any> {
|
||||
|
||||
return restClient!!.operator_add("json", "1", usuario, password, "application/json")
|
||||
}*/
|
||||
|
||||
fun worker_getPrinter(usuario: String, password: String): Call<List<Printers>> {
|
||||
|
||||
return restClient!!.worker_getPrinter("json", "1", usuario, password, "application/json")
|
||||
}
|
||||
}
|
|
@ -1,329 +0,0 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import com.google.gson.JsonObject
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.*
|
||||
import retrofit2.Call
|
||||
|
||||
class GetPaletizadoresUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
//buffer
|
||||
fun buffer_setTypeByName(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vBufferFk: Int,
|
||||
vType: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<Any> = ArrayList()
|
||||
params.add(vBufferFk)
|
||||
params.add(vType)
|
||||
return restClient!!.buffer_setTypeByName(
|
||||
/* "json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params*/
|
||||
)
|
||||
}
|
||||
|
||||
//expeditionScan opciones paletizadores
|
||||
fun expedition_scan(usuario: String, password: String, vExpeditionId: String): Call<Void> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vExpeditionId)
|
||||
return restClient!!.expedition_scan(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
//informar cmr paletizadores
|
||||
fun cmrExpeditionPallet_add(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vExpeditionPallet: Int,
|
||||
vCmrId: Int
|
||||
): Call<Void> {
|
||||
val params: ArrayList<Int> = ArrayList()
|
||||
params.add(vExpeditionPallet)
|
||||
params.add(vCmrId)
|
||||
|
||||
return restClient!!.cmrExpeditionPallet_add(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
//expedition
|
||||
|
||||
fun expedition_getState(
|
||||
usuario: String,
|
||||
password: String,
|
||||
expeditionFk: String
|
||||
): Call<itemExpedetionState> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(expeditionFk)
|
||||
return restClient!!.expedition_getState(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params
|
||||
)
|
||||
}
|
||||
|
||||
fun expedition_getStateJSON(
|
||||
expeditionFk: String
|
||||
): Call<JsonObject> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(expeditionFk)
|
||||
return restClient!!.expedition_getStateJSON(
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
fun expeditionTruckList(usuario: String, password: String): Call<List<ItemExpeditionTruckVO>> {
|
||||
// val params: ArrayList<String> = ArrayList()
|
||||
return restClient!!.expeditionTruckList()
|
||||
}
|
||||
|
||||
fun expeditionTruckAdd(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vHour: String,
|
||||
vDescription: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vHour)
|
||||
params.add(vDescription)
|
||||
// //////Log.i("VERDNATURA:"," La hora es $vHour y descrip $vDescription")
|
||||
return restClient!!.expeditionTruckAdd(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun expeditionPallet_List(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vTruckFk: String
|
||||
): Call<List<ItemPalletVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vTruckFk)
|
||||
return restClient!!.expeditionPallet_List(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun expeditionScanAdd(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vPalletFk: String,
|
||||
vTruckFk: String
|
||||
): Call<List<ItemScanVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vPalletFk)
|
||||
params.add(vTruckFk)
|
||||
return restClient!!.expeditionScanAdd(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun expeditionScanPut(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vPalletFk: String,
|
||||
vExpeditionFk: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vPalletFk)
|
||||
params.add(vExpeditionFk)
|
||||
return restClient!!.expeditionScanPut(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun checkRouteExpeditionScanPut(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vPalletFk: String,
|
||||
vExpeditionFk: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vPalletFk)
|
||||
params.add(vExpeditionFk)
|
||||
return restClient!!.checkRouteExpeditionScanPut(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun expeditionPalletView(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vPalletFk: String
|
||||
): Call<List<ItemPalletViewVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vPalletFk)
|
||||
return restClient!!.expeditionPalletView(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun expeditionPalletDel(usuario: String, password: String, vPalletFk: String): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vPalletFk)
|
||||
return restClient!!.expeditionPalletDel(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun expeditionScanList(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vPalletFk: String
|
||||
): Call<List<ItemExpeditionScanVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vPalletFk)
|
||||
return restClient!!.expeditionScanList(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun expeditionScanDel(usuario: String, password: String, vScanFk: String): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vScanFk)
|
||||
return restClient!!.expeditionScanDel(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun expeditionPalletPrintSet(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vPalletFk: String,
|
||||
vSectorFk: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vPalletFk)
|
||||
params.add(vSectorFk)
|
||||
return restClient!!.expeditionPalletPrintSet(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun expeditionPallet_get(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vPalletFk: String
|
||||
|
||||
): Call<ItemExpeditionTruckVO> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vPalletFk)
|
||||
|
||||
return restClient!!.expeditionPallet_get(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun expeditionState_addByPallet(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vPalletFk: String,
|
||||
vStateCode: String
|
||||
|
||||
|
||||
): Call<Unit> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vPalletFk)
|
||||
params.add(vStateCode)
|
||||
|
||||
return restClient!!.expeditionState_addByPallet(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
fun expeditionLoading_add(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vExpeditionFk: String,
|
||||
vBufferFk: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vExpeditionFk)
|
||||
params.add(vBufferFk)
|
||||
return restClient!!.expeditionLoading_add(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import retrofit2.Call
|
||||
|
||||
class GetPreControladorUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun collectionTicketGet(
|
||||
usuario: String,
|
||||
password: String,
|
||||
collectionFk: String,
|
||||
sectorFk: String,
|
||||
print: String,
|
||||
type: String
|
||||
): Call<CollectionVO> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(collectionFk)
|
||||
params.add(sectorFk)
|
||||
params.add(print)
|
||||
params.add(type)
|
||||
return restClient!!.collection_getTickets(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun ticket_get(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vParamFk: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vParamFk)
|
||||
return restClient!!.ticket_get(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import retrofit2.Call
|
||||
|
||||
class GetPreSacadorUseCase(context: Context) : RestClient(context) {
|
||||
|
||||
|
||||
fun ticketToPrePrepare(
|
||||
usuario: String,
|
||||
password: String,
|
||||
ticketFk: String,
|
||||
sectorFk: String
|
||||
): Call<List<PreSacadorItemVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(ticketFk)
|
||||
params.add(sectorFk)
|
||||
return restClient!!.ticketToPrePrepare(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemPlacementSupplyGetOrder(
|
||||
usuario: String,
|
||||
password: String,
|
||||
sectorFk: String
|
||||
): Call<List<PreSacadorItemVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(sectorFk)
|
||||
return restClient!!.itemPlacementSupplyGetOrder(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemPlacementSupplyCloseOrder(
|
||||
usuario: String,
|
||||
password: String,
|
||||
id: String,
|
||||
quantity: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(id)
|
||||
params.add(quantity)
|
||||
return restClient!!.itemPlacementSupplyCloseOrder(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun sectorCollection_new(
|
||||
usuario: String,
|
||||
password: String,
|
||||
sectorFk: String
|
||||
|
||||
): Call<Unit> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(sectorFk)
|
||||
return restClient!!.sectorCollection_new(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
fun sectorCollectionSaleGroup_add(
|
||||
vSaleGroupFk: String,
|
||||
vSectorCollectionFk: Int
|
||||
|
||||
): Call<Unit> {
|
||||
return restClient!!.sectorCollectionSaleGroup_add(vSaleGroupFk,vSectorCollectionFk
|
||||
)
|
||||
}
|
||||
fun saleTracking_addPrevOK(
|
||||
vSectorCollectionFk: Int
|
||||
): Call<Unit> {
|
||||
return restClient!!.saleTracking_addPrevOK(vSectorCollectionFk
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
fun saleTracking_updateIsChecked(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vSaleFk: String,
|
||||
vIsChecked: String
|
||||
|
||||
): Call<Unit> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vSaleFk)
|
||||
params.add(vIsChecked)
|
||||
return restClient!!.saleTracking_updateIsChecked(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* fun sectorCollection_get(usuario: String, password: String): Call<List<CollectionVO>> {
|
||||
return restClient!!.sectorCollection_get("json", "1", usuario, password, "application/json")
|
||||
}*/
|
||||
|
||||
fun sectorCollection_getSale(
|
||||
sectorCollectionFK: Int,
|
||||
vSectorFk: String
|
||||
|
||||
): Call<List<PreSacadorItemVO>> {
|
||||
|
||||
return restClient!!.sectorCollection_getSale(sectorCollectionFK,vSectorFk
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
|
||||
import es.verdnatura.presentation.view.feature.calidad.model.ItemBuyerVO
|
||||
import retrofit2.Call
|
||||
|
||||
class GetQualityUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun itemShelvingBuyerGet(): Call<List<BuyerVO>> {
|
||||
return restClient!!.itemShelvingBuyerGet()
|
||||
}
|
||||
|
||||
fun itemShelvingBuyerTask(
|
||||
usuario: String,
|
||||
password: String,
|
||||
userFk: String
|
||||
): Call<List<ItemBuyerVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(userFk)
|
||||
return restClient!!.itemShelvingBuyerTask(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemShelvingStarsUpdate(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vId: String,
|
||||
vStars: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vId)
|
||||
params.add(vStars)
|
||||
return restClient!!.itemShelvingStarsUpdate(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
}
|
|
@ -1,522 +0,0 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
||||
import retrofit2.Call
|
||||
|
||||
class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
//sergio: se quita para ir colocando collection_getTickets
|
||||
/* fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String,print:String,type:String) : Call<CollectionVO> {
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
params.add(collectionFk)
|
||||
params.add(sectorFk)
|
||||
params.add(print)
|
||||
params.add(type)
|
||||
return restClient!!.collectionTicketGet("json","1",usuario,password,"application/json",params)
|
||||
}*/
|
||||
//sergio: se cambia llamada a collection_getTickets
|
||||
|
||||
fun collectionTicketGet(
|
||||
collectionFk: Int,
|
||||
sectorFk: String,
|
||||
print: String,
|
||||
type: String
|
||||
): Call<CollectionVO> {
|
||||
|
||||
return restClient!!.collection_getTickets(
|
||||
collectionFk, sectorFk, print, type
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
fun collection_get(
|
||||
collectionFk: Int,
|
||||
sectorFk: String,
|
||||
print: String,
|
||||
type: String
|
||||
): Call<CollectionVO> {
|
||||
|
||||
return restClient!!.collection_get(
|
||||
collectionFk, sectorFk, print, type
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
fun ticket_checkFullyControlled(
|
||||
usuario: String,
|
||||
password: String,
|
||||
collectionFk: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(collectionFk)
|
||||
return restClient!!.ticket_checkFullyControlled(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun ticket_isOutClosureZone(
|
||||
usuario: String,
|
||||
password: String,
|
||||
ticketFk: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(ticketFk)
|
||||
return restClient!!.ticket_isOutClosureZone(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun collection_getUncheckedTicket(
|
||||
usuario: String,
|
||||
password: String,
|
||||
collectionFk: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(collectionFk)
|
||||
return restClient!!.collection_getUncheckedTicket(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun collection_assign(
|
||||
): Call<String> {
|
||||
return restClient!!.collection_assign(
|
||||
)
|
||||
}
|
||||
|
||||
fun collectionGet(): Call<List<CollectionVO>> {
|
||||
// val params:ArrayList<String> = ArrayList()
|
||||
return restClient!!.collectionGet()
|
||||
}
|
||||
|
||||
|
||||
fun collectionGetSalix(): Call<List<CollectionVO>> {
|
||||
// val params:ArrayList<String> = ArrayList()
|
||||
return salixClient.getCollectionSalix(
|
||||
)
|
||||
}
|
||||
|
||||
fun saleTrackingReplace(
|
||||
saleFk: String,
|
||||
vOriginalQuantity: String,
|
||||
vStateFk: String,
|
||||
vIsChecked: String,
|
||||
vBuyFk: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(saleFk)
|
||||
params.add(vOriginalQuantity)
|
||||
params.add(vStateFk)
|
||||
params.add(vIsChecked)
|
||||
params.add(vBuyFk)
|
||||
return restClient!!.saleTrackingReplace(
|
||||
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun saleTracking_mark(
|
||||
usuario: String,
|
||||
password: String,
|
||||
saleFk: Int,
|
||||
vOriginalQuantity: String,
|
||||
vStateFk: String,
|
||||
vIsChecked: String,
|
||||
vBuyFk: String,
|
||||
vItemShelvingFk: String,
|
||||
vQuantity: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vOriginalQuantity)
|
||||
params.add(vStateFk)
|
||||
params.add(vIsChecked)
|
||||
params.add(vBuyFk)
|
||||
params.add(vItemShelvingFk) //Tarea #4371 Se añade para transaccionar los dos proced asociados
|
||||
params.add(vQuantity)
|
||||
return restClient!!.saleTracking_mark(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
fun itemPlacementSupplyAiming(
|
||||
usuario: String,
|
||||
password: String,
|
||||
shelvingFk: String,
|
||||
quantity: String,
|
||||
itemFk: String
|
||||
): Call<List<PlacementSupplyVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(shelvingFk)
|
||||
params.add(quantity)
|
||||
params.add(itemFk)
|
||||
return restClient!!.itemPlacementSupplyAiming(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemShelvingSaleSupplyAdd(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemShelvingFk: String,
|
||||
saleFk: String,
|
||||
quantity: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemShelvingFk)
|
||||
params.add(saleFk)
|
||||
params.add(quantity)
|
||||
return restClient!!.itemShelvingSaleSupplyAdd(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemShelvingPlacementSupplyAdd(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemShelvingFk: String,
|
||||
itemPlacementSupplyFk: String,
|
||||
quantity: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemShelvingFk)
|
||||
params.add(itemPlacementSupplyFk)
|
||||
params.add(quantity)
|
||||
return restClient!!.itemShelvingPlacementSupplyAdd(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun collectionStickerPrint(
|
||||
collectionFk: Int,
|
||||
labelCount: Int?
|
||||
): Call<Any> {
|
||||
val params: ArrayList<Any> = ArrayList()
|
||||
params.add(collectionFk)
|
||||
labelCount?.let {
|
||||
params.add(labelCount)
|
||||
}
|
||||
|
||||
return restClient!!.collectionStickerPrint(
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun ticketCollection_setUsedShelves(
|
||||
ticketFk: String,
|
||||
usedShelves: String
|
||||
): Call<Void> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(ticketFk)
|
||||
params.add(usedShelves)
|
||||
return restClient!!.ticketCollection_setUsedShelves(
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun item_updatePackingShelve(
|
||||
|
||||
vSelf: String,
|
||||
vPacking: String
|
||||
): Call<Void> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vSelf)
|
||||
params.add(vPacking)
|
||||
return restClient!!.item_updatePackingShelve(
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
fun saleTracking_add(
|
||||
usuario: String,
|
||||
password: String,
|
||||
saleGroupFk: String
|
||||
): Call<Void> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(saleGroupFk)
|
||||
return restClient!!.saleTracking_add(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
/* fun itemGetAvailable(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String,
|
||||
warehouseFk: String
|
||||
): Call<ItemVO> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(warehouseFk)
|
||||
return restClient!!.itemGetAvailable(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}*/
|
||||
|
||||
fun collectionAddItem(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String,
|
||||
quantityFk: String,
|
||||
ticketFk: String,
|
||||
warehouseFk: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(quantityFk)
|
||||
params.add(ticketFk)
|
||||
params.add(warehouseFk)
|
||||
return restClient!!.collectionAddItem(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun saleMove(
|
||||
usuario: String,
|
||||
password: String,
|
||||
saleFk: String,
|
||||
quantity: String,
|
||||
originalQuantity: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(saleFk)
|
||||
params.add(quantity)
|
||||
params.add(originalQuantity)
|
||||
return restClient!!.saleMove("json", "1", usuario, password, "application/json", params)
|
||||
}
|
||||
|
||||
fun collectionMissingTrash(
|
||||
usuario: String,
|
||||
password: String,
|
||||
saleFk: String,
|
||||
quantity: String,
|
||||
type: String,
|
||||
warehouseFk: String,
|
||||
originalQuantity: Int
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(saleFk)
|
||||
params.add(quantity)
|
||||
params.add(type)
|
||||
params.add(warehouseFk)
|
||||
params.add(originalQuantity.toString())
|
||||
return restClient!!.collectionMissingTrash(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun saleTrackingDel(usuario: String, password: String, saleFk: String): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(saleFk)
|
||||
return restClient!!.saleTrackingDel(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemShelving_updateFromSale(usuario: String, password: String, saleFk: String): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(saleFk)
|
||||
return restClient!!.itemShelving_updateFromSale(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun ticket_setState(
|
||||
ticketFk: Int,
|
||||
state: String
|
||||
): Call<Any> {
|
||||
|
||||
return restClient!!.ticket_setState(
|
||||
ticketFk, state
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
fun debug_add(
|
||||
buyFk: String,
|
||||
message: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(buyFk)
|
||||
params.add(message)
|
||||
return restClient!!.debug_add(
|
||||
params
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
fun getIdFromCode(usuario: String, password: String, code: String): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(code)
|
||||
return restClient!!.getIdFromCode(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun getIdFromCodeSalix(barCodeValue: String): Call<String> {
|
||||
|
||||
return salixClient.barcodes_toitem(
|
||||
barCodeValue = barCodeValue
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
fun collectionIncreaseQuantity(
|
||||
usuario: String,
|
||||
password: String,
|
||||
saleFk: String,
|
||||
quantity: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(saleFk)
|
||||
params.add(quantity)
|
||||
return restClient!!.collectionIncreaseQuantity(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
/* fun transferSalesSalix(
|
||||
|
||||
token: String,
|
||||
ticketFk: String,
|
||||
saleFk: String,
|
||||
quantity: String,
|
||||
|
||||
): Call<Any> {
|
||||
|
||||
var saleTransfer = listSaleSalix(arrayListOf())
|
||||
saleTransfer.sales.add(saleSalix(id = saleFk.toInt(), quantity = quantity.toInt()))
|
||||
|
||||
|
||||
return salixClient!!.transferSalesSalix(
|
||||
"json",
|
||||
"1",
|
||||
token,
|
||||
"application/json",
|
||||
ticketFk,
|
||||
saleTransfer
|
||||
|
||||
)
|
||||
}*/
|
||||
|
||||
|
||||
fun collectionIncreaseQuantitySalix(
|
||||
saleFk: String,
|
||||
quantity: String
|
||||
): Call<Any> {
|
||||
|
||||
|
||||
return salixClient!!.collectionIncreaseQuantitySalix(
|
||||
|
||||
SalixSaleQuantity(saleId = saleFk.toInt(), quantity = quantity.toInt())
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
fun saleMistakeAdd(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vSaleFk: String,
|
||||
vUserFk: String,
|
||||
vTypeFk: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vSaleFk)
|
||||
params.add(vUserFk)
|
||||
params.add(vTypeFk)
|
||||
return restClient!!.saleMistakeAdd(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
/* fun mistakeType(usuario: String, password: String): Call<List<MistakeTypeVO>> {
|
||||
// val params:ArrayList<String> = ArrayList()
|
||||
return restClient!!.mistakeType("json", "1", usuario, password, "application/json")
|
||||
}*/
|
||||
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import es.verdnatura.presentation.view.feature.shelvingparking.model.ItemShelvingParkingVO
|
||||
import retrofit2.Call
|
||||
|
||||
class GetShelvingParkingUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun shelvingParking_get(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vShelvingFk: String,
|
||||
vWarehouseFk: String,
|
||||
vDayRange: String
|
||||
): Call<List<ItemShelvingParkingVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vShelvingFk)
|
||||
params.add(vWarehouseFk)
|
||||
params.add(vDayRange)
|
||||
return restClient!!.shelvingParking_get(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,284 +0,0 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import es.verdnatura.presentation.view.feature.reubication.model.Reubication
|
||||
import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO
|
||||
import retrofit2.Call
|
||||
|
||||
class GetUbicadorUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun itemShelvingList(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vShelvingFk: String
|
||||
): Call<List<ItemUbicadorVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vShelvingFk)
|
||||
return restClient!!.itemShelvingList(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemShelvingMake(
|
||||
usuario: String,
|
||||
password: String,
|
||||
shelving: String,
|
||||
item: String,
|
||||
quantity: String,
|
||||
packing: String?,
|
||||
warehouse: String,
|
||||
grouping: String?
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(shelving)
|
||||
params.add(item)
|
||||
params.add(quantity)
|
||||
if (packing != null) params.add(packing)
|
||||
params.add(warehouse)
|
||||
if (grouping != null) params.add(grouping)
|
||||
return restClient!!.itemShelvingMake(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemShelvingMakeEdit(
|
||||
usuario: String,
|
||||
password: String,
|
||||
shelving: String,
|
||||
item: String,
|
||||
deep: String,
|
||||
quantity: String,
|
||||
packing: String,
|
||||
warehouse: String,
|
||||
level: String,
|
||||
itemShelvingFk: String,
|
||||
grouping: String
|
||||
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(shelving)
|
||||
params.add(item)
|
||||
params.add(deep)
|
||||
params.add(quantity)
|
||||
params.add(packing)
|
||||
params.add(warehouse)
|
||||
params.add(level)
|
||||
params.add(itemShelvingFk)
|
||||
params.add(grouping)
|
||||
return restClient!!.itemShelvingMakeEdit(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemShelvingMake_multi(
|
||||
shelving: String,
|
||||
items: List<Int>,
|
||||
warehouse: Int
|
||||
): Call<Any> {
|
||||
val params: ArrayList<Any> = ArrayList()
|
||||
params.add(shelving)
|
||||
params.add(items)
|
||||
params.add(warehouse)
|
||||
return restClient!!.itemShelvingMake_multi(
|
||||
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemShelving_addList(
|
||||
usuario: String,
|
||||
password: String,
|
||||
shelving: String,
|
||||
items: Any,
|
||||
isChecking: Boolean,
|
||||
warehouse: Int
|
||||
): Call<Any> {
|
||||
val params: ArrayList<Any> = ArrayList()
|
||||
params.add(shelving)
|
||||
params.add(items)
|
||||
params.add(isChecking)
|
||||
params.add(warehouse)
|
||||
return restClient!!.itemShelving_addList(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
/* fun itemShelving_addList(
|
||||
usuario: String,
|
||||
password: String,
|
||||
item:itemShelvingListObject
|
||||
): Call<Any> {
|
||||
val params: itemShelvingListObject = item
|
||||
|
||||
return restClient!!.itemShelving_addList(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}*/
|
||||
|
||||
fun shelvingPriorityUpdate(
|
||||
priority: String,
|
||||
shelving: String
|
||||
): Call<Any> {
|
||||
return restClient!!.shelvingPriorityUpdate(
|
||||
priority,shelving
|
||||
)
|
||||
}
|
||||
|
||||
fun shelvingPark(
|
||||
shelving: String,
|
||||
parking: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(shelving)
|
||||
params.add(parking)
|
||||
return restClient!!.shelvingPark(params)
|
||||
}
|
||||
|
||||
|
||||
fun shelvingChange(
|
||||
usuario: String,
|
||||
password: String,
|
||||
origen: String,
|
||||
destino: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(origen)
|
||||
params.add(destino)
|
||||
return restClient!!.shelvingChange(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemShelving_return(
|
||||
usuario: String,
|
||||
password: String,
|
||||
shelvingFk: String
|
||||
|
||||
): Call<ArrayList<Reubication>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(shelvingFk)
|
||||
|
||||
return restClient!!.itemShelving_return(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
fun clearShelvingList(usuario: String, password: String, shelvingFk: String): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(shelvingFk)
|
||||
return restClient!!.clearShelvingList(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemShelvingTransfer(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String,
|
||||
shelvingFk: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(shelvingFk)
|
||||
return restClient!!.itemShelvingTransfer(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemShelving_merge(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vShelf: String,
|
||||
vShelvingFk: String,
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vShelf)
|
||||
params.add(vShelvingFk)
|
||||
return restClient!!.itemShelving_merge(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun shelvinLog_add(
|
||||
usuario: String,
|
||||
password: String,
|
||||
code: String
|
||||
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(code)
|
||||
return restClient!!.shelvingLog_add(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemShelvingDelete(usuario: String, password: String, itemFk: String): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
return restClient!!.itemShelvingDelete(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
|
||||
import retrofit2.Call
|
||||
|
||||
class GetVehicleControlTimeUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun machineWorker_add(
|
||||
usuario: String,
|
||||
password: String,
|
||||
plateNumber: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(plateNumber)
|
||||
return restClient!!.machineWorker_add(
|
||||
/*"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",*/
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun machineWorker_update(
|
||||
usuario: String,
|
||||
password: String,
|
||||
plateNumber: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(plateNumber)
|
||||
return restClient!!.machineWorker_update(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun workerMachinery_isRegistered(
|
||||
): Call<String> {
|
||||
return restClient!!.workerMachinery_isRegistered(
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
/* fun machine_getWorkerPlate(usuario: String, password: String): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
return restClient!!.machine_getWorkerPlate(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
*/
|
||||
fun deviceProductionUser_getWorker(
|
||||
android_id: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(android_id)
|
||||
return restClient!!.deviceProductionUser_getWorker(
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun deviceProduction_getnameDevice(
|
||||
android_id: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(android_id)
|
||||
return restClient!!.deviceProduction_getnameDevice(
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun machineWorker_getHistorical(
|
||||
usuario: String,
|
||||
password: String,
|
||||
PlateNumber: String
|
||||
): Call<List<ItemHistoricoVehiculo>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(PlateNumber)
|
||||
return restClient!!.machineWorker_getHistorical(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
/* fun sip_getExtensionSalix(
|
||||
token:String,
|
||||
WorkerId: String
|
||||
): Call<Any> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(WorkerId)
|
||||
return salixClient!!.sip_getExtension(
|
||||
content_type = "application/json",
|
||||
authorization = token,
|
||||
idWorker=WorkerId
|
||||
)
|
||||
}*/
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
|
||||
import android.content.Context
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake
|
||||
import es.verdnatura.presentation.view.feature.workermistake.model.MistakeWorkerType
|
||||
import es.verdnatura.presentation.view.feature.workermistake.model.WorkerFromMistake
|
||||
import retrofit2.Call
|
||||
|
||||
class GetWokerMistakeUSerCase(context: Context) : RestClient(context) {
|
||||
|
||||
|
||||
fun collectionGet(): Call<List<CollectionVO>> {
|
||||
// val params:ArrayList<String> = ArrayList()
|
||||
return restClient!!.collectionGet()
|
||||
}
|
||||
|
||||
fun collectionGetSalix(): Call<List<CollectionVO>> {
|
||||
// val params:ArrayList<String> = ArrayList()
|
||||
return salixClient!!.getCollectionSalix()
|
||||
}
|
||||
|
||||
|
||||
fun workerMistake_Add(
|
||||
vUserFk: Int,
|
||||
vTypeFk: String
|
||||
): Call<Unit> {
|
||||
|
||||
return restClient!!.workerMistake_Add(vUserFk,vTypeFk
|
||||
)
|
||||
}
|
||||
|
||||
fun expeditionMistake_add(
|
||||
vExpeditionFk: Int,
|
||||
vTypeFk: String
|
||||
): Call<Unit> {
|
||||
return restClient!!.expeditionMistake_add(
|
||||
vExpeditionFk, vTypeFk,
|
||||
)
|
||||
}
|
||||
|
||||
fun workerMistakeType_get(): Call<List<MistakeWorkerType>> {
|
||||
return restClient!!.workerMistakeType_get(
|
||||
)
|
||||
}
|
||||
|
||||
fun expeditionMistakeType_get(): Call<List<MistakeWorkerType>> {
|
||||
return restClient!!.expeditionMistakeType_get()
|
||||
}
|
||||
|
||||
fun department_getHasMistake(): Call<List<DepartmentMistake>> {
|
||||
return restClient!!.department_getHasMistake()
|
||||
}
|
||||
|
||||
fun department_getHasMistakeSalix(token: String): Call<List<DepartmentMistake>> {
|
||||
return salixClient.department_getHasMistake(
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
fun worker_getFromHasMistake(
|
||||
department: String
|
||||
): Call<List<WorkerFromMistake>> {
|
||||
return restClient!!.worker_getFromHasMistake(
|
||||
department
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -21,7 +21,6 @@ interface SalixService {
|
|||
|
||||
@POST("Accounts/login")
|
||||
fun login(
|
||||
@Header("Content-Type") content_type: String,
|
||||
@Body params: LoginSalixVO
|
||||
):
|
||||
Call<LoginSalixVO>
|
||||
|
|
|
@ -94,11 +94,6 @@ interface VerdnaturaService {
|
|||
@POST("almacennew/worker_getPrinter")//NO SALIX
|
||||
|
||||
fun worker_getPrinter(
|
||||
@Header("aplicacion") aplicacion: String,
|
||||
@Header("version") version: String,
|
||||
@Header("user") user: String,
|
||||
@Header("pass") pass: String,
|
||||
@Header("Content-Type") content_type: String
|
||||
):
|
||||
Call<List<Printers>>
|
||||
|
||||
|
@ -128,11 +123,6 @@ interface VerdnaturaService {
|
|||
|
||||
@POST("almacennew/worker_getSector")//NO SALIX
|
||||
fun worker_getSector(
|
||||
@Header("aplicacion") aplicacion: String,
|
||||
@Header("version") version: String,
|
||||
@Header("user") user: String,
|
||||
@Header("pass") pass: String,
|
||||
@Header("Content-Type") content_type: String
|
||||
):
|
||||
Call<SectorItemVO>
|
||||
|
||||
|
@ -151,12 +141,7 @@ interface VerdnaturaService {
|
|||
|
||||
@POST("almacennew/ticketToPrePrepare")//NO SALIX
|
||||
fun ticketToPrePrepare(
|
||||
@Header("aplicacion") aplicacion: String,
|
||||
@Header("version") version: String,
|
||||
@Header("user") user: String,
|
||||
@Header("pass") pass: String,
|
||||
@Header("Content-Type") content_type: String,
|
||||
@Body params: List<String>
|
||||
@Body vararg params: Any
|
||||
):
|
||||
Call<List<PreSacadorItemVO>>
|
||||
|
||||
|
@ -190,16 +175,16 @@ interface VerdnaturaService {
|
|||
):
|
||||
Call<List<CollectionVO>>
|
||||
|
||||
/* @POST("almacennew/collectionNew")//NO SALIX
|
||||
fun collectionNew(
|
||||
@Header("aplicacion") aplicacion: String,
|
||||
@Header("version") version: String,
|
||||
@Header("user") user: String,
|
||||
@Header("pass") pass: String,
|
||||
@Header("Content-Type") content_type: String,
|
||||
@Body params: List<String>
|
||||
):
|
||||
Call<String>*/
|
||||
/* @POST("almacennew/collectionNew")//NO SALIX
|
||||
fun collectionNew(
|
||||
@Header("aplicacion") aplicacion: String,
|
||||
@Header("version") version: String,
|
||||
@Header("user") user: String,
|
||||
@Header("pass") pass: String,
|
||||
@Header("Content-Type") content_type: String,
|
||||
@Body params: List<String>
|
||||
):
|
||||
Call<String>*/
|
||||
|
||||
@POST("almacennew/collection_assign")//NO SALIX
|
||||
fun collection_assign(
|
||||
|
@ -225,25 +210,25 @@ interface VerdnaturaService {
|
|||
fun sectorCollection_new(
|
||||
@Body vararg params: Any
|
||||
):
|
||||
Call<Unit>
|
||||
Call<Any>
|
||||
|
||||
@POST("almacennew/sectorCollectionSaleGroup_add")//NO SALIX
|
||||
fun sectorCollectionSaleGroup_add(
|
||||
@Body vararg params: Any
|
||||
):
|
||||
Call<Unit>
|
||||
Call<Any>
|
||||
|
||||
@POST("almacennew/saleTracking_addPrevOK")//NO SALIX
|
||||
fun saleTracking_addPrevOK(
|
||||
@Body vararg params: Any
|
||||
):
|
||||
Call<Unit>
|
||||
Call<Any>
|
||||
|
||||
@POST("almacennew/saleTracking_updateIsChecked")//NO SALIX
|
||||
fun saleTracking_updateIsChecked(
|
||||
@Body vararg params: Any
|
||||
):
|
||||
Call<Unit>
|
||||
Call<Any>
|
||||
|
||||
/* @POST("almacennew/collectionTicketGet")//REVISADA-ANULADA POT collection_getTickets
|
||||
fun collectionTicketGet(
|
||||
|
@ -336,12 +321,8 @@ interface VerdnaturaService {
|
|||
|
||||
@POST("almacennew/itemShelvingPlacementSupplyAdd")//REVISADA
|
||||
fun itemShelvingPlacementSupplyAdd(
|
||||
@Header("aplicacion") aplicacion: String,
|
||||
@Header("version") version: String,
|
||||
@Header("user") user: String,
|
||||
@Header("pass") pass: String,
|
||||
@Header("Content-Type") content_type: String,
|
||||
@Body params: List<String>
|
||||
|
||||
@Body vararg params: Any
|
||||
):
|
||||
Call<Any>
|
||||
|
||||
|
@ -378,12 +359,8 @@ interface VerdnaturaService {
|
|||
|
||||
@POST("almacennew/saleMove")//REVISADA
|
||||
fun saleMove(
|
||||
@Header("aplicacion") aplicacion: String,
|
||||
@Header("version") version: String,
|
||||
@Header("user") user: String,
|
||||
@Header("pass") pass: String,
|
||||
@Header("Content-Type") content_type: String,
|
||||
@Body params: List<String>
|
||||
|
||||
@Body vararg params: Any
|
||||
):
|
||||
Call<Any>
|
||||
|
||||
|
@ -436,12 +413,7 @@ interface VerdnaturaService {
|
|||
|
||||
@POST("almacennew/collectionIncreaseQuantity")//REVISADA
|
||||
fun collectionIncreaseQuantity(
|
||||
@Header("aplicacion") aplicacion: String,
|
||||
@Header("version") version: String,
|
||||
@Header("user") user: String,
|
||||
@Header("pass") pass: String,
|
||||
@Header("Content-Type") content_type: String,
|
||||
@Body params: List<String>
|
||||
@Body vararg params: Any
|
||||
):
|
||||
Call<Any>
|
||||
|
||||
|
@ -455,13 +427,13 @@ interface VerdnaturaService {
|
|||
fun workerMistake_Add(
|
||||
@Body vararg params: Any
|
||||
):
|
||||
Call<Unit>
|
||||
Call<Any>
|
||||
|
||||
@POST("almacennew/expeditionMistake_add")//REVISADA
|
||||
fun expeditionMistake_add(
|
||||
@Body vararg params: Any
|
||||
):
|
||||
Call<Unit>
|
||||
Call<Any>
|
||||
|
||||
@POST("almacennew/mistakeType")//REVISADA
|
||||
fun mistakeType(
|
||||
|
@ -593,12 +565,7 @@ interface VerdnaturaService {
|
|||
//SHELVING PARKING ========================================================================>
|
||||
@POST("almacennew/shelvingParking_get")//REVISADA
|
||||
fun shelvingParking_get(
|
||||
@Header("aplicacion") aplicacion: String,
|
||||
@Header("version") version: String,
|
||||
@Header("user") user: String,
|
||||
@Header("pass") pass: String,
|
||||
@Header("Content-Type") content_type: String,
|
||||
@Body params: List<String>
|
||||
@Body vararg params: Any
|
||||
):
|
||||
Call<List<ItemShelvingParkingVO>>
|
||||
|
||||
|
@ -704,12 +671,7 @@ interface VerdnaturaService {
|
|||
|
||||
@POST("almacennew/clearShelvingList")//REVISADA
|
||||
fun clearShelvingList(
|
||||
@Header("aplicacion") aplicacion: String,
|
||||
@Header("version") version: String,
|
||||
@Header("user") user: String,
|
||||
@Header("pass") pass: String,
|
||||
@Header("Content-Type") content_type: String,
|
||||
@Body params: List<String>
|
||||
@Body vararg params: Any
|
||||
):
|
||||
Call<Any>
|
||||
|
||||
|
@ -758,23 +720,13 @@ interface VerdnaturaService {
|
|||
|
||||
@POST("almacennew/expedition_scan")//REVISADA
|
||||
fun expedition_scan(
|
||||
@Header("aplicacion") aplicacion: String,
|
||||
@Header("version") version: String,
|
||||
@Header("user") user: String,
|
||||
@Header("pass") pass: String,
|
||||
@Header("Content-Type") content_type: String,
|
||||
@Body params: List<String>
|
||||
@Body vararg params: Any
|
||||
):
|
||||
Call<Void>
|
||||
|
||||
@POST("almacennew/cmrPallet_add")//REVISADA
|
||||
fun cmrExpeditionPallet_add(
|
||||
@Header("aplicacion") aplicacion: String,
|
||||
@Header("version") version: String,
|
||||
@Header("user") user: String,
|
||||
@Header("pass") pass: String,
|
||||
@Header("Content-Type") content_type: String,
|
||||
@Body params: List<Int>
|
||||
@Body vararg params: Any
|
||||
):
|
||||
Call<Void>
|
||||
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
|
||||
import android.content.Context
|
||||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||
import es.verdnatura.presentation.view.feature.historicoshelving.model.ItemShelvingLog
|
||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLog
|
||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalix
|
||||
import es.verdnatura.presentation.view.feature.packaging.model.EntrySalix
|
||||
import retrofit2.Call
|
||||
|
||||
class itemShelvingLogUSerCase(context: Context) : RestClient(context) {
|
||||
|
||||
|
||||
fun itemShelvingLog_get(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vShelvingFk: String
|
||||
): Call<List<ItemShelvingLog>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vShelvingFk)
|
||||
return restClient!!.itemShelvingLog_get(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun shelvingLog_get(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vShelvingFk: String
|
||||
): Call<List<ShelvingLog>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vShelvingFk)
|
||||
return restClient!!.shelvingLog_get(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun Shelvings(
|
||||
vShelvingFilter: String,
|
||||
): Call<List<ShelvingLogSalix>> {
|
||||
return salixClient!!.Shelvings(
|
||||
filter = vShelvingFilter
|
||||
)
|
||||
}
|
||||
|
||||
fun getSectorsSalix(): Call<List<SectorItemVO>> {
|
||||
return salixClient!!.getSectorsSalix(
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -51,6 +51,12 @@ class testPrint(
|
|||
|
||||
setToolbar()
|
||||
setEvents()
|
||||
|
||||
val i = Intent()
|
||||
i.setClassName("verdnatura.es.repartoverdnatura", "verdnatura.es.repartoverdnatura.MainActivity")
|
||||
i.putExtra("token",getData(TOKEN))
|
||||
startActivity(i)
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
|
|
|
@ -103,6 +103,12 @@ class SaleAdapter(
|
|||
onMistakeClickListener.onMistakeClickListener(sale)
|
||||
false
|
||||
}*/
|
||||
|
||||
//Tarea #5004
|
||||
/* if (sale.hasMistake){
|
||||
imageErrorMessage.setBackgroundColor(color.RED)
|
||||
}*/
|
||||
|
||||
imageErrorMessage.setOnClickListener {
|
||||
onMistakeClickListener.onMistakeClickListener(sale)
|
||||
false
|
||||
|
|
|
@ -4,9 +4,7 @@ import android.content.Context
|
|||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import es.verdnatura.domain.GetInventaryUserCase
|
||||
import es.verdnatura.domain.GetItemCardUserCase
|
||||
import es.verdnatura.domain.GetWokerMistakeUSerCase
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
|
@ -17,15 +15,9 @@ import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
|
|||
import es.verdnatura.presentation.view.feature.inventario.model.InventaryListVO
|
||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
||||
import es.verdnatura.presentation.view.feature.workermistake.model.*
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
||||
|
||||
//private val getInventaryUserCase: GetInventaryUserCase = GetInventaryUserCase(context)
|
||||
//private val getItemCardUserCase: GetItemCardUserCase = GetItemCardUserCase(context)
|
||||
//private val getWorkerMistakeUserCase: GetWokerMistakeUSerCase = GetWokerMistakeUSerCase(context)
|
||||
class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val _inventaryList by lazy { MutableLiveData<InventaryListVO>() }
|
||||
val inventaryList: LiveData<InventaryListVO>
|
||||
|
@ -59,8 +51,8 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
|||
//sergio para obtener comprador
|
||||
fun itemShelvingBuyerGet() {
|
||||
silex.itemShelvingBuyerGet().enqueue(object :
|
||||
Callback<List<BuyerVO>> {
|
||||
override fun onFailure(call: Call<List<BuyerVO>>, t: Throwable) {
|
||||
SilexCallback<List<BuyerVO>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<BuyerVO> = ArrayList()
|
||||
listError.add(
|
||||
BuyerVO(
|
||||
|
@ -71,10 +63,7 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
|||
_buyersList.value = BuyerListVO(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<BuyerVO>>,
|
||||
response: Response<List<BuyerVO>>
|
||||
) {
|
||||
override fun onSuccess(response: Response<List<BuyerVO>>) {
|
||||
if (response.body() != null) {
|
||||
_buyersList.value = response.body()?.let { BuyerListVO(it) }
|
||||
} else {
|
||||
|
@ -101,8 +90,8 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
|||
fun getInventory(buyerFk: Int, warehouseFk: Int) {
|
||||
silex.itemShelvingRadarFilterBuyer(buyerFk, warehouseFk)
|
||||
.enqueue(object :
|
||||
Callback<List<ItemInventaryVO>> {
|
||||
override fun onFailure(call: Call<List<ItemInventaryVO>>, t: Throwable) {
|
||||
SilexCallback<List<ItemInventaryVO>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<ItemInventaryVO> = ArrayList()
|
||||
listError.add(
|
||||
ItemInventaryVO(
|
||||
|
@ -116,10 +105,7 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
|||
_inventaryList.value = InventaryListVO(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<ItemInventaryVO>>,
|
||||
response: Response<List<ItemInventaryVO>>
|
||||
) {
|
||||
override fun onSuccess(response: Response<List<ItemInventaryVO>>) {
|
||||
if (response.body() != null) {
|
||||
_inventaryList.value = response.body()?.let { InventaryListVO(it) }
|
||||
} else {
|
||||
|
@ -152,30 +138,18 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
|||
|
||||
|
||||
silex.itemTrash(itemFk, warehouseFk, newValue, isTrash)
|
||||
.enqueue(object : Callback<Any> {
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
|
||||
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
@ -221,8 +195,8 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
|||
fun department_getHasMistake() {
|
||||
|
||||
silex.department_getHasMistake()
|
||||
.enqueue(object : Callback<List<DepartmentMistake>> {
|
||||
override fun onFailure(call: Call<List<DepartmentMistake>>, t: Throwable) {
|
||||
.enqueue(object : SilexCallback<List<DepartmentMistake>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<DepartmentMistake> = ArrayList()
|
||||
listError.add(
|
||||
DepartmentMistake(
|
||||
|
@ -236,10 +210,7 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
|||
_mistakeDepartmentList.value = departmentMistakeList(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<DepartmentMistake>>,
|
||||
response: Response<List<DepartmentMistake>>
|
||||
) {
|
||||
override fun onSuccess(response: Response<List<DepartmentMistake>>) {
|
||||
if (response.body() != null) {
|
||||
_mistakeDepartmentList.value =
|
||||
response.body()?.let { departmentMistakeList(it) }
|
||||
|
@ -256,8 +227,8 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
|||
fun worker_getFromHasMistake( departmentFk: Int) {
|
||||
silex.worker_getFromHasMistake(departmentFk)
|
||||
.enqueue(object :
|
||||
Callback<List<WorkerFromMistake>> {
|
||||
override fun onFailure(call: Call<List<WorkerFromMistake>>, t: Throwable) {
|
||||
SilexCallback<List<WorkerFromMistake>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<WorkerFromMistake> = ArrayList()
|
||||
listError.add(
|
||||
WorkerFromMistake(
|
||||
|
@ -271,10 +242,7 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
|||
_workerFromMistakeList.value = workerFromMistakeList(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<WorkerFromMistake>>,
|
||||
response: Response<List<WorkerFromMistake>>
|
||||
) {
|
||||
override fun onSuccess(response: Response<List<WorkerFromMistake>>) {
|
||||
if (response.body() != null) {
|
||||
|
||||
_workerFromMistakeList.value =
|
||||
|
@ -299,8 +267,8 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
|||
|
||||
fun workerMistakeType_get() {
|
||||
silex.workerMistakeType_get()
|
||||
.enqueue(object : Callback<List<MistakeWorkerType>> {
|
||||
override fun onFailure(call: Call<List<MistakeWorkerType>>, t: Throwable) {
|
||||
.enqueue(object : SilexCallback<List<MistakeWorkerType>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<MistakeWorkerType> = ArrayList()
|
||||
listError.add(
|
||||
MistakeWorkerType(
|
||||
|
@ -316,10 +284,7 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
|||
_mistakeWorkerList.value = workerMistakeTypeList(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<MistakeWorkerType>>,
|
||||
response: Response<List<MistakeWorkerType>>
|
||||
) {
|
||||
override fun onSuccess(response: Response<List<MistakeWorkerType>>) {
|
||||
if (response.body() != null) {
|
||||
_mistakeWorkerList.value =
|
||||
response.body()?.let { workerMistakeTypeList(it) }
|
||||
|
@ -351,39 +316,22 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
|||
) {
|
||||
silex.workerMistake_Add(vUserFk, vTypeFk)
|
||||
.enqueue(object :
|
||||
Callback<Unit> {
|
||||
override fun onFailure(call: Call<Unit>, t: Throwable) {
|
||||
SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseAddMistake.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<Unit>,
|
||||
response: Response<Unit>
|
||||
) {
|
||||
if (!response.isSuccessful) {
|
||||
|
||||
_responseAddMistake.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage =
|
||||
getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
), codeError = response.code()
|
||||
)
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
// sergio:refactor:solo debería haber un mensaje no un response o errorMessage
|
||||
_responseAddMistake.value =
|
||||
ResponseItemVO(
|
||||
isError = false,
|
||||
response = response.message()
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -394,47 +342,30 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
|||
) {
|
||||
silex.expeditionMistake_add(vExpeditionFk, vTypeFk)
|
||||
.enqueue(object :
|
||||
Callback<Unit> {
|
||||
override fun onFailure(call: Call<Unit>, t: Throwable) {
|
||||
SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseAddMistake.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<Unit>,
|
||||
response: Response<Unit>
|
||||
) {
|
||||
if (!response.isSuccessful) {
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
|
||||
_responseAddMistake.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage =
|
||||
getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
), codeError = response.code()
|
||||
)
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
// sergio:refactor:solo debería haber un mensaje no un response o errorMessage
|
||||
// sergio:refactor:solo debería haber un mensaje no un response o errorMessage
|
||||
_responseAddMistake.value =
|
||||
ResponseItemVO(
|
||||
isError = false,
|
||||
response = response.message()
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun expeditionMistakeType_get() {
|
||||
silex.expeditionMistakeType_get()
|
||||
.enqueue(object : Callback<List<MistakeWorkerType>> {
|
||||
override fun onFailure(call: Call<List<MistakeWorkerType>>, t: Throwable) {
|
||||
.enqueue(object : SilexCallback<List<MistakeWorkerType>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<MistakeWorkerType> = ArrayList()
|
||||
listError.add(
|
||||
MistakeWorkerType(
|
||||
|
@ -450,10 +381,8 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
|||
_mistakeWorkerList.value = workerMistakeTypeList(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<MistakeWorkerType>>,
|
||||
response: Response<List<MistakeWorkerType>>
|
||||
) {
|
||||
override fun onSuccess(response: Response<List<MistakeWorkerType>>) {
|
||||
|
||||
if (response.body() != null) {
|
||||
_mistakeWorkerList.value =
|
||||
response.body()?.let { workerMistakeTypeList(it) }
|
||||
|
|
|
@ -9,7 +9,6 @@ import android.content.pm.PackageInfo
|
|||
import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import android.provider.Settings
|
||||
import android.system.Os.kill
|
||||
import android.view.View
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
|
@ -282,25 +281,8 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
} else {
|
||||
//sergio: se añade el log
|
||||
viewModel.worker_getId()
|
||||
|
||||
viewModel.worker_getSector(
|
||||
binding.edittextUsername.text.toString(),
|
||||
binding.edittextPassword.text.toString()
|
||||
)
|
||||
|
||||
|
||||
/* viewModel.operator_getNumberOfWagons(
|
||||
binding.edittextUsername.text.toString(),
|
||||
binding.edittextPassword.text.toString()
|
||||
)*/
|
||||
|
||||
viewModel.worker_getPrinter(
|
||||
binding.edittextUsername.text.toString(),
|
||||
binding.edittextPassword.text.toString()
|
||||
)
|
||||
|
||||
|
||||
|
||||
viewModel.worker_getSector()
|
||||
viewModel.worker_getPrinter()
|
||||
deviceLog_add(
|
||||
getString(R.string.logAppName),
|
||||
getInfoVersionNameApp(),
|
||||
|
@ -313,29 +295,17 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
saveRemember(false)
|
||||
}
|
||||
|
||||
/*saveUserAccesPref(
|
||||
binding.edittextUsername.text.toString(),
|
||||
binding.edittextPassword.text.toString()
|
||||
)*/
|
||||
|
||||
|
||||
if (it.vIsAuthorized == "1" && it.vMessage.isNullOrEmpty()) {
|
||||
|
||||
getVersion()
|
||||
|
||||
}
|
||||
if (it.vIsAuthorized == "1" && !it.vMessage.isNullOrEmpty()) {
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
//binding.splashProgress.visibility = View.GONE
|
||||
customDialog.setTitle(getString(R.string.info))
|
||||
.setDescription(it.vMessage)
|
||||
.setOkButton(getString(R.string.close)) {
|
||||
customDialog.dismiss()
|
||||
/* binding.splashProgress.visibility = View.VISIBLE
|
||||
loginSalix(
|
||||
user = binding.edittextUsername.text.toString(),
|
||||
password = binding.edittextPassword.text.toString(),
|
||||
"login de Salix"
|
||||
)*/
|
||||
getVersion()
|
||||
}.show()
|
||||
|
||||
|
@ -398,7 +368,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
}
|
||||
|
||||
workergetSector.observe(viewLifecycleOwner) {
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
//binding.splashProgress.visibility = View.GONE
|
||||
|
||||
|
||||
if (it.isError) {
|
||||
|
@ -413,7 +383,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
}
|
||||
|
||||
loadWorkerPrintList.observe(viewLifecycleOwner, Observer { event ->
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
//binding.splashProgress.visibility = View.GONE
|
||||
|
||||
event.getContentIfNotHandled().notNull {
|
||||
|
||||
|
@ -511,7 +481,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
private fun goToMain() {
|
||||
val intent = Intent(activity, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
//binding.splashProgress.visibility=View.GONE
|
||||
binding.splashProgress.visibility=View.GONE
|
||||
requireActivity().finish()
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import androidx.lifecycle.Transformations
|
|||
import com.google.gson.Gson
|
||||
import com.google.gson.JsonObject
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import es.verdnatura.domain.GetLoginUserCase
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
|
@ -23,12 +22,9 @@ import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO
|
|||
import es.verdnatura.presentation.view.feature.login.model.versionApp
|
||||
import es.verdnatura.presentation.view.feature.login.model.workerId
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.itemsExpeditionDynamics
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class LoginViewModel(var context: Context) : BaseViewModel(context) {
|
||||
private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase(context)
|
||||
class LoginViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val _loginsalixitem by lazy { MutableLiveData<LoginSalixVO>() }
|
||||
val loginsalixitem: LiveData<LoginSalixVO>
|
||||
|
@ -74,99 +70,85 @@ class LoginViewModel(var context: Context) : BaseViewModel(context) {
|
|||
val loadWorkerPrintList = Transformations.map(_workerPrintList) { Event(it) }
|
||||
|
||||
fun loginSalix(user: String, password: String) {
|
||||
getLoginUserCase.salixLogin(user, password).enqueue(object : Callback<LoginSalixVO> {
|
||||
override fun onResponse(call: Call<LoginSalixVO>, response: Response<LoginSalixVO>) {
|
||||
salix.login(LoginSalixVO(user, password)).enqueue(
|
||||
object : SilexCallback<LoginSalixVO>(context) {
|
||||
override fun onSuccess(response: Response<LoginSalixVO>) {
|
||||
|
||||
val loginSalixVO: LoginSalixVO?
|
||||
if (response.body() != null) {
|
||||
val loginSalixVO: LoginSalixVO?
|
||||
if (response.body() != null) {
|
||||
loginSalixVO = response.body()?.token?.let {
|
||||
LoginSalixVO(
|
||||
user,
|
||||
password,
|
||||
it,
|
||||
isError = false,
|
||||
errorMessage = ""
|
||||
)
|
||||
}
|
||||
} else {
|
||||
|
||||
loginSalixVO = response.body()?.token?.let {
|
||||
loginSalixVO = LoginSalixVO(
|
||||
user,
|
||||
password,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this), response.message()
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
}
|
||||
|
||||
_loginsalixitem.value = loginSalixVO
|
||||
}
|
||||
|
||||
override fun onError(t: Throwable) {
|
||||
val loginSalixVO =
|
||||
LoginSalixVO(
|
||||
user,
|
||||
password,
|
||||
it,
|
||||
isError = false,
|
||||
errorMessage = ""
|
||||
"",
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
t.message!!
|
||||
)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
|
||||
loginSalixVO = LoginSalixVO(
|
||||
user,
|
||||
password,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this), response.message()
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
_loginsalixitem.value = loginSalixVO
|
||||
}
|
||||
|
||||
_loginsalixitem.value = loginSalixVO
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<LoginSalixVO>, t: Throwable) {
|
||||
val loginSalixVO =
|
||||
LoginSalixVO(
|
||||
user,
|
||||
password,
|
||||
"",
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
_loginsalixitem.value = loginSalixVO
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
fun device_checkLogin(user: String, android_id: String) {
|
||||
|
||||
getLoginUserCase.device_checkLogin(user, android_id)
|
||||
.enqueue(object : Callback<LoginDevice> {
|
||||
override fun onResponse(call: Call<LoginDevice>, response: Response<LoginDevice>) {
|
||||
silex.device_checkLogin(user, android_id)
|
||||
.enqueue(object : SilexCallback<LoginDevice>(context) {
|
||||
override fun onSuccess(response: Response<LoginDevice>) {
|
||||
if (response.body() != null) {
|
||||
|
||||
val loginDevice: LoginDevice?
|
||||
response.body()?.let {
|
||||
|
||||
if (!response.isSuccessful) {
|
||||
loginDevice = LoginDevice(
|
||||
_logindevice.value = LoginDevice(
|
||||
it.vMessage, it.vIsAuthorized,
|
||||
isError = false,
|
||||
errorMessage = ""
|
||||
)
|
||||
|
||||
}
|
||||
} else {
|
||||
_logindevice.value = LoginDevice(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
} else {
|
||||
if (response.body() != null) {
|
||||
|
||||
loginDevice = response.body()?.let {
|
||||
|
||||
LoginDevice(
|
||||
it.vMessage, it.vIsAuthorized,
|
||||
isError = false,
|
||||
errorMessage = ""
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
loginDevice = LoginDevice(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
_logindevice.value = loginDevice
|
||||
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<LoginDevice>, t: Throwable) {
|
||||
|
||||
val loginDevice =
|
||||
override fun onError(t: Throwable) {
|
||||
_logindevice.value =
|
||||
LoginDevice(
|
||||
"",
|
||||
"",
|
||||
|
@ -176,7 +158,6 @@ class LoginViewModel(var context: Context) : BaseViewModel(context) {
|
|||
t.message!!
|
||||
)
|
||||
)
|
||||
_logindevice.value = loginDevice
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -184,55 +165,35 @@ class LoginViewModel(var context: Context) : BaseViewModel(context) {
|
|||
fun worker_getId() {
|
||||
silex.worker_getId().enqueue(object : SilexCallback<Int>(context) {
|
||||
override fun onSuccess(response: Response<Int>) {
|
||||
val prefs = app!!.getPrefs()
|
||||
val prefs = app.getPrefs()
|
||||
response.body()?.let { prefs.putInt("userFk", it) }
|
||||
prefs.commit()
|
||||
|
||||
}
|
||||
|
||||
// Esto no estava:
|
||||
override fun onError(t: Throwable) {
|
||||
throw Error(nameofFunction((this)) + t.message)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun deviceLog_add(
|
||||
app: String, versionApp: String, android_id: String
|
||||
) {
|
||||
silex.deviceLog_add(app, versionApp, android_id)
|
||||
silex.deviceLog_add(app, versionApp, android_id)
|
||||
.enqueue(object : SilexCallback<Void>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
throw Error(nameofFunction((this)) + t.message)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<Void>) {
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
fun messageError(callFunction: String, message: String) {
|
||||
_devicelogresponse.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(callFunction, message)
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
fun checkVersion(nameApp: String) {
|
||||
getLoginUserCase.checkVersion(nameApp)
|
||||
.enqueue(object : Callback<versionApp> {
|
||||
override fun onResponse(call: Call<versionApp>, response: Response<versionApp>) {
|
||||
|
||||
//var versionApp: versionApp?
|
||||
|
||||
silex.getVersion(nameApp)
|
||||
.enqueue(object : SilexCallback<versionApp>(context) {
|
||||
override fun onSuccess(response: Response<versionApp>) {
|
||||
if (response.body() != null) {
|
||||
|
||||
_versionappitem.value = response.body()?.let {
|
||||
|
||||
versionApp(
|
||||
it.appname,
|
||||
it.version,
|
||||
|
@ -255,12 +216,9 @@ class LoginViewModel(var context: Context) : BaseViewModel(context) {
|
|||
)
|
||||
)
|
||||
}
|
||||
|
||||
// _versionappitem.value = versionApp
|
||||
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<versionApp>, t: Throwable) {
|
||||
override fun onError(t: Throwable) {
|
||||
_versionappitem.value =
|
||||
versionApp(
|
||||
nameApp,
|
||||
|
@ -271,7 +229,6 @@ class LoginViewModel(var context: Context) : BaseViewModel(context) {
|
|||
t.message!!
|
||||
)
|
||||
)
|
||||
//_versionappitem.value = versionApp
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -347,11 +304,10 @@ class LoginViewModel(var context: Context) : BaseViewModel(context) {
|
|||
return list
|
||||
}
|
||||
|
||||
fun worker_getSector(user: String, password: String) {
|
||||
|
||||
getLoginUserCase.worker_getSector(user, password).enqueue(object : Callback<SectorItemVO> {
|
||||
override fun onFailure(call: Call<SectorItemVO>, t: Throwable) {
|
||||
fun worker_getSector() {
|
||||
|
||||
silex.worker_getSector().enqueue(object : SilexCallback<SectorItemVO>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_workergetSector.value = SectorItemVO(
|
||||
0,
|
||||
"",
|
||||
|
@ -361,32 +317,14 @@ class LoginViewModel(var context: Context) : BaseViewModel(context) {
|
|||
)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<SectorItemVO>,
|
||||
response: Response<SectorItemVO>
|
||||
) {
|
||||
|
||||
if (!response.isSuccessful) {
|
||||
_workergetSector.value = SectorItemVO(
|
||||
0, "", 0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
override fun onSuccess(response: Response<SectorItemVO>) {
|
||||
_workergetSector.value = response.body()?.let {
|
||||
SectorItemVO(
|
||||
it.id,
|
||||
it.description,
|
||||
it.warehouseFk,
|
||||
isError = false
|
||||
)
|
||||
} else {
|
||||
|
||||
_workergetSector.value = response.body()?.let {
|
||||
SectorItemVO(
|
||||
it.id,
|
||||
it.description,
|
||||
it.warehouseFk,
|
||||
isError = false
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -396,10 +334,9 @@ class LoginViewModel(var context: Context) : BaseViewModel(context) {
|
|||
|
||||
fun operator_getNumberOfWagons() {
|
||||
|
||||
silex.operator_getNumberOfWagons()
|
||||
.enqueue(object : Callback<Int?> {
|
||||
override fun onFailure(call: Call<Int?>, t: Throwable) {
|
||||
|
||||
silex.operator_getNumberOfWagons()
|
||||
.enqueue(object : SilexCallback<Int?>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_operatorGetNumberOfWagons.value = ResponseItemNumber(
|
||||
null,
|
||||
isError = true,
|
||||
|
@ -407,73 +344,37 @@ class LoginViewModel(var context: Context) : BaseViewModel(context) {
|
|||
)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<Int?>,
|
||||
response: Response<Int?>
|
||||
) {
|
||||
override fun onSuccess(response: Response<Int?>) {
|
||||
if (response.body() != null)
|
||||
_operatorGetNumberOfWagons.value =
|
||||
ResponseItemNumber(response.body(), isError = false)
|
||||
|
||||
if (!response.isSuccessful) {
|
||||
_operatorGetNumberOfWagons.value = ResponseItemNumber(
|
||||
null, true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
|
||||
if (response.body() != null)
|
||||
_operatorGetNumberOfWagons.value =
|
||||
ResponseItemNumber(response.body(), isError = false)
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun operator_add() {
|
||||
|
||||
silex.operator_add().enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
silex.operator_add().enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_operatorAdd.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<Any>,
|
||||
response: Response<Any>
|
||||
) {
|
||||
|
||||
if (!response.isSuccessful) {
|
||||
_operatorAdd.value = ResponseItemVO(
|
||||
"", true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
_operatorAdd.value = ResponseItemVO("", false)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_operatorAdd.value = ResponseItemVO("", false)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun worker_getPrinter(user: String, password: String) {
|
||||
fun worker_getPrinter() {
|
||||
|
||||
getLoginUserCase.worker_getPrinter(user, password)
|
||||
.enqueue(object : Callback<List<Printers>> {
|
||||
override fun onFailure(call: Call<List<Printers>>, t: Throwable) {
|
||||
silex.worker_getPrinter()
|
||||
.enqueue(object : SilexCallback<List<Printers>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<Printers> = ArrayList()
|
||||
listError.add(
|
||||
Printers(
|
||||
|
@ -488,10 +389,7 @@ class LoginViewModel(var context: Context) : BaseViewModel(context) {
|
|||
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<Printers>>,
|
||||
response: Response<List<Printers>>
|
||||
) {
|
||||
override fun onSuccess(response: Response<List<Printers>>) {
|
||||
if (response.body() != null) {
|
||||
_workerPrintList.value = response.body()?.let {
|
||||
WorkerPrintersList(it)
|
||||
|
|
|
@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.packaging.fragment.PackagingView
|
|||
import android.content.Context
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
|
@ -12,7 +13,7 @@ import retrofit2.Call
|
|||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class PackagingViewModel(context: Context) : BaseViewModel(context) {
|
||||
class PackagingViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
|
||||
private val _itemSupplierList by lazy { MutableLiveData<itemSupplierList>() }
|
||||
|
@ -34,8 +35,8 @@ class PackagingViewModel(context: Context) : BaseViewModel(context) {
|
|||
fun getSuppliers() {
|
||||
salix.getSuppliers()
|
||||
.enqueue(object :
|
||||
Callback<List<Supplier>> {
|
||||
override fun onFailure(call: Call<List<Supplier>>, t: Throwable) {
|
||||
SilexCallback<List<Supplier>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<Supplier> = ArrayList()
|
||||
listError.add(
|
||||
Supplier(
|
||||
|
@ -49,10 +50,7 @@ class PackagingViewModel(context: Context) : BaseViewModel(context) {
|
|||
_supplierList.value = SupplierList(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<Supplier>>,
|
||||
response: Response<List<Supplier>>
|
||||
) {
|
||||
override fun onSuccess(response: Response<List<Supplier>>) {
|
||||
if (response.body() != null) {
|
||||
_supplierList.value = response.body()?.let { SupplierList(it) }
|
||||
} else {
|
||||
|
@ -77,8 +75,8 @@ class PackagingViewModel(context: Context) : BaseViewModel(context) {
|
|||
fun supplier_getItems(supplierFk: Int) {
|
||||
|
||||
silex.supplier_getItems(supplierFk)
|
||||
.enqueue(object : Callback<List<ItemSupplier>> {
|
||||
override fun onFailure(call: Call<List<ItemSupplier>>, t: Throwable) {
|
||||
.enqueue(object : SilexCallback<List<ItemSupplier>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<ItemSupplier> = ArrayList()
|
||||
listError.add(
|
||||
ItemSupplier(
|
||||
|
@ -92,10 +90,7 @@ class PackagingViewModel(context: Context) : BaseViewModel(context) {
|
|||
_itemSupplierList.value = itemSupplierList(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<ItemSupplier>>,
|
||||
response: Response<List<ItemSupplier>>
|
||||
) {
|
||||
override fun onSuccess(response: Response<List<ItemSupplier>>) {
|
||||
if (response.body() != null) {
|
||||
_itemSupplierList.value =
|
||||
response.body()?.let { itemSupplierList(it) }
|
||||
|
@ -112,8 +107,8 @@ class PackagingViewModel(context: Context) : BaseViewModel(context) {
|
|||
fun entry_addSalix(entry: EntrySalix) {
|
||||
salix.Entries(entry = entry)
|
||||
.enqueue(object :
|
||||
Callback<EntrySalix> {
|
||||
override fun onFailure(call: Call<EntrySalix>, t: Throwable) {
|
||||
SilexCallback<EntrySalix> (context){
|
||||
override fun onError(t: Throwable) {
|
||||
_entry.value = EntrySalix(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
|
@ -123,10 +118,7 @@ class PackagingViewModel(context: Context) : BaseViewModel(context) {
|
|||
)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<EntrySalix>,
|
||||
response: Response<EntrySalix>
|
||||
) {
|
||||
override fun onSuccess(response: Response<EntrySalix>) {
|
||||
if (response.body() != null) {
|
||||
_entry.value = response.body()
|
||||
} else {
|
||||
|
|
|
@ -45,8 +45,6 @@ class CmrExpeditionPalletFragment(
|
|||
customDialogList.dismiss()
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
viewModel.cmrExpeditionPallet_add(
|
||||
getData(USER),
|
||||
getData(PASSWORD),
|
||||
vExpeditionPallet!!,
|
||||
vCmrId!!
|
||||
)
|
||||
|
|
|
@ -3,56 +3,41 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment
|
|||
import android.content.Context
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.GetPaletizadoresUserCase
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
|
||||
class CmrExpeditionPalletViewModel(context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val GetPaletizadoresUserCase: GetPaletizadoresUserCase =
|
||||
GetPaletizadoresUserCase(context)
|
||||
|
||||
private val _responsescan by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responsescan: LiveData<ResponseItemVO>
|
||||
get() = _responsescan
|
||||
class CmrExpeditionPalletViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
|
||||
fun cmrExpeditionPallet_add(usuario: String, password: String, vExpeditionPallet: Int,vCmrId:Int) {
|
||||
GetPaletizadoresUserCase.cmrExpeditionPallet_add(usuario, password, vExpeditionPallet, vCmrId)
|
||||
.enqueue(object : Callback<Void> {
|
||||
override fun onFailure(call: Call<Void>, t: Throwable) {
|
||||
|
||||
_responsescan.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Void>, response: Response<Void>) {
|
||||
|
||||
if (!response.isSuccessful) {
|
||||
_responsescan.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_responsescan.value =
|
||||
ResponseItemVO(isError = false, response = response.message()!!)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
private val _responsescan by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responsescan: LiveData<ResponseItemVO>
|
||||
get() = _responsescan
|
||||
|
||||
|
||||
fun cmrExpeditionPallet_add(vExpeditionPallet: Int, vCmrId: Int) {
|
||||
silex.cmrExpeditionPallet_add(vExpeditionPallet, vCmrId)
|
||||
.enqueue(object : SilexCallback<Void>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responsescan.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<Void>) {
|
||||
|
||||
_responsescan.value =
|
||||
ResponseItemVO(isError = false, response = response.message()!!)
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -4,9 +4,8 @@ import android.content.Context
|
|||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import es.verdnatura.domain.GetPaletizadoresUserCase
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.common.Event
|
||||
|
@ -17,9 +16,9 @@ import retrofit2.Call
|
|||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel(context) {
|
||||
class ExpeditionPalletDetailViewModel(var context: Context) : BaseViewModel(context) {
|
||||
|
||||
|
||||
private val getPaletizadoresUserCase: GetPaletizadoresUserCase = GetPaletizadoresUserCase(context)
|
||||
|
||||
private val _expeditionPalletList by lazy { MutableLiveData<ItemPalletViewListVO>() }
|
||||
val loadExpeditionPalletList = Transformations.map(_expeditionPalletList) { Event(it) }
|
||||
|
@ -33,25 +32,35 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel(context)
|
|||
get() = _responsePrintPallet
|
||||
|
||||
|
||||
|
||||
fun expeditionPallet_List(vPalletFk:Int){
|
||||
fun expeditionPallet_List(vPalletFk: Int) {
|
||||
silex.expeditionPalletView(vPalletFk).enqueue(object :
|
||||
Callback<List<ItemPalletViewVO>> {
|
||||
override fun onFailure(call: Call<List<ItemPalletViewVO>>, t: Throwable) {
|
||||
val listError:ArrayList<ItemPalletViewVO> = ArrayList()
|
||||
listError.add(ItemPalletViewVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
|
||||
SilexCallback<List<ItemPalletViewVO>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<ItemPalletViewVO> = ArrayList()
|
||||
listError.add(
|
||||
ItemPalletViewVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
)
|
||||
_expeditionPalletList.value = ItemPalletViewListVO(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<ItemPalletViewVO>>,
|
||||
response: Response<List<ItemPalletViewVO>>
|
||||
) {
|
||||
if (response.body() != null){
|
||||
override fun onSuccess(response: Response<List<ItemPalletViewVO>>) {
|
||||
|
||||
if (response.body() != null) {
|
||||
_expeditionPalletList.value = response.body()?.let { ItemPalletViewListVO(it) }
|
||||
}else{
|
||||
val listError:ArrayList<ItemPalletViewVO> = ArrayList()
|
||||
listError.add(ItemPalletViewVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
|
||||
} else {
|
||||
val listError: ArrayList<ItemPalletViewVO> = ArrayList()
|
||||
listError.add(
|
||||
ItemPalletViewVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
)
|
||||
_expeditionPalletList.value = ItemPalletViewListVO(listError)
|
||||
}
|
||||
}
|
||||
|
@ -59,54 +68,63 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel(context)
|
|||
})
|
||||
}
|
||||
|
||||
fun expeditionPalletDel(vPalletFk:Int){
|
||||
silex.expeditionPalletDel(vPalletFk).enqueue(object : Callback<Any>{
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
|
||||
fun expeditionPalletDel(vPalletFk: Int) {
|
||||
silex.expeditionPalletDel(vPalletFk).enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (response.isSuccessful){
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
|
||||
}else{
|
||||
_response.value = ResponseItemVO(isError = false,response = response.message())
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun expeditionPalletPrintSet(
|
||||
vPalletFk: Int,
|
||||
vSectorFk: Int){
|
||||
vSectorFk: Int
|
||||
) {
|
||||
|
||||
silex.expeditionPalletPrintSet(vPalletFk,vSectorFk).enqueue(object : Callback<Any>{
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
_responsePrintPallet.value = ResponseItemVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))
|
||||
silex.expeditionPalletPrintSet(vPalletFk, vSectorFk).enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responsePrintPallet.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful){
|
||||
_responsePrintPallet.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
|
||||
}else{
|
||||
_responsePrintPallet.value = ResponseItemVO(isError = false,response = response.message())
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_responsePrintPallet.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun expeditionState_addByPallet(
|
||||
vPalletFk: Int,
|
||||
vStateCode:String,
|
||||
){
|
||||
vStateCode: String,
|
||||
) {
|
||||
|
||||
silex.expeditionState_addByPallet(vPalletFk,vStateCode).enqueue(object : Callback<Unit>{
|
||||
override fun onFailure(call: Call<Unit>, t: Throwable) {
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))
|
||||
silex.expeditionState_addByPallet(vPalletFk, vStateCode).enqueue(object : SilexCallback<Unit>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
override fun onResponse(call: Call<Unit>, response: Response<Unit>) {
|
||||
if (!response.isSuccessful){
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
|
||||
}else{
|
||||
_response.value = ResponseItemVO(isError = false,response = response.message())
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<Unit>) {
|
||||
_response.value = ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -4,9 +4,8 @@ import android.content.Context
|
|||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import es.verdnatura.domain.GetPaletizadoresUserCase
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.common.Event
|
||||
|
@ -16,12 +15,10 @@ import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
|
|||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanList
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanVO
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class ExpeditionPalletViewModel (context: Context) : BaseViewModel(context) {
|
||||
class ExpeditionPalletViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val getPaletizadoresUserCase: GetPaletizadoresUserCase = GetPaletizadoresUserCase(context)
|
||||
|
||||
private val _expeditionPalletList by lazy { MutableLiveData<ItemPalletListVO>() }
|
||||
val loadExpeditionPalletList = Transformations.map(_expeditionPalletList) { Event(it) }
|
||||
|
@ -34,32 +31,42 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel(context) {
|
|||
val response: LiveData<ResponseItemVO>
|
||||
get() = _response
|
||||
|
||||
//sergio: añadido para comprobar rutas escaneado desde PalletFragment
|
||||
//sergio: añadido para comprobar rutas escaneado desde PalletFragment
|
||||
private val _responseCheckexpeditionScanPut by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseCheckexpeditionScanPut: LiveData<ResponseItemVO>
|
||||
get() = _responseCheckexpeditionScanPut
|
||||
|
||||
|
||||
|
||||
|
||||
fun expeditionPallet_List(vTruckFk:Int){
|
||||
fun expeditionPallet_List(vTruckFk: Int) {
|
||||
silex.expeditionPallet_List(vTruckFk).enqueue(object :
|
||||
Callback<List<ItemPalletVO>> {
|
||||
override fun onFailure(call: Call<List<ItemPalletVO>>, t: Throwable) {
|
||||
val listError:ArrayList<ItemPalletVO> = ArrayList()
|
||||
listError.add(ItemPalletVO(0,isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
|
||||
SilexCallback<List<ItemPalletVO>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<ItemPalletVO> = ArrayList()
|
||||
listError.add(
|
||||
ItemPalletVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
)
|
||||
_expeditionPalletList.value = ItemPalletListVO(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<ItemPalletVO>>,
|
||||
response: Response<List<ItemPalletVO>>
|
||||
) {
|
||||
if (response.body() != null){
|
||||
override fun onSuccess(response: Response<List<ItemPalletVO>>) {
|
||||
if (response.body() != null) {
|
||||
_expeditionPalletList.value = response.body()?.let { ItemPalletListVO(it) }
|
||||
}else{
|
||||
val listError:ArrayList<ItemPalletVO> = ArrayList()
|
||||
listError.add(ItemPalletVO(0,isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
|
||||
} else {
|
||||
val listError: ArrayList<ItemPalletVO> = ArrayList()
|
||||
listError.add(
|
||||
ItemPalletVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
)
|
||||
_expeditionPalletList.value = ItemPalletListVO(listError)
|
||||
}
|
||||
}
|
||||
|
@ -67,24 +74,38 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun expeditionScanAdd(vPalletFk:Int,vTruckFk:Int){
|
||||
silex.expeditionScanAdd(vPalletFk,vTruckFk).enqueue(object :
|
||||
Callback<List<ItemScanVO>> {
|
||||
override fun onFailure(call: Call<List<ItemScanVO>>, t: Throwable) {
|
||||
val listError:ArrayList<ItemScanVO> = ArrayList()
|
||||
listError.add(ItemScanVO("",0,isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
|
||||
fun expeditionScanAdd(vPalletFk: Int, vTruckFk: Int) {
|
||||
silex.expeditionScanAdd(vPalletFk, vTruckFk).enqueue(object :
|
||||
SilexCallback<List<ItemScanVO>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<ItemScanVO> = ArrayList()
|
||||
listError.add(
|
||||
ItemScanVO(
|
||||
"",
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
)
|
||||
_scanList.value = ItemScanList(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<ItemScanVO>>,
|
||||
response: Response<List<ItemScanVO>>
|
||||
) {
|
||||
if (response.body() != null){
|
||||
override fun onSuccess(response: Response<List<ItemScanVO>>) {
|
||||
if (response.body() != null) {
|
||||
_scanList.value = response.body()?.let { ItemScanList(it) }
|
||||
}else{
|
||||
val listError:ArrayList<ItemScanVO> = ArrayList()
|
||||
listError.add(ItemScanVO("",0,isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
|
||||
} else {
|
||||
val listError: ArrayList<ItemScanVO> = ArrayList()
|
||||
listError.add(
|
||||
ItemScanVO(
|
||||
"",
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
)
|
||||
_scanList.value = ItemScanList(listError)
|
||||
}
|
||||
}
|
||||
|
@ -92,36 +113,51 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun expeditionScanPut(vPalletFk:Int,vExpeditionFk:Int){
|
||||
silex.expeditionScanPut(vPalletFk,vExpeditionFk).enqueue(object : Callback<Any>{
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
|
||||
}
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful){
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
|
||||
}else{
|
||||
_response.value = ResponseItemVO(isError = false,response = response.message())
|
||||
fun expeditionScanPut(vPalletFk: Int, vExpeditionFk: Int) {
|
||||
silex.expeditionScanPut(vPalletFk, vExpeditionFk)
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
_response.value = ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun checkRouteExpeditionScanPut(vPalletFk:Int,vExpeditionFk:Int){
|
||||
silex.checkRouteExpeditionScanPut(vPalletFk,vExpeditionFk).enqueue(object : Callback<String>{
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
|
||||
}
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
//sergio: espera repuesta en el body
|
||||
if (response.body() == null){
|
||||
_responseCheckexpeditionScanPut.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
|
||||
}else{
|
||||
_responseCheckexpeditionScanPut.value = ResponseItemVO(isError = false,response = response.body()!!)
|
||||
fun checkRouteExpeditionScanPut(vPalletFk: Int, vExpeditionFk: Int) {
|
||||
silex.checkRouteExpeditionScanPut(vPalletFk, vExpeditionFk)
|
||||
.enqueue(object : SilexCallback<String>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
override fun onSuccess(response: Response<String>) {
|
||||
//sergio: espera repuesta en el body
|
||||
if (response.body() == null) {
|
||||
_responseCheckexpeditionScanPut.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_responseCheckexpeditionScanPut.value =
|
||||
ResponseItemVO(isError = false, response = response.body()!!)
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ class ExpeditionScanSorterFragment(
|
|||
private fun expeditionscan(ExpeditionScan: String) {
|
||||
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
viewModel.expedition_scan(getData(USER),getData(PASSWORD), ExpeditionScan)
|
||||
viewModel.expedition_scan(ExpeditionScan)
|
||||
itemScaned = ExpeditionScan
|
||||
|
||||
}
|
||||
|
|
|
@ -3,9 +3,7 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment
|
|||
import android.content.Context
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.GetPaletizadoresUserCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
|
@ -13,18 +11,15 @@ import retrofit2.Call
|
|||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class ExpeditionScanSorterViewModel(context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val GetPaletizadoresUserCase: GetPaletizadoresUserCase =
|
||||
GetPaletizadoresUserCase(context)
|
||||
class ExpeditionScanSorterViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val _responsescan by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responsescan: LiveData<ResponseItemVO>
|
||||
get() = _responsescan
|
||||
|
||||
|
||||
fun expedition_scan(usuario: String, password: String, vExpeditionId: String) {
|
||||
GetPaletizadoresUserCase.expedition_scan(usuario, password, vExpeditionId)
|
||||
fun expedition_scan(vExpeditionId: String) {
|
||||
silex.expedition_scan(vExpeditionId)
|
||||
.enqueue(object : Callback<Void> {
|
||||
override fun onFailure(call: Call<Void>, t: Throwable) {
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import android.content.Context
|
|||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import es.verdnatura.domain.GetPaletizadoresUserCase
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
|
@ -18,10 +18,8 @@ import retrofit2.Call
|
|||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class ExpeditionScanViewModel(context: Context) : BaseViewModel(context) {
|
||||
class ExpeditionScanViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val getPaletizadoresUserCase: GetPaletizadoresUserCase =
|
||||
GetPaletizadoresUserCase(context)
|
||||
|
||||
private val _expeditionScanList by lazy { MutableLiveData<ItemExpeditionScanList>() }
|
||||
val loadExpeditionScanList = Transformations.map(_expeditionScanList) { Event(it) }
|
||||
|
@ -45,8 +43,8 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel(context) {
|
|||
|
||||
fun expeditionScanList(vPalletFk: Int) {
|
||||
silex.expeditionScanList(vPalletFk).enqueue(object :
|
||||
Callback<List<ItemExpeditionScanVO>> {
|
||||
override fun onFailure(call: Call<List<ItemExpeditionScanVO>>, t: Throwable) {
|
||||
SilexCallback<List<ItemExpeditionScanVO>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<ItemExpeditionScanVO> = ArrayList()
|
||||
listError.add(
|
||||
ItemExpeditionScanVO(0,
|
||||
|
@ -57,10 +55,8 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel(context) {
|
|||
_expeditionScanList.value = ItemExpeditionScanList(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<ItemExpeditionScanVO>>,
|
||||
response: Response<List<ItemExpeditionScanVO>>
|
||||
) {
|
||||
override fun onSuccess(response: Response<List<ItemExpeditionScanVO>>) {
|
||||
|
||||
if (response.body() != null) {
|
||||
_expeditionScanList.value = response.body()?.let { ItemExpeditionScanList(it) }
|
||||
} else {
|
||||
|
@ -84,8 +80,8 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel(context) {
|
|||
fun expeditionScanAdd(vPalletFk: Int, vTruckFk: Int) {
|
||||
silex.expeditionScanAdd(vPalletFk, vTruckFk)
|
||||
.enqueue(object :
|
||||
Callback<List<ItemScanVO>> {
|
||||
override fun onFailure(call: Call<List<ItemScanVO>>, t: Throwable) {
|
||||
SilexCallback<List<ItemScanVO>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<ItemScanVO> = ArrayList()
|
||||
listError.add(
|
||||
ItemScanVO(
|
||||
|
@ -100,10 +96,8 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel(context) {
|
|||
_scanList.value = ItemScanList(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<ItemScanVO>>,
|
||||
response: Response<List<ItemScanVO>>
|
||||
) {
|
||||
override fun onSuccess(response: Response<List<ItemScanVO>>) {
|
||||
|
||||
if (response.body() != null) {
|
||||
_scanList.value = response.body()?.let { ItemScanList(it) }
|
||||
} else {
|
||||
|
@ -130,8 +124,8 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel(context) {
|
|||
vExpeditionFk: Int
|
||||
) {
|
||||
silex.expeditionScanPut(vPalletFk, vExpeditionFk)
|
||||
.enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true, errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this), t.message!!
|
||||
|
@ -139,20 +133,11 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel(context) {
|
|||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()!!
|
||||
)
|
||||
)
|
||||
} else {
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -164,15 +149,16 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel(context) {
|
|||
silex.checkRouteExpeditionScanPut(
|
||||
vPalletFk,
|
||||
vExpeditionFk
|
||||
).enqueue(object : Callback<String> {
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
).enqueue(object : SilexCallback<String>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
|
||||
_responseCheckexpeditionScanPut.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
override fun onSuccess(response: Response<String>) {
|
||||
//sergio:se devuelve en el body
|
||||
if (response.body() == null) {
|
||||
_responseCheckexpeditionScanPut.value = ResponseItemVO(
|
||||
|
@ -194,8 +180,8 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel(context) {
|
|||
|
||||
fun expeditionScanDel( vScanFk: Int) {
|
||||
silex.expeditionScanDel(vScanFk)
|
||||
.enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
.enqueue(object : SilexCallback<Any> (context){
|
||||
override fun onError(t: Throwable) {
|
||||
_responseDeleteScan.value = ResponseItemVO(
|
||||
isError = true, errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this), t.message!!
|
||||
|
@ -203,18 +189,11 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel(context) {
|
|||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_responseDeleteScan.value = ResponseItemVO(
|
||||
isError = true, errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this), response.message()!!
|
||||
)
|
||||
)
|
||||
} else {
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
|
||||
_responseDeleteScan.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -1,40 +1,32 @@
|
|||
package es.verdnatura.presentation.view.feature.paletizador.fragment
|
||||
|
||||
|
||||
//import es.verdnatura.presentation.view.feature.paletizador.model.itemExpeditionDynamicsList
|
||||
import android.content.Context
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.airbnb.lottie.parser.IntegerParser
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.JsonObject
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import es.verdnatura.domain.GetPaletizadoresUserCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingTypeList
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.itemExpedetionState
|
||||
//import es.verdnatura.presentation.view.feature.paletizador.model.itemExpeditionDynamicsList
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.itemsExpeditionDynamics
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
|
||||
class ExpeditionStateViewModel(context: Context) : BaseViewModel(context) {
|
||||
private val GetPaletizadoresUserCase: GetPaletizadoresUserCase =
|
||||
GetPaletizadoresUserCase(context)
|
||||
class ExpeditionStateViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val _itemcard by lazy { MutableLiveData<ItemCardVO>() }
|
||||
val itemcard: LiveData<ItemCardVO>
|
||||
get() = _itemcard
|
||||
|
||||
|
||||
private val _itemexpeditionlist by lazy { MutableLiveData<itemExpedetionState>() }
|
||||
val itemexpeditionlist: LiveData<itemExpedetionState>
|
||||
get() = _itemexpeditionlist
|
||||
|
@ -57,46 +49,7 @@ class ExpeditionStateViewModel(context: Context) : BaseViewModel(context) {
|
|||
val itemsExpeditionlist: LiveData<ItemPackingTypeList>
|
||||
get() = _itemsExpeditionlist
|
||||
|
||||
|
||||
|
||||
|
||||
/* fun expedition_getState(expeditionFk: String, user: String, password: String) {
|
||||
GetPaletizadoresUserCase.expedition_getState(user, password, expeditionFk)
|
||||
.enqueue(object : Callback<itemExpedetionState> {
|
||||
|
||||
|
||||
|
||||
|
||||
override fun onFailure(call: Call<itemExpedetionState>, t: Throwable) {
|
||||
_itemexpedition.value = itemExpedetionState(
|
||||
isError = true,
|
||||
errorMessage = "Error al obtener " + expeditionFk + " Respuesta:" + t.message!!
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<itemExpedetionState>,
|
||||
response: Response<itemExpedetionState>
|
||||
) {
|
||||
if (response.body() != null) {
|
||||
_itemexpedition.value = response.body()!!
|
||||
|
||||
Log.i(
|
||||
"VERDNATURA:",
|
||||
"el resultado sin JSOBJECT es ${response.body().toString()}"
|
||||
)
|
||||
} else {
|
||||
_itemexpedition.value = itemExpedetionState(
|
||||
isError = true,
|
||||
errorMessage = "Error al obtener el estado de la expedición"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}*/
|
||||
|
||||
fun expedition_getStateJSON(expeditionFk: Int){
|
||||
fun expedition_getStateJSON(expeditionFk: Int) {
|
||||
silex.expedition_getStateJSON(expeditionFk)
|
||||
.enqueue(object : Callback<JsonObject> {
|
||||
override fun onFailure(call: Call<JsonObject>, t: Throwable) {
|
||||
|
@ -105,7 +58,8 @@ class ExpeditionStateViewModel(context: Context) : BaseViewModel(context) {
|
|||
|
||||
_itemexpedition.value = itemExpedetionState(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!), list= listProperties
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!),
|
||||
list = listProperties
|
||||
|
||||
)
|
||||
}
|
||||
|
@ -117,11 +71,12 @@ class ExpeditionStateViewModel(context: Context) : BaseViewModel(context) {
|
|||
|
||||
if (response.body() != null) {
|
||||
|
||||
listProperties=getListFromJSON(response.body()!!.asJsonObject)
|
||||
listProperties = getListFromJSON(response.body()!!.asJsonObject)
|
||||
|
||||
_itemexpedition.value = itemExpedetionState(
|
||||
isError = false,
|
||||
errorMessage = "",list = listProperties)
|
||||
errorMessage = "", list = listProperties
|
||||
)
|
||||
|
||||
let {
|
||||
|
||||
|
@ -131,7 +86,10 @@ class ExpeditionStateViewModel(context: Context) : BaseViewModel(context) {
|
|||
} else {
|
||||
_itemexpedition.value = itemExpedetionState(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()),list = listProperties
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
), list = listProperties
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -154,9 +112,9 @@ class ExpeditionStateViewModel(context: Context) : BaseViewModel(context) {
|
|||
|
||||
var expeditionState: Map<String, String?> =
|
||||
gson.fromJson(json, object : TypeToken<Map<String, String?>>() {}.type)
|
||||
expeditionState.forEach {
|
||||
expeditionState.forEach {
|
||||
|
||||
list.add(itemsExpeditionDynamics(key=it.key, it.value?:""))
|
||||
list.add(itemsExpeditionDynamics(key = it.key, it.value ?: ""))
|
||||
|
||||
}
|
||||
return list
|
||||
|
|
|
@ -4,9 +4,8 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment
|
|||
import android.content.Context
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import es.verdnatura.domain.GetPaletizadoresUserCase
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.common.Event
|
||||
|
@ -17,9 +16,7 @@ import retrofit2.Call
|
|||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class ExpeditionTruckListViewModel(context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val getPaletizadoresUserCase: GetPaletizadoresUserCase = GetPaletizadoresUserCase(context)
|
||||
class ExpeditionTruckListViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val _expeditionTruckList by lazy { MutableLiveData<ItemExpeditionTruckList>() }
|
||||
val loadExpeditionTruckList = Transformations.map(_expeditionTruckList) { Event(it) }
|
||||
|
@ -28,26 +25,37 @@ class ExpeditionTruckListViewModel(context: Context) : BaseViewModel(context) {
|
|||
val loadResponseExpeditionAdd = Transformations.map(_response) { Event(it) }
|
||||
|
||||
|
||||
|
||||
|
||||
fun expeditionTruckList(){
|
||||
fun expeditionTruckList() {
|
||||
silex.expeditionTruckList().enqueue(object :
|
||||
Callback<List<ItemExpeditionTruckVO>> {
|
||||
override fun onFailure(call: Call<List<ItemExpeditionTruckVO>>, t: Throwable) {
|
||||
val listError:ArrayList<ItemExpeditionTruckVO> = ArrayList()
|
||||
listError.add(ItemExpeditionTruckVO(0,isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
|
||||
SilexCallback<List<ItemExpeditionTruckVO>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<ItemExpeditionTruckVO> = ArrayList()
|
||||
listError.add(
|
||||
ItemExpeditionTruckVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
)
|
||||
_expeditionTruckList.value = ItemExpeditionTruckList(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<ItemExpeditionTruckVO>>,
|
||||
response: Response<List<ItemExpeditionTruckVO>>
|
||||
) {
|
||||
if (response.body() != null){
|
||||
_expeditionTruckList.value = response.body()?.let { ItemExpeditionTruckList(it) }
|
||||
}else{
|
||||
val listError:ArrayList<ItemExpeditionTruckVO> = ArrayList()
|
||||
listError.add(ItemExpeditionTruckVO(0,isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
|
||||
override fun onSuccess(response: Response<List<ItemExpeditionTruckVO>>) {
|
||||
if (response.body() != null) {
|
||||
_expeditionTruckList.value =
|
||||
response.body()?.let { ItemExpeditionTruckList(it) }
|
||||
} else {
|
||||
val listError: ArrayList<ItemExpeditionTruckVO> = ArrayList()
|
||||
listError.add(
|
||||
ItemExpeditionTruckVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
)
|
||||
_expeditionTruckList.value = ItemExpeditionTruckList(listError)
|
||||
}
|
||||
}
|
||||
|
@ -55,17 +63,26 @@ class ExpeditionTruckListViewModel(context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun expeditionTruckAdd(vHour:String,vDescription:String){
|
||||
silex.expeditionTruckAdd(vHour,vDescription).enqueue(object : Callback<Any>{
|
||||
fun expeditionTruckAdd(vHour: String, vDescription: String) {
|
||||
silex.expeditionTruckAdd(vHour, vDescription).enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful){
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
|
||||
}else{
|
||||
_response.value = ResponseItemVO(isError = false,response = response.message())
|
||||
if (!response.isSuccessful) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_response.value = ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment
|
|||
import android.content.Context
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.GetPaletizadoresUserCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
|
@ -14,10 +13,8 @@ import retrofit2.Callback
|
|||
import retrofit2.Response
|
||||
|
||||
|
||||
class PalletScanViewModel(context: Context) : BaseViewModel(context) {
|
||||
class PalletScanViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val GetPaletizadoresUserCase: GetPaletizadoresUserCase =
|
||||
GetPaletizadoresUserCase(context)
|
||||
|
||||
private val _responseScan by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseScan: LiveData<ResponseItemVO>
|
||||
|
|
|
@ -5,17 +5,14 @@ import android.view.View.GONE
|
|||
import android.view.View.VISIBLE
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class ParkingViewModel(context: Context) : BaseViewModel(context) {
|
||||
// private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context)
|
||||
|
||||
class ParkingViewModel(val context: Context) : BaseViewModel(context) {
|
||||
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val response: LiveData<ResponseItemVO>
|
||||
get() = _response
|
||||
|
@ -41,28 +38,18 @@ class ParkingViewModel(context: Context) : BaseViewModel(context) {
|
|||
fun parking(scanItem: String, parking: String) {
|
||||
ProgressLoading(VISIBLE)
|
||||
silex.shelvingPark(scanItem, parking).enqueue(object :
|
||||
Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
ProgressLoading(GONE)
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
ProgressLoading(GONE)
|
||||
|
||||
if (response.isSuccessful)
|
||||
_response.value = ResponseItemVO(isError = false, response = response.message())
|
||||
else
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
|
||||
_response.value = ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -5,19 +5,14 @@ import android.view.View.GONE
|
|||
import android.view.View.VISIBLE
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.GetUbicadorUserCase
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class ParkingSaleViewModel(context: Context) : BaseViewModel(context) {
|
||||
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context)
|
||||
|
||||
class ParkingSaleViewModel(val context: Context) : BaseViewModel(context) {
|
||||
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val response: LiveData<ResponseItemVO>
|
||||
get() = _response
|
||||
|
@ -41,25 +36,26 @@ class ParkingSaleViewModel(context: Context) : BaseViewModel(context) {
|
|||
fun hideProgressLoading() {
|
||||
_isLoading.value = false
|
||||
}
|
||||
fun ProgressLoading(visibility:Int) {
|
||||
|
||||
fun ProgressLoading(visibility: Int) {
|
||||
_isLoadingProgress.value = visibility
|
||||
}
|
||||
|
||||
fun parking(scanItem: String,parking:String){
|
||||
fun parking(scanItem: String, parking: String) {
|
||||
ProgressLoading(VISIBLE)
|
||||
silex.shelvingPark(scanItem,parking).enqueue(object :
|
||||
Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
|
||||
silex.shelvingPark(scanItem, parking).enqueue(object :
|
||||
SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
|
||||
ProgressLoading(GONE)
|
||||
if (!response.isSuccessful){
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
|
||||
}else{
|
||||
_response.value = ResponseItemVO(isError = false,response = response.message())
|
||||
}
|
||||
_response.value = ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -510,7 +510,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
|
|||
)
|
||||
)*/
|
||||
|
||||
val working_in_test=false
|
||||
val working_in_test=true
|
||||
if (working_in_test){
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
|
|
|
@ -3,68 +3,46 @@ package es.verdnatura.presentation.view.feature.precontrol
|
|||
import android.content.Context
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.domain.GetPreControladorUserCase
|
||||
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class PreControladorViewModel(context: Context) : BaseViewModel(context) {
|
||||
class PreControladorViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val contextApp=context
|
||||
private val _collectionTicketList by lazy { MutableLiveData<CollectionVO>() }
|
||||
private val getPreControladorUserCase: GetPreControladorUserCase = GetPreControladorUserCase(context)
|
||||
|
||||
val collectionTicketList: LiveData<CollectionVO>
|
||||
get() = _collectionTicketList
|
||||
|
||||
fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String,type:String){
|
||||
getPreControladorUserCase.collectionTicketGet(usuario,password,collectionFk,sectorFk,"0",type).enqueue(object :
|
||||
Callback<CollectionVO> {
|
||||
override fun onFailure(call: Call<CollectionVO>, t: Throwable) {
|
||||
_collectionTicketList.value = CollectionVO(0,isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))
|
||||
fun collectionTicketGet(collectionFk: String, sectorFk: String, type: String) {
|
||||
silex.collection_getTickets(collectionFk, sectorFk, "0", type).enqueue(object :
|
||||
SilexCallback<CollectionVO>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_collectionTicketList.value = CollectionVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
override fun onResponse(
|
||||
call: Call<CollectionVO>,
|
||||
response: Response<CollectionVO>
|
||||
) {
|
||||
if (response.body() != null){
|
||||
_collectionTicketList.value = response.body()?.let { it.map(contextApp) }
|
||||
}else{
|
||||
_collectionTicketList.value = CollectionVO(0,isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
|
||||
|
||||
override fun onSuccess(response: Response<CollectionVO>) {
|
||||
if (response.body() != null) {
|
||||
_collectionTicketList.value = response.body()?.let { it.map(context) }
|
||||
} else {
|
||||
_collectionTicketList.value = CollectionVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/* sergio: para el caso que íbamos a diferenciar pero ahora se hará desde Collection_getTickets pasánsole parámetro
|
||||
|
||||
fun collection_getTickets(usuario:String,password:String,collectionFk:String,sectorFk:String){
|
||||
//getPreControladorUserCase.collection_getTickets(usuario,password,collectionFk,sectorFk,"0").enqueue(object :
|
||||
getPreControladorUserCase.collection_getTickets(usuario,password,collectionFk,sectorFk,"0").enqueue(object :
|
||||
Callback<CollectionVO> {
|
||||
override fun onFailure(call: Call<CollectionVO>, t: Throwable) {
|
||||
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = t.message!!)
|
||||
}
|
||||
override fun onResponse(
|
||||
call: Call<CollectionVO>,
|
||||
response: Response<CollectionVO>
|
||||
) {
|
||||
if (response.body() != null){
|
||||
_collectionTicketList.value = response.body()?.let { it.map() }
|
||||
}else{
|
||||
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = "No hay tickets para sacar")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
}
|
|
@ -555,7 +555,6 @@ class EndSacadorFragment(
|
|||
|
||||
if (!workerId.isNullOrEmpty())
|
||||
viewModel.sendChekingPresence(
|
||||
token = getData(TOKEN),
|
||||
workerId = workerId,
|
||||
message = message
|
||||
)
|
||||
|
@ -898,8 +897,6 @@ class EndSacadorFragment(
|
|||
itemShelvingFkStored = itemShelvingFk
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
viewModel.getIdFromCode(
|
||||
usuario = getData(USER),
|
||||
password = getData(PASSWORD),
|
||||
code = customDialogList.getValueTwo()
|
||||
)
|
||||
customDialogList.dismiss()
|
||||
|
@ -946,8 +943,6 @@ class EndSacadorFragment(
|
|||
itemShelvingFkStored = itemShelvingFk
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
viewModel.getIdFromCode(
|
||||
usuario = getData(USER),
|
||||
password = getData(PASSWORD),
|
||||
code = customDialogList.getValueTwo()
|
||||
)
|
||||
customDialogList.dismiss()
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package es.verdnatura.presentation.view.feature.presacador.fragment
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import android.util.Log.d
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.*
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
|
@ -13,6 +11,7 @@ import es.verdnatura.presentation.common.ResponseItemVO
|
|||
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
||||
import es.verdnatura.presentation.view.feature.collection.listSaleSalix
|
||||
import es.verdnatura.presentation.view.feature.collection.saleSalix
|
||||
import es.verdnatura.presentation.view.feature.login.model.SalixMessageVO
|
||||
import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.mapper.toDateFormat
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionListVO
|
||||
|
@ -20,18 +19,16 @@ import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
|||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val contextApp=context
|
||||
/*private val contextApp=context
|
||||
private val getPreSacadorUseCase: GetPreSacadorUseCase = GetPreSacadorUseCase(context)
|
||||
private val getSacadorControladorUserCase: GetSacadorControladorUserCase =
|
||||
GetSacadorControladorUserCase(context)
|
||||
|
||||
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context)
|
||||
private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase(context)
|
||||
private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase(context)*/
|
||||
|
||||
private val _salesList by lazy { MutableLiveData<List<PreSacadorItemVO>>() }
|
||||
val salesList: LiveData<List<PreSacadorItemVO>>
|
||||
|
@ -108,56 +105,46 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
get() = _responseSaleupdateIsChecked
|
||||
|
||||
|
||||
fun ticketToPrePrepare(usuario: String, password: String, ticketFk: String, sectorFk: String) {
|
||||
getPreSacadorUseCase.ticketToPrePrepare(usuario, password, ticketFk, sectorFk)
|
||||
.enqueue(object :
|
||||
Callback<List<PreSacadorItemVO>> {
|
||||
override fun onFailure(call: Call<List<PreSacadorItemVO>>, t: Throwable) {
|
||||
//d("VERDNATURA::", "ha fallado")
|
||||
_salesList.value = listOf()
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<PreSacadorItemVO>>,
|
||||
response: Response<List<PreSacadorItemVO>>
|
||||
) {
|
||||
if (response.body() != null) {
|
||||
_salesList.value = response.body()?.let { it }
|
||||
} else {
|
||||
_salesList.value = listOf()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
/* fun ticketToPrePrepare(usuario: String, password: String, ticketFk: String, sectorFk: String) {
|
||||
silex.ticketToPrePrepare(usuario, password, ticketFk, sectorFk)
|
||||
.enqueue(object :
|
||||
Callback<List<PreSacadorItemVO>> {
|
||||
override fun onFailure(call: Call<List<PreSacadorItemVO>>, t: Throwable) {
|
||||
//d("VERDNATURA::", "ha fallado")
|
||||
_salesList.value = listOf()
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<PreSacadorItemVO>>,
|
||||
response: Response<List<PreSacadorItemVO>>
|
||||
) {
|
||||
if (response.body() != null) {
|
||||
_salesList.value = response.body()?.let { it }
|
||||
} else {
|
||||
_salesList.value = listOf()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
*/
|
||||
fun collectionStickerPrint(
|
||||
collectionFk: Int,
|
||||
sectorFk: Int
|
||||
) {
|
||||
getSacadorControladorUserCase.collectionStickerPrint(
|
||||
silex.collectionStickerPrint(
|
||||
collectionFk,
|
||||
sectorFk
|
||||
).enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
).enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.message()!!)
|
||||
}
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.message()!!)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -166,63 +153,23 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
ticketFk: String,
|
||||
parking: String
|
||||
) {
|
||||
silex.shelvingPark(ticketFk, parking)
|
||||
.enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
silex.shelvingPark(ticketFk, parking)
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/* fun saleParking_add(usuario: String, password: String, sales:List<String>,parking: String)
|
||||
{
|
||||
getUbicadorUserCase.saleParking_add(usuario, password, sales, parking)
|
||||
.enqueue(object : Callback<String>
|
||||
{
|
||||
override fun onFailure(call: Call<String>, t: Throwable)
|
||||
{
|
||||
_responseParkingAdd.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<String>, response: Response<String>)
|
||||
{
|
||||
if (!response.isSuccessfull)
|
||||
{
|
||||
_responseParkingAdd.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
|
||||
)
|
||||
} else
|
||||
{
|
||||
_responseParkingAdd.value =
|
||||
ResponseItemVO(isError = false, response = response.body()!!)
|
||||
}
|
||||
}
|
||||
})
|
||||
}*/
|
||||
|
||||
fun itemPlacementSupplyAiming(
|
||||
shelvingFk: String,
|
||||
quantity: Int,
|
||||
|
@ -233,11 +180,12 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
quantity,
|
||||
itemFk
|
||||
).enqueue(object :
|
||||
Callback<List<PlacementSupplyVO>> {
|
||||
override fun onFailure(call: Call<List<PlacementSupplyVO>>, t: Throwable) {
|
||||
SilexCallback<List<PlacementSupplyVO>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<PlacementSupplyVO> = ArrayList()
|
||||
listError.add(
|
||||
PlacementSupplyVO(itemShelvingFk = 0,
|
||||
PlacementSupplyVO(
|
||||
itemShelvingFk = 0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
|
@ -245,16 +193,14 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
_placementSuppleyList.value = PlacementSupplyListVO(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<PlacementSupplyVO>>,
|
||||
response: Response<List<PlacementSupplyVO>>
|
||||
) {
|
||||
override fun onSuccess(response: Response<List<PlacementSupplyVO>>) {
|
||||
if (response.body() != null) {
|
||||
_placementSuppleyList.value = response.body()?.let { PlacementSupplyListVO(it) }
|
||||
} else {
|
||||
val listError: ArrayList<PlacementSupplyVO> = ArrayList()
|
||||
listError.add(
|
||||
PlacementSupplyVO(itemShelvingFk = 0,
|
||||
PlacementSupplyVO(
|
||||
itemShelvingFk = 0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
|
@ -277,8 +223,8 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
itemShelvingFk,
|
||||
saleFk,
|
||||
quantity
|
||||
).enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
).enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseItemShelvingSaleSupplyAdd.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
|
@ -286,24 +232,13 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_responseItemShelvingSaleSupplyAdd.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_responseItemShelvingSaleSupplyAdd.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
_responseItemShelvingSaleSupplyAdd.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun saleTrackingReplace(
|
||||
saleFk: String,
|
||||
vOriginalQuantity: String,
|
||||
|
@ -312,47 +247,37 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
vBuyFk: String
|
||||
) {
|
||||
|
||||
getSacadorControladorUserCase.saleTrackingReplace(
|
||||
silex.saleTrackingReplace(
|
||||
saleFk,
|
||||
vOriginalQuantity,
|
||||
vStateFk,
|
||||
vIsChecked,
|
||||
vBuyFk
|
||||
).enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
).enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_response.value = ResponseItemVO(isError = false, response = "")
|
||||
}
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_response.value = ResponseItemVO(isError = false, response = "")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun getIdFromCode(usuario: String, password: String, code: String) {
|
||||
getSacadorControladorUserCase.getIdFromCode(usuario, password, code)
|
||||
.enqueue(object : Callback<String> {
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
fun getIdFromCode(code: String) {
|
||||
silex.getIdFromCode(code)
|
||||
.enqueue(object : SilexCallback<String>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseCode.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
override fun onSuccess(response: Response<String>) {
|
||||
//sergio: espera item en el body
|
||||
if (response.body() == null) {
|
||||
_responseCode.value = ResponseItemVO(
|
||||
|
@ -371,67 +296,46 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun saleTrackingDel(usuario: String, password: String, saleFk: String) {
|
||||
getSacadorControladorUserCase.saleTrackingDel(usuario, password, saleFk)
|
||||
.enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
fun saleTrackingDel(saleFk: String) {
|
||||
silex.saleTrackingDel(saleFk)
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun saleMove(
|
||||
usuario: String,
|
||||
password: String,
|
||||
saleFk: String,
|
||||
quantity: String,
|
||||
originalQuantity: String
|
||||
) {
|
||||
getSacadorControladorUserCase.saleMove(
|
||||
usuario,
|
||||
password,
|
||||
silex.saleMove(
|
||||
saleFk,
|
||||
quantity,
|
||||
originalQuantity
|
||||
).enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
).enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseSaleMove.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_responseSaleMove.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_responseSaleMove.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_responseSaleMove.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -449,27 +353,17 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
type,
|
||||
warehouseFk,
|
||||
originalQuantity
|
||||
).enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
).enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseMissingTrash.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_responseMissingTrash.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_responseMissingTrash.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_responseMissingTrash.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -480,78 +374,59 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
) {
|
||||
salix.collectionIncreaseQuantitySalix(
|
||||
SalixSaleQuantity(
|
||||
saleFk,
|
||||
quantity)
|
||||
).enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
saleFk,
|
||||
quantity
|
||||
)
|
||||
).enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseIncQuantity.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_responseIncQuantity.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_responseIncQuantity.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_responseIncQuantity.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun collectionIncreaseQuantitySilex(
|
||||
usuario: String,
|
||||
password: String,
|
||||
saleFk: String,
|
||||
quantity: String
|
||||
) {
|
||||
getSacadorControladorUserCase.collectionIncreaseQuantity(
|
||||
usuario,
|
||||
password,
|
||||
silex.collectionIncreaseQuantity(
|
||||
saleFk,
|
||||
quantity
|
||||
).enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
).enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseIncQuantity.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_responseIncQuantity.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_responseIncQuantity.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_responseIncQuantity.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
fun sendChekingPresence(
|
||||
token: String,
|
||||
workerId: String,
|
||||
message: String,
|
||||
) {
|
||||
try {
|
||||
getLoginUserCase.sendChekingPresence(token, workerId.toInt(), message)
|
||||
.enqueue(object : Callback<Boolean> {
|
||||
salix.sendChekingPresence(
|
||||
params = SalixMessageVO(
|
||||
workerId = workerId.toInt(),
|
||||
message = message
|
||||
)
|
||||
)
|
||||
.enqueue(object : SilexCallback<Boolean>(context) {
|
||||
override fun onResponse(call: Call<Boolean>, response: Response<Boolean>) {
|
||||
if (!response.isSuccessful || response.message() == "false") {
|
||||
_responseSalixMessage.value = ResponseItemVO(
|
||||
|
@ -565,7 +440,7 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<Boolean>, t: Throwable) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseSalixMessage.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
|
@ -576,7 +451,7 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
})
|
||||
} catch (e: Exception) {
|
||||
//Log.d("error " + e.message)
|
||||
//Log.d("error " + e.message)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -584,11 +459,12 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
fun sectorCollection_get() {
|
||||
|
||||
silex.sectorCollection_get().enqueue(object :
|
||||
Callback<List<CollectionVO>> {
|
||||
override fun onFailure(call: Call<List<CollectionVO>>, t: Throwable) {
|
||||
SilexCallback<List<CollectionVO>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<CollectionVO> = ArrayList()
|
||||
listError.add(
|
||||
CollectionVO(0,
|
||||
CollectionVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
|
@ -597,17 +473,16 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<CollectionVO>>,
|
||||
response: Response<List<CollectionVO>>
|
||||
) {
|
||||
override fun onSuccess(response: Response<List<CollectionVO>>) {
|
||||
|
||||
if (response.body() != null) {
|
||||
_collectionList.value =
|
||||
response.body()?.let { CollectionListVO(it.toDateFormat(contextApp)) }
|
||||
response.body()?.let { CollectionListVO(it.toDateFormat(context)) }
|
||||
} else {
|
||||
val listError: ArrayList<CollectionVO> = ArrayList()
|
||||
listError.add(
|
||||
CollectionVO(0,
|
||||
CollectionVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
|
@ -628,8 +503,8 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
) {
|
||||
silex.sectorCollection_new(sectorFk).enqueue(
|
||||
object :
|
||||
Callback<Unit> {
|
||||
override fun onFailure(call: Call<Unit>, t: Throwable) {
|
||||
SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseNew.value =
|
||||
ResponseItemVO(
|
||||
isError = true,
|
||||
|
@ -639,46 +514,17 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
)
|
||||
)
|
||||
|
||||
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<Unit>,
|
||||
response: Response<Unit>
|
||||
) {
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
|
||||
if (!response.isSuccessful) {
|
||||
_responseNew.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this), response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_responseNew.value = ResponseItemVO(
|
||||
isError = false,
|
||||
errorMessage = "" + getMessageFromAllResponse(
|
||||
nameofFunction(this), response.message()
|
||||
)
|
||||
_responseNew.value = ResponseItemVO(
|
||||
isError = false,
|
||||
errorMessage = "" + getMessageFromAllResponse(
|
||||
nameofFunction(this), response.message()
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Log.i("Salix","Mensaje enviado a salix")
|
||||
|
||||
|
||||
/*if (response.body() != null) {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.body()!!)
|
||||
} else {
|
||||
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
|
||||
)
|
||||
|
||||
}*/
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -692,15 +538,12 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
vSectorFk.toString()
|
||||
)
|
||||
.enqueue(object :
|
||||
Callback<List<PreSacadorItemVO>> {
|
||||
override fun onFailure(call: Call<List<PreSacadorItemVO>>, t: Throwable) {
|
||||
SilexCallback<List<PreSacadorItemVO>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_salesList.value = listOf()
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<PreSacadorItemVO>>,
|
||||
response: Response<List<PreSacadorItemVO>>
|
||||
) {
|
||||
override fun onSuccess(response: Response<List<PreSacadorItemVO>>) {
|
||||
if (response.body() != null) {
|
||||
_salesList.value = response.body()?.let { it }
|
||||
|
||||
|
@ -721,8 +564,8 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
vSectorCollectionFk
|
||||
).enqueue(
|
||||
object :
|
||||
Callback<Unit> {
|
||||
override fun onFailure(call: Call<Unit>, t: Throwable) {
|
||||
SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value =
|
||||
ResponseItemVO(
|
||||
isError = true,
|
||||
|
@ -735,29 +578,13 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<Unit>,
|
||||
response: Response<Unit>
|
||||
) {
|
||||
|
||||
if (!response.isSuccessful) {
|
||||
_responseSaleGroupAdd.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this), response.message()
|
||||
)
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_responseSaleGroupAdd.value = ResponseItemVO(
|
||||
isError = false,
|
||||
errorMessage = "" + getMessageFromAllResponse(
|
||||
nameofFunction(this), response.message()
|
||||
)
|
||||
} else {
|
||||
_responseSaleGroupAdd.value = ResponseItemVO(
|
||||
isError = false,
|
||||
errorMessage = "" + getMessageFromAllResponse(
|
||||
nameofFunction(this), response.message()
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -767,8 +594,8 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
) {
|
||||
silex.saleTracking_addPrevOK(vSectorCollectionFk).enqueue(
|
||||
object :
|
||||
Callback<Unit> {
|
||||
override fun onFailure(call: Call<Unit>, t: Throwable) {
|
||||
SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseSaleAddPrevOK.value =
|
||||
ResponseItemVO(
|
||||
isError = true,
|
||||
|
@ -778,33 +605,16 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
)
|
||||
)
|
||||
|
||||
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<Unit>,
|
||||
response: Response<Unit>
|
||||
) {
|
||||
|
||||
if (!response.isSuccessful) {
|
||||
_responseSaleAddPrevOK.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this), response.message()
|
||||
)
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_responseSaleAddPrevOK.value = ResponseItemVO(
|
||||
isError = false,
|
||||
errorMessage = ""
|
||||
+ getMessageFromAllResponse(
|
||||
nameofFunction(this), response.message()
|
||||
)
|
||||
} else {
|
||||
_responseSaleAddPrevOK.value = ResponseItemVO(
|
||||
isError = false,
|
||||
errorMessage = ""
|
||||
+ getMessageFromAllResponse(
|
||||
nameofFunction(this), response.message()
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -816,8 +626,8 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
silex.saleTracking_updateIsChecked(vSaleFk, vIsChecked)
|
||||
.enqueue(
|
||||
object :
|
||||
Callback<Unit> {
|
||||
override fun onFailure(call: Call<Unit>, t: Throwable) {
|
||||
SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseSaleupdateIsChecked.value =
|
||||
ResponseItemVO(
|
||||
isError = true,
|
||||
|
@ -830,30 +640,14 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<Unit>,
|
||||
response: Response<Unit>
|
||||
) {
|
||||
|
||||
if (!response.isSuccessful) {
|
||||
_responseSaleupdateIsChecked.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this), response.message()
|
||||
)
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_responseSaleupdateIsChecked.value = ResponseItemVO(
|
||||
isError = false,
|
||||
errorMessage = ""
|
||||
+ getMessageFromAllResponse(
|
||||
nameofFunction(this), response.message()
|
||||
)
|
||||
} else {
|
||||
_responseSaleupdateIsChecked.value = ResponseItemVO(
|
||||
isError = false,
|
||||
errorMessage = ""
|
||||
+ getMessageFromAllResponse(
|
||||
nameofFunction(this), response.message()
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -875,26 +669,25 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
|
||||
_responseItemShelvingUpdate.value =
|
||||
ResponseItemVO(isError = false, response = response.message()!!)
|
||||
_responseItemShelvingUpdate.value =
|
||||
ResponseItemVO(isError = false, response = response.message()!!)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun transferSalesSalix(
|
||||
ticketFk:String,
|
||||
ticketFk: String,
|
||||
saleFk: Int,
|
||||
quantity: String,
|
||||
|
||||
) {
|
||||
var saleTransfer = listSaleSalix(arrayListOf(saleSalix(id = saleFk, quantity = quantity.toInt())))
|
||||
//saleTransfer.sales.add(saleSalix(id = saleFk.toInt(), quantity = quantity.toInt()))
|
||||
var saleTransfer =
|
||||
listSaleSalix(arrayListOf(saleSalix(id = saleFk, quantity = quantity.toInt())))
|
||||
salix.transferSalesSalix(
|
||||
ticketFk,saleTransfer
|
||||
ticketFk, saleTransfer
|
||||
|
||||
).enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
).enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseSplit.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
|
@ -919,5 +712,4 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,46 +5,41 @@ import android.content.Context
|
|||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class QrFragmentViewModel(context: Context) : BaseViewModel(context) {
|
||||
private val contextApp =context
|
||||
class QrFragmentViewModel(var context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val _qrresponse by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val qrresponse: LiveData<ResponseItemVO>
|
||||
get() = _qrresponse
|
||||
|
||||
|
||||
fun qr_getCall(vStatement: String){
|
||||
fun qr_getCall(vStatement: String) {
|
||||
silex.qr_getCall(vStatement)
|
||||
.enqueue(object : Callback<String> {
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
|
||||
.enqueue(object : SilexCallback<String>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_qrresponse.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
override fun onSuccess(response: Response<String>) {
|
||||
|
||||
if (response.raw().code() == 555 || response.raw().code()==403) {
|
||||
|
||||
//Log.i("VERDNATURA:","UserError ${response.raw().message().toString()}")
|
||||
// var message = response.raw().message().toString()
|
||||
if (response.raw().code() == 555 || response.raw().code() == 403) {
|
||||
|
||||
_qrresponse.value = ResponseItemVO(
|
||||
response = "",
|
||||
isError = true,
|
||||
errorMessage =contextApp.getString(
|
||||
errorMessage = context.getString(
|
||||
R.string.userNotPermission
|
||||
))
|
||||
)
|
||||
)
|
||||
|
||||
} else if (response.body() != null) {
|
||||
_qrresponse.value = ResponseItemVO(
|
||||
|
@ -55,16 +50,18 @@ class QrFragmentViewModel(context: Context) : BaseViewModel(context) {
|
|||
|
||||
} else {
|
||||
|
||||
_qrresponse.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
|
||||
_qrresponse.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,26 +3,18 @@ package es.verdnatura.presentation.view.feature.reposicion.fragment
|
|||
import android.content.Context
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.GetPreSacadorUseCase
|
||||
import es.verdnatura.domain.GetSacadorControladorUserCase
|
||||
import es.verdnatura.domain.GetUbicadorUserCase
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class ReposicionViewModel(context: Context) : BaseViewModel(context) {
|
||||
private val getPreSacadorUseCase: GetPreSacadorUseCase = GetPreSacadorUseCase(context)
|
||||
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context)
|
||||
private val getSacadorControladorUserCase: GetSacadorControladorUserCase =
|
||||
GetSacadorControladorUserCase(context)
|
||||
class ReposicionViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
|
||||
private val _salesList by lazy { MutableLiveData<List<PreSacadorItemVO>>() }
|
||||
val salesList: LiveData<List<PreSacadorItemVO>>
|
||||
|
@ -50,15 +42,12 @@ class ReposicionViewModel(context: Context) : BaseViewModel(context) {
|
|||
) {
|
||||
silex.itemPlacementSupplyGetOrder(sectorFk)
|
||||
.enqueue(object :
|
||||
Callback<List<PreSacadorItemVO>> {
|
||||
override fun onFailure(call: Call<List<PreSacadorItemVO>>, t: Throwable) {
|
||||
SilexCallback<List<PreSacadorItemVO>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_salesList.value = listOf()
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<PreSacadorItemVO>>,
|
||||
response: Response<List<PreSacadorItemVO>>
|
||||
) {
|
||||
override fun onSuccess(response: Response<List<PreSacadorItemVO>>) {
|
||||
if (response.body() != null) {
|
||||
_salesList.value = response.body()?.let { it }
|
||||
} else {
|
||||
|
@ -73,28 +62,18 @@ class ReposicionViewModel(context: Context) : BaseViewModel(context) {
|
|||
parking: String
|
||||
|
||||
) {
|
||||
silex.shelvingPark(ticketFk, parking)
|
||||
.enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
silex.shelvingPark(ticketFk, parking)
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -110,11 +89,12 @@ class ReposicionViewModel(context: Context) : BaseViewModel(context) {
|
|||
quantity,
|
||||
itemFk
|
||||
).enqueue(object :
|
||||
Callback<List<PlacementSupplyVO>> {
|
||||
override fun onFailure(call: Call<List<PlacementSupplyVO>>, t: Throwable) {
|
||||
SilexCallback<List<PlacementSupplyVO>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<PlacementSupplyVO> = ArrayList()
|
||||
listError.add(
|
||||
PlacementSupplyVO(itemShelvingFk = 0,
|
||||
PlacementSupplyVO(
|
||||
itemShelvingFk = 0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
|
@ -122,16 +102,14 @@ class ReposicionViewModel(context: Context) : BaseViewModel(context) {
|
|||
_placementSuppleyList.value = PlacementSupplyListVO(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<PlacementSupplyVO>>,
|
||||
response: Response<List<PlacementSupplyVO>>
|
||||
) {
|
||||
override fun onSuccess(response: Response<List<PlacementSupplyVO>>) {
|
||||
if (response.body() != null) {
|
||||
_placementSuppleyList.value = response.body()?.let { PlacementSupplyListVO(it) }
|
||||
} else {
|
||||
val listError: ArrayList<PlacementSupplyVO> = ArrayList()
|
||||
listError.add(
|
||||
PlacementSupplyVO(itemShelvingFk = 0,
|
||||
PlacementSupplyVO(
|
||||
itemShelvingFk = 0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
|
@ -146,16 +124,16 @@ class ReposicionViewModel(context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
|
||||
fun getIdFromCode(usuario: String, password: String, code: String) {
|
||||
getSacadorControladorUserCase.getIdFromCode(usuario, password, code)
|
||||
.enqueue(object : Callback<String> {
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
silex.getIdFromCode(usuario, password, code)
|
||||
.enqueue(object : SilexCallback<String>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseCode.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
override fun onSuccess(response: Response<String>) {
|
||||
//sergio:espera item en el body
|
||||
if (response.body() == null) {
|
||||
_responseCode.value = ResponseItemVO(
|
||||
|
@ -175,39 +153,25 @@ class ReposicionViewModel(context: Context) : BaseViewModel(context) {
|
|||
|
||||
|
||||
fun itemShelvingPlacementSupplyAdd(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemShelvingFk: String,
|
||||
itemPlacementSupplyFk: String,
|
||||
quantity: String
|
||||
|
||||
) {
|
||||
getSacadorControladorUserCase.itemShelvingPlacementSupplyAdd(
|
||||
usuario,
|
||||
password,
|
||||
silex.itemShelvingPlacementSupplyAdd(
|
||||
itemShelvingFk,
|
||||
itemPlacementSupplyFk,
|
||||
quantity
|
||||
).enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
).enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_response.value = ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_response.value = ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -217,27 +181,17 @@ class ReposicionViewModel(context: Context) : BaseViewModel(context) {
|
|||
quantity: Int
|
||||
) {
|
||||
silex.itemPlacementSupplyCloseOrder(id, quantity)
|
||||
.enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseClose.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_responseClose.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_responseClose.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_responseClose.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -4,9 +4,8 @@ package es.verdnatura.presentation.view.feature.sacador.fragment
|
|||
import android.content.Context
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.GetSacadorControladorUserCase
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
|
@ -15,18 +14,9 @@ import es.verdnatura.presentation.view.feature.sacador.mapper.toDateFormat
|
|||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionListVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class SacadorViewModel(context: Context) : BaseViewModel(context) {
|
||||
|
||||
//val emptyMessage = "No tienes colecciones pendientes. Presiona sobre el + para crear colección"
|
||||
|
||||
private val contextApp=context
|
||||
private val getSacadorControladorUserCase: GetSacadorControladorUserCase = GetSacadorControladorUserCase(
|
||||
context
|
||||
)
|
||||
|
||||
class SacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val _collectionList by lazy { MutableLiveData<CollectionListVO>() }
|
||||
val collectionList: LiveData<CollectionListVO>
|
||||
|
@ -44,24 +34,24 @@ class SacadorViewModel(context: Context) : BaseViewModel(context) {
|
|||
val responseCollectionSmart: LiveData<ResponseItemVO>
|
||||
get() = _responseCollectionSmart
|
||||
|
||||
|
||||
fun collectionTicketGet(
|
||||
collectionFk: Int,
|
||||
sectorFk: String,
|
||||
print: String,
|
||||
type:String
|
||||
){
|
||||
getSacadorControladorUserCase.collectionTicketGet(
|
||||
type: String
|
||||
) {
|
||||
silex.collection_getTickets(
|
||||
collectionFk,
|
||||
sectorFk,
|
||||
print,
|
||||
type
|
||||
).enqueue(object :
|
||||
Callback<CollectionVO> {
|
||||
override fun onFailure(call: Call<CollectionVO>, t: Throwable) {
|
||||
_collectionTicketList.value = CollectionVO(0,
|
||||
SilexCallback<CollectionVO>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_collectionTicketList.value = CollectionVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -70,63 +60,37 @@ class SacadorViewModel(context: Context) : BaseViewModel(context) {
|
|||
response: Response<CollectionVO>
|
||||
) {
|
||||
if (response.body() != null) {
|
||||
_collectionTicketList.value = response.body()?.let { it.map(contextApp) }
|
||||
_collectionTicketList.value = response.body()?.let { it.map(context) }
|
||||
} else {
|
||||
_collectionTicketList.value = CollectionVO(0,
|
||||
_collectionTicketList.value = CollectionVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/* fun collectionNew(usuario: String, password: String, sectorFk: String, wagons: String){
|
||||
getSacadorControladorUserCase.collectionNew(usuario, password, sectorFk, wagons).enqueue(
|
||||
object :
|
||||
Callback<String> {
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
|
||||
|
||||
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<String>,
|
||||
response: Response<String>
|
||||
) {
|
||||
if (response.body() != null) {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.body()!!)
|
||||
} else {
|
||||
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}*/
|
||||
|
||||
|
||||
fun collection_assign(){
|
||||
getSacadorControladorUserCase.collection_assign().enqueue(
|
||||
fun collection_assign() {
|
||||
silex.collection_assign().enqueue(
|
||||
object :
|
||||
Callback<String> {
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
SilexCallback<String>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
|
||||
|
||||
|
||||
ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
t.message!!
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<String>,
|
||||
response: Response<String>
|
||||
) {
|
||||
override fun onSuccess(response: Response<String>) {
|
||||
if (response.body() != null) {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.body()!!)
|
||||
|
@ -134,7 +98,10 @@ class SacadorViewModel(context: Context) : BaseViewModel(context) {
|
|||
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
|
@ -142,29 +109,35 @@ class SacadorViewModel(context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun collectionGet(){
|
||||
getSacadorControladorUserCase.collectionGet().enqueue(object :
|
||||
Callback<List<CollectionVO>> {
|
||||
override fun onFailure(call: Call<List<CollectionVO>>, t: Throwable) {
|
||||
fun collectionGet() {
|
||||
silex.collectionGet().enqueue(object :
|
||||
SilexCallback<List<CollectionVO>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<CollectionVO> = ArrayList()
|
||||
listError.add(CollectionVO(0,isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
|
||||
listError.add(
|
||||
CollectionVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
)
|
||||
_collectionList.value = CollectionListVO(listError)
|
||||
}
|
||||
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<CollectionVO>>,
|
||||
response: Response<List<CollectionVO>>
|
||||
) {
|
||||
override fun onSuccess(response: Response<List<CollectionVO>>) {
|
||||
if (response.body() != null) {
|
||||
_collectionList.value =
|
||||
response.body()?.let { CollectionListVO(it.toDateFormat(contextApp)) }
|
||||
response.body()?.let { CollectionListVO(it.toDateFormat(context)) }
|
||||
} else {
|
||||
val listError: ArrayList<CollectionVO> = ArrayList()
|
||||
listError.add(
|
||||
CollectionVO(0,
|
||||
CollectionVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
)
|
||||
_collectionList.value = CollectionListVO(listError)
|
||||
|
@ -175,29 +148,36 @@ class SacadorViewModel(context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun collectionGetSalix(){
|
||||
fun collectionGetSalix() {
|
||||
salix.getCollectionSalix().enqueue(object :
|
||||
Callback<List<CollectionVO>> {
|
||||
override fun onFailure(call: Call<List<CollectionVO>>, t: Throwable) {
|
||||
SilexCallback<List<CollectionVO>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<CollectionVO> = ArrayList()
|
||||
listError.add(CollectionVO(0,isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
|
||||
listError.add(
|
||||
CollectionVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
)
|
||||
_collectionList.value = CollectionListVO(listError)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<List<CollectionVO>>) {
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<CollectionVO>>,
|
||||
response: Response<List<CollectionVO>>
|
||||
) {
|
||||
if (response.body() != null) {
|
||||
_collectionList.value =
|
||||
response.body()?.let { CollectionListVO(it.toDateFormat(contextApp)) }
|
||||
response.body()?.let { CollectionListVO(it.toDateFormat(context)) }
|
||||
} else {
|
||||
val listError: ArrayList<CollectionVO> = ArrayList()
|
||||
listError.add(
|
||||
CollectionVO(0,
|
||||
CollectionVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
)
|
||||
_collectionList.value = CollectionListVO(listError)
|
||||
|
|
|
@ -9,16 +9,18 @@ import es.verdnatura.R
|
|||
import es.verdnatura.databinding.FragmentShelvingParkingBinding
|
||||
import es.verdnatura.domain.notNull
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||
import es.verdnatura.presentation.view.feature.shelvingparking.adapter.ShelvingParkingAdapter
|
||||
|
||||
|
||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||
class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, ShelvingParkingViewModel>(
|
||||
ShelvingParkingViewModel::class) {
|
||||
class ShelvingParkingFragment :
|
||||
BaseFragment<FragmentShelvingParkingBinding, ShelvingParkingViewModel>(
|
||||
ShelvingParkingViewModel::class
|
||||
) {
|
||||
|
||||
|
||||
private var adapter : ShelvingParkingAdapter? = null
|
||||
private var adapter: ShelvingParkingAdapter? = null
|
||||
|
||||
companion object {
|
||||
fun newInstance() = ShelvingParkingFragment()
|
||||
}
|
||||
|
@ -36,18 +38,22 @@ class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, She
|
|||
}
|
||||
|
||||
|
||||
private fun setEvents(){
|
||||
private fun setEvents() {
|
||||
binding.mainToolbar.backButton.setOnClickListener {
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
|
||||
binding.shelvingText.requestFocus()
|
||||
binding.shelvingText.requestFocus()
|
||||
binding.shelvingText.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||
if (!binding.shelvingText.text.toString().isNullOrEmpty()){
|
||||
if (!binding.shelvingText.text.toString().isNullOrEmpty()) {
|
||||
binding.mainToolbar.toolbarTitle.text = binding.shelvingText.text.toString()
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
viewModel.shelvingParking_get( getData(USER),getData(PASSWORD),binding.shelvingText.text.toString(),getData(WAREHOUSEFK),binding.dayrange.text.toString())
|
||||
viewModel.shelvingParking_get(
|
||||
binding.shelvingText.text.toString(),
|
||||
getData(WAREHOUSEFK),
|
||||
binding.dayrange.text.toString()
|
||||
)
|
||||
}
|
||||
|
||||
binding.shelvingText.setText("")
|
||||
|
@ -66,7 +72,11 @@ class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, She
|
|||
binding.shelvingText.requestFocus()
|
||||
|
||||
binding.mainToolbar.toolbarTitle.text = binding.shelvingText.text.toString()
|
||||
viewModel.shelvingParking_get( getData(USER),getData(PASSWORD),binding.shelvingText.text.toString(),getData(WAREHOUSEFK),binding.dayrange.text.toString())
|
||||
viewModel.shelvingParking_get(
|
||||
binding.shelvingText.text.toString(),
|
||||
getData(WAREHOUSEFK),
|
||||
binding.dayrange.text.toString()
|
||||
)
|
||||
binding.shelvingText.setText("")
|
||||
ma.hideKeyboard(binding.dayrange)
|
||||
return@setOnEditorActionListener true
|
||||
|
@ -77,13 +87,14 @@ class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, She
|
|||
}
|
||||
|
||||
override fun observeViewModel() {
|
||||
with(viewModel){
|
||||
with(viewModel) {
|
||||
loadShelvingList.observe(viewLifecycleOwner, Observer { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
adapter = ShelvingParkingAdapter(it.list)
|
||||
binding.locationRecyclerview.adapter = adapter
|
||||
binding.locationRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
binding.locationRecyclerview.layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
|
||||
}
|
||||
})
|
||||
|
|
|
@ -4,24 +4,16 @@ import android.content.Context
|
|||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import es.verdnatura.domain.GetShelvingParkingUserCase
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.common.Event
|
||||
import es.verdnatura.presentation.view.feature.shelvingparking.model.ItemShelvingParkingListVO
|
||||
import es.verdnatura.presentation.view.feature.shelvingparking.model.ItemShelvingParkingVO
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class ShelvingParkingViewModel(context: Context) : BaseViewModel(context) {
|
||||
|
||||
|
||||
private val getShelvingParkingUserCase: GetShelvingParkingUserCase = GetShelvingParkingUserCase(context)
|
||||
|
||||
|
||||
class ShelvingParkingViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val _shelvingList by lazy { MutableLiveData<ItemShelvingParkingListVO>() }
|
||||
val shelvingList: LiveData<ItemShelvingParkingListVO>
|
||||
|
@ -31,24 +23,35 @@ class ShelvingParkingViewModel(context: Context) : BaseViewModel(context) {
|
|||
val loadShelvingList = Transformations.map(_shelvingList) { Event(it) }
|
||||
|
||||
|
||||
fun shelvingParking_get(usuario:String,password:String,vShelvingFk:String,vWarehouseFk:String,vDayRange:String){
|
||||
getShelvingParkingUserCase.shelvingParking_get(usuario,password,vShelvingFk.uppercase(),vWarehouseFk,vDayRange).enqueue(object :
|
||||
Callback<List<ItemShelvingParkingVO>> {
|
||||
override fun onFailure(call: Call<List<ItemShelvingParkingVO>>, t: Throwable) {
|
||||
val listError:ArrayList<ItemShelvingParkingVO> = ArrayList()
|
||||
listError.add(ItemShelvingParkingVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
|
||||
fun shelvingParking_get(vShelvingFk: String, vWarehouseFk: String, vDayRange: String) {
|
||||
silex.shelvingParking_get(vShelvingFk.uppercase(), vWarehouseFk, vDayRange).enqueue(object :
|
||||
SilexCallback<List<ItemShelvingParkingVO>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<ItemShelvingParkingVO> = ArrayList()
|
||||
listError.add(
|
||||
ItemShelvingParkingVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
)
|
||||
_shelvingList.value = ItemShelvingParkingListVO(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<ItemShelvingParkingVO>>,
|
||||
response: Response<List<ItemShelvingParkingVO>>
|
||||
) {
|
||||
if (response.body() != null){
|
||||
override fun onSuccess(response: Response<List<ItemShelvingParkingVO>>) {
|
||||
|
||||
if (response.body() != null) {
|
||||
_shelvingList.value = response.body()?.let { ItemShelvingParkingListVO(it) }
|
||||
}else{
|
||||
val listError:ArrayList<ItemShelvingParkingVO> = ArrayList()
|
||||
listError.add(ItemShelvingParkingVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
|
||||
} else {
|
||||
val listError: ArrayList<ItemShelvingParkingVO> = ArrayList()
|
||||
listError.add(
|
||||
ItemShelvingParkingVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
)
|
||||
_shelvingList.value = ItemShelvingParkingListVO(listError)
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +60,4 @@ class ShelvingParkingViewModel(context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,17 +3,10 @@ package es.verdnatura.presentation.view.feature.transferencia.fragment
|
|||
import android.content.Context
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.GetUbicadorUserCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class TransferenciaViewModel(context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context)
|
||||
|
||||
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val response: LiveData<ResponseItemVO>
|
||||
get() = _response
|
||||
|
|
|
@ -222,8 +222,6 @@ class UbicadorFragment(
|
|||
} else {
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
viewModel.getIdFromCode(
|
||||
usuario = getData(USER),
|
||||
password = getData(PASSWORD),
|
||||
code = binding.editMatricula.text.toString()
|
||||
)
|
||||
|
||||
|
@ -365,8 +363,7 @@ class UbicadorFragment(
|
|||
.setDescription(getString(R.string.operationNoReturn))
|
||||
.setOkButton(getString(R.string.empty)) {
|
||||
viewModel.clearShelvingList(
|
||||
getData(USER),
|
||||
getData(PASSWORD), shelvingFk
|
||||
shelvingFk
|
||||
)
|
||||
listItems.forEach {
|
||||
it.stickers = "0"
|
||||
|
|
|
@ -4,8 +4,7 @@ import android.content.Context
|
|||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import es.verdnatura.domain.GetSacadorControladorUserCase
|
||||
import es.verdnatura.domain.GetUbicadorUserCase
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
|
@ -19,11 +18,8 @@ import retrofit2.Call
|
|||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
||||
class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context)
|
||||
private val getSacadorControladorUserCase: GetSacadorControladorUserCase =
|
||||
GetSacadorControladorUserCase(context)
|
||||
private val _shelvingList by lazy { MutableLiveData<ItemUbicadorListVO>() }
|
||||
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val response: LiveData<ResponseItemVO>
|
||||
|
@ -50,11 +46,12 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
|||
) {
|
||||
silex.itemShelvingList(vShelvingFk.uppercase())
|
||||
.enqueue(object :
|
||||
Callback<List<ItemUbicadorVO>> {
|
||||
override fun onFailure(call: Call<List<ItemUbicadorVO>>, t: Throwable) {
|
||||
SilexCallback<List<ItemUbicadorVO>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<ItemUbicadorVO> = ArrayList()
|
||||
listError.add(
|
||||
ItemUbicadorVO(0,
|
||||
ItemUbicadorVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
|
@ -65,16 +62,15 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
|||
_shelvingList.value = ItemUbicadorListVO(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<ItemUbicadorVO>>,
|
||||
response: Response<List<ItemUbicadorVO>>
|
||||
) {
|
||||
override fun onSuccess(response: Response<List<ItemUbicadorVO>>) {
|
||||
|
||||
if (response.body() != null) {
|
||||
_shelvingList.value = response.body()?.let { ItemUbicadorListVO(it) }
|
||||
} else {
|
||||
val listError: ArrayList<ItemUbicadorVO> = ArrayList()
|
||||
listError.add(
|
||||
ItemUbicadorVO(0,
|
||||
ItemUbicadorVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
|
@ -94,36 +90,22 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
|||
shelving: String
|
||||
|
||||
) {
|
||||
silex.shelvingPriorityUpdate(priority, shelving)
|
||||
.enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
silex.shelvingPriorityUpdate(priority, shelving)
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responsepriority.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
|
||||
if (!response.isSuccessful) {
|
||||
_responsepriority.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_responsepriority.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_responsepriority.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
fun itemShelvingMake(
|
||||
shelving: String,
|
||||
item: Int,
|
||||
|
@ -139,8 +121,8 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
|||
packing,
|
||||
warehouse,
|
||||
grouping
|
||||
).enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
).enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseMake.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
|
@ -148,19 +130,8 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_responseMake.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_responseMake.value =
|
||||
ResponseItemVO(isError = false, response = response.message()!!)
|
||||
}
|
||||
|
||||
_responseMake.value =
|
||||
ResponseItemVO(isError = false, response = response.message()!!)
|
||||
}
|
||||
|
||||
})
|
||||
|
@ -178,28 +149,17 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
|||
packing,
|
||||
itemShelvingFk,
|
||||
grouping
|
||||
).enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
).enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseMake.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_responseMake.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_responseMake.value =
|
||||
ResponseItemVO(isError = false, response = response.message()!!)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_responseMake.value =
|
||||
ResponseItemVO(isError = false, response = response.message()!!)
|
||||
}
|
||||
|
||||
})
|
||||
|
@ -210,7 +170,7 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
|||
shelving: String,
|
||||
parking: String
|
||||
) {
|
||||
silex.shelvingPark(shelving, parking)
|
||||
silex.shelvingPark(shelving, parking)
|
||||
.enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
_response.value = ResponseItemVO(
|
||||
|
@ -241,27 +201,17 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
|||
destino: String
|
||||
) {
|
||||
silex.shelvingChange(origen, destino)
|
||||
.enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.message()!!)
|
||||
}
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.message()!!)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -271,28 +221,18 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
|||
vShelvingFk: String
|
||||
|
||||
) {
|
||||
silex.itemShelving_merge( vShelf, vShelvingFk)
|
||||
.enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
silex.itemShelving_merge(vShelf, vShelvingFk)
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.message()!!)
|
||||
}
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.message()!!)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -302,25 +242,14 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
|||
code: String
|
||||
) {
|
||||
silex.shelvingLog_add(code)
|
||||
.enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -329,11 +258,12 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
|||
|
||||
) {
|
||||
silex.itemShelving_return(shelvingFk)
|
||||
.enqueue(object : Callback<ArrayList<Reubication>> {
|
||||
override fun onFailure(call: Call<ArrayList<Reubication>>, t: Throwable) {
|
||||
.enqueue(object : SilexCallback<ArrayList<Reubication>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<Reubication> = ArrayList()
|
||||
listError.add(
|
||||
Reubication(0,
|
||||
Reubication(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
|
@ -345,14 +275,12 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
|||
_reubicationList.value = ReubicationList(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<ArrayList<Reubication>>,
|
||||
response: Response<ArrayList<Reubication>>
|
||||
) {
|
||||
override fun onSuccess(response: Response<ArrayList<Reubication>>) {
|
||||
if (response.body() == null) {
|
||||
val listError: ArrayList<Reubication> = ArrayList()
|
||||
listError.add(
|
||||
Reubication(0,
|
||||
Reubication(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
|
@ -371,33 +299,21 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
|
||||
fun clearShelvingList(
|
||||
usuario: String,
|
||||
password: String,
|
||||
shelvingFk: String
|
||||
|
||||
) {
|
||||
getUbicadorUserCase.clearShelvingList(usuario, password, shelvingFk)
|
||||
.enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
silex.clearShelvingList(shelvingFk)
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -408,69 +324,51 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
|||
|
||||
) {
|
||||
silex.itemShelvingTransfer(itemFk, shelvingFk)
|
||||
.enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.message()!!)
|
||||
}
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.message()!!)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun itemShelvingDelete(itemFk: Int) {
|
||||
silex.itemShelvingDelete(itemFk)
|
||||
.enqueue(object : Callback<Any> {
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||
if (!response.isSuccessful) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun getIdFromCode(usuario: String, password: String, code: String) {
|
||||
getSacadorControladorUserCase.getIdFromCode(usuario, password, code)
|
||||
.enqueue(object : Callback<String> {
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
fun getIdFromCode(code: String) {
|
||||
silex.getIdFromCode(code)
|
||||
.enqueue(object : SilexCallback<String>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseCode.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
override fun onSuccess(response: Response<String>) {
|
||||
if (response.body() == null) {
|
||||
_responseCode.value = ResponseItemVO(
|
||||
isError = true,
|
||||
|
|
Loading…
Reference in New Issue