Version 9.8Beta. Borrados UserCase y uso de SilexCallBack
This commit is contained in:
parent
2469e2e368
commit
e52d7cb7e8
|
@ -44,8 +44,8 @@
|
||||||
</shared>
|
</shared>
|
||||||
</component>
|
</component>
|
||||||
<component name="AndroidLogFilters">
|
<component name="AndroidLogFilters">
|
||||||
<option name="TOOL_WINDOW_CUSTOM_FILTER" value="verdnatura" />
|
<option name="TOOL_WINDOW_CUSTOM_FILTER" value="verdnatura:" />
|
||||||
<option name="TOOL_WINDOW_LOG_LEVEL" value="error" />
|
<option name="TOOL_WINDOW_LOG_LEVEL" value="debug" />
|
||||||
<option name="TOOL_WINDOW_CONFIGURED_FILTER" value="No Filters" />
|
<option name="TOOL_WINDOW_CONFIGURED_FILTER" value="No Filters" />
|
||||||
<option name="TOOL_WINDOW_REGEXP_FILTER" value="false" />
|
<option name="TOOL_WINDOW_REGEXP_FILTER" value="false" />
|
||||||
</component>
|
</component>
|
||||||
|
@ -83,9 +83,60 @@
|
||||||
</select>
|
</select>
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<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$/.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/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>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
@ -253,7 +304,7 @@
|
||||||
<property name="cidr.known.project.marker" value="true" />
|
<property name="cidr.known.project.marker" value="true" />
|
||||||
<property name="com.developerphil.adbidea.selecteddevices" value="21114523025303" />
|
<property name="com.developerphil.adbidea.selecteddevices" value="21114523025303" />
|
||||||
<property name="last_directory_selection" value="$PROJECT_DIR$/app/src/main/res/drawable" />
|
<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/.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/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" />
|
<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"
|
applicationId "es.verdnatura"
|
||||||
minSdkVersion 24 //21
|
minSdkVersion 24 //21
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 144
|
versionCode 148
|
||||||
//versionName = "9.4" versionCode 143
|
//versionName = "9.4" versionCode 143
|
||||||
//versionName = "9.5Beta" 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"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||||
<uses-permission android:name="android.permission.PREVENT_POWER_KEY" />
|
<uses-permission android:name="android.permission.PREVENT_POWER_KEY" />
|
||||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
<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"
|
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"
|
||||||
tools:ignore="ProtectedPermissions" />
|
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")
|
@POST("Accounts/login")
|
||||||
fun login(
|
fun login(
|
||||||
@Header("Content-Type") content_type: String,
|
|
||||||
@Body params: LoginSalixVO
|
@Body params: LoginSalixVO
|
||||||
):
|
):
|
||||||
Call<LoginSalixVO>
|
Call<LoginSalixVO>
|
||||||
|
|
|
@ -94,11 +94,6 @@ interface VerdnaturaService {
|
||||||
@POST("almacennew/worker_getPrinter")//NO SALIX
|
@POST("almacennew/worker_getPrinter")//NO SALIX
|
||||||
|
|
||||||
fun worker_getPrinter(
|
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>>
|
Call<List<Printers>>
|
||||||
|
|
||||||
|
@ -128,11 +123,6 @@ interface VerdnaturaService {
|
||||||
|
|
||||||
@POST("almacennew/worker_getSector")//NO SALIX
|
@POST("almacennew/worker_getSector")//NO SALIX
|
||||||
fun worker_getSector(
|
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>
|
Call<SectorItemVO>
|
||||||
|
|
||||||
|
@ -151,12 +141,7 @@ interface VerdnaturaService {
|
||||||
|
|
||||||
@POST("almacennew/ticketToPrePrepare")//NO SALIX
|
@POST("almacennew/ticketToPrePrepare")//NO SALIX
|
||||||
fun ticketToPrePrepare(
|
fun ticketToPrePrepare(
|
||||||
@Header("aplicacion") aplicacion: String,
|
@Body vararg params: Any
|
||||||
@Header("version") version: String,
|
|
||||||
@Header("user") user: String,
|
|
||||||
@Header("pass") pass: String,
|
|
||||||
@Header("Content-Type") content_type: String,
|
|
||||||
@Body params: List<String>
|
|
||||||
):
|
):
|
||||||
Call<List<PreSacadorItemVO>>
|
Call<List<PreSacadorItemVO>>
|
||||||
|
|
||||||
|
@ -190,16 +175,16 @@ interface VerdnaturaService {
|
||||||
):
|
):
|
||||||
Call<List<CollectionVO>>
|
Call<List<CollectionVO>>
|
||||||
|
|
||||||
/* @POST("almacennew/collectionNew")//NO SALIX
|
/* @POST("almacennew/collectionNew")//NO SALIX
|
||||||
fun collectionNew(
|
fun collectionNew(
|
||||||
@Header("aplicacion") aplicacion: String,
|
@Header("aplicacion") aplicacion: String,
|
||||||
@Header("version") version: String,
|
@Header("version") version: String,
|
||||||
@Header("user") user: String,
|
@Header("user") user: String,
|
||||||
@Header("pass") pass: String,
|
@Header("pass") pass: String,
|
||||||
@Header("Content-Type") content_type: String,
|
@Header("Content-Type") content_type: String,
|
||||||
@Body params: List<String>
|
@Body params: List<String>
|
||||||
):
|
):
|
||||||
Call<String>*/
|
Call<String>*/
|
||||||
|
|
||||||
@POST("almacennew/collection_assign")//NO SALIX
|
@POST("almacennew/collection_assign")//NO SALIX
|
||||||
fun collection_assign(
|
fun collection_assign(
|
||||||
|
@ -225,25 +210,25 @@ interface VerdnaturaService {
|
||||||
fun sectorCollection_new(
|
fun sectorCollection_new(
|
||||||
@Body vararg params: Any
|
@Body vararg params: Any
|
||||||
):
|
):
|
||||||
Call<Unit>
|
Call<Any>
|
||||||
|
|
||||||
@POST("almacennew/sectorCollectionSaleGroup_add")//NO SALIX
|
@POST("almacennew/sectorCollectionSaleGroup_add")//NO SALIX
|
||||||
fun sectorCollectionSaleGroup_add(
|
fun sectorCollectionSaleGroup_add(
|
||||||
@Body vararg params: Any
|
@Body vararg params: Any
|
||||||
):
|
):
|
||||||
Call<Unit>
|
Call<Any>
|
||||||
|
|
||||||
@POST("almacennew/saleTracking_addPrevOK")//NO SALIX
|
@POST("almacennew/saleTracking_addPrevOK")//NO SALIX
|
||||||
fun saleTracking_addPrevOK(
|
fun saleTracking_addPrevOK(
|
||||||
@Body vararg params: Any
|
@Body vararg params: Any
|
||||||
):
|
):
|
||||||
Call<Unit>
|
Call<Any>
|
||||||
|
|
||||||
@POST("almacennew/saleTracking_updateIsChecked")//NO SALIX
|
@POST("almacennew/saleTracking_updateIsChecked")//NO SALIX
|
||||||
fun saleTracking_updateIsChecked(
|
fun saleTracking_updateIsChecked(
|
||||||
@Body vararg params: Any
|
@Body vararg params: Any
|
||||||
):
|
):
|
||||||
Call<Unit>
|
Call<Any>
|
||||||
|
|
||||||
/* @POST("almacennew/collectionTicketGet")//REVISADA-ANULADA POT collection_getTickets
|
/* @POST("almacennew/collectionTicketGet")//REVISADA-ANULADA POT collection_getTickets
|
||||||
fun collectionTicketGet(
|
fun collectionTicketGet(
|
||||||
|
@ -336,12 +321,8 @@ interface VerdnaturaService {
|
||||||
|
|
||||||
@POST("almacennew/itemShelvingPlacementSupplyAdd")//REVISADA
|
@POST("almacennew/itemShelvingPlacementSupplyAdd")//REVISADA
|
||||||
fun itemShelvingPlacementSupplyAdd(
|
fun itemShelvingPlacementSupplyAdd(
|
||||||
@Header("aplicacion") aplicacion: String,
|
|
||||||
@Header("version") version: String,
|
@Body vararg params: Any
|
||||||
@Header("user") user: String,
|
|
||||||
@Header("pass") pass: String,
|
|
||||||
@Header("Content-Type") content_type: String,
|
|
||||||
@Body params: List<String>
|
|
||||||
):
|
):
|
||||||
Call<Any>
|
Call<Any>
|
||||||
|
|
||||||
|
@ -378,12 +359,8 @@ interface VerdnaturaService {
|
||||||
|
|
||||||
@POST("almacennew/saleMove")//REVISADA
|
@POST("almacennew/saleMove")//REVISADA
|
||||||
fun saleMove(
|
fun saleMove(
|
||||||
@Header("aplicacion") aplicacion: String,
|
|
||||||
@Header("version") version: String,
|
@Body vararg params: Any
|
||||||
@Header("user") user: String,
|
|
||||||
@Header("pass") pass: String,
|
|
||||||
@Header("Content-Type") content_type: String,
|
|
||||||
@Body params: List<String>
|
|
||||||
):
|
):
|
||||||
Call<Any>
|
Call<Any>
|
||||||
|
|
||||||
|
@ -436,12 +413,7 @@ interface VerdnaturaService {
|
||||||
|
|
||||||
@POST("almacennew/collectionIncreaseQuantity")//REVISADA
|
@POST("almacennew/collectionIncreaseQuantity")//REVISADA
|
||||||
fun collectionIncreaseQuantity(
|
fun collectionIncreaseQuantity(
|
||||||
@Header("aplicacion") aplicacion: String,
|
@Body vararg params: Any
|
||||||
@Header("version") version: String,
|
|
||||||
@Header("user") user: String,
|
|
||||||
@Header("pass") pass: String,
|
|
||||||
@Header("Content-Type") content_type: String,
|
|
||||||
@Body params: List<String>
|
|
||||||
):
|
):
|
||||||
Call<Any>
|
Call<Any>
|
||||||
|
|
||||||
|
@ -455,13 +427,13 @@ interface VerdnaturaService {
|
||||||
fun workerMistake_Add(
|
fun workerMistake_Add(
|
||||||
@Body vararg params: Any
|
@Body vararg params: Any
|
||||||
):
|
):
|
||||||
Call<Unit>
|
Call<Any>
|
||||||
|
|
||||||
@POST("almacennew/expeditionMistake_add")//REVISADA
|
@POST("almacennew/expeditionMistake_add")//REVISADA
|
||||||
fun expeditionMistake_add(
|
fun expeditionMistake_add(
|
||||||
@Body vararg params: Any
|
@Body vararg params: Any
|
||||||
):
|
):
|
||||||
Call<Unit>
|
Call<Any>
|
||||||
|
|
||||||
@POST("almacennew/mistakeType")//REVISADA
|
@POST("almacennew/mistakeType")//REVISADA
|
||||||
fun mistakeType(
|
fun mistakeType(
|
||||||
|
@ -593,12 +565,7 @@ interface VerdnaturaService {
|
||||||
//SHELVING PARKING ========================================================================>
|
//SHELVING PARKING ========================================================================>
|
||||||
@POST("almacennew/shelvingParking_get")//REVISADA
|
@POST("almacennew/shelvingParking_get")//REVISADA
|
||||||
fun shelvingParking_get(
|
fun shelvingParking_get(
|
||||||
@Header("aplicacion") aplicacion: String,
|
@Body vararg params: Any
|
||||||
@Header("version") version: String,
|
|
||||||
@Header("user") user: String,
|
|
||||||
@Header("pass") pass: String,
|
|
||||||
@Header("Content-Type") content_type: String,
|
|
||||||
@Body params: List<String>
|
|
||||||
):
|
):
|
||||||
Call<List<ItemShelvingParkingVO>>
|
Call<List<ItemShelvingParkingVO>>
|
||||||
|
|
||||||
|
@ -704,12 +671,7 @@ interface VerdnaturaService {
|
||||||
|
|
||||||
@POST("almacennew/clearShelvingList")//REVISADA
|
@POST("almacennew/clearShelvingList")//REVISADA
|
||||||
fun clearShelvingList(
|
fun clearShelvingList(
|
||||||
@Header("aplicacion") aplicacion: String,
|
@Body vararg params: Any
|
||||||
@Header("version") version: String,
|
|
||||||
@Header("user") user: String,
|
|
||||||
@Header("pass") pass: String,
|
|
||||||
@Header("Content-Type") content_type: String,
|
|
||||||
@Body params: List<String>
|
|
||||||
):
|
):
|
||||||
Call<Any>
|
Call<Any>
|
||||||
|
|
||||||
|
@ -758,23 +720,13 @@ interface VerdnaturaService {
|
||||||
|
|
||||||
@POST("almacennew/expedition_scan")//REVISADA
|
@POST("almacennew/expedition_scan")//REVISADA
|
||||||
fun expedition_scan(
|
fun expedition_scan(
|
||||||
@Header("aplicacion") aplicacion: String,
|
@Body vararg params: Any
|
||||||
@Header("version") version: String,
|
|
||||||
@Header("user") user: String,
|
|
||||||
@Header("pass") pass: String,
|
|
||||||
@Header("Content-Type") content_type: String,
|
|
||||||
@Body params: List<String>
|
|
||||||
):
|
):
|
||||||
Call<Void>
|
Call<Void>
|
||||||
|
|
||||||
@POST("almacennew/cmrPallet_add")//REVISADA
|
@POST("almacennew/cmrPallet_add")//REVISADA
|
||||||
fun cmrExpeditionPallet_add(
|
fun cmrExpeditionPallet_add(
|
||||||
@Header("aplicacion") aplicacion: String,
|
@Body vararg params: Any
|
||||||
@Header("version") version: String,
|
|
||||||
@Header("user") user: String,
|
|
||||||
@Header("pass") pass: String,
|
|
||||||
@Header("Content-Type") content_type: String,
|
|
||||||
@Body params: List<Int>
|
|
||||||
):
|
):
|
||||||
Call<Void>
|
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()
|
setToolbar()
|
||||||
setEvents()
|
setEvents()
|
||||||
|
|
||||||
|
val i = Intent()
|
||||||
|
i.setClassName("verdnatura.es.repartoverdnatura", "verdnatura.es.repartoverdnatura.MainActivity")
|
||||||
|
i.putExtra("token",getData(TOKEN))
|
||||||
|
startActivity(i)
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,12 @@ class SaleAdapter(
|
||||||
onMistakeClickListener.onMistakeClickListener(sale)
|
onMistakeClickListener.onMistakeClickListener(sale)
|
||||||
false
|
false
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
//Tarea #5004
|
||||||
|
/* if (sale.hasMistake){
|
||||||
|
imageErrorMessage.setBackgroundColor(color.RED)
|
||||||
|
}*/
|
||||||
|
|
||||||
imageErrorMessage.setOnClickListener {
|
imageErrorMessage.setOnClickListener {
|
||||||
onMistakeClickListener.onMistakeClickListener(sale)
|
onMistakeClickListener.onMistakeClickListener(sale)
|
||||||
false
|
false
|
||||||
|
|
|
@ -4,9 +4,7 @@ import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
import androidx.lifecycle.Transformations
|
||||||
import es.verdnatura.domain.GetInventaryUserCase
|
import es.verdnatura.domain.SilexCallback
|
||||||
import es.verdnatura.domain.GetItemCardUserCase
|
|
||||||
import es.verdnatura.domain.GetWokerMistakeUSerCase
|
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
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.InventaryListVO
|
||||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.model.*
|
import es.verdnatura.presentation.view.feature.workermistake.model.*
|
||||||
import retrofit2.Call
|
|
||||||
import retrofit2.Callback
|
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
//private val getInventaryUserCase: GetInventaryUserCase = GetInventaryUserCase(context)
|
|
||||||
//private val getItemCardUserCase: GetItemCardUserCase = GetItemCardUserCase(context)
|
|
||||||
//private val getWorkerMistakeUserCase: GetWokerMistakeUSerCase = GetWokerMistakeUSerCase(context)
|
|
||||||
|
|
||||||
private val _inventaryList by lazy { MutableLiveData<InventaryListVO>() }
|
private val _inventaryList by lazy { MutableLiveData<InventaryListVO>() }
|
||||||
val inventaryList: LiveData<InventaryListVO>
|
val inventaryList: LiveData<InventaryListVO>
|
||||||
|
@ -59,8 +51,8 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
||||||
//sergio para obtener comprador
|
//sergio para obtener comprador
|
||||||
fun itemShelvingBuyerGet() {
|
fun itemShelvingBuyerGet() {
|
||||||
silex.itemShelvingBuyerGet().enqueue(object :
|
silex.itemShelvingBuyerGet().enqueue(object :
|
||||||
Callback<List<BuyerVO>> {
|
SilexCallback<List<BuyerVO>>(context) {
|
||||||
override fun onFailure(call: Call<List<BuyerVO>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<BuyerVO> = ArrayList()
|
val listError: ArrayList<BuyerVO> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
BuyerVO(
|
BuyerVO(
|
||||||
|
@ -71,10 +63,7 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
||||||
_buyersList.value = BuyerListVO(listError)
|
_buyersList.value = BuyerListVO(listError)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<List<BuyerVO>>) {
|
||||||
call: Call<List<BuyerVO>>,
|
|
||||||
response: Response<List<BuyerVO>>
|
|
||||||
) {
|
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_buyersList.value = response.body()?.let { BuyerListVO(it) }
|
_buyersList.value = response.body()?.let { BuyerListVO(it) }
|
||||||
} else {
|
} else {
|
||||||
|
@ -101,8 +90,8 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
||||||
fun getInventory(buyerFk: Int, warehouseFk: Int) {
|
fun getInventory(buyerFk: Int, warehouseFk: Int) {
|
||||||
silex.itemShelvingRadarFilterBuyer(buyerFk, warehouseFk)
|
silex.itemShelvingRadarFilterBuyer(buyerFk, warehouseFk)
|
||||||
.enqueue(object :
|
.enqueue(object :
|
||||||
Callback<List<ItemInventaryVO>> {
|
SilexCallback<List<ItemInventaryVO>>(context) {
|
||||||
override fun onFailure(call: Call<List<ItemInventaryVO>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<ItemInventaryVO> = ArrayList()
|
val listError: ArrayList<ItemInventaryVO> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
ItemInventaryVO(
|
ItemInventaryVO(
|
||||||
|
@ -116,10 +105,7 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
||||||
_inventaryList.value = InventaryListVO(listError)
|
_inventaryList.value = InventaryListVO(listError)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<List<ItemInventaryVO>>) {
|
||||||
call: Call<List<ItemInventaryVO>>,
|
|
||||||
response: Response<List<ItemInventaryVO>>
|
|
||||||
) {
|
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_inventaryList.value = response.body()?.let { InventaryListVO(it) }
|
_inventaryList.value = response.body()?.let { InventaryListVO(it) }
|
||||||
} else {
|
} else {
|
||||||
|
@ -152,30 +138,18 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
|
|
||||||
silex.itemTrash(itemFk, warehouseFk, newValue, isTrash)
|
silex.itemTrash(itemFk, warehouseFk, newValue, isTrash)
|
||||||
.enqueue(object : Callback<Any> {
|
.enqueue(object : SilexCallback<Any>(context) {
|
||||||
|
|
||||||
|
override fun onError(t: Throwable) {
|
||||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
|
||||||
_response.value = ResponseItemVO(
|
_response.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
if (!response.isSuccessful) {
|
|
||||||
_response.value = ResponseItemVO(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_response.value =
|
_response.value =
|
||||||
ResponseItemVO(isError = false, response = response.message())
|
ResponseItemVO(isError = false, response = response.message())
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -221,8 +195,8 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
||||||
fun department_getHasMistake() {
|
fun department_getHasMistake() {
|
||||||
|
|
||||||
silex.department_getHasMistake()
|
silex.department_getHasMistake()
|
||||||
.enqueue(object : Callback<List<DepartmentMistake>> {
|
.enqueue(object : SilexCallback<List<DepartmentMistake>>(context) {
|
||||||
override fun onFailure(call: Call<List<DepartmentMistake>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<DepartmentMistake> = ArrayList()
|
val listError: ArrayList<DepartmentMistake> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
DepartmentMistake(
|
DepartmentMistake(
|
||||||
|
@ -236,10 +210,7 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
||||||
_mistakeDepartmentList.value = departmentMistakeList(listError)
|
_mistakeDepartmentList.value = departmentMistakeList(listError)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<List<DepartmentMistake>>) {
|
||||||
call: Call<List<DepartmentMistake>>,
|
|
||||||
response: Response<List<DepartmentMistake>>
|
|
||||||
) {
|
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_mistakeDepartmentList.value =
|
_mistakeDepartmentList.value =
|
||||||
response.body()?.let { departmentMistakeList(it) }
|
response.body()?.let { departmentMistakeList(it) }
|
||||||
|
@ -256,8 +227,8 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
||||||
fun worker_getFromHasMistake( departmentFk: Int) {
|
fun worker_getFromHasMistake( departmentFk: Int) {
|
||||||
silex.worker_getFromHasMistake(departmentFk)
|
silex.worker_getFromHasMistake(departmentFk)
|
||||||
.enqueue(object :
|
.enqueue(object :
|
||||||
Callback<List<WorkerFromMistake>> {
|
SilexCallback<List<WorkerFromMistake>>(context) {
|
||||||
override fun onFailure(call: Call<List<WorkerFromMistake>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<WorkerFromMistake> = ArrayList()
|
val listError: ArrayList<WorkerFromMistake> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
WorkerFromMistake(
|
WorkerFromMistake(
|
||||||
|
@ -271,10 +242,7 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
||||||
_workerFromMistakeList.value = workerFromMistakeList(listError)
|
_workerFromMistakeList.value = workerFromMistakeList(listError)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<List<WorkerFromMistake>>) {
|
||||||
call: Call<List<WorkerFromMistake>>,
|
|
||||||
response: Response<List<WorkerFromMistake>>
|
|
||||||
) {
|
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
|
|
||||||
_workerFromMistakeList.value =
|
_workerFromMistakeList.value =
|
||||||
|
@ -299,8 +267,8 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
fun workerMistakeType_get() {
|
fun workerMistakeType_get() {
|
||||||
silex.workerMistakeType_get()
|
silex.workerMistakeType_get()
|
||||||
.enqueue(object : Callback<List<MistakeWorkerType>> {
|
.enqueue(object : SilexCallback<List<MistakeWorkerType>>(context) {
|
||||||
override fun onFailure(call: Call<List<MistakeWorkerType>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<MistakeWorkerType> = ArrayList()
|
val listError: ArrayList<MistakeWorkerType> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
MistakeWorkerType(
|
MistakeWorkerType(
|
||||||
|
@ -316,10 +284,7 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
||||||
_mistakeWorkerList.value = workerMistakeTypeList(listError)
|
_mistakeWorkerList.value = workerMistakeTypeList(listError)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<List<MistakeWorkerType>>) {
|
||||||
call: Call<List<MistakeWorkerType>>,
|
|
||||||
response: Response<List<MistakeWorkerType>>
|
|
||||||
) {
|
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_mistakeWorkerList.value =
|
_mistakeWorkerList.value =
|
||||||
response.body()?.let { workerMistakeTypeList(it) }
|
response.body()?.let { workerMistakeTypeList(it) }
|
||||||
|
@ -351,39 +316,22 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
||||||
) {
|
) {
|
||||||
silex.workerMistake_Add(vUserFk, vTypeFk)
|
silex.workerMistake_Add(vUserFk, vTypeFk)
|
||||||
.enqueue(object :
|
.enqueue(object :
|
||||||
Callback<Unit> {
|
SilexCallback<Any>(context) {
|
||||||
override fun onFailure(call: Call<Unit>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseAddMistake.value = ResponseItemVO(
|
_responseAddMistake.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<Any>) {
|
||||||
call: Call<Unit>,
|
|
||||||
response: Response<Unit>
|
|
||||||
) {
|
|
||||||
if (!response.isSuccessful) {
|
|
||||||
|
|
||||||
_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 =
|
_responseAddMistake.value =
|
||||||
ResponseItemVO(
|
ResponseItemVO(
|
||||||
isError = false,
|
isError = false,
|
||||||
response = response.message()
|
response = response.message()
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -394,47 +342,30 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
||||||
) {
|
) {
|
||||||
silex.expeditionMistake_add(vExpeditionFk, vTypeFk)
|
silex.expeditionMistake_add(vExpeditionFk, vTypeFk)
|
||||||
.enqueue(object :
|
.enqueue(object :
|
||||||
Callback<Unit> {
|
SilexCallback<Any>(context) {
|
||||||
override fun onFailure(call: Call<Unit>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseAddMistake.value = ResponseItemVO(
|
_responseAddMistake.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<Any>) {
|
||||||
call: Call<Unit>,
|
|
||||||
response: Response<Unit>
|
|
||||||
) {
|
|
||||||
if (!response.isSuccessful) {
|
|
||||||
|
|
||||||
_responseAddMistake.value = ResponseItemVO(
|
// sergio:refactor:solo debería haber un mensaje no un response o errorMessage
|
||||||
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
|
|
||||||
_responseAddMistake.value =
|
_responseAddMistake.value =
|
||||||
ResponseItemVO(
|
ResponseItemVO(
|
||||||
isError = false,
|
isError = false,
|
||||||
response = response.message()
|
response = response.message()
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun expeditionMistakeType_get() {
|
fun expeditionMistakeType_get() {
|
||||||
silex.expeditionMistakeType_get()
|
silex.expeditionMistakeType_get()
|
||||||
.enqueue(object : Callback<List<MistakeWorkerType>> {
|
.enqueue(object : SilexCallback<List<MistakeWorkerType>>(context) {
|
||||||
override fun onFailure(call: Call<List<MistakeWorkerType>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<MistakeWorkerType> = ArrayList()
|
val listError: ArrayList<MistakeWorkerType> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
MistakeWorkerType(
|
MistakeWorkerType(
|
||||||
|
@ -450,10 +381,8 @@ class InventaryViewModel(context: Context) : BaseViewModel(context) {
|
||||||
_mistakeWorkerList.value = workerMistakeTypeList(listError)
|
_mistakeWorkerList.value = workerMistakeTypeList(listError)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<List<MistakeWorkerType>>) {
|
||||||
call: Call<List<MistakeWorkerType>>,
|
|
||||||
response: Response<List<MistakeWorkerType>>
|
|
||||||
) {
|
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_mistakeWorkerList.value =
|
_mistakeWorkerList.value =
|
||||||
response.body()?.let { workerMistakeTypeList(it) }
|
response.body()?.let { workerMistakeTypeList(it) }
|
||||||
|
|
|
@ -9,7 +9,6 @@ import android.content.pm.PackageInfo
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import android.system.Os.kill
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
@ -282,25 +281,8 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
||||||
} else {
|
} else {
|
||||||
//sergio: se añade el log
|
//sergio: se añade el log
|
||||||
viewModel.worker_getId()
|
viewModel.worker_getId()
|
||||||
|
viewModel.worker_getSector()
|
||||||
viewModel.worker_getSector(
|
viewModel.worker_getPrinter()
|
||||||
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()
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
deviceLog_add(
|
deviceLog_add(
|
||||||
getString(R.string.logAppName),
|
getString(R.string.logAppName),
|
||||||
getInfoVersionNameApp(),
|
getInfoVersionNameApp(),
|
||||||
|
@ -313,29 +295,17 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
||||||
saveRemember(false)
|
saveRemember(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*saveUserAccesPref(
|
|
||||||
binding.edittextUsername.text.toString(),
|
|
||||||
binding.edittextPassword.text.toString()
|
|
||||||
)*/
|
|
||||||
|
|
||||||
|
|
||||||
if (it.vIsAuthorized == "1" && it.vMessage.isNullOrEmpty()) {
|
if (it.vIsAuthorized == "1" && it.vMessage.isNullOrEmpty()) {
|
||||||
|
|
||||||
getVersion()
|
getVersion()
|
||||||
|
|
||||||
}
|
}
|
||||||
if (it.vIsAuthorized == "1" && !it.vMessage.isNullOrEmpty()) {
|
if (it.vIsAuthorized == "1" && !it.vMessage.isNullOrEmpty()) {
|
||||||
binding.splashProgress.visibility = View.GONE
|
//binding.splashProgress.visibility = View.GONE
|
||||||
customDialog.setTitle(getString(R.string.info))
|
customDialog.setTitle(getString(R.string.info))
|
||||||
.setDescription(it.vMessage)
|
.setDescription(it.vMessage)
|
||||||
.setOkButton(getString(R.string.close)) {
|
.setOkButton(getString(R.string.close)) {
|
||||||
customDialog.dismiss()
|
customDialog.dismiss()
|
||||||
/* binding.splashProgress.visibility = View.VISIBLE
|
|
||||||
loginSalix(
|
|
||||||
user = binding.edittextUsername.text.toString(),
|
|
||||||
password = binding.edittextPassword.text.toString(),
|
|
||||||
"login de Salix"
|
|
||||||
)*/
|
|
||||||
getVersion()
|
getVersion()
|
||||||
}.show()
|
}.show()
|
||||||
|
|
||||||
|
@ -398,7 +368,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
||||||
}
|
}
|
||||||
|
|
||||||
workergetSector.observe(viewLifecycleOwner) {
|
workergetSector.observe(viewLifecycleOwner) {
|
||||||
binding.splashProgress.visibility = View.GONE
|
//binding.splashProgress.visibility = View.GONE
|
||||||
|
|
||||||
|
|
||||||
if (it.isError) {
|
if (it.isError) {
|
||||||
|
@ -413,7 +383,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
||||||
}
|
}
|
||||||
|
|
||||||
loadWorkerPrintList.observe(viewLifecycleOwner, Observer { event ->
|
loadWorkerPrintList.observe(viewLifecycleOwner, Observer { event ->
|
||||||
binding.splashProgress.visibility = View.GONE
|
//binding.splashProgress.visibility = View.GONE
|
||||||
|
|
||||||
event.getContentIfNotHandled().notNull {
|
event.getContentIfNotHandled().notNull {
|
||||||
|
|
||||||
|
@ -511,7 +481,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
||||||
private fun goToMain() {
|
private fun goToMain() {
|
||||||
val intent = Intent(activity, MainActivity::class.java)
|
val intent = Intent(activity, MainActivity::class.java)
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
//binding.splashProgress.visibility=View.GONE
|
binding.splashProgress.visibility=View.GONE
|
||||||
requireActivity().finish()
|
requireActivity().finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import androidx.lifecycle.Transformations
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import com.google.gson.reflect.TypeToken
|
import com.google.gson.reflect.TypeToken
|
||||||
import es.verdnatura.domain.GetLoginUserCase
|
|
||||||
import es.verdnatura.domain.SilexCallback
|
import es.verdnatura.domain.SilexCallback
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
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.versionApp
|
||||||
import es.verdnatura.presentation.view.feature.login.model.workerId
|
import es.verdnatura.presentation.view.feature.login.model.workerId
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.itemsExpeditionDynamics
|
import es.verdnatura.presentation.view.feature.paletizador.model.itemsExpeditionDynamics
|
||||||
import retrofit2.Call
|
|
||||||
import retrofit2.Callback
|
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class LoginViewModel(var context: Context) : BaseViewModel(context) {
|
class LoginViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase(context)
|
|
||||||
|
|
||||||
private val _loginsalixitem by lazy { MutableLiveData<LoginSalixVO>() }
|
private val _loginsalixitem by lazy { MutableLiveData<LoginSalixVO>() }
|
||||||
val loginsalixitem: LiveData<LoginSalixVO>
|
val loginsalixitem: LiveData<LoginSalixVO>
|
||||||
|
@ -74,99 +70,85 @@ class LoginViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
val loadWorkerPrintList = Transformations.map(_workerPrintList) { Event(it) }
|
val loadWorkerPrintList = Transformations.map(_workerPrintList) { Event(it) }
|
||||||
|
|
||||||
fun loginSalix(user: String, password: String) {
|
fun loginSalix(user: String, password: String) {
|
||||||
getLoginUserCase.salixLogin(user, password).enqueue(object : Callback<LoginSalixVO> {
|
salix.login(LoginSalixVO(user, password)).enqueue(
|
||||||
override fun onResponse(call: Call<LoginSalixVO>, response: Response<LoginSalixVO>) {
|
object : SilexCallback<LoginSalixVO>(context) {
|
||||||
|
override fun onSuccess(response: Response<LoginSalixVO>) {
|
||||||
|
|
||||||
val loginSalixVO: LoginSalixVO?
|
val loginSalixVO: LoginSalixVO?
|
||||||
if (response.body() != null) {
|
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(
|
LoginSalixVO(
|
||||||
user,
|
user,
|
||||||
password,
|
password,
|
||||||
it,
|
"",
|
||||||
isError = false,
|
isError = true,
|
||||||
errorMessage = ""
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
nameofFunction(this),
|
||||||
|
t.message!!
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
_loginsalixitem.value = loginSalixVO
|
||||||
} else {
|
|
||||||
|
|
||||||
loginSalixVO = LoginSalixVO(
|
|
||||||
user,
|
|
||||||
password,
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this), response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
_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) {
|
fun device_checkLogin(user: String, android_id: String) {
|
||||||
|
|
||||||
getLoginUserCase.device_checkLogin(user, android_id)
|
silex.device_checkLogin(user, android_id)
|
||||||
.enqueue(object : Callback<LoginDevice> {
|
.enqueue(object : SilexCallback<LoginDevice>(context) {
|
||||||
override fun onResponse(call: Call<LoginDevice>, response: Response<LoginDevice>) {
|
override fun onSuccess(response: Response<LoginDevice>) {
|
||||||
|
if (response.body() != null) {
|
||||||
|
|
||||||
val loginDevice: LoginDevice?
|
response.body()?.let {
|
||||||
|
|
||||||
if (!response.isSuccessful) {
|
_logindevice.value = LoginDevice(
|
||||||
loginDevice = LoginDevice(
|
it.vMessage, it.vIsAuthorized,
|
||||||
|
isError = false,
|
||||||
|
errorMessage = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_logindevice.value = LoginDevice(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(
|
errorMessage = getMessageFromAllResponse(
|
||||||
nameofFunction(this),
|
nameofFunction(this),
|
||||||
response.message()
|
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) {
|
override fun onError(t: Throwable) {
|
||||||
|
_logindevice.value =
|
||||||
val loginDevice =
|
|
||||||
LoginDevice(
|
LoginDevice(
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
|
@ -176,7 +158,6 @@ class LoginViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
t.message!!
|
t.message!!
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
_logindevice.value = loginDevice
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -184,55 +165,35 @@ class LoginViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
fun worker_getId() {
|
fun worker_getId() {
|
||||||
silex.worker_getId().enqueue(object : SilexCallback<Int>(context) {
|
silex.worker_getId().enqueue(object : SilexCallback<Int>(context) {
|
||||||
override fun onSuccess(response: Response<Int>) {
|
override fun onSuccess(response: Response<Int>) {
|
||||||
val prefs = app!!.getPrefs()
|
val prefs = app.getPrefs()
|
||||||
response.body()?.let { prefs.putInt("userFk", it) }
|
response.body()?.let { prefs.putInt("userFk", it) }
|
||||||
prefs.commit()
|
prefs.commit()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Esto no estava:
|
|
||||||
override fun onError(t: Throwable) {
|
|
||||||
throw Error(nameofFunction((this)) + t.message)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun deviceLog_add(
|
fun deviceLog_add(
|
||||||
app: String, versionApp: String, android_id: String
|
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) {
|
.enqueue(object : SilexCallback<Void>(context) {
|
||||||
override fun onError(t: Throwable) {
|
|
||||||
throw Error(nameofFunction((this)) + t.message)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSuccess(response: Response<Void>) {
|
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) {
|
fun checkVersion(nameApp: String) {
|
||||||
getLoginUserCase.checkVersion(nameApp)
|
silex.getVersion(nameApp)
|
||||||
.enqueue(object : Callback<versionApp> {
|
.enqueue(object : SilexCallback<versionApp>(context) {
|
||||||
override fun onResponse(call: Call<versionApp>, response: Response<versionApp>) {
|
override fun onSuccess(response: Response<versionApp>) {
|
||||||
|
|
||||||
//var versionApp: versionApp?
|
|
||||||
|
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
|
|
||||||
_versionappitem.value = response.body()?.let {
|
_versionappitem.value = response.body()?.let {
|
||||||
|
|
||||||
versionApp(
|
versionApp(
|
||||||
it.appname,
|
it.appname,
|
||||||
it.version,
|
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 =
|
_versionappitem.value =
|
||||||
versionApp(
|
versionApp(
|
||||||
nameApp,
|
nameApp,
|
||||||
|
@ -271,7 +229,6 @@ class LoginViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
t.message!!
|
t.message!!
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
//_versionappitem.value = versionApp
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -347,11 +304,10 @@ class LoginViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
|
||||||
fun worker_getSector(user: String, password: String) {
|
fun worker_getSector() {
|
||||||
|
|
||||||
getLoginUserCase.worker_getSector(user, password).enqueue(object : Callback<SectorItemVO> {
|
|
||||||
override fun onFailure(call: Call<SectorItemVO>, t: Throwable) {
|
|
||||||
|
|
||||||
|
silex.worker_getSector().enqueue(object : SilexCallback<SectorItemVO>(context) {
|
||||||
|
override fun onError(t: Throwable) {
|
||||||
_workergetSector.value = SectorItemVO(
|
_workergetSector.value = SectorItemVO(
|
||||||
0,
|
0,
|
||||||
"",
|
"",
|
||||||
|
@ -361,32 +317,14 @@ class LoginViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<SectorItemVO>) {
|
||||||
call: Call<SectorItemVO>,
|
_workergetSector.value = response.body()?.let {
|
||||||
response: Response<SectorItemVO>
|
SectorItemVO(
|
||||||
) {
|
it.id,
|
||||||
|
it.description,
|
||||||
if (!response.isSuccessful) {
|
it.warehouseFk,
|
||||||
_workergetSector.value = SectorItemVO(
|
isError = false
|
||||||
0, "", 0,
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
} 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() {
|
fun operator_getNumberOfWagons() {
|
||||||
|
|
||||||
silex.operator_getNumberOfWagons()
|
silex.operator_getNumberOfWagons()
|
||||||
.enqueue(object : Callback<Int?> {
|
.enqueue(object : SilexCallback<Int?>(context) {
|
||||||
override fun onFailure(call: Call<Int?>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
|
|
||||||
_operatorGetNumberOfWagons.value = ResponseItemNumber(
|
_operatorGetNumberOfWagons.value = ResponseItemNumber(
|
||||||
null,
|
null,
|
||||||
isError = true,
|
isError = true,
|
||||||
|
@ -407,73 +344,37 @@ class LoginViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<Int?>) {
|
||||||
call: Call<Int?>,
|
if (response.body() != null)
|
||||||
response: Response<Int?>
|
_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() {
|
fun operator_add() {
|
||||||
|
|
||||||
silex.operator_add().enqueue(object : Callback<Any> {
|
silex.operator_add().enqueue(object : SilexCallback<Any>(context) {
|
||||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_operatorAdd.value = ResponseItemVO(
|
_operatorAdd.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<Any>) {
|
||||||
call: Call<Any>,
|
_operatorAdd.value = ResponseItemVO("", false)
|
||||||
response: Response<Any>
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (!response.isSuccessful) {
|
|
||||||
_operatorAdd.value = ResponseItemVO(
|
|
||||||
"", true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
_operatorAdd.value = ResponseItemVO("", false)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun worker_getPrinter(user: String, password: String) {
|
fun worker_getPrinter() {
|
||||||
|
|
||||||
getLoginUserCase.worker_getPrinter(user, password)
|
silex.worker_getPrinter()
|
||||||
.enqueue(object : Callback<List<Printers>> {
|
.enqueue(object : SilexCallback<List<Printers>>(context) {
|
||||||
override fun onFailure(call: Call<List<Printers>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<Printers> = ArrayList()
|
val listError: ArrayList<Printers> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
Printers(
|
Printers(
|
||||||
|
@ -488,10 +389,7 @@ class LoginViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<List<Printers>>) {
|
||||||
call: Call<List<Printers>>,
|
|
||||||
response: Response<List<Printers>>
|
|
||||||
) {
|
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_workerPrintList.value = response.body()?.let {
|
_workerPrintList.value = response.body()?.let {
|
||||||
WorkerPrintersList(it)
|
WorkerPrintersList(it)
|
||||||
|
|
|
@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.packaging.fragment.PackagingView
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import es.verdnatura.domain.SilexCallback
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
|
@ -12,7 +13,7 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class PackagingViewModel(context: Context) : BaseViewModel(context) {
|
class PackagingViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
|
|
||||||
private val _itemSupplierList by lazy { MutableLiveData<itemSupplierList>() }
|
private val _itemSupplierList by lazy { MutableLiveData<itemSupplierList>() }
|
||||||
|
@ -34,8 +35,8 @@ class PackagingViewModel(context: Context) : BaseViewModel(context) {
|
||||||
fun getSuppliers() {
|
fun getSuppliers() {
|
||||||
salix.getSuppliers()
|
salix.getSuppliers()
|
||||||
.enqueue(object :
|
.enqueue(object :
|
||||||
Callback<List<Supplier>> {
|
SilexCallback<List<Supplier>>(context) {
|
||||||
override fun onFailure(call: Call<List<Supplier>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<Supplier> = ArrayList()
|
val listError: ArrayList<Supplier> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
Supplier(
|
Supplier(
|
||||||
|
@ -49,10 +50,7 @@ class PackagingViewModel(context: Context) : BaseViewModel(context) {
|
||||||
_supplierList.value = SupplierList(listError)
|
_supplierList.value = SupplierList(listError)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<List<Supplier>>) {
|
||||||
call: Call<List<Supplier>>,
|
|
||||||
response: Response<List<Supplier>>
|
|
||||||
) {
|
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_supplierList.value = response.body()?.let { SupplierList(it) }
|
_supplierList.value = response.body()?.let { SupplierList(it) }
|
||||||
} else {
|
} else {
|
||||||
|
@ -77,8 +75,8 @@ class PackagingViewModel(context: Context) : BaseViewModel(context) {
|
||||||
fun supplier_getItems(supplierFk: Int) {
|
fun supplier_getItems(supplierFk: Int) {
|
||||||
|
|
||||||
silex.supplier_getItems(supplierFk)
|
silex.supplier_getItems(supplierFk)
|
||||||
.enqueue(object : Callback<List<ItemSupplier>> {
|
.enqueue(object : SilexCallback<List<ItemSupplier>>(context) {
|
||||||
override fun onFailure(call: Call<List<ItemSupplier>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<ItemSupplier> = ArrayList()
|
val listError: ArrayList<ItemSupplier> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
ItemSupplier(
|
ItemSupplier(
|
||||||
|
@ -92,10 +90,7 @@ class PackagingViewModel(context: Context) : BaseViewModel(context) {
|
||||||
_itemSupplierList.value = itemSupplierList(listError)
|
_itemSupplierList.value = itemSupplierList(listError)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<List<ItemSupplier>>) {
|
||||||
call: Call<List<ItemSupplier>>,
|
|
||||||
response: Response<List<ItemSupplier>>
|
|
||||||
) {
|
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_itemSupplierList.value =
|
_itemSupplierList.value =
|
||||||
response.body()?.let { itemSupplierList(it) }
|
response.body()?.let { itemSupplierList(it) }
|
||||||
|
@ -112,8 +107,8 @@ class PackagingViewModel(context: Context) : BaseViewModel(context) {
|
||||||
fun entry_addSalix(entry: EntrySalix) {
|
fun entry_addSalix(entry: EntrySalix) {
|
||||||
salix.Entries(entry = entry)
|
salix.Entries(entry = entry)
|
||||||
.enqueue(object :
|
.enqueue(object :
|
||||||
Callback<EntrySalix> {
|
SilexCallback<EntrySalix> (context){
|
||||||
override fun onFailure(call: Call<EntrySalix>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_entry.value = EntrySalix(
|
_entry.value = EntrySalix(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
@ -123,10 +118,7 @@ class PackagingViewModel(context: Context) : BaseViewModel(context) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<EntrySalix>) {
|
||||||
call: Call<EntrySalix>,
|
|
||||||
response: Response<EntrySalix>
|
|
||||||
) {
|
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_entry.value = response.body()
|
_entry.value = response.body()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -45,8 +45,6 @@ class CmrExpeditionPalletFragment(
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
viewModel.cmrExpeditionPallet_add(
|
viewModel.cmrExpeditionPallet_add(
|
||||||
getData(USER),
|
|
||||||
getData(PASSWORD),
|
|
||||||
vExpeditionPallet!!,
|
vExpeditionPallet!!,
|
||||||
vCmrId!!
|
vCmrId!!
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,56 +3,41 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
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.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
import retrofit2.Call
|
|
||||||
import retrofit2.Callback
|
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
|
|
||||||
class CmrExpeditionPalletViewModel(context: Context) : BaseViewModel(context) {
|
class CmrExpeditionPalletViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
private val GetPaletizadoresUserCase: GetPaletizadoresUserCase =
|
|
||||||
GetPaletizadoresUserCase(context)
|
|
||||||
|
|
||||||
private val _responsescan by lazy { MutableLiveData<ResponseItemVO>() }
|
|
||||||
val responsescan: LiveData<ResponseItemVO>
|
|
||||||
get() = _responsescan
|
|
||||||
|
|
||||||
|
|
||||||
fun cmrExpeditionPallet_add(usuario: String, password: String, vExpeditionPallet: Int,vCmrId:Int) {
|
private val _responsescan by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
GetPaletizadoresUserCase.cmrExpeditionPallet_add(usuario, password, vExpeditionPallet, vCmrId)
|
val responsescan: LiveData<ResponseItemVO>
|
||||||
.enqueue(object : Callback<Void> {
|
get() = _responsescan
|
||||||
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()!!)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
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.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
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.BaseViewModel
|
||||||
|
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.common.Event
|
import es.verdnatura.presentation.common.Event
|
||||||
|
@ -17,9 +16,9 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
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>() }
|
private val _expeditionPalletList by lazy { MutableLiveData<ItemPalletViewListVO>() }
|
||||||
val loadExpeditionPalletList = Transformations.map(_expeditionPalletList) { Event(it) }
|
val loadExpeditionPalletList = Transformations.map(_expeditionPalletList) { Event(it) }
|
||||||
|
@ -33,25 +32,35 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel(context)
|
||||||
get() = _responsePrintPallet
|
get() = _responsePrintPallet
|
||||||
|
|
||||||
|
|
||||||
|
fun expeditionPallet_List(vPalletFk: Int) {
|
||||||
fun expeditionPallet_List(vPalletFk:Int){
|
|
||||||
silex.expeditionPalletView(vPalletFk).enqueue(object :
|
silex.expeditionPalletView(vPalletFk).enqueue(object :
|
||||||
Callback<List<ItemPalletViewVO>> {
|
SilexCallback<List<ItemPalletViewVO>>(context) {
|
||||||
override fun onFailure(call: Call<List<ItemPalletViewVO>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError:ArrayList<ItemPalletViewVO> = ArrayList()
|
val listError: ArrayList<ItemPalletViewVO> = ArrayList()
|
||||||
listError.add(ItemPalletViewVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
|
listError.add(
|
||||||
|
ItemPalletViewVO(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
|
)
|
||||||
|
)
|
||||||
_expeditionPalletList.value = ItemPalletViewListVO(listError)
|
_expeditionPalletList.value = ItemPalletViewListVO(listError)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<List<ItemPalletViewVO>>) {
|
||||||
call: Call<List<ItemPalletViewVO>>,
|
|
||||||
response: Response<List<ItemPalletViewVO>>
|
if (response.body() != null) {
|
||||||
) {
|
|
||||||
if (response.body() != null){
|
|
||||||
_expeditionPalletList.value = response.body()?.let { ItemPalletViewListVO(it) }
|
_expeditionPalletList.value = response.body()?.let { ItemPalletViewListVO(it) }
|
||||||
}else{
|
} else {
|
||||||
val listError:ArrayList<ItemPalletViewVO> = ArrayList()
|
val listError: ArrayList<ItemPalletViewVO> = ArrayList()
|
||||||
listError.add(ItemPalletViewVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
|
listError.add(
|
||||||
|
ItemPalletViewVO(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
nameofFunction(this),
|
||||||
|
response.message()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
_expeditionPalletList.value = ItemPalletViewListVO(listError)
|
_expeditionPalletList.value = ItemPalletViewListVO(listError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,54 +68,63 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel(context)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun expeditionPalletDel(vPalletFk:Int){
|
fun expeditionPalletDel(vPalletFk: Int) {
|
||||||
silex.expeditionPalletDel(vPalletFk).enqueue(object : Callback<Any>{
|
silex.expeditionPalletDel(vPalletFk).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!!))
|
_response.value = ResponseItemVO(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
|
||||||
if (response.isSuccessful){
|
override fun onSuccess(response: Response<Any>) {
|
||||||
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
|
_response.value = ResponseItemVO(
|
||||||
}else{
|
isError = true,
|
||||||
_response.value = ResponseItemVO(isError = false,response = response.message())
|
errorMessage = getMessageFromAllResponse(
|
||||||
}
|
nameofFunction(this),
|
||||||
|
response.message()
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun expeditionPalletPrintSet(
|
fun expeditionPalletPrintSet(
|
||||||
vPalletFk: Int,
|
vPalletFk: Int,
|
||||||
vSectorFk: Int){
|
vSectorFk: Int
|
||||||
|
) {
|
||||||
|
|
||||||
silex.expeditionPalletPrintSet(vPalletFk,vSectorFk).enqueue(object : Callback<Any>{
|
silex.expeditionPalletPrintSet(vPalletFk, vSectorFk).enqueue(object : SilexCallback<Any>(context) {
|
||||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responsePrintPallet.value = ResponseItemVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))
|
_responsePrintPallet.value = ResponseItemVO(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
|
||||||
if (!response.isSuccessful){
|
override fun onSuccess(response: Response<Any>) {
|
||||||
_responsePrintPallet.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
|
_responsePrintPallet.value =
|
||||||
}else{
|
ResponseItemVO(isError = false, response = response.message())
|
||||||
_responsePrintPallet.value = ResponseItemVO(isError = false,response = response.message())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun expeditionState_addByPallet(
|
fun expeditionState_addByPallet(
|
||||||
vPalletFk: Int,
|
vPalletFk: Int,
|
||||||
vStateCode:String,
|
vStateCode: String,
|
||||||
){
|
) {
|
||||||
|
|
||||||
silex.expeditionState_addByPallet(vPalletFk,vStateCode).enqueue(object : Callback<Unit>{
|
silex.expeditionState_addByPallet(vPalletFk, vStateCode).enqueue(object : SilexCallback<Unit>(context) {
|
||||||
override fun onFailure(call: Call<Unit>, t: Throwable) {
|
override fun onError(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<Unit>, response: Response<Unit>) {
|
|
||||||
if (!response.isSuccessful){
|
override fun onSuccess(response: Response<Unit>) {
|
||||||
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
|
_response.value = ResponseItemVO(isError = false, response = response.message())
|
||||||
}else{
|
|
||||||
_response.value = ResponseItemVO(isError = false,response = response.message())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,8 @@ import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
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.BaseViewModel
|
||||||
|
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.common.Event
|
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.ItemScanList
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanVO
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanVO
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
|
||||||
import retrofit2.Response
|
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>() }
|
private val _expeditionPalletList by lazy { MutableLiveData<ItemPalletListVO>() }
|
||||||
val loadExpeditionPalletList = Transformations.map(_expeditionPalletList) { Event(it) }
|
val loadExpeditionPalletList = Transformations.map(_expeditionPalletList) { Event(it) }
|
||||||
|
@ -34,32 +31,42 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel(context) {
|
||||||
val response: LiveData<ResponseItemVO>
|
val response: LiveData<ResponseItemVO>
|
||||||
get() = _response
|
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>() }
|
private val _responseCheckexpeditionScanPut by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
val responseCheckexpeditionScanPut: LiveData<ResponseItemVO>
|
val responseCheckexpeditionScanPut: LiveData<ResponseItemVO>
|
||||||
get() = _responseCheckexpeditionScanPut
|
get() = _responseCheckexpeditionScanPut
|
||||||
|
|
||||||
|
|
||||||
|
fun expeditionPallet_List(vTruckFk: Int) {
|
||||||
|
|
||||||
fun expeditionPallet_List(vTruckFk:Int){
|
|
||||||
silex.expeditionPallet_List(vTruckFk).enqueue(object :
|
silex.expeditionPallet_List(vTruckFk).enqueue(object :
|
||||||
Callback<List<ItemPalletVO>> {
|
SilexCallback<List<ItemPalletVO>>(context) {
|
||||||
override fun onFailure(call: Call<List<ItemPalletVO>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError:ArrayList<ItemPalletVO> = ArrayList()
|
val listError: ArrayList<ItemPalletVO> = ArrayList()
|
||||||
listError.add(ItemPalletVO(0,isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
|
listError.add(
|
||||||
|
ItemPalletVO(
|
||||||
|
0,
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
|
)
|
||||||
|
)
|
||||||
_expeditionPalletList.value = ItemPalletListVO(listError)
|
_expeditionPalletList.value = ItemPalletListVO(listError)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<List<ItemPalletVO>>) {
|
||||||
call: Call<List<ItemPalletVO>>,
|
if (response.body() != null) {
|
||||||
response: Response<List<ItemPalletVO>>
|
|
||||||
) {
|
|
||||||
if (response.body() != null){
|
|
||||||
_expeditionPalletList.value = response.body()?.let { ItemPalletListVO(it) }
|
_expeditionPalletList.value = response.body()?.let { ItemPalletListVO(it) }
|
||||||
}else{
|
} else {
|
||||||
val listError:ArrayList<ItemPalletVO> = ArrayList()
|
val listError: ArrayList<ItemPalletVO> = ArrayList()
|
||||||
listError.add(ItemPalletVO(0,isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
|
listError.add(
|
||||||
|
ItemPalletVO(
|
||||||
|
0,
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
nameofFunction(this),
|
||||||
|
response.message()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
_expeditionPalletList.value = ItemPalletListVO(listError)
|
_expeditionPalletList.value = ItemPalletListVO(listError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,24 +74,38 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun expeditionScanAdd(vPalletFk:Int,vTruckFk:Int){
|
fun expeditionScanAdd(vPalletFk: Int, vTruckFk: Int) {
|
||||||
silex.expeditionScanAdd(vPalletFk,vTruckFk).enqueue(object :
|
silex.expeditionScanAdd(vPalletFk, vTruckFk).enqueue(object :
|
||||||
Callback<List<ItemScanVO>> {
|
SilexCallback<List<ItemScanVO>>(context) {
|
||||||
override fun onFailure(call: Call<List<ItemScanVO>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError:ArrayList<ItemScanVO> = ArrayList()
|
val listError: ArrayList<ItemScanVO> = ArrayList()
|
||||||
listError.add(ItemScanVO("",0,isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
|
listError.add(
|
||||||
|
ItemScanVO(
|
||||||
|
"",
|
||||||
|
0,
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
|
)
|
||||||
|
)
|
||||||
_scanList.value = ItemScanList(listError)
|
_scanList.value = ItemScanList(listError)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<List<ItemScanVO>>) {
|
||||||
call: Call<List<ItemScanVO>>,
|
if (response.body() != null) {
|
||||||
response: Response<List<ItemScanVO>>
|
|
||||||
) {
|
|
||||||
if (response.body() != null){
|
|
||||||
_scanList.value = response.body()?.let { ItemScanList(it) }
|
_scanList.value = response.body()?.let { ItemScanList(it) }
|
||||||
}else{
|
} else {
|
||||||
val listError:ArrayList<ItemScanVO> = ArrayList()
|
val listError: ArrayList<ItemScanVO> = ArrayList()
|
||||||
listError.add(ItemScanVO("",0,isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
|
listError.add(
|
||||||
|
ItemScanVO(
|
||||||
|
"",
|
||||||
|
0,
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
nameofFunction(this),
|
||||||
|
response.message()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
_scanList.value = ItemScanList(listError)
|
_scanList.value = ItemScanList(listError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,36 +113,51 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun expeditionScanPut(vPalletFk:Int,vExpeditionFk:Int){
|
fun expeditionScanPut(vPalletFk: Int, vExpeditionFk: Int) {
|
||||||
silex.expeditionScanPut(vPalletFk,vExpeditionFk).enqueue(object : Callback<Any>{
|
silex.expeditionScanPut(vPalletFk, vExpeditionFk)
|
||||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
.enqueue(object : SilexCallback<Any>(context) {
|
||||||
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
|
override fun onError(t: Throwable) {
|
||||||
}
|
_response.value = ResponseItemVO(
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
isError = true,
|
||||||
if (!response.isSuccessful){
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
|
)
|
||||||
}else{
|
|
||||||
_response.value = ResponseItemVO(isError = false,response = response.message())
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||||
|
_response.value = ResponseItemVO(isError = false, response = response.message())
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun checkRouteExpeditionScanPut(vPalletFk:Int,vExpeditionFk:Int){
|
fun checkRouteExpeditionScanPut(vPalletFk: Int, vExpeditionFk: Int) {
|
||||||
silex.checkRouteExpeditionScanPut(vPalletFk,vExpeditionFk).enqueue(object : Callback<String>{
|
silex.checkRouteExpeditionScanPut(vPalletFk, vExpeditionFk)
|
||||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
.enqueue(object : SilexCallback<String>(context) {
|
||||||
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
|
override fun onError(t: Throwable) {
|
||||||
}
|
|
||||||
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()!!)
|
|
||||||
|
|
||||||
|
_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) {
|
private fun expeditionscan(ExpeditionScan: String) {
|
||||||
|
|
||||||
binding.splashProgress.visibility = VISIBLE
|
binding.splashProgress.visibility = VISIBLE
|
||||||
viewModel.expedition_scan(getData(USER),getData(PASSWORD), ExpeditionScan)
|
viewModel.expedition_scan(ExpeditionScan)
|
||||||
itemScaned = ExpeditionScan
|
itemScaned = ExpeditionScan
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,7 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import es.verdnatura.domain.GetPaletizadoresUserCase
|
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
|
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
|
@ -13,18 +11,15 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class ExpeditionScanSorterViewModel(context: Context) : BaseViewModel(context) {
|
class ExpeditionScanSorterViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
private val GetPaletizadoresUserCase: GetPaletizadoresUserCase =
|
|
||||||
GetPaletizadoresUserCase(context)
|
|
||||||
|
|
||||||
private val _responsescan by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _responsescan by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
val responsescan: LiveData<ResponseItemVO>
|
val responsescan: LiveData<ResponseItemVO>
|
||||||
get() = _responsescan
|
get() = _responsescan
|
||||||
|
|
||||||
|
|
||||||
fun expedition_scan(usuario: String, password: String, vExpeditionId: String) {
|
fun expedition_scan(vExpeditionId: String) {
|
||||||
GetPaletizadoresUserCase.expedition_scan(usuario, password, vExpeditionId)
|
silex.expedition_scan(vExpeditionId)
|
||||||
.enqueue(object : Callback<Void> {
|
.enqueue(object : Callback<Void> {
|
||||||
override fun onFailure(call: Call<Void>, t: Throwable) {
|
override fun onFailure(call: Call<Void>, t: Throwable) {
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
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.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
|
@ -18,10 +18,8 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
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>() }
|
private val _expeditionScanList by lazy { MutableLiveData<ItemExpeditionScanList>() }
|
||||||
val loadExpeditionScanList = Transformations.map(_expeditionScanList) { Event(it) }
|
val loadExpeditionScanList = Transformations.map(_expeditionScanList) { Event(it) }
|
||||||
|
@ -45,8 +43,8 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
fun expeditionScanList(vPalletFk: Int) {
|
fun expeditionScanList(vPalletFk: Int) {
|
||||||
silex.expeditionScanList(vPalletFk).enqueue(object :
|
silex.expeditionScanList(vPalletFk).enqueue(object :
|
||||||
Callback<List<ItemExpeditionScanVO>> {
|
SilexCallback<List<ItemExpeditionScanVO>>(context) {
|
||||||
override fun onFailure(call: Call<List<ItemExpeditionScanVO>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<ItemExpeditionScanVO> = ArrayList()
|
val listError: ArrayList<ItemExpeditionScanVO> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
ItemExpeditionScanVO(0,
|
ItemExpeditionScanVO(0,
|
||||||
|
@ -57,10 +55,8 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel(context) {
|
||||||
_expeditionScanList.value = ItemExpeditionScanList(listError)
|
_expeditionScanList.value = ItemExpeditionScanList(listError)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<List<ItemExpeditionScanVO>>) {
|
||||||
call: Call<List<ItemExpeditionScanVO>>,
|
|
||||||
response: Response<List<ItemExpeditionScanVO>>
|
|
||||||
) {
|
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_expeditionScanList.value = response.body()?.let { ItemExpeditionScanList(it) }
|
_expeditionScanList.value = response.body()?.let { ItemExpeditionScanList(it) }
|
||||||
} else {
|
} else {
|
||||||
|
@ -84,8 +80,8 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel(context) {
|
||||||
fun expeditionScanAdd(vPalletFk: Int, vTruckFk: Int) {
|
fun expeditionScanAdd(vPalletFk: Int, vTruckFk: Int) {
|
||||||
silex.expeditionScanAdd(vPalletFk, vTruckFk)
|
silex.expeditionScanAdd(vPalletFk, vTruckFk)
|
||||||
.enqueue(object :
|
.enqueue(object :
|
||||||
Callback<List<ItemScanVO>> {
|
SilexCallback<List<ItemScanVO>>(context) {
|
||||||
override fun onFailure(call: Call<List<ItemScanVO>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<ItemScanVO> = ArrayList()
|
val listError: ArrayList<ItemScanVO> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
ItemScanVO(
|
ItemScanVO(
|
||||||
|
@ -100,10 +96,8 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel(context) {
|
||||||
_scanList.value = ItemScanList(listError)
|
_scanList.value = ItemScanList(listError)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<List<ItemScanVO>>) {
|
||||||
call: Call<List<ItemScanVO>>,
|
|
||||||
response: Response<List<ItemScanVO>>
|
|
||||||
) {
|
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_scanList.value = response.body()?.let { ItemScanList(it) }
|
_scanList.value = response.body()?.let { ItemScanList(it) }
|
||||||
} else {
|
} else {
|
||||||
|
@ -130,8 +124,8 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel(context) {
|
||||||
vExpeditionFk: Int
|
vExpeditionFk: Int
|
||||||
) {
|
) {
|
||||||
silex.expeditionScanPut(vPalletFk, vExpeditionFk)
|
silex.expeditionScanPut(vPalletFk, vExpeditionFk)
|
||||||
.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(
|
_response.value = ResponseItemVO(
|
||||||
isError = true, errorMessage = getMessageFromAllResponse(
|
isError = true, errorMessage = getMessageFromAllResponse(
|
||||||
nameofFunction(this), t.message!!
|
nameofFunction(this), t.message!!
|
||||||
|
@ -139,20 +133,11 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel(context) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
if (!response.isSuccessful) {
|
|
||||||
_response.value = ResponseItemVO(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()!!
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_response.value =
|
_response.value =
|
||||||
ResponseItemVO(isError = false, response = response.message())
|
ResponseItemVO(isError = false, response = response.message())
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -164,15 +149,16 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel(context) {
|
||||||
silex.checkRouteExpeditionScanPut(
|
silex.checkRouteExpeditionScanPut(
|
||||||
vPalletFk,
|
vPalletFk,
|
||||||
vExpeditionFk
|
vExpeditionFk
|
||||||
).enqueue(object : Callback<String> {
|
).enqueue(object : SilexCallback<String>(context) {
|
||||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
|
|
||||||
_responseCheckexpeditionScanPut.value = ResponseItemVO(
|
_responseCheckexpeditionScanPut.value = ResponseItemVO(
|
||||||
isError = true,
|
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>) {
|
||||||
//sergio:se devuelve en el body
|
//sergio:se devuelve en el body
|
||||||
if (response.body() == null) {
|
if (response.body() == null) {
|
||||||
_responseCheckexpeditionScanPut.value = ResponseItemVO(
|
_responseCheckexpeditionScanPut.value = ResponseItemVO(
|
||||||
|
@ -194,8 +180,8 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
fun expeditionScanDel( vScanFk: Int) {
|
fun expeditionScanDel( vScanFk: Int) {
|
||||||
silex.expeditionScanDel(vScanFk)
|
silex.expeditionScanDel(vScanFk)
|
||||||
.enqueue(object : Callback<Any> {
|
.enqueue(object : SilexCallback<Any> (context){
|
||||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseDeleteScan.value = ResponseItemVO(
|
_responseDeleteScan.value = ResponseItemVO(
|
||||||
isError = true, errorMessage = getMessageFromAllResponse(
|
isError = true, errorMessage = getMessageFromAllResponse(
|
||||||
nameofFunction(this), t.message!!
|
nameofFunction(this), t.message!!
|
||||||
|
@ -203,18 +189,11 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel(context) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
if (!response.isSuccessful) {
|
|
||||||
_responseDeleteScan.value = ResponseItemVO(
|
|
||||||
isError = true, errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this), response.message()!!
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_responseDeleteScan.value =
|
_responseDeleteScan.value =
|
||||||
ResponseItemVO(isError = false, response = response.message())
|
ResponseItemVO(isError = false, response = response.message())
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,40 +1,32 @@
|
||||||
package es.verdnatura.presentation.view.feature.paletizador.fragment
|
package es.verdnatura.presentation.view.feature.paletizador.fragment
|
||||||
|
|
||||||
|
|
||||||
|
//import es.verdnatura.presentation.view.feature.paletizador.model.itemExpeditionDynamicsList
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.text.TextUtils
|
|
||||||
import android.util.Log
|
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import com.airbnb.lottie.parser.IntegerParser
|
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import com.google.gson.reflect.TypeToken
|
import com.google.gson.reflect.TypeToken
|
||||||
import es.verdnatura.domain.GetPaletizadoresUserCase
|
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
|
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingTypeList
|
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.itemExpedetionState
|
||||||
//import es.verdnatura.presentation.view.feature.paletizador.model.itemExpeditionDynamicsList
|
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.itemsExpeditionDynamics
|
import es.verdnatura.presentation.view.feature.paletizador.model.itemsExpeditionDynamics
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
|
|
||||||
class ExpeditionStateViewModel(context: Context) : BaseViewModel(context) {
|
class ExpeditionStateViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
private val GetPaletizadoresUserCase: GetPaletizadoresUserCase =
|
|
||||||
GetPaletizadoresUserCase(context)
|
|
||||||
|
|
||||||
private val _itemcard by lazy { MutableLiveData<ItemCardVO>() }
|
private val _itemcard by lazy { MutableLiveData<ItemCardVO>() }
|
||||||
val itemcard: LiveData<ItemCardVO>
|
val itemcard: LiveData<ItemCardVO>
|
||||||
get() = _itemcard
|
get() = _itemcard
|
||||||
|
|
||||||
|
|
||||||
private val _itemexpeditionlist by lazy { MutableLiveData<itemExpedetionState>() }
|
private val _itemexpeditionlist by lazy { MutableLiveData<itemExpedetionState>() }
|
||||||
val itemexpeditionlist: LiveData<itemExpedetionState>
|
val itemexpeditionlist: LiveData<itemExpedetionState>
|
||||||
get() = _itemexpeditionlist
|
get() = _itemexpeditionlist
|
||||||
|
@ -57,46 +49,7 @@ class ExpeditionStateViewModel(context: Context) : BaseViewModel(context) {
|
||||||
val itemsExpeditionlist: LiveData<ItemPackingTypeList>
|
val itemsExpeditionlist: LiveData<ItemPackingTypeList>
|
||||||
get() = _itemsExpeditionlist
|
get() = _itemsExpeditionlist
|
||||||
|
|
||||||
|
fun expedition_getStateJSON(expeditionFk: Int) {
|
||||||
|
|
||||||
|
|
||||||
/* 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){
|
|
||||||
silex.expedition_getStateJSON(expeditionFk)
|
silex.expedition_getStateJSON(expeditionFk)
|
||||||
.enqueue(object : Callback<JsonObject> {
|
.enqueue(object : Callback<JsonObject> {
|
||||||
override fun onFailure(call: Call<JsonObject>, t: Throwable) {
|
override fun onFailure(call: Call<JsonObject>, t: Throwable) {
|
||||||
|
@ -105,7 +58,8 @@ class ExpeditionStateViewModel(context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
_itemexpedition.value = itemExpedetionState(
|
_itemexpedition.value = itemExpedetionState(
|
||||||
isError = true,
|
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) {
|
if (response.body() != null) {
|
||||||
|
|
||||||
listProperties=getListFromJSON(response.body()!!.asJsonObject)
|
listProperties = getListFromJSON(response.body()!!.asJsonObject)
|
||||||
|
|
||||||
_itemexpedition.value = itemExpedetionState(
|
_itemexpedition.value = itemExpedetionState(
|
||||||
isError = false,
|
isError = false,
|
||||||
errorMessage = "",list = listProperties)
|
errorMessage = "", list = listProperties
|
||||||
|
)
|
||||||
|
|
||||||
let {
|
let {
|
||||||
|
|
||||||
|
@ -131,7 +86,10 @@ class ExpeditionStateViewModel(context: Context) : BaseViewModel(context) {
|
||||||
} else {
|
} else {
|
||||||
_itemexpedition.value = itemExpedetionState(
|
_itemexpedition.value = itemExpedetionState(
|
||||||
isError = true,
|
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?> =
|
var expeditionState: Map<String, String?> =
|
||||||
gson.fromJson(json, object : TypeToken<Map<String, String?>>() {}.type)
|
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
|
return list
|
||||||
|
|
|
@ -4,9 +4,8 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
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.BaseViewModel
|
||||||
|
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.common.Event
|
import es.verdnatura.presentation.common.Event
|
||||||
|
@ -17,9 +16,7 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class ExpeditionTruckListViewModel(context: Context) : BaseViewModel(context) {
|
class ExpeditionTruckListViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
private val getPaletizadoresUserCase: GetPaletizadoresUserCase = GetPaletizadoresUserCase(context)
|
|
||||||
|
|
||||||
private val _expeditionTruckList by lazy { MutableLiveData<ItemExpeditionTruckList>() }
|
private val _expeditionTruckList by lazy { MutableLiveData<ItemExpeditionTruckList>() }
|
||||||
val loadExpeditionTruckList = Transformations.map(_expeditionTruckList) { Event(it) }
|
val loadExpeditionTruckList = Transformations.map(_expeditionTruckList) { Event(it) }
|
||||||
|
@ -28,26 +25,37 @@ class ExpeditionTruckListViewModel(context: Context) : BaseViewModel(context) {
|
||||||
val loadResponseExpeditionAdd = Transformations.map(_response) { Event(it) }
|
val loadResponseExpeditionAdd = Transformations.map(_response) { Event(it) }
|
||||||
|
|
||||||
|
|
||||||
|
fun expeditionTruckList() {
|
||||||
|
|
||||||
fun expeditionTruckList(){
|
|
||||||
silex.expeditionTruckList().enqueue(object :
|
silex.expeditionTruckList().enqueue(object :
|
||||||
Callback<List<ItemExpeditionTruckVO>> {
|
SilexCallback<List<ItemExpeditionTruckVO>>(context) {
|
||||||
override fun onFailure(call: Call<List<ItemExpeditionTruckVO>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError:ArrayList<ItemExpeditionTruckVO> = ArrayList()
|
val listError: ArrayList<ItemExpeditionTruckVO> = ArrayList()
|
||||||
listError.add(ItemExpeditionTruckVO(0,isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
|
listError.add(
|
||||||
|
ItemExpeditionTruckVO(
|
||||||
|
0,
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
|
)
|
||||||
|
)
|
||||||
_expeditionTruckList.value = ItemExpeditionTruckList(listError)
|
_expeditionTruckList.value = ItemExpeditionTruckList(listError)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<List<ItemExpeditionTruckVO>>) {
|
||||||
call: Call<List<ItemExpeditionTruckVO>>,
|
if (response.body() != null) {
|
||||||
response: Response<List<ItemExpeditionTruckVO>>
|
_expeditionTruckList.value =
|
||||||
) {
|
response.body()?.let { ItemExpeditionTruckList(it) }
|
||||||
if (response.body() != null){
|
} else {
|
||||||
_expeditionTruckList.value = response.body()?.let { ItemExpeditionTruckList(it) }
|
val listError: ArrayList<ItemExpeditionTruckVO> = ArrayList()
|
||||||
}else{
|
listError.add(
|
||||||
val listError:ArrayList<ItemExpeditionTruckVO> = ArrayList()
|
ItemExpeditionTruckVO(
|
||||||
listError.add(ItemExpeditionTruckVO(0,isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
|
0,
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
nameofFunction(this),
|
||||||
|
response.message()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
_expeditionTruckList.value = ItemExpeditionTruckList(listError)
|
_expeditionTruckList.value = ItemExpeditionTruckList(listError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,17 +63,26 @@ class ExpeditionTruckListViewModel(context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun expeditionTruckAdd(vHour:String,vDescription:String){
|
fun expeditionTruckAdd(vHour: String, vDescription: String) {
|
||||||
silex.expeditionTruckAdd(vHour,vDescription).enqueue(object : Callback<Any>{
|
silex.expeditionTruckAdd(vHour, vDescription).enqueue(object : Callback<Any> {
|
||||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
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>) {
|
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||||
if (!response.isSuccessful){
|
if (!response.isSuccessful) {
|
||||||
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
|
_response.value = ResponseItemVO(
|
||||||
}else{
|
isError = true,
|
||||||
_response.value = ResponseItemVO(isError = false,response = response.message())
|
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 android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import es.verdnatura.domain.GetPaletizadoresUserCase
|
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
|
@ -14,10 +13,8 @@ import retrofit2.Callback
|
||||||
import retrofit2.Response
|
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>() }
|
private val _responseScan by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
val responseScan: LiveData<ResponseItemVO>
|
val responseScan: LiveData<ResponseItemVO>
|
||||||
|
|
|
@ -5,17 +5,14 @@ import android.view.View.GONE
|
||||||
import android.view.View.VISIBLE
|
import android.view.View.VISIBLE
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import es.verdnatura.domain.SilexCallback
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
import retrofit2.Call
|
|
||||||
import retrofit2.Callback
|
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class ParkingViewModel(context: Context) : BaseViewModel(context) {
|
class ParkingViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
// private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context)
|
|
||||||
|
|
||||||
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
val response: LiveData<ResponseItemVO>
|
val response: LiveData<ResponseItemVO>
|
||||||
get() = _response
|
get() = _response
|
||||||
|
@ -41,28 +38,18 @@ class ParkingViewModel(context: Context) : BaseViewModel(context) {
|
||||||
fun parking(scanItem: String, parking: String) {
|
fun parking(scanItem: String, parking: String) {
|
||||||
ProgressLoading(VISIBLE)
|
ProgressLoading(VISIBLE)
|
||||||
silex.shelvingPark(scanItem, parking).enqueue(object :
|
silex.shelvingPark(scanItem, parking).enqueue(object :
|
||||||
Callback<Any> {
|
SilexCallback<Any>(context) {
|
||||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
|
ProgressLoading(GONE)
|
||||||
_response.value = ResponseItemVO(
|
_response.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
ProgressLoading(GONE)
|
ProgressLoading(GONE)
|
||||||
|
_response.value = ResponseItemVO(isError = false, response = response.message())
|
||||||
if (response.isSuccessful)
|
|
||||||
_response.value = ResponseItemVO(isError = false, response = response.message())
|
|
||||||
else
|
|
||||||
_response.value = ResponseItemVO(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,19 +5,14 @@ import android.view.View.GONE
|
||||||
import android.view.View.VISIBLE
|
import android.view.View.VISIBLE
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
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.BaseViewModel
|
||||||
|
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
import retrofit2.Call
|
|
||||||
import retrofit2.Callback
|
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class ParkingSaleViewModel(context: Context) : BaseViewModel(context) {
|
class ParkingSaleViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context)
|
|
||||||
|
|
||||||
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
val response: LiveData<ResponseItemVO>
|
val response: LiveData<ResponseItemVO>
|
||||||
get() = _response
|
get() = _response
|
||||||
|
@ -41,25 +36,26 @@ class ParkingSaleViewModel(context: Context) : BaseViewModel(context) {
|
||||||
fun hideProgressLoading() {
|
fun hideProgressLoading() {
|
||||||
_isLoading.value = false
|
_isLoading.value = false
|
||||||
}
|
}
|
||||||
fun ProgressLoading(visibility:Int) {
|
|
||||||
|
fun ProgressLoading(visibility: Int) {
|
||||||
_isLoadingProgress.value = visibility
|
_isLoadingProgress.value = visibility
|
||||||
}
|
}
|
||||||
|
|
||||||
fun parking(scanItem: String,parking:String){
|
fun parking(scanItem: String, parking: String) {
|
||||||
ProgressLoading(VISIBLE)
|
ProgressLoading(VISIBLE)
|
||||||
silex.shelvingPark(scanItem,parking).enqueue(object :
|
silex.shelvingPark(scanItem, parking).enqueue(object :
|
||||||
Callback<Any> {
|
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!!))
|
_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)
|
ProgressLoading(GONE)
|
||||||
if (!response.isSuccessful){
|
_response.value = ResponseItemVO(isError = false, response = response.message())
|
||||||
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
|
|
||||||
}else{
|
|
||||||
_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){
|
if (working_in_test){
|
||||||
_pasillerositem.add(
|
_pasillerositem.add(
|
||||||
PasillerosItemVO(
|
PasillerosItemVO(
|
||||||
|
|
|
@ -3,68 +3,46 @@ package es.verdnatura.presentation.view.feature.precontrol
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import es.verdnatura.domain.SilexCallback
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.domain.GetPreControladorUserCase
|
|
||||||
|
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||||
import retrofit2.Call
|
|
||||||
import retrofit2.Callback
|
|
||||||
import retrofit2.Response
|
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 _collectionTicketList by lazy { MutableLiveData<CollectionVO>() }
|
||||||
private val getPreControladorUserCase: GetPreControladorUserCase = GetPreControladorUserCase(context)
|
|
||||||
|
|
||||||
val collectionTicketList: LiveData<CollectionVO>
|
val collectionTicketList: LiveData<CollectionVO>
|
||||||
get() = _collectionTicketList
|
get() = _collectionTicketList
|
||||||
|
|
||||||
fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String,type:String){
|
fun collectionTicketGet(collectionFk: String, sectorFk: String, type: String) {
|
||||||
getPreControladorUserCase.collectionTicketGet(usuario,password,collectionFk,sectorFk,"0",type).enqueue(object :
|
silex.collection_getTickets(collectionFk, sectorFk, "0", type).enqueue(object :
|
||||||
Callback<CollectionVO> {
|
SilexCallback<CollectionVO>(context) {
|
||||||
override fun onFailure(call: Call<CollectionVO>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_collectionTicketList.value = CollectionVO(0,isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))
|
_collectionTicketList.value = CollectionVO(
|
||||||
|
0,
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
override fun onResponse(
|
|
||||||
call: Call<CollectionVO>,
|
override fun onSuccess(response: Response<CollectionVO>) {
|
||||||
response: Response<CollectionVO>
|
if (response.body() != null) {
|
||||||
) {
|
_collectionTicketList.value = response.body()?.let { it.map(context) }
|
||||||
if (response.body() != null){
|
} else {
|
||||||
_collectionTicketList.value = response.body()?.let { it.map(contextApp) }
|
_collectionTicketList.value = CollectionVO(
|
||||||
}else{
|
0,
|
||||||
_collectionTicketList.value = CollectionVO(0,isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
|
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())
|
if (!workerId.isNullOrEmpty())
|
||||||
viewModel.sendChekingPresence(
|
viewModel.sendChekingPresence(
|
||||||
token = getData(TOKEN),
|
|
||||||
workerId = workerId,
|
workerId = workerId,
|
||||||
message = message
|
message = message
|
||||||
)
|
)
|
||||||
|
@ -898,8 +897,6 @@ class EndSacadorFragment(
|
||||||
itemShelvingFkStored = itemShelvingFk
|
itemShelvingFkStored = itemShelvingFk
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
viewModel.getIdFromCode(
|
viewModel.getIdFromCode(
|
||||||
usuario = getData(USER),
|
|
||||||
password = getData(PASSWORD),
|
|
||||||
code = customDialogList.getValueTwo()
|
code = customDialogList.getValueTwo()
|
||||||
)
|
)
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
|
@ -946,8 +943,6 @@ class EndSacadorFragment(
|
||||||
itemShelvingFkStored = itemShelvingFk
|
itemShelvingFkStored = itemShelvingFk
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
viewModel.getIdFromCode(
|
viewModel.getIdFromCode(
|
||||||
usuario = getData(USER),
|
|
||||||
password = getData(PASSWORD),
|
|
||||||
code = customDialogList.getValueTwo()
|
code = customDialogList.getValueTwo()
|
||||||
)
|
)
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
package es.verdnatura.presentation.view.feature.presacador.fragment
|
package es.verdnatura.presentation.view.feature.presacador.fragment
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.Log
|
|
||||||
import android.util.Log.d
|
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import es.verdnatura.domain.*
|
import es.verdnatura.domain.SilexCallback
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
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.SalixSaleQuantity
|
||||||
import es.verdnatura.presentation.view.feature.collection.listSaleSalix
|
import es.verdnatura.presentation.view.feature.collection.listSaleSalix
|
||||||
import es.verdnatura.presentation.view.feature.collection.saleSalix
|
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.presacador.model.PreSacadorItemVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.mapper.toDateFormat
|
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.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.PlacementSupplyListVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
private val contextApp=context
|
/*private val contextApp=context
|
||||||
private val getPreSacadorUseCase: GetPreSacadorUseCase = GetPreSacadorUseCase(context)
|
private val getPreSacadorUseCase: GetPreSacadorUseCase = GetPreSacadorUseCase(context)
|
||||||
private val getSacadorControladorUserCase: GetSacadorControladorUserCase =
|
private val getSacadorControladorUserCase: GetSacadorControladorUserCase =
|
||||||
GetSacadorControladorUserCase(context)
|
GetSacadorControladorUserCase(context)
|
||||||
|
|
||||||
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(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>>() }
|
private val _salesList by lazy { MutableLiveData<List<PreSacadorItemVO>>() }
|
||||||
val salesList: LiveData<List<PreSacadorItemVO>>
|
val salesList: LiveData<List<PreSacadorItemVO>>
|
||||||
|
@ -108,56 +105,46 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
get() = _responseSaleupdateIsChecked
|
get() = _responseSaleupdateIsChecked
|
||||||
|
|
||||||
|
|
||||||
fun ticketToPrePrepare(usuario: String, password: String, ticketFk: String, sectorFk: String) {
|
/* fun ticketToPrePrepare(usuario: String, password: String, ticketFk: String, sectorFk: String) {
|
||||||
getPreSacadorUseCase.ticketToPrePrepare(usuario, password, ticketFk, sectorFk)
|
silex.ticketToPrePrepare(usuario, password, ticketFk, sectorFk)
|
||||||
.enqueue(object :
|
.enqueue(object :
|
||||||
Callback<List<PreSacadorItemVO>> {
|
Callback<List<PreSacadorItemVO>> {
|
||||||
override fun onFailure(call: Call<List<PreSacadorItemVO>>, t: Throwable) {
|
override fun onFailure(call: Call<List<PreSacadorItemVO>>, t: Throwable) {
|
||||||
//d("VERDNATURA::", "ha fallado")
|
//d("VERDNATURA::", "ha fallado")
|
||||||
_salesList.value = listOf()
|
_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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
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(
|
fun collectionStickerPrint(
|
||||||
collectionFk: Int,
|
collectionFk: Int,
|
||||||
sectorFk: Int
|
sectorFk: Int
|
||||||
) {
|
) {
|
||||||
getSacadorControladorUserCase.collectionStickerPrint(
|
silex.collectionStickerPrint(
|
||||||
collectionFk,
|
collectionFk,
|
||||||
sectorFk
|
sectorFk
|
||||||
).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(
|
_response.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
if (!response.isSuccessful) {
|
_response.value =
|
||||||
_response.value = ResponseItemVO(
|
ResponseItemVO(isError = false, response = response.message()!!)
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_response.value =
|
|
||||||
ResponseItemVO(isError = false, response = response.message()!!)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -166,63 +153,23 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
ticketFk: String,
|
ticketFk: String,
|
||||||
parking: String
|
parking: String
|
||||||
) {
|
) {
|
||||||
silex.shelvingPark(ticketFk, parking)
|
silex.shelvingPark(ticketFk, parking)
|
||||||
.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(
|
_response.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
if (!response.isSuccessful) {
|
|
||||||
_response.value = ResponseItemVO(
|
_response.value =
|
||||||
isError = true,
|
ResponseItemVO(isError = false, response = response.message())
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_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(
|
fun itemPlacementSupplyAiming(
|
||||||
shelvingFk: String,
|
shelvingFk: String,
|
||||||
quantity: Int,
|
quantity: Int,
|
||||||
|
@ -233,11 +180,12 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
quantity,
|
quantity,
|
||||||
itemFk
|
itemFk
|
||||||
).enqueue(object :
|
).enqueue(object :
|
||||||
Callback<List<PlacementSupplyVO>> {
|
SilexCallback<List<PlacementSupplyVO>>(context) {
|
||||||
override fun onFailure(call: Call<List<PlacementSupplyVO>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<PlacementSupplyVO> = ArrayList()
|
val listError: ArrayList<PlacementSupplyVO> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
PlacementSupplyVO(itemShelvingFk = 0,
|
PlacementSupplyVO(
|
||||||
|
itemShelvingFk = 0,
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
|
@ -245,16 +193,14 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
_placementSuppleyList.value = PlacementSupplyListVO(listError)
|
_placementSuppleyList.value = PlacementSupplyListVO(listError)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<List<PlacementSupplyVO>>) {
|
||||||
call: Call<List<PlacementSupplyVO>>,
|
|
||||||
response: Response<List<PlacementSupplyVO>>
|
|
||||||
) {
|
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_placementSuppleyList.value = response.body()?.let { PlacementSupplyListVO(it) }
|
_placementSuppleyList.value = response.body()?.let { PlacementSupplyListVO(it) }
|
||||||
} else {
|
} else {
|
||||||
val listError: ArrayList<PlacementSupplyVO> = ArrayList()
|
val listError: ArrayList<PlacementSupplyVO> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
PlacementSupplyVO(itemShelvingFk = 0,
|
PlacementSupplyVO(
|
||||||
|
itemShelvingFk = 0,
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(
|
errorMessage = getMessageFromAllResponse(
|
||||||
nameofFunction(this),
|
nameofFunction(this),
|
||||||
|
@ -277,8 +223,8 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
itemShelvingFk,
|
itemShelvingFk,
|
||||||
saleFk,
|
saleFk,
|
||||||
quantity
|
quantity
|
||||||
).enqueue(object : Callback<Any> {
|
).enqueue(object : SilexCallback<Any>(context) {
|
||||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseItemShelvingSaleSupplyAdd.value = ResponseItemVO(
|
_responseItemShelvingSaleSupplyAdd.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
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>) {
|
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||||
if (!response.isSuccessful) {
|
_responseItemShelvingSaleSupplyAdd.value =
|
||||||
_responseItemShelvingSaleSupplyAdd.value = ResponseItemVO(
|
ResponseItemVO(isError = false, response = response.message())
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_responseItemShelvingSaleSupplyAdd.value =
|
|
||||||
ResponseItemVO(isError = false, response = response.message())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fun saleTrackingReplace(
|
fun saleTrackingReplace(
|
||||||
saleFk: String,
|
saleFk: String,
|
||||||
vOriginalQuantity: String,
|
vOriginalQuantity: String,
|
||||||
|
@ -312,47 +247,37 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
vBuyFk: String
|
vBuyFk: String
|
||||||
) {
|
) {
|
||||||
|
|
||||||
getSacadorControladorUserCase.saleTrackingReplace(
|
silex.saleTrackingReplace(
|
||||||
saleFk,
|
saleFk,
|
||||||
vOriginalQuantity,
|
vOriginalQuantity,
|
||||||
vStateFk,
|
vStateFk,
|
||||||
vIsChecked,
|
vIsChecked,
|
||||||
vBuyFk
|
vBuyFk
|
||||||
).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(
|
_response.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
if (!response.isSuccessful) {
|
_response.value = ResponseItemVO(isError = false, response = "")
|
||||||
_response.value = ResponseItemVO(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_response.value = ResponseItemVO(isError = false, response = "")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getIdFromCode(usuario: String, password: String, code: String) {
|
fun getIdFromCode(code: String) {
|
||||||
getSacadorControladorUserCase.getIdFromCode(usuario, password, code)
|
silex.getIdFromCode(code)
|
||||||
.enqueue(object : Callback<String> {
|
.enqueue(object : SilexCallback<String>(context) {
|
||||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseCode.value = ResponseItemVO(
|
_responseCode.value = ResponseItemVO(
|
||||||
isError = true,
|
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>) {
|
||||||
//sergio: espera item en el body
|
//sergio: espera item en el body
|
||||||
if (response.body() == null) {
|
if (response.body() == null) {
|
||||||
_responseCode.value = ResponseItemVO(
|
_responseCode.value = ResponseItemVO(
|
||||||
|
@ -371,67 +296,46 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun saleTrackingDel(usuario: String, password: String, saleFk: String) {
|
fun saleTrackingDel(saleFk: String) {
|
||||||
getSacadorControladorUserCase.saleTrackingDel(usuario, password, saleFk)
|
silex.saleTrackingDel(saleFk)
|
||||||
.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(
|
_response.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
if (!response.isSuccessful) {
|
|
||||||
_response.value = ResponseItemVO(
|
_response.value =
|
||||||
isError = true,
|
ResponseItemVO(isError = false, response = response.message())
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_response.value =
|
|
||||||
ResponseItemVO(isError = false, response = response.message())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun saleMove(
|
fun saleMove(
|
||||||
usuario: String,
|
|
||||||
password: String,
|
|
||||||
saleFk: String,
|
saleFk: String,
|
||||||
quantity: String,
|
quantity: String,
|
||||||
originalQuantity: String
|
originalQuantity: String
|
||||||
) {
|
) {
|
||||||
getSacadorControladorUserCase.saleMove(
|
silex.saleMove(
|
||||||
usuario,
|
|
||||||
password,
|
|
||||||
saleFk,
|
saleFk,
|
||||||
quantity,
|
quantity,
|
||||||
originalQuantity
|
originalQuantity
|
||||||
).enqueue(object : Callback<Any> {
|
).enqueue(object : SilexCallback<Any>(context) {
|
||||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseSaleMove.value = ResponseItemVO(
|
_responseSaleMove.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
if (!response.isSuccessful) {
|
_responseSaleMove.value =
|
||||||
_responseSaleMove.value = ResponseItemVO(
|
ResponseItemVO(isError = false, response = response.message())
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_responseSaleMove.value =
|
|
||||||
ResponseItemVO(isError = false, response = response.message())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -449,27 +353,17 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
type,
|
type,
|
||||||
warehouseFk,
|
warehouseFk,
|
||||||
originalQuantity
|
originalQuantity
|
||||||
).enqueue(object : Callback<Any> {
|
).enqueue(object : SilexCallback<Any>(context) {
|
||||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseMissingTrash.value = ResponseItemVO(
|
_responseMissingTrash.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
if (!response.isSuccessful) {
|
_responseMissingTrash.value =
|
||||||
_responseMissingTrash.value = ResponseItemVO(
|
ResponseItemVO(isError = false, response = response.message())
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_responseMissingTrash.value =
|
|
||||||
ResponseItemVO(isError = false, response = response.message())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -480,78 +374,59 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
) {
|
) {
|
||||||
salix.collectionIncreaseQuantitySalix(
|
salix.collectionIncreaseQuantitySalix(
|
||||||
SalixSaleQuantity(
|
SalixSaleQuantity(
|
||||||
saleFk,
|
saleFk,
|
||||||
quantity)
|
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(
|
_responseIncQuantity.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
if (!response.isSuccessful) {
|
_responseIncQuantity.value =
|
||||||
_responseIncQuantity.value = ResponseItemVO(
|
ResponseItemVO(isError = false, response = response.message())
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_responseIncQuantity.value =
|
|
||||||
ResponseItemVO(isError = false, response = response.message())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun collectionIncreaseQuantitySilex(
|
fun collectionIncreaseQuantitySilex(
|
||||||
usuario: String,
|
|
||||||
password: String,
|
|
||||||
saleFk: String,
|
saleFk: String,
|
||||||
quantity: String
|
quantity: String
|
||||||
) {
|
) {
|
||||||
getSacadorControladorUserCase.collectionIncreaseQuantity(
|
silex.collectionIncreaseQuantity(
|
||||||
usuario,
|
|
||||||
password,
|
|
||||||
saleFk,
|
saleFk,
|
||||||
quantity
|
quantity
|
||||||
).enqueue(object : Callback<Any> {
|
).enqueue(object : SilexCallback<Any>(context) {
|
||||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseIncQuantity.value = ResponseItemVO(
|
_responseIncQuantity.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
if (!response.isSuccessful) {
|
_responseIncQuantity.value =
|
||||||
_responseIncQuantity.value = ResponseItemVO(
|
ResponseItemVO(isError = false, response = response.message())
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_responseIncQuantity.value =
|
|
||||||
ResponseItemVO(isError = false, response = response.message())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun sendChekingPresence(
|
fun sendChekingPresence(
|
||||||
token: String,
|
|
||||||
workerId: String,
|
workerId: String,
|
||||||
message: String,
|
message: String,
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
getLoginUserCase.sendChekingPresence(token, workerId.toInt(), message)
|
salix.sendChekingPresence(
|
||||||
.enqueue(object : Callback<Boolean> {
|
params = SalixMessageVO(
|
||||||
|
workerId = workerId.toInt(),
|
||||||
|
message = message
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.enqueue(object : SilexCallback<Boolean>(context) {
|
||||||
override fun onResponse(call: Call<Boolean>, response: Response<Boolean>) {
|
override fun onResponse(call: Call<Boolean>, response: Response<Boolean>) {
|
||||||
if (!response.isSuccessful || response.message() == "false") {
|
if (!response.isSuccessful || response.message() == "false") {
|
||||||
_responseSalixMessage.value = ResponseItemVO(
|
_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(
|
_responseSalixMessage.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
@ -576,7 +451,7 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} catch (e: Exception) {
|
} 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() {
|
fun sectorCollection_get() {
|
||||||
|
|
||||||
silex.sectorCollection_get().enqueue(object :
|
silex.sectorCollection_get().enqueue(object :
|
||||||
Callback<List<CollectionVO>> {
|
SilexCallback<List<CollectionVO>>(context) {
|
||||||
override fun onFailure(call: Call<List<CollectionVO>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<CollectionVO> = ArrayList()
|
val listError: ArrayList<CollectionVO> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
CollectionVO(0,
|
CollectionVO(
|
||||||
|
0,
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
|
@ -597,17 +473,16 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<List<CollectionVO>>) {
|
||||||
call: Call<List<CollectionVO>>,
|
|
||||||
response: Response<List<CollectionVO>>
|
|
||||||
) {
|
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_collectionList.value =
|
_collectionList.value =
|
||||||
response.body()?.let { CollectionListVO(it.toDateFormat(contextApp)) }
|
response.body()?.let { CollectionListVO(it.toDateFormat(context)) }
|
||||||
} else {
|
} else {
|
||||||
val listError: ArrayList<CollectionVO> = ArrayList()
|
val listError: ArrayList<CollectionVO> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
CollectionVO(0,
|
CollectionVO(
|
||||||
|
0,
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(
|
errorMessage = getMessageFromAllResponse(
|
||||||
nameofFunction(this),
|
nameofFunction(this),
|
||||||
|
@ -628,8 +503,8 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
) {
|
) {
|
||||||
silex.sectorCollection_new(sectorFk).enqueue(
|
silex.sectorCollection_new(sectorFk).enqueue(
|
||||||
object :
|
object :
|
||||||
Callback<Unit> {
|
SilexCallback<Any>(context) {
|
||||||
override fun onFailure(call: Call<Unit>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseNew.value =
|
_responseNew.value =
|
||||||
ResponseItemVO(
|
ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
|
@ -639,46 +514,17 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<Any>) {
|
||||||
call: Call<Unit>,
|
|
||||||
response: Response<Unit>
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (!response.isSuccessful) {
|
_responseNew.value = ResponseItemVO(
|
||||||
_responseNew.value = ResponseItemVO(
|
isError = false,
|
||||||
isError = true,
|
errorMessage = "" + getMessageFromAllResponse(
|
||||||
errorMessage = getMessageFromAllResponse(
|
nameofFunction(this), response.message()
|
||||||
nameofFunction(this), response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_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()
|
vSectorFk.toString()
|
||||||
)
|
)
|
||||||
.enqueue(object :
|
.enqueue(object :
|
||||||
Callback<List<PreSacadorItemVO>> {
|
SilexCallback<List<PreSacadorItemVO>>(context) {
|
||||||
override fun onFailure(call: Call<List<PreSacadorItemVO>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_salesList.value = listOf()
|
_salesList.value = listOf()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<List<PreSacadorItemVO>>) {
|
||||||
call: Call<List<PreSacadorItemVO>>,
|
|
||||||
response: Response<List<PreSacadorItemVO>>
|
|
||||||
) {
|
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_salesList.value = response.body()?.let { it }
|
_salesList.value = response.body()?.let { it }
|
||||||
|
|
||||||
|
@ -721,8 +564,8 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
vSectorCollectionFk
|
vSectorCollectionFk
|
||||||
).enqueue(
|
).enqueue(
|
||||||
object :
|
object :
|
||||||
Callback<Unit> {
|
SilexCallback<Any>(context) {
|
||||||
override fun onFailure(call: Call<Unit>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_response.value =
|
_response.value =
|
||||||
ResponseItemVO(
|
ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
|
@ -735,29 +578,13 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<Any>) {
|
||||||
call: Call<Unit>,
|
_responseSaleGroupAdd.value = ResponseItemVO(
|
||||||
response: Response<Unit>
|
isError = false,
|
||||||
) {
|
errorMessage = "" + getMessageFromAllResponse(
|
||||||
|
nameofFunction(this), response.message()
|
||||||
if (!response.isSuccessful) {
|
|
||||||
_responseSaleGroupAdd.value = ResponseItemVO(
|
|
||||||
isError = true,
|
|
||||||
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(
|
silex.saleTracking_addPrevOK(vSectorCollectionFk).enqueue(
|
||||||
object :
|
object :
|
||||||
Callback<Unit> {
|
SilexCallback<Any>(context) {
|
||||||
override fun onFailure(call: Call<Unit>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseSaleAddPrevOK.value =
|
_responseSaleAddPrevOK.value =
|
||||||
ResponseItemVO(
|
ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
|
@ -778,33 +605,16 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<Any>) {
|
||||||
call: Call<Unit>,
|
_responseSaleAddPrevOK.value = ResponseItemVO(
|
||||||
response: Response<Unit>
|
isError = false,
|
||||||
) {
|
errorMessage = ""
|
||||||
|
+ getMessageFromAllResponse(
|
||||||
if (!response.isSuccessful) {
|
nameofFunction(this), response.message()
|
||||||
_responseSaleAddPrevOK.value = ResponseItemVO(
|
|
||||||
isError = true,
|
|
||||||
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)
|
silex.saleTracking_updateIsChecked(vSaleFk, vIsChecked)
|
||||||
.enqueue(
|
.enqueue(
|
||||||
object :
|
object :
|
||||||
Callback<Unit> {
|
SilexCallback<Any>(context) {
|
||||||
override fun onFailure(call: Call<Unit>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseSaleupdateIsChecked.value =
|
_responseSaleupdateIsChecked.value =
|
||||||
ResponseItemVO(
|
ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
|
@ -830,30 +640,14 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<Any>) {
|
||||||
call: Call<Unit>,
|
_responseSaleupdateIsChecked.value = ResponseItemVO(
|
||||||
response: Response<Unit>
|
isError = false,
|
||||||
) {
|
errorMessage = ""
|
||||||
|
+ getMessageFromAllResponse(
|
||||||
if (!response.isSuccessful) {
|
nameofFunction(this), response.message()
|
||||||
_responseSaleupdateIsChecked.value = ResponseItemVO(
|
|
||||||
isError = true,
|
|
||||||
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>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
|
_responseItemShelvingUpdate.value =
|
||||||
_responseItemShelvingUpdate.value =
|
ResponseItemVO(isError = false, response = response.message()!!)
|
||||||
ResponseItemVO(isError = false, response = response.message()!!)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun transferSalesSalix(
|
fun transferSalesSalix(
|
||||||
ticketFk:String,
|
ticketFk: String,
|
||||||
saleFk: Int,
|
saleFk: Int,
|
||||||
quantity: String,
|
quantity: String,
|
||||||
|
|
||||||
) {
|
) {
|
||||||
var saleTransfer = listSaleSalix(arrayListOf(saleSalix(id = saleFk, quantity = quantity.toInt())))
|
var saleTransfer =
|
||||||
//saleTransfer.sales.add(saleSalix(id = saleFk.toInt(), quantity = quantity.toInt()))
|
listSaleSalix(arrayListOf(saleSalix(id = saleFk, quantity = quantity.toInt())))
|
||||||
salix.transferSalesSalix(
|
salix.transferSalesSalix(
|
||||||
ticketFk,saleTransfer
|
ticketFk, saleTransfer
|
||||||
|
|
||||||
).enqueue(object : Callback<Any> {
|
).enqueue(object : SilexCallback<Any>(context) {
|
||||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseSplit.value = ResponseItemVO(
|
_responseSplit.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
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.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
|
import es.verdnatura.domain.SilexCallback
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
import retrofit2.Call
|
|
||||||
import retrofit2.Callback
|
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class QrFragmentViewModel(context: Context) : BaseViewModel(context) {
|
class QrFragmentViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
private val contextApp =context
|
|
||||||
|
|
||||||
private val _qrresponse by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _qrresponse by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
val qrresponse: LiveData<ResponseItemVO>
|
val qrresponse: LiveData<ResponseItemVO>
|
||||||
get() = _qrresponse
|
get() = _qrresponse
|
||||||
|
|
||||||
|
|
||||||
fun qr_getCall(vStatement: String){
|
fun qr_getCall(vStatement: String) {
|
||||||
silex.qr_getCall(vStatement)
|
silex.qr_getCall(vStatement)
|
||||||
.enqueue(object : Callback<String> {
|
.enqueue(object : SilexCallback<String>(context) {
|
||||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
|
|
||||||
_qrresponse.value = ResponseItemVO(
|
_qrresponse.value = ResponseItemVO(
|
||||||
isError = true,
|
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) {
|
if (response.raw().code() == 555 || response.raw().code() == 403) {
|
||||||
|
|
||||||
//Log.i("VERDNATURA:","UserError ${response.raw().message().toString()}")
|
|
||||||
// var message = response.raw().message().toString()
|
|
||||||
|
|
||||||
_qrresponse.value = ResponseItemVO(
|
_qrresponse.value = ResponseItemVO(
|
||||||
response = "",
|
response = "",
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage =contextApp.getString(
|
errorMessage = context.getString(
|
||||||
R.string.userNotPermission
|
R.string.userNotPermission
|
||||||
))
|
)
|
||||||
|
)
|
||||||
|
|
||||||
} else if (response.body() != null) {
|
} else if (response.body() != null) {
|
||||||
_qrresponse.value = ResponseItemVO(
|
_qrresponse.value = ResponseItemVO(
|
||||||
|
@ -55,16 +50,18 @@ class QrFragmentViewModel(context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
_qrresponse.value = ResponseItemVO(
|
_qrresponse.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
nameofFunction(this),
|
||||||
|
response.message()
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,26 +3,18 @@ package es.verdnatura.presentation.view.feature.reposicion.fragment
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import es.verdnatura.domain.GetPreSacadorUseCase
|
import es.verdnatura.domain.SilexCallback
|
||||||
import es.verdnatura.domain.GetSacadorControladorUserCase
|
|
||||||
import es.verdnatura.domain.GetUbicadorUserCase
|
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
|
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO
|
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.PlacementSupplyListVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
||||||
import retrofit2.Call
|
|
||||||
import retrofit2.Callback
|
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class ReposicionViewModel(context: Context) : BaseViewModel(context) {
|
class ReposicionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
private val getPreSacadorUseCase: GetPreSacadorUseCase = GetPreSacadorUseCase(context)
|
|
||||||
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context)
|
|
||||||
private val getSacadorControladorUserCase: GetSacadorControladorUserCase =
|
|
||||||
GetSacadorControladorUserCase(context)
|
|
||||||
|
|
||||||
private val _salesList by lazy { MutableLiveData<List<PreSacadorItemVO>>() }
|
private val _salesList by lazy { MutableLiveData<List<PreSacadorItemVO>>() }
|
||||||
val salesList: LiveData<List<PreSacadorItemVO>>
|
val salesList: LiveData<List<PreSacadorItemVO>>
|
||||||
|
@ -50,15 +42,12 @@ class ReposicionViewModel(context: Context) : BaseViewModel(context) {
|
||||||
) {
|
) {
|
||||||
silex.itemPlacementSupplyGetOrder(sectorFk)
|
silex.itemPlacementSupplyGetOrder(sectorFk)
|
||||||
.enqueue(object :
|
.enqueue(object :
|
||||||
Callback<List<PreSacadorItemVO>> {
|
SilexCallback<List<PreSacadorItemVO>>(context) {
|
||||||
override fun onFailure(call: Call<List<PreSacadorItemVO>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_salesList.value = listOf()
|
_salesList.value = listOf()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<List<PreSacadorItemVO>>) {
|
||||||
call: Call<List<PreSacadorItemVO>>,
|
|
||||||
response: Response<List<PreSacadorItemVO>>
|
|
||||||
) {
|
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_salesList.value = response.body()?.let { it }
|
_salesList.value = response.body()?.let { it }
|
||||||
} else {
|
} else {
|
||||||
|
@ -73,28 +62,18 @@ class ReposicionViewModel(context: Context) : BaseViewModel(context) {
|
||||||
parking: String
|
parking: String
|
||||||
|
|
||||||
) {
|
) {
|
||||||
silex.shelvingPark(ticketFk, parking)
|
silex.shelvingPark(ticketFk, parking)
|
||||||
.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(
|
_response.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
if (!response.isSuccessful) {
|
_response.value =
|
||||||
_response.value = ResponseItemVO(
|
ResponseItemVO(isError = false, response = response.message())
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_response.value =
|
|
||||||
ResponseItemVO(isError = false, response = response.message())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -110,11 +89,12 @@ class ReposicionViewModel(context: Context) : BaseViewModel(context) {
|
||||||
quantity,
|
quantity,
|
||||||
itemFk
|
itemFk
|
||||||
).enqueue(object :
|
).enqueue(object :
|
||||||
Callback<List<PlacementSupplyVO>> {
|
SilexCallback<List<PlacementSupplyVO>>(context) {
|
||||||
override fun onFailure(call: Call<List<PlacementSupplyVO>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<PlacementSupplyVO> = ArrayList()
|
val listError: ArrayList<PlacementSupplyVO> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
PlacementSupplyVO(itemShelvingFk = 0,
|
PlacementSupplyVO(
|
||||||
|
itemShelvingFk = 0,
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
|
@ -122,16 +102,14 @@ class ReposicionViewModel(context: Context) : BaseViewModel(context) {
|
||||||
_placementSuppleyList.value = PlacementSupplyListVO(listError)
|
_placementSuppleyList.value = PlacementSupplyListVO(listError)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<List<PlacementSupplyVO>>) {
|
||||||
call: Call<List<PlacementSupplyVO>>,
|
|
||||||
response: Response<List<PlacementSupplyVO>>
|
|
||||||
) {
|
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_placementSuppleyList.value = response.body()?.let { PlacementSupplyListVO(it) }
|
_placementSuppleyList.value = response.body()?.let { PlacementSupplyListVO(it) }
|
||||||
} else {
|
} else {
|
||||||
val listError: ArrayList<PlacementSupplyVO> = ArrayList()
|
val listError: ArrayList<PlacementSupplyVO> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
PlacementSupplyVO(itemShelvingFk = 0,
|
PlacementSupplyVO(
|
||||||
|
itemShelvingFk = 0,
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(
|
errorMessage = getMessageFromAllResponse(
|
||||||
nameofFunction(this),
|
nameofFunction(this),
|
||||||
|
@ -146,16 +124,16 @@ class ReposicionViewModel(context: Context) : BaseViewModel(context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getIdFromCode(usuario: String, password: String, code: String) {
|
fun getIdFromCode(usuario: String, password: String, code: String) {
|
||||||
getSacadorControladorUserCase.getIdFromCode(usuario, password, code)
|
silex.getIdFromCode(usuario, password, code)
|
||||||
.enqueue(object : Callback<String> {
|
.enqueue(object : SilexCallback<String>(context) {
|
||||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseCode.value = ResponseItemVO(
|
_responseCode.value = ResponseItemVO(
|
||||||
isError = true,
|
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>) {
|
||||||
//sergio:espera item en el body
|
//sergio:espera item en el body
|
||||||
if (response.body() == null) {
|
if (response.body() == null) {
|
||||||
_responseCode.value = ResponseItemVO(
|
_responseCode.value = ResponseItemVO(
|
||||||
|
@ -175,39 +153,25 @@ class ReposicionViewModel(context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
|
|
||||||
fun itemShelvingPlacementSupplyAdd(
|
fun itemShelvingPlacementSupplyAdd(
|
||||||
usuario: String,
|
|
||||||
password: String,
|
|
||||||
itemShelvingFk: String,
|
itemShelvingFk: String,
|
||||||
itemPlacementSupplyFk: String,
|
itemPlacementSupplyFk: String,
|
||||||
quantity: String
|
quantity: String
|
||||||
|
|
||||||
) {
|
) {
|
||||||
getSacadorControladorUserCase.itemShelvingPlacementSupplyAdd(
|
silex.itemShelvingPlacementSupplyAdd(
|
||||||
usuario,
|
|
||||||
password,
|
|
||||||
itemShelvingFk,
|
itemShelvingFk,
|
||||||
itemPlacementSupplyFk,
|
itemPlacementSupplyFk,
|
||||||
quantity
|
quantity
|
||||||
).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(
|
_response.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
if (!response.isSuccessful) {
|
_response.value = ResponseItemVO(isError = false, response = response.message())
|
||||||
_response.value = ResponseItemVO(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_response.value = ResponseItemVO(isError = false, response = response.message())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -217,27 +181,17 @@ class ReposicionViewModel(context: Context) : BaseViewModel(context) {
|
||||||
quantity: Int
|
quantity: Int
|
||||||
) {
|
) {
|
||||||
silex.itemPlacementSupplyCloseOrder(id, quantity)
|
silex.itemPlacementSupplyCloseOrder(id, quantity)
|
||||||
.enqueue(object : Callback<Any> {
|
.enqueue(object : SilexCallback<Any>(context) {
|
||||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseClose.value = ResponseItemVO(
|
_responseClose.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
if (!response.isSuccessful) {
|
_responseClose.value =
|
||||||
_responseClose.value = ResponseItemVO(
|
ResponseItemVO(isError = false, response = response.message())
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_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 android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
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.BaseViewModel
|
||||||
|
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
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.CollectionListVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class SacadorViewModel(context: Context) : BaseViewModel(context) {
|
class SacadorViewModel(val 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
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
private val _collectionList by lazy { MutableLiveData<CollectionListVO>() }
|
private val _collectionList by lazy { MutableLiveData<CollectionListVO>() }
|
||||||
val collectionList: LiveData<CollectionListVO>
|
val collectionList: LiveData<CollectionListVO>
|
||||||
|
@ -44,24 +34,24 @@ class SacadorViewModel(context: Context) : BaseViewModel(context) {
|
||||||
val responseCollectionSmart: LiveData<ResponseItemVO>
|
val responseCollectionSmart: LiveData<ResponseItemVO>
|
||||||
get() = _responseCollectionSmart
|
get() = _responseCollectionSmart
|
||||||
|
|
||||||
|
|
||||||
fun collectionTicketGet(
|
fun collectionTicketGet(
|
||||||
collectionFk: Int,
|
collectionFk: Int,
|
||||||
sectorFk: String,
|
sectorFk: String,
|
||||||
print: String,
|
print: String,
|
||||||
type:String
|
type: String
|
||||||
){
|
) {
|
||||||
getSacadorControladorUserCase.collectionTicketGet(
|
silex.collection_getTickets(
|
||||||
collectionFk,
|
collectionFk,
|
||||||
sectorFk,
|
sectorFk,
|
||||||
print,
|
print,
|
||||||
type
|
type
|
||||||
).enqueue(object :
|
).enqueue(object :
|
||||||
Callback<CollectionVO> {
|
SilexCallback<CollectionVO>(context) {
|
||||||
override fun onFailure(call: Call<CollectionVO>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_collectionTicketList.value = CollectionVO(0,
|
_collectionTicketList.value = CollectionVO(
|
||||||
|
0,
|
||||||
isError = true,
|
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>
|
response: Response<CollectionVO>
|
||||||
) {
|
) {
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_collectionTicketList.value = response.body()?.let { it.map(contextApp) }
|
_collectionTicketList.value = response.body()?.let { it.map(context) }
|
||||||
} else {
|
} else {
|
||||||
_collectionTicketList.value = CollectionVO(0,
|
_collectionTicketList.value = CollectionVO(
|
||||||
|
0,
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
nameofFunction(this),
|
||||||
|
response.message()
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fun collectionNew(usuario: String, password: String, sectorFk: String, wagons: String){
|
fun collection_assign() {
|
||||||
getSacadorControladorUserCase.collectionNew(usuario, password, sectorFk, wagons).enqueue(
|
silex.collection_assign().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(
|
|
||||||
object :
|
object :
|
||||||
Callback<String> {
|
SilexCallback<String>(context) {
|
||||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_response.value =
|
_response.value =
|
||||||
ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
|
ResponseItemVO(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
nameofFunction(this),
|
||||||
|
t.message!!
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<String>) {
|
||||||
call: Call<String>,
|
|
||||||
response: Response<String>
|
|
||||||
) {
|
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_response.value =
|
_response.value =
|
||||||
ResponseItemVO(isError = false, response = response.body()!!)
|
ResponseItemVO(isError = false, response = response.body()!!)
|
||||||
|
@ -134,7 +98,10 @@ class SacadorViewModel(context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
_response.value = ResponseItemVO(
|
_response.value = ResponseItemVO(
|
||||||
isError = true,
|
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(){
|
fun collectionGet() {
|
||||||
getSacadorControladorUserCase.collectionGet().enqueue(object :
|
silex.collectionGet().enqueue(object :
|
||||||
Callback<List<CollectionVO>> {
|
SilexCallback<List<CollectionVO>>(context) {
|
||||||
override fun onFailure(call: Call<List<CollectionVO>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<CollectionVO> = ArrayList()
|
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)
|
_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) {
|
if (response.body() != null) {
|
||||||
_collectionList.value =
|
_collectionList.value =
|
||||||
response.body()?.let { CollectionListVO(it.toDateFormat(contextApp)) }
|
response.body()?.let { CollectionListVO(it.toDateFormat(context)) }
|
||||||
} else {
|
} else {
|
||||||
val listError: ArrayList<CollectionVO> = ArrayList()
|
val listError: ArrayList<CollectionVO> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
CollectionVO(0,
|
CollectionVO(
|
||||||
|
0,
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
nameofFunction(this),
|
||||||
|
response.message()
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
_collectionList.value = CollectionListVO(listError)
|
_collectionList.value = CollectionListVO(listError)
|
||||||
|
@ -175,29 +148,36 @@ class SacadorViewModel(context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun collectionGetSalix(){
|
fun collectionGetSalix() {
|
||||||
salix.getCollectionSalix().enqueue(object :
|
salix.getCollectionSalix().enqueue(object :
|
||||||
Callback<List<CollectionVO>> {
|
SilexCallback<List<CollectionVO>>(context) {
|
||||||
override fun onFailure(call: Call<List<CollectionVO>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<CollectionVO> = ArrayList()
|
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)
|
_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) {
|
if (response.body() != null) {
|
||||||
_collectionList.value =
|
_collectionList.value =
|
||||||
response.body()?.let { CollectionListVO(it.toDateFormat(contextApp)) }
|
response.body()?.let { CollectionListVO(it.toDateFormat(context)) }
|
||||||
} else {
|
} else {
|
||||||
val listError: ArrayList<CollectionVO> = ArrayList()
|
val listError: ArrayList<CollectionVO> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
CollectionVO(0,
|
CollectionVO(
|
||||||
|
0,
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
nameofFunction(this),
|
||||||
|
response.message()
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
_collectionList.value = CollectionListVO(listError)
|
_collectionList.value = CollectionListVO(listError)
|
||||||
|
|
|
@ -9,16 +9,18 @@ import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentShelvingParkingBinding
|
import es.verdnatura.databinding.FragmentShelvingParkingBinding
|
||||||
import es.verdnatura.domain.notNull
|
import es.verdnatura.domain.notNull
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
|
||||||
import es.verdnatura.presentation.view.feature.shelvingparking.adapter.ShelvingParkingAdapter
|
import es.verdnatura.presentation.view.feature.shelvingparking.adapter.ShelvingParkingAdapter
|
||||||
|
|
||||||
|
|
||||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||||
class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, ShelvingParkingViewModel>(
|
class ShelvingParkingFragment :
|
||||||
ShelvingParkingViewModel::class) {
|
BaseFragment<FragmentShelvingParkingBinding, ShelvingParkingViewModel>(
|
||||||
|
ShelvingParkingViewModel::class
|
||||||
|
) {
|
||||||
|
|
||||||
|
|
||||||
private var adapter : ShelvingParkingAdapter? = null
|
private var adapter: ShelvingParkingAdapter? = null
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance() = ShelvingParkingFragment()
|
fun newInstance() = ShelvingParkingFragment()
|
||||||
}
|
}
|
||||||
|
@ -36,18 +38,22 @@ class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, She
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun setEvents(){
|
private fun setEvents() {
|
||||||
binding.mainToolbar.backButton.setOnClickListener {
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
requireActivity().onBackPressed()
|
requireActivity().onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.shelvingText.requestFocus()
|
binding.shelvingText.requestFocus()
|
||||||
binding.shelvingText.setOnEditorActionListener { v, actionId, event ->
|
binding.shelvingText.setOnEditorActionListener { v, actionId, event ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
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.mainToolbar.toolbarTitle.text = binding.shelvingText.text.toString()
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
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("")
|
binding.shelvingText.setText("")
|
||||||
|
@ -66,7 +72,11 @@ class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, She
|
||||||
binding.shelvingText.requestFocus()
|
binding.shelvingText.requestFocus()
|
||||||
|
|
||||||
binding.mainToolbar.toolbarTitle.text = binding.shelvingText.text.toString()
|
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("")
|
binding.shelvingText.setText("")
|
||||||
ma.hideKeyboard(binding.dayrange)
|
ma.hideKeyboard(binding.dayrange)
|
||||||
return@setOnEditorActionListener true
|
return@setOnEditorActionListener true
|
||||||
|
@ -77,13 +87,14 @@ class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, She
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
with(viewModel){
|
with(viewModel) {
|
||||||
loadShelvingList.observe(viewLifecycleOwner, Observer { event ->
|
loadShelvingList.observe(viewLifecycleOwner, Observer { event ->
|
||||||
event.getContentIfNotHandled().notNull {
|
event.getContentIfNotHandled().notNull {
|
||||||
binding.splashProgress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
adapter = ShelvingParkingAdapter(it.list)
|
adapter = ShelvingParkingAdapter(it.list)
|
||||||
binding.locationRecyclerview.adapter = adapter
|
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.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
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.BaseViewModel
|
||||||
|
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.common.Event
|
import es.verdnatura.presentation.common.Event
|
||||||
import es.verdnatura.presentation.view.feature.shelvingparking.model.ItemShelvingParkingListVO
|
import es.verdnatura.presentation.view.feature.shelvingparking.model.ItemShelvingParkingListVO
|
||||||
import es.verdnatura.presentation.view.feature.shelvingparking.model.ItemShelvingParkingVO
|
import es.verdnatura.presentation.view.feature.shelvingparking.model.ItemShelvingParkingVO
|
||||||
import retrofit2.Call
|
|
||||||
import retrofit2.Callback
|
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class ShelvingParkingViewModel(context: Context) : BaseViewModel(context) {
|
class ShelvingParkingViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
|
|
||||||
private val getShelvingParkingUserCase: GetShelvingParkingUserCase = GetShelvingParkingUserCase(context)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private val _shelvingList by lazy { MutableLiveData<ItemShelvingParkingListVO>() }
|
private val _shelvingList by lazy { MutableLiveData<ItemShelvingParkingListVO>() }
|
||||||
val shelvingList: LiveData<ItemShelvingParkingListVO>
|
val shelvingList: LiveData<ItemShelvingParkingListVO>
|
||||||
|
@ -31,24 +23,35 @@ class ShelvingParkingViewModel(context: Context) : BaseViewModel(context) {
|
||||||
val loadShelvingList = Transformations.map(_shelvingList) { Event(it) }
|
val loadShelvingList = Transformations.map(_shelvingList) { Event(it) }
|
||||||
|
|
||||||
|
|
||||||
fun shelvingParking_get(usuario:String,password:String,vShelvingFk:String,vWarehouseFk:String,vDayRange:String){
|
fun shelvingParking_get(vShelvingFk: String, vWarehouseFk: String, vDayRange: String) {
|
||||||
getShelvingParkingUserCase.shelvingParking_get(usuario,password,vShelvingFk.uppercase(),vWarehouseFk,vDayRange).enqueue(object :
|
silex.shelvingParking_get(vShelvingFk.uppercase(), vWarehouseFk, vDayRange).enqueue(object :
|
||||||
Callback<List<ItemShelvingParkingVO>> {
|
SilexCallback<List<ItemShelvingParkingVO>>(context) {
|
||||||
override fun onFailure(call: Call<List<ItemShelvingParkingVO>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError:ArrayList<ItemShelvingParkingVO> = ArrayList()
|
val listError: ArrayList<ItemShelvingParkingVO> = ArrayList()
|
||||||
listError.add(ItemShelvingParkingVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
|
listError.add(
|
||||||
|
ItemShelvingParkingVO(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
|
)
|
||||||
|
)
|
||||||
_shelvingList.value = ItemShelvingParkingListVO(listError)
|
_shelvingList.value = ItemShelvingParkingListVO(listError)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<List<ItemShelvingParkingVO>>) {
|
||||||
call: Call<List<ItemShelvingParkingVO>>,
|
|
||||||
response: Response<List<ItemShelvingParkingVO>>
|
if (response.body() != null) {
|
||||||
) {
|
|
||||||
if (response.body() != null){
|
|
||||||
_shelvingList.value = response.body()?.let { ItemShelvingParkingListVO(it) }
|
_shelvingList.value = response.body()?.let { ItemShelvingParkingListVO(it) }
|
||||||
}else{
|
} else {
|
||||||
val listError:ArrayList<ItemShelvingParkingVO> = ArrayList()
|
val listError: ArrayList<ItemShelvingParkingVO> = ArrayList()
|
||||||
listError.add(ItemShelvingParkingVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
|
listError.add(
|
||||||
|
ItemShelvingParkingVO(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
nameofFunction(this),
|
||||||
|
response.message()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
_shelvingList.value = ItemShelvingParkingListVO(listError)
|
_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 android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import es.verdnatura.domain.GetUbicadorUserCase
|
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
import retrofit2.Call
|
|
||||||
import retrofit2.Callback
|
|
||||||
import retrofit2.Response
|
|
||||||
|
|
||||||
class TransferenciaViewModel(context: Context) : BaseViewModel(context) {
|
class TransferenciaViewModel(context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context)
|
|
||||||
|
|
||||||
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
val response: LiveData<ResponseItemVO>
|
val response: LiveData<ResponseItemVO>
|
||||||
get() = _response
|
get() = _response
|
||||||
|
|
|
@ -222,8 +222,6 @@ class UbicadorFragment(
|
||||||
} else {
|
} else {
|
||||||
binding.splashProgress.visibility = VISIBLE
|
binding.splashProgress.visibility = VISIBLE
|
||||||
viewModel.getIdFromCode(
|
viewModel.getIdFromCode(
|
||||||
usuario = getData(USER),
|
|
||||||
password = getData(PASSWORD),
|
|
||||||
code = binding.editMatricula.text.toString()
|
code = binding.editMatricula.text.toString()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -365,8 +363,7 @@ class UbicadorFragment(
|
||||||
.setDescription(getString(R.string.operationNoReturn))
|
.setDescription(getString(R.string.operationNoReturn))
|
||||||
.setOkButton(getString(R.string.empty)) {
|
.setOkButton(getString(R.string.empty)) {
|
||||||
viewModel.clearShelvingList(
|
viewModel.clearShelvingList(
|
||||||
getData(USER),
|
shelvingFk
|
||||||
getData(PASSWORD), shelvingFk
|
|
||||||
)
|
)
|
||||||
listItems.forEach {
|
listItems.forEach {
|
||||||
it.stickers = "0"
|
it.stickers = "0"
|
||||||
|
|
|
@ -4,8 +4,7 @@ import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
import androidx.lifecycle.Transformations
|
||||||
import es.verdnatura.domain.GetSacadorControladorUserCase
|
import es.verdnatura.domain.SilexCallback
|
||||||
import es.verdnatura.domain.GetUbicadorUserCase
|
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
|
@ -19,11 +18,8 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
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 _shelvingList by lazy { MutableLiveData<ItemUbicadorListVO>() }
|
||||||
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
val response: LiveData<ResponseItemVO>
|
val response: LiveData<ResponseItemVO>
|
||||||
|
@ -50,11 +46,12 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
||||||
) {
|
) {
|
||||||
silex.itemShelvingList(vShelvingFk.uppercase())
|
silex.itemShelvingList(vShelvingFk.uppercase())
|
||||||
.enqueue(object :
|
.enqueue(object :
|
||||||
Callback<List<ItemUbicadorVO>> {
|
SilexCallback<List<ItemUbicadorVO>>(context) {
|
||||||
override fun onFailure(call: Call<List<ItemUbicadorVO>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<ItemUbicadorVO> = ArrayList()
|
val listError: ArrayList<ItemUbicadorVO> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
ItemUbicadorVO(0,
|
ItemUbicadorVO(
|
||||||
|
0,
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(
|
errorMessage = getMessageFromAllResponse(
|
||||||
nameofFunction(this),
|
nameofFunction(this),
|
||||||
|
@ -65,16 +62,15 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
||||||
_shelvingList.value = ItemUbicadorListVO(listError)
|
_shelvingList.value = ItemUbicadorListVO(listError)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<List<ItemUbicadorVO>>) {
|
||||||
call: Call<List<ItemUbicadorVO>>,
|
|
||||||
response: Response<List<ItemUbicadorVO>>
|
|
||||||
) {
|
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_shelvingList.value = response.body()?.let { ItemUbicadorListVO(it) }
|
_shelvingList.value = response.body()?.let { ItemUbicadorListVO(it) }
|
||||||
} else {
|
} else {
|
||||||
val listError: ArrayList<ItemUbicadorVO> = ArrayList()
|
val listError: ArrayList<ItemUbicadorVO> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
ItemUbicadorVO(0,
|
ItemUbicadorVO(
|
||||||
|
0,
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(
|
errorMessage = getMessageFromAllResponse(
|
||||||
nameofFunction(this),
|
nameofFunction(this),
|
||||||
|
@ -94,36 +90,22 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
||||||
shelving: String
|
shelving: String
|
||||||
|
|
||||||
) {
|
) {
|
||||||
silex.shelvingPriorityUpdate(priority, shelving)
|
silex.shelvingPriorityUpdate(priority, shelving)
|
||||||
.enqueue(object : Callback<Any> {
|
.enqueue(object : SilexCallback<Any>(context) {
|
||||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responsepriority.value = ResponseItemVO(
|
_responsepriority.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
|
_responsepriority.value =
|
||||||
if (!response.isSuccessful) {
|
ResponseItemVO(isError = false, response = response.message())
|
||||||
_responsepriority.value = ResponseItemVO(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_responsepriority.value =
|
|
||||||
ResponseItemVO(isError = false, response = response.message())
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun itemShelvingMake(
|
fun itemShelvingMake(
|
||||||
shelving: String,
|
shelving: String,
|
||||||
item: Int,
|
item: Int,
|
||||||
|
@ -139,8 +121,8 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
||||||
packing,
|
packing,
|
||||||
warehouse,
|
warehouse,
|
||||||
grouping
|
grouping
|
||||||
).enqueue(object : Callback<Any> {
|
).enqueue(object : SilexCallback<Any>(context) {
|
||||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseMake.value = ResponseItemVO(
|
_responseMake.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
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>) {
|
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||||
if (!response.isSuccessful) {
|
_responseMake.value =
|
||||||
_responseMake.value = ResponseItemVO(
|
ResponseItemVO(isError = false, response = response.message()!!)
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_responseMake.value =
|
|
||||||
ResponseItemVO(isError = false, response = response.message()!!)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -178,28 +149,17 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
||||||
packing,
|
packing,
|
||||||
itemShelvingFk,
|
itemShelvingFk,
|
||||||
grouping
|
grouping
|
||||||
).enqueue(object : Callback<Any> {
|
).enqueue(object : SilexCallback<Any>(context) {
|
||||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseMake.value = ResponseItemVO(
|
_responseMake.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
if (!response.isSuccessful) {
|
_responseMake.value =
|
||||||
_responseMake.value = ResponseItemVO(
|
ResponseItemVO(isError = false, response = response.message()!!)
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_responseMake.value =
|
|
||||||
ResponseItemVO(isError = false, response = response.message()!!)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -210,7 +170,7 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
||||||
shelving: String,
|
shelving: String,
|
||||||
parking: String
|
parking: String
|
||||||
) {
|
) {
|
||||||
silex.shelvingPark(shelving, parking)
|
silex.shelvingPark(shelving, parking)
|
||||||
.enqueue(object : Callback<Any> {
|
.enqueue(object : Callback<Any> {
|
||||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||||
_response.value = ResponseItemVO(
|
_response.value = ResponseItemVO(
|
||||||
|
@ -241,27 +201,17 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
||||||
destino: String
|
destino: String
|
||||||
) {
|
) {
|
||||||
silex.shelvingChange(origen, destino)
|
silex.shelvingChange(origen, destino)
|
||||||
.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(
|
_response.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
if (!response.isSuccessful) {
|
_response.value =
|
||||||
_response.value = ResponseItemVO(
|
ResponseItemVO(isError = false, response = response.message()!!)
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_response.value =
|
|
||||||
ResponseItemVO(isError = false, response = response.message()!!)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -271,28 +221,18 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
||||||
vShelvingFk: String
|
vShelvingFk: String
|
||||||
|
|
||||||
) {
|
) {
|
||||||
silex.itemShelving_merge( vShelf, vShelvingFk)
|
silex.itemShelving_merge(vShelf, vShelvingFk)
|
||||||
.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(
|
_response.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
if (!response.isSuccessful) {
|
_response.value =
|
||||||
_response.value = ResponseItemVO(
|
ResponseItemVO(isError = false, response = response.message()!!)
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_response.value =
|
|
||||||
ResponseItemVO(isError = false, response = response.message()!!)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -302,25 +242,14 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
||||||
code: String
|
code: String
|
||||||
) {
|
) {
|
||||||
silex.shelvingLog_add(code)
|
silex.shelvingLog_add(code)
|
||||||
.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(
|
_response.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
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)
|
silex.itemShelving_return(shelvingFk)
|
||||||
.enqueue(object : Callback<ArrayList<Reubication>> {
|
.enqueue(object : SilexCallback<ArrayList<Reubication>>(context) {
|
||||||
override fun onFailure(call: Call<ArrayList<Reubication>>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<Reubication> = ArrayList()
|
val listError: ArrayList<Reubication> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
Reubication(0,
|
Reubication(
|
||||||
|
0,
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(
|
errorMessage = getMessageFromAllResponse(
|
||||||
nameofFunction(this),
|
nameofFunction(this),
|
||||||
|
@ -345,14 +275,12 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
||||||
_reubicationList.value = ReubicationList(listError)
|
_reubicationList.value = ReubicationList(listError)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
override fun onSuccess(response: Response<ArrayList<Reubication>>) {
|
||||||
call: Call<ArrayList<Reubication>>,
|
|
||||||
response: Response<ArrayList<Reubication>>
|
|
||||||
) {
|
|
||||||
if (response.body() == null) {
|
if (response.body() == null) {
|
||||||
val listError: ArrayList<Reubication> = ArrayList()
|
val listError: ArrayList<Reubication> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
Reubication(0,
|
Reubication(
|
||||||
|
0,
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(
|
errorMessage = getMessageFromAllResponse(
|
||||||
nameofFunction(this),
|
nameofFunction(this),
|
||||||
|
@ -371,33 +299,21 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun clearShelvingList(
|
fun clearShelvingList(
|
||||||
usuario: String,
|
|
||||||
password: String,
|
|
||||||
shelvingFk: String
|
shelvingFk: String
|
||||||
|
|
||||||
) {
|
) {
|
||||||
getUbicadorUserCase.clearShelvingList(usuario, password, shelvingFk)
|
silex.clearShelvingList(shelvingFk)
|
||||||
.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(
|
_response.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
if (!response.isSuccessful) {
|
_response.value =
|
||||||
_response.value = ResponseItemVO(
|
ResponseItemVO(isError = false, response = response.message())
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_response.value =
|
|
||||||
ResponseItemVO(isError = false, response = response.message())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -408,69 +324,51 @@ class UbicadorViewModel(context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
) {
|
) {
|
||||||
silex.itemShelvingTransfer(itemFk, shelvingFk)
|
silex.itemShelvingTransfer(itemFk, shelvingFk)
|
||||||
.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(
|
_response.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
if (!response.isSuccessful) {
|
_response.value =
|
||||||
_response.value = ResponseItemVO(
|
ResponseItemVO(isError = false, response = response.message()!!)
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_response.value =
|
|
||||||
ResponseItemVO(isError = false, response = response.message()!!)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun itemShelvingDelete(itemFk: Int) {
|
fun itemShelvingDelete(itemFk: Int) {
|
||||||
silex.itemShelvingDelete(itemFk)
|
silex.itemShelvingDelete(itemFk)
|
||||||
.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(
|
_response.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
if (!response.isSuccessful) {
|
_response.value =
|
||||||
_response.value = ResponseItemVO(
|
ResponseItemVO(isError = false, response = response.message())
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_response.value =
|
|
||||||
ResponseItemVO(isError = false, response = response.message())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getIdFromCode(usuario: String, password: String, code: String) {
|
fun getIdFromCode(code: String) {
|
||||||
getSacadorControladorUserCase.getIdFromCode(usuario, password, code)
|
silex.getIdFromCode(code)
|
||||||
.enqueue(object : Callback<String> {
|
.enqueue(object : SilexCallback<String>(context) {
|
||||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseCode.value = ResponseItemVO(
|
_responseCode.value = ResponseItemVO(
|
||||||
isError = true,
|
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.body() == null) {
|
if (response.body() == null) {
|
||||||
_responseCode.value = ResponseItemVO(
|
_responseCode.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
|
|
Loading…
Reference in New Issue