refs #5134 Refactor silex→salix
This commit is contained in:
parent
eed96ea4eb
commit
8618425413
|
@ -3,6 +3,8 @@ package es.verdnatura.domain
|
||||||
import android.app.ActivityManager
|
import android.app.ActivityManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import com.google.gson.JsonObject
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.view.feature.login.activity.LoginActivity
|
import es.verdnatura.presentation.view.feature.login.activity.LoginActivity
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
@ -32,17 +34,9 @@ abstract class SalixCallback<T>(val context: Context) : Callback<T> {
|
||||||
onError(Error(response.message().toString()))
|
onError(Error(response.message().toString()))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
println("message:"+response.errorBody()!!.source())
|
|
||||||
println("message::"+response.errorBody() as okhttp3.ResponseBody)
|
|
||||||
var m= response.errorBody() as okhttp3.ResponseBody
|
|
||||||
println("Message2::"+m.source().toString())
|
|
||||||
/* var r = response as okhttp3.Response
|
|
||||||
println("message" + r.body() )
|
|
||||||
println("message" + r.message() )
|
|
||||||
println(response.raw().message().toString())
|
|
||||||
println(response.raw().message())*/
|
|
||||||
|
|
||||||
onError(Error(response.message().toString()))
|
onError(Error(errorSalixMessage(response)))
|
||||||
|
// onError(Error(response.message().toString()))
|
||||||
}
|
}
|
||||||
} catch (t: Throwable) {
|
} catch (t: Throwable) {
|
||||||
defaultErrorHandler(t)
|
defaultErrorHandler(t)
|
||||||
|
@ -86,4 +80,17 @@ abstract class SalixCallback<T>(val context: Context) : Callback<T> {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun errorSalixMessage(response: Response<T>): String {
|
||||||
|
|
||||||
|
val messageResponse = response.errorBody()!!.string()
|
||||||
|
return try {
|
||||||
|
|
||||||
|
val jsonObject = Gson().fromJson(messageResponse, JsonObject::class.java)
|
||||||
|
jsonObject?.getAsJsonObject("error")?.get("message")?.asString.toString()
|
||||||
|
|
||||||
|
} catch (ex: Exception) {
|
||||||
|
response.message()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -2,12 +2,12 @@ package es.verdnatura.domain
|
||||||
|
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import es.verdnatura.presentation.common.itemBarCodeSalix
|
import es.verdnatura.presentation.common.itemBarCodeSalix
|
||||||
import es.verdnatura.presentation.common.itemPackingTypeSalix
|
|
||||||
import es.verdnatura.presentation.common.packingSiteSalix
|
import es.verdnatura.presentation.common.packingSiteSalix
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
||||||
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.controlvehiculo.fragment.model.DeviceId
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.RouteInfo
|
import es.verdnatura.presentation.view.feature.delivery.model.RouteInfo
|
||||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalix
|
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalix
|
||||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventoryParking
|
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventoryParking
|
||||||
|
@ -20,8 +20,13 @@ import es.verdnatura.presentation.view.feature.login.model.accessConfigSalix
|
||||||
import es.verdnatura.presentation.view.feature.packaging.model.EntrySalix
|
import es.verdnatura.presentation.view.feature.packaging.model.EntrySalix
|
||||||
import es.verdnatura.presentation.view.feature.packaging.model.ItemSupplier
|
import es.verdnatura.presentation.view.feature.packaging.model.ItemSupplier
|
||||||
import es.verdnatura.presentation.view.feature.packaging.model.Supplier
|
import es.verdnatura.presentation.view.feature.packaging.model.Supplier
|
||||||
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||||
|
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake
|
import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake
|
||||||
|
import es.verdnatura.presentation.view.feature.workermistake.model.ExpeditionMistakeSalix
|
||||||
|
import es.verdnatura.presentation.view.feature.workermistake.model.MistakeType
|
||||||
|
import es.verdnatura.presentation.view.feature.workermistake.model.WorkerMistakeSalix
|
||||||
import okhttp3.MultipartBody
|
import okhttp3.MultipartBody
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.http.*
|
import retrofit2.http.*
|
||||||
|
@ -31,13 +36,11 @@ interface SalixService {
|
||||||
@POST("Accounts/login")
|
@POST("Accounts/login")
|
||||||
fun login(
|
fun login(
|
||||||
@Body params: LoginSalixVO
|
@Body params: LoginSalixVO
|
||||||
):
|
): Call<LoginSalixVO>
|
||||||
Call<LoginSalixVO>
|
|
||||||
|
|
||||||
@GET("VnUsers/getCurrentUserData")
|
@GET("VnUsers/getCurrentUserData")
|
||||||
fun getCurrentUserData(
|
fun getCurrentUserData(
|
||||||
):
|
): Call<DataUserSalix>
|
||||||
Call<DataUserSalix>
|
|
||||||
|
|
||||||
/* @POST("chats/sendCheckingPresence")
|
/* @POST("chats/sendCheckingPresence")
|
||||||
fun sendChekingPresence(
|
fun sendChekingPresence(
|
||||||
|
@ -53,25 +56,21 @@ interface SalixService {
|
||||||
|
|
||||||
@GET("collections/getSectors")
|
@GET("collections/getSectors")
|
||||||
fun getSectorsSalix(
|
fun getSectorsSalix(
|
||||||
):
|
): Call<List<SectorItemVO>>
|
||||||
Call<List<SectorItemVO>>
|
|
||||||
|
|
||||||
@GET("collections/getCollection")
|
@GET("collections/getCollection")
|
||||||
fun getCollectionSalix(
|
fun getCollectionSalix(
|
||||||
):
|
): Call<List<CollectionVO>>
|
||||||
Call<List<CollectionVO>>
|
|
||||||
|
|
||||||
|
|
||||||
@GET("collections/sectorCollection_get")
|
@GET("collections/sectorCollection_get")
|
||||||
fun sectorCollection_get(
|
fun sectorCollection_get(
|
||||||
):
|
): Call<List<CollectionVO>>
|
||||||
Call<List<CollectionVO>>
|
|
||||||
|
|
||||||
@POST("collections/setSaleQuantity")
|
@POST("collections/setSaleQuantity")
|
||||||
fun collectionIncreaseQuantitySalix(
|
fun collectionIncreaseQuantitySalix(
|
||||||
@Body params: SalixSaleQuantity
|
@Body params: SalixSaleQuantity
|
||||||
):
|
): Call<Any>
|
||||||
Call<Any>
|
|
||||||
|
|
||||||
@Multipart
|
@Multipart
|
||||||
@POST("Entries/{id}/uploadFile")
|
@POST("Entries/{id}/uploadFile")
|
||||||
|
@ -84,8 +83,7 @@ interface SalixService {
|
||||||
@Query("description") description: String,
|
@Query("description") description: String,
|
||||||
@Query("hasFile") hasFile: Boolean,
|
@Query("hasFile") hasFile: Boolean,
|
||||||
@Part file: MultipartBody.Part,
|
@Part file: MultipartBody.Part,
|
||||||
):
|
): Call<Any>
|
||||||
Call<Any>
|
|
||||||
|
|
||||||
@Multipart
|
@Multipart
|
||||||
@POST("dms/uploadFile")
|
@POST("dms/uploadFile")
|
||||||
|
@ -97,14 +95,12 @@ interface SalixService {
|
||||||
@Query("description") description: String,
|
@Query("description") description: String,
|
||||||
@Query("hasFile") hasFile: Boolean,
|
@Query("hasFile") hasFile: Boolean,
|
||||||
@Part file: MultipartBody.Part,
|
@Part file: MultipartBody.Part,
|
||||||
):
|
): Call<Any>
|
||||||
Call<Any>
|
|
||||||
|
|
||||||
@Multipart
|
@Multipart
|
||||||
@POST("/api/Tickets/saveSign")
|
@POST("/api/Tickets/saveSign")
|
||||||
fun saveSign(
|
fun saveSign(
|
||||||
@Part file: MultipartBody.Part?,
|
@Part file: MultipartBody.Part?, @QueryMap(encoded = true) queryMap: Map<String?, String?>
|
||||||
@QueryMap(encoded = true) queryMap: Map<String?, String?>
|
|
||||||
): Call<Any>
|
): Call<Any>
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,68 +109,105 @@ interface SalixService {
|
||||||
@Path("id") id: Number,
|
@Path("id") id: Number,
|
||||||
@Query("item") item: Number,
|
@Query("item") item: Number,
|
||||||
@Query("printedStickers") printedStickers: Number
|
@Query("printedStickers") printedStickers: Number
|
||||||
):
|
): Call<Any>
|
||||||
Call<Any>
|
|
||||||
|
|
||||||
|
|
||||||
@POST("tickets/{idTicket}/transferSales") //-->saleMove en Silex
|
@POST("tickets/{idTicket}/transferSales") //-->saleMove en Silex
|
||||||
fun transferSalesSalix(
|
fun transferSalesSalix(
|
||||||
@Path("idTicket") idTicket: String,
|
@Path("idTicket") idTicket: String, @Body params: listSaleSalix
|
||||||
@Body params: listSaleSalix
|
): Call<Any>
|
||||||
):
|
|
||||||
Call<Any>
|
|
||||||
|
|
||||||
|
|
||||||
//https://test-salix.verdnatura.es/api/Departments?filter={"fields": {"id": true, "name": true},"where": {"name": "COMPRAS"}}
|
|
||||||
// http://test-salix.verdnatura.es/api/Departments?filter={"fields": {"id": true, "name": true},"where": {"hasToMistake": "FALSE"}}
|
|
||||||
|
|
||||||
// @GET("api/Departments?filter={\"fields\": {\"id\": true, \"name\": true},\"where\": {\"hasToMistake\": \"FALSE\"}}")
|
|
||||||
@GET("Departments")
|
@GET("Departments")
|
||||||
fun department_getHasMistake(
|
fun department_getHasMistake(
|
||||||
@Query("filter") filter: String = "{\"fields\": {\"id\": true, \"name\": true},\"where\": {\"name\": \"INFORMATICA\"}}"
|
@Query("filter") filter:String = """{"fields": {"id": true,"name": true},"where": {"hasToMistake": true}}"""
|
||||||
// @Query("name") name:String ="COMPRAS"
|
): Call<List<DepartmentMistake>>
|
||||||
):
|
|
||||||
Call<List<DepartmentMistake>>
|
@DELETE("ExpeditionPallets/{id}")
|
||||||
|
fun expeditionPalletDel(
|
||||||
|
@Path("id") id: Number
|
||||||
|
): Call<Any>
|
||||||
|
|
||||||
|
@DELETE("ExpeditionScans/{id}")
|
||||||
|
fun expeditionScanDel(
|
||||||
|
@Path("id") id: Number
|
||||||
|
): Call<Any>
|
||||||
|
|
||||||
|
@DELETE("ItemShelvings/{id}")
|
||||||
|
fun itemShelvingsDelete(
|
||||||
|
@Path("id") id: Number
|
||||||
|
): Call<Any>
|
||||||
|
|
||||||
@GET("Workers/{idWorker}/sip")
|
@GET("Workers/{idWorker}/sip")
|
||||||
fun sip_getExtension(
|
fun sip_getExtension(
|
||||||
@Path("idWorker") idWorker: Int,
|
@Path("idWorker") idWorker: Int,
|
||||||
):
|
): Call<Any>
|
||||||
Call<Any>
|
|
||||||
|
|
||||||
@PATCH("Items/{itemFk}")
|
@PATCH("Items/{itemFk}")
|
||||||
fun update_ItemPackingType(
|
fun update_ItemPackingType(
|
||||||
@Path("itemFk") itemFk: String,
|
@Path("itemFk") itemFk: String,
|
||||||
@Body params: itemPackingTypeSalix
|
@Body params: Any
|
||||||
):
|
): Call<Any>
|
||||||
Call<Any>
|
|
||||||
|
|
||||||
|
@PATCH("Items/{itemFk}")
|
||||||
|
fun updateItem(
|
||||||
|
@Path("itemFk") itemFk: Int,
|
||||||
|
@Body params: Any
|
||||||
|
): Call<Any>
|
||||||
|
|
||||||
|
@POST("Shelvings/upsertWithWhere")
|
||||||
|
fun updateShelvingPriority(
|
||||||
|
@Query("where") where: String,
|
||||||
|
@Body params: Any
|
||||||
|
): Call<Any>
|
||||||
|
|
||||||
|
//DE MOMENTO NO FUNCIONA, SE QUERÍA AÑADIR POR INSERTIGNORE
|
||||||
|
@POST("Operators/upsertWithWhere")
|
||||||
|
fun operatorAdd(
|
||||||
|
@Query("where") where: String,
|
||||||
|
@Body params: Any
|
||||||
|
): Call<Any>
|
||||||
|
|
||||||
|
@PUT("DeviceLogs")
|
||||||
|
fun deviceLogInsert(
|
||||||
|
@Body params: Any
|
||||||
|
): Call<Any>
|
||||||
|
|
||||||
|
@POST("ExpeditionTrucks")
|
||||||
|
fun expeditionTrucksInsert(
|
||||||
|
@Body params: Any
|
||||||
|
): Call<Any>
|
||||||
|
|
||||||
@GET("ItemPackingTypes")
|
@GET("ItemPackingTypes")
|
||||||
fun get_ItemPackingType(
|
fun get_ItemPackingType(
|
||||||
|
@Query("filter") filter:String = """{"where": {"isActive": true}}"""
|
||||||
|
): Call<List<ItemPackingType>>
|
||||||
|
|
||||||
):
|
@GET("ExpeditionTrucks")
|
||||||
Call<List<ItemPackingType>>
|
fun expeditionTruckGet(
|
||||||
|
@Query("filter") filter:String
|
||||||
|
): Call<List<ItemExpeditionTruckVO>>
|
||||||
|
|
||||||
@POST("PackingSiteAdvanceds")
|
@POST("PackingSiteAdvanceds")
|
||||||
fun ticket_advancePackaging(
|
fun ticket_advancePackaging(
|
||||||
@Body parms: packingSiteSalix
|
@Body parms: packingSiteSalix
|
||||||
):
|
): Call<Void>
|
||||||
Call<Void>
|
|
||||||
|
|
||||||
|
|
||||||
@PUT("ItemBarCodes")//REVISADA
|
@PUT("ItemBarCodes")//REVISADA
|
||||||
fun barcodes_edit(
|
fun barcodes_edit(
|
||||||
@Body params: itemBarCodeSalix
|
@Body params: itemBarCodeSalix
|
||||||
):
|
): Call<Any>
|
||||||
Call<Any>
|
|
||||||
|
@DELETE("ItemBarCodes")//REVISADA
|
||||||
|
fun deleteItemBarCode(
|
||||||
|
@Body params: itemBarCodeSalix
|
||||||
|
): Call<Any>
|
||||||
|
|
||||||
|
|
||||||
@GET("ItemBarCodes/{barCodeValue}/toItem")//REVISADA
|
@GET("ItemBarCodes/{barCodeValue}/toItem")//REVISADA
|
||||||
fun barcodes_toitem(
|
fun barcodes_toitem(
|
||||||
@Path("barCodeValue") barCodeValue: String
|
@Path("barCodeValue") barCodeValue: String
|
||||||
):
|
): Call<String>
|
||||||
Call<String>
|
|
||||||
|
|
||||||
@GET("Suppliers")//REVISADA
|
@GET("Suppliers")//REVISADA
|
||||||
fun getSuppliers(
|
fun getSuppliers(
|
||||||
|
@ -184,36 +217,34 @@ interface SalixService {
|
||||||
"\"fields\":[\"email\"],\"order\":\"id DESC\",\"limit\":1," +
|
"\"fields\":[\"email\"],\"order\":\"id DESC\",\"limit\":1," +
|
||||||
"\"where\":{ \"email\":{\"neq\":null } }}}]})"*/
|
"\"where\":{ \"email\":{\"neq\":null } }}}]})"*/
|
||||||
|
|
||||||
):
|
): Call<List<Supplier>>
|
||||||
Call<List<Supplier>>
|
|
||||||
|
|
||||||
@PUT("Entries")//REVISADA
|
@PUT("Entries")//REVISADA
|
||||||
fun Entries(
|
fun Entries(
|
||||||
@Body entry: EntrySalix
|
@Body entry: EntrySalix
|
||||||
):
|
): Call<EntrySalix>
|
||||||
Call<EntrySalix>
|
|
||||||
|
|
||||||
@GET("Shelvings")
|
@GET("Shelvings")
|
||||||
fun Shelvings(
|
fun Shelvings(
|
||||||
@Query("filter") filter: String
|
@Query("filter") filter: String
|
||||||
):
|
): Call<List<ShelvingLogSalix>>
|
||||||
Call<List<ShelvingLogSalix>>
|
|
||||||
|
@GET("DeviceProductions")
|
||||||
|
fun deviceProductionsGetName(
|
||||||
|
@Query("filter") filter: String
|
||||||
|
): Call<List<DeviceId>>
|
||||||
|
|
||||||
@GET("Suppliers/{supplierId}/getItemsPackaging")
|
@GET("Suppliers/{supplierId}/getItemsPackaging")
|
||||||
fun getItemsPackaging(
|
fun getItemsPackaging(
|
||||||
@Path("supplierId") supplierId: Int,
|
@Path("supplierId") supplierId: Int, @Query("entry") entry: Int
|
||||||
@Query("entry") entry: Int
|
|
||||||
|
|
||||||
):
|
): Call<List<ItemSupplier>>
|
||||||
Call<List<ItemSupplier>>
|
|
||||||
|
|
||||||
@POST("Entries/addFromPackaging")
|
@POST("Entries/addFromPackaging")
|
||||||
fun addFromPackaging(
|
fun addFromPackaging(
|
||||||
@Query("supplier") supplier: Int,
|
@Query("supplier") supplier: Int, @Query("isTravelReception") isTravelReception: Boolean
|
||||||
@Query("isTravelReception") isTravelReception: Boolean
|
|
||||||
|
|
||||||
):
|
): Call<EntrySalix>
|
||||||
Call<EntrySalix>
|
|
||||||
|
|
||||||
@POST("Images/upload")
|
@POST("Images/upload")
|
||||||
@Multipart
|
@Multipart
|
||||||
|
@ -221,64 +252,65 @@ interface SalixService {
|
||||||
@Query("collection") collection: String,
|
@Query("collection") collection: String,
|
||||||
@Query("id") id: Int,
|
@Query("id") id: Int,
|
||||||
@Part filePart: MultipartBody.Part,
|
@Part filePart: MultipartBody.Part,
|
||||||
):
|
): Call<Any>
|
||||||
Call<Any>
|
|
||||||
|
|
||||||
|
|
||||||
@PATCH("Operators/{id}")
|
@PATCH("Operators/{id}")
|
||||||
fun update_operator(
|
fun update_operator(
|
||||||
@Path("id") id: Number,
|
@Path("id") id: Number, @Body params: Any
|
||||||
@Body params: Any
|
|
||||||
|
|
||||||
):
|
): Call<Void>
|
||||||
Call<Void>
|
|
||||||
|
|
||||||
@GET("Operators")
|
@GET("Operators")
|
||||||
fun operator_getData(
|
fun operator_getData(
|
||||||
@Query("filter") filter: String
|
@Query("filter") filter: String
|
||||||
):
|
): Call<List<OperatorSalix>>
|
||||||
Call<List<OperatorSalix>>
|
|
||||||
|
|
||||||
@GET("AccessTokenConfigs")
|
@GET("AccessTokenConfigs")
|
||||||
fun getAccessTokenConfigs(
|
fun getAccessTokenConfigs(
|
||||||
):
|
): Call<List<accessConfigSalix>>
|
||||||
Call<List<accessConfigSalix>>
|
|
||||||
|
|
||||||
@POST("vnusers/renewToken")
|
@POST("vnusers/renewToken")
|
||||||
fun renewToken(
|
fun renewToken(
|
||||||
):
|
): Call<RenewToken>
|
||||||
Call<RenewToken>
|
|
||||||
|
|
||||||
@PATCH("ItemShelvings/{id}")
|
@PATCH("ItemShelvings/{id}")
|
||||||
fun itemShelvingUpdate(
|
fun itemShelvingUpdate(
|
||||||
@Path("id") id: Number,
|
@Path("id") id: Number, @Body params: Any
|
||||||
@Body params: Any
|
): Call<Any>
|
||||||
):
|
|
||||||
Call<Any>
|
|
||||||
|
|
||||||
@POST("ItemShelvings/update")
|
@POST("ItemShelvings/update")
|
||||||
fun itemShelvingsUpdate(
|
fun itemShelvingsUpdate(
|
||||||
@Query("where") id: JsonObject,
|
@Query("where") id: JsonObject,
|
||||||
@Body params: Any
|
@Body params: Any
|
||||||
):
|
): Call<Any>
|
||||||
Call<Any>
|
|
||||||
|
|
||||||
@POST("ItemShelvings/getInventory")
|
@POST("ItemShelvings/getInventory")
|
||||||
fun getInventoryParking(
|
fun getInventoryParking(
|
||||||
@Query("parkingFrom") parkingFrom: String,
|
@Query("parkingFrom") parkingFrom: String, @Query("parkingTo") parkingTo: String
|
||||||
@Query("parkingTo") parkingTo: String
|
): Call<List<ItemInventoryParking>>
|
||||||
):
|
|
||||||
Call<List<ItemInventoryParking>>
|
|
||||||
|
|
||||||
@PATCH("Routes/{id}")
|
@PATCH("Routes/{id}")
|
||||||
fun routeUpdate(
|
fun routeUpdate(
|
||||||
@Path("id") id: Number,
|
@Path("id") id: Number,
|
||||||
@Body route: RouteInfo,
|
@Body route: RouteInfo,
|
||||||
|
|
||||||
):
|
): Call<Any>
|
||||||
Call<Any>
|
|
||||||
|
|
||||||
|
@GET("ExpeditionMistakeTypes")
|
||||||
|
fun getExpeditionMistakeTypes(
|
||||||
|
): Call<List<MistakeType>>
|
||||||
|
|
||||||
|
@POST("ExpeditionMistakes")
|
||||||
|
fun expeditionMistakesAdd(expeditionMistake:ExpeditionMistakeSalix
|
||||||
|
): Call<Any>
|
||||||
|
@POST("WorkerMistakes")
|
||||||
|
fun workerMistakesAdd(workerMistake: WorkerMistakeSalix
|
||||||
|
): Call<Any>
|
||||||
|
|
||||||
|
@GET("MistakeTypes")
|
||||||
|
fun getMistakeTypes(
|
||||||
|
): Call<List<MistakeTypeVO>>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,8 +319,7 @@ interface SalixServiceSend {
|
||||||
@POST("chats/send")
|
@POST("chats/send")
|
||||||
fun sendGroup(
|
fun sendGroup(
|
||||||
@Body params: SalixGrupo
|
@Body params: SalixGrupo
|
||||||
):
|
): Call<Boolean>
|
||||||
Call<Boolean>
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ class AjustesFragment :
|
||||||
binding.androididText.text = getData(ANDROID_ID)
|
binding.androididText.text = getData(ANDROID_ID)
|
||||||
|
|
||||||
// Tarea 4815
|
// Tarea 4815
|
||||||
// binding.serialNumber.text = getData("SERIALNUMBER")
|
/*binding.serialNumber.text = mobileApplication.serialNumber*/
|
||||||
|
|
||||||
binding.txtserver.setText(getData(getString(R.string.baseurl)))
|
binding.txtserver.setText(getData(getString(R.string.baseurl)))
|
||||||
super.init()
|
super.init()
|
||||||
|
|
|
@ -8,6 +8,7 @@ import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
import androidx.lifecycle.Transformations
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
|
import es.verdnatura.domain.SalixCallback
|
||||||
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
|
||||||
|
@ -202,7 +203,7 @@ class AjustesViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
fun getItemPackingTypeSalix() {
|
fun getItemPackingTypeSalix() {
|
||||||
salix.get_ItemPackingType().enqueue(object :
|
salix.get_ItemPackingType().enqueue(object :
|
||||||
SilexCallback<List<ItemPackingType>>(context) {
|
SalixCallback<List<ItemPackingType>>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
|
|
||||||
val listError: ArrayList<ItemPackingType> = ArrayList()
|
val listError: ArrayList<ItemPackingType> = ArrayList()
|
||||||
|
@ -324,31 +325,6 @@ class AjustesViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun worker_updateSector(sectorFk: Int) {
|
|
||||||
|
|
||||||
silex.worker_updateSector(sectorFk)
|
|
||||||
.enqueue(object : SilexCallback<Unit>(context) {
|
|
||||||
override fun onError(t: Throwable) {
|
|
||||||
|
|
||||||
_actionUpdate.value = ResponseItemVO(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSuccess(response: Response<Unit>) {
|
|
||||||
_actionUpdate.value = ResponseItemVO(
|
|
||||||
response = response.message(),
|
|
||||||
isError = false,
|
|
||||||
errorMessage = ""
|
|
||||||
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fun operator_updateItemPackingType(itemPackingTypeFk: String) {
|
fun operator_updateItemPackingType(itemPackingTypeFk: String) {
|
||||||
|
|
||||||
silex.operator_updateItemPackingType(itemPackingTypeFk)
|
silex.operator_updateItemPackingType(itemPackingTypeFk)
|
||||||
|
@ -466,24 +442,6 @@ class AjustesViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun worker_updatePrinter(printerFk: Int) {
|
|
||||||
ProgressLoading(VISIBLE)
|
|
||||||
silex.worker_updatePrinter(printerFk)
|
|
||||||
.enqueue(object : SilexCallback<Unit>(context) {
|
|
||||||
override fun onError(t: Throwable) {
|
|
||||||
ProgressLoading(GONE)
|
|
||||||
throw t
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSuccess(response: Response<Unit>) {
|
|
||||||
ProgressLoading(GONE)
|
|
||||||
super.onSuccess(response)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fun worker_updateOperatorSalix(entity: String, workerFk: Int, sectorFk: Int?, labelerFk: Int?) {
|
fun worker_updateOperatorSalix(entity: String, workerFk: Int, sectorFk: Int?, labelerFk: Int?) {
|
||||||
ProgressLoading(VISIBLE)
|
ProgressLoading(VISIBLE)
|
||||||
salix.update_operator(id = workerFk, Operator(sectorFk, labelerFk))
|
salix.update_operator(id = workerFk, Operator(sectorFk, labelerFk))
|
||||||
|
|
|
@ -1,52 +1,52 @@
|
||||||
package es.verdnatura.presentation.view.feature.ajustes.model
|
package es.verdnatura.presentation.view.feature.ajustes.model
|
||||||
|
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
class AjustesItemVO(
|
||||||
|
|
||||||
class AjustesItemVO (
|
|
||||||
var id: Int,
|
var id: Int,
|
||||||
var title: String = "",
|
var title: String = "",
|
||||||
var selected: String? = "",
|
var selected: String? = "",
|
||||||
var sectorFk : Int?,
|
var sectorFk: Int?,
|
||||||
var warehouse: Int?,
|
var warehouse: Int?,
|
||||||
var printerFk:Int?,
|
var printerFk: Int?,
|
||||||
var printerSelected:String="",
|
var printerSelected: String = "",
|
||||||
var action:Boolean
|
var action: Boolean
|
||||||
)
|
)
|
||||||
|
|
||||||
class SectorItemVO (
|
class SectorItemVO(
|
||||||
var id: Int,
|
var id: Int,
|
||||||
var description:String = "",
|
var description: String = "",
|
||||||
val warehouseFk:Int?,
|
val warehouseFk: Int?,
|
||||||
val isError : Boolean = false,
|
val isError: Boolean = false,
|
||||||
var errorMessage : String = ""
|
var errorMessage: String = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
class SectorListVO (
|
class SectorListVO(
|
||||||
var list: List<SectorItemVO> = listOf()
|
var list: List<SectorItemVO> = listOf()
|
||||||
)
|
)
|
||||||
class PrintersList (
|
|
||||||
|
class PrintersList(
|
||||||
var list: List<Printers> = listOf()
|
var list: List<Printers> = listOf()
|
||||||
)
|
)
|
||||||
|
|
||||||
class Printers(
|
class Printers(
|
||||||
|
|
||||||
var id: Int?=null,
|
var id: Int,
|
||||||
var name: String="",
|
var name: String,
|
||||||
val isError : Boolean = false,
|
val isError: Boolean = false,
|
||||||
var errorMessage : String = ""
|
var errorMessage: String = ""
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
class WorkerPrintersList(
|
class WorkerPrintersList(
|
||||||
var list:List<Printers> = listOf()
|
var list: List<Printers> = listOf()
|
||||||
)
|
)
|
||||||
|
|
||||||
class Train(
|
class Train(
|
||||||
var id: Int?=null,
|
var id: Int,
|
||||||
var name: String="",
|
var name: String,
|
||||||
val isError : Boolean = false,
|
val isError: Boolean = false,
|
||||||
var errorMessage : String = ""
|
var errorMessage: String = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
class TrainList (
|
class TrainList(
|
||||||
var list: List<Train> = listOf()
|
var list: List<Train> = listOf()
|
||||||
)
|
)
|
|
@ -4,7 +4,6 @@ import android.app.AlertDialog
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.util.Log.d
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.View.GONE
|
import android.view.View.GONE
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
|
@ -15,6 +14,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentItemCardBinding
|
import es.verdnatura.databinding.FragmentItemCardBinding
|
||||||
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.*
|
import es.verdnatura.presentation.common.*
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogDynamicButtons
|
import es.verdnatura.presentation.view.component.CustomDialogDynamicButtons
|
||||||
|
@ -434,7 +434,23 @@ class ItemCardFragment(
|
||||||
)
|
)
|
||||||
.setOkButton(getString(R.string.save)) {
|
.setOkButton(getString(R.string.save)) {
|
||||||
ma.hideKeyboard(customDialogInput.getEditText())
|
ma.hideKeyboard(customDialogInput.getEditText())
|
||||||
editItemCardRow(item, customDialogInput.getValue().toInt())
|
|
||||||
|
//Tarea 6182
|
||||||
|
try {
|
||||||
|
editItemCardRow(item, customDialogInput.getValue().toInt())
|
||||||
|
} catch (ex: Exception) {
|
||||||
|
if (item.action == "itemSaveStem" && customDialogInput.getValue()
|
||||||
|
.isNullOrBlank()
|
||||||
|
)
|
||||||
|
viewModel.item_saveStems(
|
||||||
|
itemFk = itemInfoG!!.id,
|
||||||
|
value = null
|
||||||
|
) else {
|
||||||
|
getString(R.string.errorInput).toast(requireContext())
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
customDialogInput.dismiss()
|
customDialogInput.dismiss()
|
||||||
|
|
||||||
}.setKoButton(getString(R.string.cancel)) {
|
}.setKoButton(getString(R.string.cancel)) {
|
||||||
|
@ -699,7 +715,6 @@ class ItemCardFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateBarcode(code: String, delete: Boolean) {
|
private fun updateBarcode(code: String, delete: Boolean) {
|
||||||
d("VERDNATURA::", "El bacode se va actualizar" + code + delete)
|
|
||||||
if (delete) {
|
if (delete) {
|
||||||
var i = 0
|
var i = 0
|
||||||
var posDelete = 0
|
var posDelete = 0
|
||||||
|
@ -750,8 +765,8 @@ class ItemCardFragment(
|
||||||
private fun updateItemPackingType(itemPackingType: String) {
|
private fun updateItemPackingType(itemPackingType: String) {
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
viewModel.updatePackingTypeSalix(
|
viewModel.updatePackingTypeSalix(
|
||||||
itemInfoG!!.id.toString(),
|
itemInfoG!!.id,
|
||||||
itemPackingTypeSalix(itemPackingType)
|
itemPackingType
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,15 +3,13 @@ package es.verdnatura.presentation.view.feature.articulo.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 androidx.lifecycle.Transformations
|
import es.verdnatura.domain.SalixCallback
|
||||||
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
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.common.Event
|
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
import es.verdnatura.presentation.common.itemBarCodeSalix
|
import es.verdnatura.presentation.common.itemBarCodeSalix
|
||||||
import es.verdnatura.presentation.common.itemPackingTypeSalix
|
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.AddressLoses
|
import es.verdnatura.presentation.view.feature.articulo.model.AddressLoses
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.AddressLosesList
|
import es.verdnatura.presentation.view.feature.articulo.model.AddressLosesList
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
||||||
|
@ -23,8 +21,6 @@ import okhttp3.MultipartBody
|
||||||
import okhttp3.RequestBody
|
import okhttp3.RequestBody
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
|
||||||
import kotlin.collections.ArrayList
|
|
||||||
|
|
||||||
class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
|
@ -207,8 +203,8 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updatePackingTypeSalix(itemFk: String, itemPackingType: itemPackingTypeSalix) {
|
fun updatePackingTypeSalix(itemFk: Int, itemPackingTypeFk: String) {
|
||||||
salix.update_ItemPackingType(itemFk, itemPackingType)
|
salix.updateItem(itemFk, hashMapOf("itemPackingTypeFk" to itemPackingTypeFk))
|
||||||
.enqueue(object : SilexCallback<Any>(context) {
|
.enqueue(object : SilexCallback<Any>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_response.value = ResponseItemVO(
|
_response.value = ResponseItemVO(
|
||||||
|
@ -228,11 +224,11 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
fun item_saveStems(
|
fun item_saveStems(
|
||||||
itemFk: Int,
|
itemFk: Int,
|
||||||
value: Int
|
value: Int?
|
||||||
|
|
||||||
) {
|
) {
|
||||||
silex.item_saveStems(itemFk, value)
|
salix.updateItem(itemFk, hashMapOf("stems" to value))
|
||||||
.enqueue(object : SilexCallback<Any>(context) {
|
.enqueue(object : SalixCallback<Any>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_response.value = ResponseItemVO(
|
_response.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
|
@ -252,8 +248,8 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
value: Int
|
value: Int
|
||||||
|
|
||||||
) {
|
) {
|
||||||
silex.item_saveReference(itemFk, value)
|
salix.updateItem(itemFk, hashMapOf("comment" to value))
|
||||||
.enqueue(object : SilexCallback<Any>(context) {
|
.enqueue(object : SalixCallback<Any>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_response.value = ResponseItemVO(
|
_response.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
|
@ -272,7 +268,8 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
itemFk: Int,
|
itemFk: Int,
|
||||||
value: String,
|
value: String,
|
||||||
delete: Boolean
|
delete: Boolean
|
||||||
) {
|
) {//Tarea 5134 cambiar Silex para obtener el id y así poder hacer un DELETE y un PATCH
|
||||||
|
// salix.barcodes_edit(idBarcode:Int, )
|
||||||
silex.barcodes_edit(value, itemFk, delete)
|
silex.barcodes_edit(value, itemFk, delete)
|
||||||
.enqueue(object : SilexCallback<Any>(context) {
|
.enqueue(object : SilexCallback<Any>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
|
@ -317,20 +314,23 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private val _responseinsert by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _responseinsert by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
val responseinsert: LiveData<ResponseItemVO>
|
val responseinsert: LiveData<ResponseItemVO>
|
||||||
get() = _responseinsert
|
get() = _responseinsert
|
||||||
|
|
||||||
|
|
||||||
fun uploadPhoto(
|
fun uploadPhoto(
|
||||||
urlImage:String,
|
urlImage: String,
|
||||||
itemFK:Int,
|
itemFK: Int,
|
||||||
file: File = File("$urlImage"),
|
file: File = File("$urlImage"),
|
||||||
fileRequestBody: RequestBody = RequestBody.create(MediaType.parse("image/jpeg"), file),
|
fileRequestBody: RequestBody = RequestBody.create(MediaType.parse("image/jpeg"), file),
|
||||||
filePart: MultipartBody.Part = MultipartBody.Part.createFormData("file", file.name, fileRequestBody),
|
filePart: MultipartBody.Part = MultipartBody.Part.createFormData(
|
||||||
) {
|
"file",
|
||||||
salix.uploadImage("catalog",itemFK,filePart)
|
file.name,
|
||||||
|
fileRequestBody
|
||||||
|
),
|
||||||
|
) {
|
||||||
|
salix.uploadImage("catalog", itemFK, filePart)
|
||||||
.enqueue(object : SilexCallback<Any>(context) {
|
.enqueue(object : SilexCallback<Any>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responseinsert.value = ResponseItemVO(
|
_responseinsert.value = ResponseItemVO(
|
||||||
|
@ -361,8 +361,8 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
AddressLoses(7475, "MERMA: RECLAMACION TALLER", "BASURA"),
|
AddressLoses(7475, "MERMA: RECLAMACION TALLER", "BASURA"),
|
||||||
AddressLoses(43432, "MERMA: TRANSPORTE", "BASURA")
|
AddressLoses(43432, "MERMA: TRANSPORTE", "BASURA")
|
||||||
)
|
)
|
||||||
println("Vamos a a lista")
|
println("Vamos a a lista")
|
||||||
_addressLosesList.value= AddressLosesList(mermaRecords)
|
_addressLosesList.value = AddressLosesList(mermaRecords)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ class ItemPackingType (
|
||||||
|
|
||||||
var code:String= "",
|
var code:String= "",
|
||||||
var description:String = "",
|
var description:String = "",
|
||||||
|
var isActive:Boolean = false,
|
||||||
var isError: Boolean = false,
|
var isError: Boolean = false,
|
||||||
var errorMessage:String = ""
|
var errorMessage:String = ""
|
||||||
)
|
)
|
||||||
|
|
|
@ -27,7 +27,7 @@ class BufferFragmentViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
fun buffer_setTypeByName(vBufferFk: Int, vType: String) {
|
fun buffer_setTypeByName(vBufferFk: Int, vType: String) {
|
||||||
silex.buffer_setTypeByName(vBufferFk, vType)
|
silex.buffer_setTypeByName(vBufferFk, vType)
|
||||||
.enqueue(object : SilexCallback<Any>(context) {
|
.enqueue(object : SilexCallback<Boolean>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_itembuffertype.value = ResponseItemVO(
|
_itembuffertype.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
|
@ -35,8 +35,8 @@ class BufferFragmentViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSuccess(response: Response<Any>) {
|
override fun onSuccess(response: Response<Boolean>) {
|
||||||
if (response.body() as Boolean) {
|
if (response.body() == true ) {
|
||||||
|
|
||||||
_itembuffertype.value = ResponseItemVO(
|
_itembuffertype.value = ResponseItemVO(
|
||||||
isError = false,
|
isError = false,
|
||||||
|
|
|
@ -2440,84 +2440,6 @@ class CollectionFragment(
|
||||||
customDialogThreeButtons.setFocusDialogValue()
|
customDialogThreeButtons.setFocusDialogValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* private fun checkAndCall(position: Int, value: String, action: String) {
|
|
||||||
if (value.trim().isNullOrEmpty()) {
|
|
||||||
getString(R.string.Indicanuevacantidad).toast(requireContext())
|
|
||||||
} else {
|
|
||||||
|
|
||||||
when (action) {
|
|
||||||
getString(R.string.Agregar) -> increaseQuantity(position, value.toInt())
|
|
||||||
getString(R.string.BasuraRechazar) -> TrashMissingReject(
|
|
||||||
position,
|
|
||||||
value.toInt(),
|
|
||||||
"TRUE"
|
|
||||||
)
|
|
||||||
getString(R.string.titleFaults) -> TrashMissingReject(
|
|
||||||
position,
|
|
||||||
value.toInt(),
|
|
||||||
"FALSE"
|
|
||||||
)
|
|
||||||
getString(R.string.Reject) -> TrashMissingReject(
|
|
||||||
position,
|
|
||||||
value.toInt(),
|
|
||||||
"reject"
|
|
||||||
)
|
|
||||||
getString(R.string.Split) -> split(position, value.toInt())
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
scanRequest()
|
|
||||||
customDialogThreeButtons.dismiss()
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/* private fun split(position: Int, quantity: Int) {
|
|
||||||
|
|
||||||
//sergio: SPLIT SALIX
|
|
||||||
|
|
||||||
quantityCollectionSplit = quantity
|
|
||||||
positionCollectionSplit = position
|
|
||||||
|
|
||||||
var totalQuantity: Int = 0
|
|
||||||
try {
|
|
||||||
totalQuantity = sales[position].quantity!!.toInt() - quantity.toInt()
|
|
||||||
} catch (e: Exception) {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
viewModel.transferSalesSalix(
|
|
||||||
ticketFk = sales[position].ticketFk,
|
|
||||||
saleFk = sales[position].saleFk,
|
|
||||||
quantity = totalQuantity.toString()
|
|
||||||
)
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/* private fun TrashMissingReject(
|
|
||||||
position: Int,
|
|
||||||
quantity: Int,
|
|
||||||
typeCollectionTrashMissingReject: String
|
|
||||||
) {
|
|
||||||
typeCollectionMissing = typeCollectionTrashMissingReject
|
|
||||||
positionCollectionMissing = position
|
|
||||||
quantityCollectionMissing = quantity
|
|
||||||
|
|
||||||
var totalQuantity: Int = 0
|
|
||||||
try {
|
|
||||||
totalQuantity = sales[position].quantity!!.toInt() - quantity.toInt()
|
|
||||||
} catch (e: Exception) {
|
|
||||||
}
|
|
||||||
|
|
||||||
viewModel.collectionMissingTrash(
|
|
||||||
saleFk = sales[position].saleFk,
|
|
||||||
quantity = totalQuantity.toString(),
|
|
||||||
warehouseFk = getData(WAREHOUSEFK),
|
|
||||||
type = typeCollectionTrashMissingReject,
|
|
||||||
originalQuantity = quantity
|
|
||||||
)
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
private fun missingTrashSuccesful() {
|
private fun missingTrashSuccesful() {
|
||||||
|
|
||||||
|
|
|
@ -2539,85 +2539,6 @@ import org.json.JSONObject
|
||||||
customDialogThreeButtons.setFocusDialogValue()
|
customDialogThreeButtons.setFocusDialogValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* private fun checkAndCall(position: Int, value: String, action: String) {
|
|
||||||
if (value.trim().isNullOrEmpty()) {
|
|
||||||
getString(R.string.Indicanuevacantidad).toast(requireContext())
|
|
||||||
} else {
|
|
||||||
|
|
||||||
when (action) {
|
|
||||||
getString(R.string.Agregar) -> increaseQuantity(position, value.toInt())
|
|
||||||
getString(R.string.BasuraRechazar) -> TrashMissingReject(
|
|
||||||
position,
|
|
||||||
value.toInt(),
|
|
||||||
"TRUE"
|
|
||||||
)
|
|
||||||
getString(R.string.titleFaults) -> TrashMissingReject(
|
|
||||||
position,
|
|
||||||
value.toInt(),
|
|
||||||
"FALSE"
|
|
||||||
)
|
|
||||||
getString(R.string.Reject) -> TrashMissingReject(
|
|
||||||
position,
|
|
||||||
value.toInt(),
|
|
||||||
"reject"
|
|
||||||
)
|
|
||||||
getString(R.string.Split) -> split(position, value.toInt())
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
scanRequest()
|
|
||||||
customDialogThreeButtons.dismiss()
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/* private fun split(position: Int, quantity: Int) {
|
|
||||||
|
|
||||||
//sergio: SPLIT SALIX
|
|
||||||
|
|
||||||
quantityCollectionSplit = quantity
|
|
||||||
positionCollectionSplit = position
|
|
||||||
|
|
||||||
var totalQuantity: Int = 0
|
|
||||||
try {
|
|
||||||
totalQuantity = sales[position].quantity!!.toInt() - quantity.toInt()
|
|
||||||
} catch (e: Exception) {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
viewModel.transferSalesSalix(
|
|
||||||
ticketFk = sales[position].ticketFk,
|
|
||||||
saleFk = sales[position].saleFk,
|
|
||||||
quantity = totalQuantity.toString()
|
|
||||||
)
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/* private fun TrashMissingReject(
|
|
||||||
position: Int,
|
|
||||||
quantity: Int,
|
|
||||||
typeCollectionTrashMissingReject: String
|
|
||||||
) {
|
|
||||||
typeCollectionMissing = typeCollectionTrashMissingReject
|
|
||||||
positionCollectionMissing = position
|
|
||||||
quantityCollectionMissing = quantity
|
|
||||||
|
|
||||||
var totalQuantity: Int = 0
|
|
||||||
try {
|
|
||||||
totalQuantity = sales[position].quantity!!.toInt() - quantity.toInt()
|
|
||||||
} catch (e: Exception) {
|
|
||||||
}
|
|
||||||
|
|
||||||
viewModel.collectionMissingTrash(
|
|
||||||
saleFk = sales[position].saleFk,
|
|
||||||
quantity = totalQuantity.toString(),
|
|
||||||
warehouseFk = getData(WAREHOUSEFK),
|
|
||||||
type = typeCollectionTrashMissingReject,
|
|
||||||
originalQuantity = quantity
|
|
||||||
)
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
private fun missingTrashSuccesful() {
|
private fun missingTrashSuccesful() {
|
||||||
|
|
||||||
var message = ""
|
var message = ""
|
||||||
|
|
|
@ -2463,84 +2463,6 @@ class CollectionFragmentPreChecker(
|
||||||
customDialogThreeButtons.setFocusDialogValue()
|
customDialogThreeButtons.setFocusDialogValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* private fun checkAndCall(position: Int, value: String, action: String) {
|
|
||||||
if (value.trim().isNullOrEmpty()) {
|
|
||||||
getString(R.string.Indicanuevacantidad).toast(requireContext())
|
|
||||||
} else {
|
|
||||||
|
|
||||||
when (action) {
|
|
||||||
getString(R.string.Agregar) -> increaseQuantity(position, value.toInt())
|
|
||||||
getString(R.string.BasuraRechazar) -> TrashMissingReject(
|
|
||||||
position,
|
|
||||||
value.toInt(),
|
|
||||||
"TRUE"
|
|
||||||
)
|
|
||||||
getString(R.string.titleFaults) -> TrashMissingReject(
|
|
||||||
position,
|
|
||||||
value.toInt(),
|
|
||||||
"FALSE"
|
|
||||||
)
|
|
||||||
getString(R.string.Reject) -> TrashMissingReject(
|
|
||||||
position,
|
|
||||||
value.toInt(),
|
|
||||||
"reject"
|
|
||||||
)
|
|
||||||
getString(R.string.Split) -> split(position, value.toInt())
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
scanRequest()
|
|
||||||
customDialogThreeButtons.dismiss()
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/* private fun split(position: Int, quantity: Int) {
|
|
||||||
|
|
||||||
//sergio: SPLIT SALIX
|
|
||||||
|
|
||||||
quantityCollectionSplit = quantity
|
|
||||||
positionCollectionSplit = position
|
|
||||||
|
|
||||||
var totalQuantity: Int = 0
|
|
||||||
try {
|
|
||||||
totalQuantity = sales[position].quantity!!.toInt() - quantity.toInt()
|
|
||||||
} catch (e: Exception) {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
viewModel.transferSalesSalix(
|
|
||||||
ticketFk = sales[position].ticketFk,
|
|
||||||
saleFk = sales[position].saleFk,
|
|
||||||
quantity = totalQuantity.toString()
|
|
||||||
)
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/* private fun TrashMissingReject(
|
|
||||||
position: Int,
|
|
||||||
quantity: Int,
|
|
||||||
typeCollectionTrashMissingReject: String
|
|
||||||
) {
|
|
||||||
typeCollectionMissing = typeCollectionTrashMissingReject
|
|
||||||
positionCollectionMissing = position
|
|
||||||
quantityCollectionMissing = quantity
|
|
||||||
|
|
||||||
var totalQuantity: Int = 0
|
|
||||||
try {
|
|
||||||
totalQuantity = sales[position].quantity!!.toInt() - quantity.toInt()
|
|
||||||
} catch (e: Exception) {
|
|
||||||
}
|
|
||||||
|
|
||||||
viewModel.collectionMissingTrash(
|
|
||||||
saleFk = sales[position].saleFk,
|
|
||||||
quantity = totalQuantity.toString(),
|
|
||||||
warehouseFk = getData(WAREHOUSEFK),
|
|
||||||
type = typeCollectionTrashMissingReject,
|
|
||||||
originalQuantity = quantity
|
|
||||||
)
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
private fun missingTrashSuccesful() {
|
private fun missingTrashSuccesful() {
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import es.verdnatura.presentation.common.Event
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
import es.verdnatura.presentation.view.feature.collection.*
|
import es.verdnatura.presentation.view.feature.collection.*
|
||||||
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
||||||
|
import es.verdnatura.presentation.view.feature.collection.mapper.proposal
|
||||||
import es.verdnatura.presentation.view.feature.login.model.SalixMessageVO
|
import es.verdnatura.presentation.view.feature.login.model.SalixMessageVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.*
|
import es.verdnatura.presentation.view.feature.sacador.model.*
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
|
@ -331,7 +332,11 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
response: Response<List<PlacementSupplyVO>>
|
response: Response<List<PlacementSupplyVO>>
|
||||||
) {
|
) {
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_placementSuppleyList.value = response.body()?.let { PlacementSupplyListVO(it) }
|
val mappedList = response.body()?.map { it.proposal(context) }
|
||||||
|
_placementSuppleyList.value = PlacementSupplyListVO(mappedList.orEmpty())
|
||||||
|
|
||||||
|
|
||||||
|
// _placementSuppleyList.value = response.body()?.let { PlacementSupplyListVO(it) }
|
||||||
} else {
|
} else {
|
||||||
val listError: ArrayList<PlacementSupplyVO> = ArrayList()
|
val listError: ArrayList<PlacementSupplyVO> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
|
@ -576,34 +581,6 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fun collectionMissingTrash(
|
|
||||||
saleFk: Int,
|
|
||||||
quantity: String,
|
|
||||||
type: String,
|
|
||||||
warehouseFk: String,
|
|
||||||
originalQuantity: Int
|
|
||||||
) {
|
|
||||||
silex.collectionMissingTrash(
|
|
||||||
saleFk,
|
|
||||||
quantity,
|
|
||||||
type,
|
|
||||||
warehouseFk,
|
|
||||||
originalQuantity
|
|
||||||
).enqueue(object : SilexCallback<Any>(context) {
|
|
||||||
override fun onError(t: Throwable) {
|
|
||||||
_responseMissingTrash.value = ResponseItemVO(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSuccess(response: Response<Any>) {
|
|
||||||
_responseMissingTrash.value =
|
|
||||||
ResponseItemVO(isError = false, response = response.message())
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
fun saleTrackingDel(saleFk: Int) {
|
fun saleTrackingDel(saleFk: Int) {
|
||||||
silex.saleTrackingDel(saleFk)
|
silex.saleTrackingDel(saleFk)
|
||||||
|
@ -693,6 +670,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
buyFk: String,
|
buyFk: String,
|
||||||
message: String
|
message: String
|
||||||
) {
|
) {
|
||||||
|
//TAREA 5134
|
||||||
|
//Borrar
|
||||||
silex.debug_add(buyFk, message)
|
silex.debug_add(buyFk, message)
|
||||||
.enqueue(object : SilexCallback<Any>(context) {
|
.enqueue(object : SilexCallback<Any>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
|
@ -851,6 +830,9 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun mistakeType() {
|
fun mistakeType() {
|
||||||
|
|
||||||
|
//Tarea 5134
|
||||||
|
// salix.getMistakeTypes()
|
||||||
silex.mistakeType()
|
silex.mistakeType()
|
||||||
.enqueue(object : SilexCallback<List<MistakeTypeVO>>(context) {
|
.enqueue(object : SilexCallback<List<MistakeTypeVO>>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.content.Context
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.presentation.common.convertToDateString
|
import es.verdnatura.presentation.common.convertToDateString
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||||
|
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
@ -67,4 +68,12 @@ private fun getCalendarFromDate(date: String,context:Context): Calendar {
|
||||||
val cal = Calendar.getInstance()
|
val cal = Calendar.getInstance()
|
||||||
cal.time = sdf.parse(date)!!
|
cal.time = sdf.parse(date)!!
|
||||||
return cal
|
return cal
|
||||||
|
}
|
||||||
|
// para cuando se pase a Salix el modelo
|
||||||
|
//Tarea 5134
|
||||||
|
fun PlacementSupplyVO.proposal(context: Context): PlacementSupplyVO {
|
||||||
|
try {
|
||||||
|
}catch (ex:Exception){
|
||||||
|
}
|
||||||
|
return this
|
||||||
}
|
}
|
|
@ -3,12 +3,16 @@ package es.verdnatura.presentation.view.feature.controlvehiculo.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 com.google.gson.Gson
|
||||||
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.SilexCallback
|
import es.verdnatura.domain.SilexCallback
|
||||||
|
import es.verdnatura.domain.model.Filter
|
||||||
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.ResponseItemMachineControl
|
import es.verdnatura.presentation.common.ResponseItemMachineControl
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
|
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.model.DeviceId
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
|
@ -131,10 +135,20 @@ class ControlVehiculoViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
|
|
||||||
fun deviceProduction_getnameDevice(android_id: String) {
|
fun deviceProduction_getnameDevice(android_id: String) {
|
||||||
silex.deviceProduction_getnameDevice(
|
|
||||||
android_id
|
/* silex.deviceProduction_getnameDevice(
|
||||||
|
android_id
|
||||||
|
)*/
|
||||||
|
|
||||||
|
salix.deviceProductionsGetName(
|
||||||
|
Gson().toJson(
|
||||||
|
Filter(
|
||||||
|
mapOf("id" to true),
|
||||||
|
mapOf("android_id" to mapOf("eq" to android_id))
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
.enqueue(object : SilexCallback<Any>(context) {
|
.enqueue(object : SalixCallback<List<DeviceId>>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responsemachine.value = ResponseItemMachineControl(
|
_responsemachine.value = ResponseItemMachineControl(
|
||||||
isError = true,
|
isError = true,
|
||||||
|
@ -143,13 +157,17 @@ class ControlVehiculoViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSuccess(response: Response<Any>) {
|
override fun onSuccess(response: Response<List<DeviceId>>) {
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
|
|
||||||
_responsemachine.value =
|
_responsemachine.value =
|
||||||
ResponseItemMachineControl(
|
ResponseItemMachineControl(
|
||||||
isError = false,
|
isError = false,
|
||||||
response = response.body()!!.toString(),
|
response = if (response.body()!!.isEmpty()) {
|
||||||
|
""
|
||||||
|
} else {
|
||||||
|
response.body()!![0].id.toString()
|
||||||
|
},
|
||||||
type = "getnameDevice"
|
type = "getnameDevice"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@ import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
import androidx.lifecycle.Transformations
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
|
import es.verdnatura.MobileApplication
|
||||||
|
import es.verdnatura.domain.SalixCallback
|
||||||
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
|
||||||
|
@ -18,8 +20,10 @@ import es.verdnatura.presentation.view.feature.inventario.model.InventoryParking
|
||||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
||||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventoryParking
|
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventoryParking
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake
|
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.ExpeditionMistakeSalix
|
||||||
|
import es.verdnatura.presentation.view.feature.workermistake.model.MistakeType
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.model.WorkerFromMistake
|
import es.verdnatura.presentation.view.feature.workermistake.model.WorkerFromMistake
|
||||||
|
import es.verdnatura.presentation.view.feature.workermistake.model.WorkerMistakeSalix
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.model.departmentMistakeList
|
import es.verdnatura.presentation.view.feature.workermistake.model.departmentMistakeList
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.model.workerFromMistakeList
|
import es.verdnatura.presentation.view.feature.workermistake.model.workerFromMistakeList
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.model.workerMistakeTypeList
|
import es.verdnatura.presentation.view.feature.workermistake.model.workerMistakeTypeList
|
||||||
|
@ -228,47 +232,11 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//En test encara,no provat en Salix
|
|
||||||
/* fun department_getHasMistakeSalix(token: String) {
|
|
||||||
|
|
||||||
getWorkerMistakeUserCase.department_getHasMistakeSalix(token)
|
|
||||||
|
|
||||||
.enqueue(object : Callback<List<DepartmentMistake>> {
|
|
||||||
override fun onFailure(call: Call<List<DepartmentMistake>>, t: Throwable) {
|
|
||||||
val listError: ArrayList<DepartmentMistake> = ArrayList()
|
|
||||||
listError.add(
|
|
||||||
DepartmentMistake(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
t.message!!
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
_mistakeDepartmentList.value = departmentMistakeList(listError)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResponse(
|
|
||||||
call: Call<List<DepartmentMistake>>,
|
|
||||||
response: Response<List<DepartmentMistake>>
|
|
||||||
) {
|
|
||||||
if (response.body() != null) {
|
|
||||||
_mistakeDepartmentList.value =
|
|
||||||
response.body()?.let { departmentMistakeList(it) }
|
|
||||||
} else {
|
|
||||||
val listError: ArrayList<DepartmentMistake> = ArrayList()
|
|
||||||
listError.add(DepartmentMistake(0, ""))
|
|
||||||
_mistakeDepartmentList.value = departmentMistakeList(listError)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}*/
|
|
||||||
|
|
||||||
fun department_getHasMistake() {
|
fun department_getHasMistake() {
|
||||||
|
|
||||||
silex.department_getHasMistake()
|
salix.department_getHasMistake()
|
||||||
.enqueue(object : SilexCallback<List<DepartmentMistake>>(context) {
|
.enqueue(object : SalixCallback<List<DepartmentMistake>>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<DepartmentMistake> = ArrayList()
|
val listError: ArrayList<DepartmentMistake> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
|
@ -289,7 +257,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
response.body()?.let { departmentMistakeList(it) }
|
response.body()?.let { departmentMistakeList(it) }
|
||||||
} else {
|
} else {
|
||||||
val listError: ArrayList<DepartmentMistake> = ArrayList()
|
val listError: ArrayList<DepartmentMistake> = ArrayList()
|
||||||
listError.add(DepartmentMistake(0, ""))
|
listError.add(DepartmentMistake())
|
||||||
_mistakeDepartmentList.value = departmentMistakeList(listError)
|
_mistakeDepartmentList.value = departmentMistakeList(listError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -339,38 +307,38 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun workerMistakeType_get() {
|
fun workerMistakeType_get() {
|
||||||
|
//Tarea 5134
|
||||||
|
//salix.getWorkerMistakeTypes()
|
||||||
silex.workerMistakeType_get()
|
silex.workerMistakeType_get()
|
||||||
.enqueue(object : SilexCallback<List<MistakeWorkerType>>(context) {
|
.enqueue(object : SilexCallback<List<MistakeType>>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<MistakeWorkerType> = ArrayList()
|
val listError: ArrayList<MistakeType> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
MistakeWorkerType(
|
MistakeType(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(
|
errorMessage = getMessageFromAllResponse(
|
||||||
nameofFunction(this),
|
nameofFunction(this),
|
||||||
t.message!!
|
t.message!!
|
||||||
),
|
),
|
||||||
id = "0",
|
|
||||||
description = ""
|
description = ""
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
_mistakeWorkerList.value = workerMistakeTypeList(listError)
|
_mistakeWorkerList.value = workerMistakeTypeList(listError)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSuccess(response: Response<List<MistakeWorkerType>>) {
|
override fun onSuccess(response: Response<List<MistakeType>>) {
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_mistakeWorkerList.value =
|
_mistakeWorkerList.value =
|
||||||
response.body()?.let { workerMistakeTypeList(it) }
|
response.body()?.let { workerMistakeTypeList(it) }
|
||||||
} else {
|
} else {
|
||||||
val listError: ArrayList<MistakeWorkerType> = ArrayList()
|
val listError: ArrayList<MistakeType> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
MistakeWorkerType(
|
MistakeType(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(
|
errorMessage = getMessageFromAllResponse(
|
||||||
nameofFunction(this),
|
nameofFunction(this),
|
||||||
response.message()
|
response.message()
|
||||||
),
|
),
|
||||||
id = "0",
|
|
||||||
description = ""
|
description = ""
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -387,6 +355,8 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
vUserFk: Int,
|
vUserFk: Int,
|
||||||
vTypeFk: String
|
vTypeFk: String
|
||||||
) {
|
) {
|
||||||
|
//Tarea 5134
|
||||||
|
//salix.workerMistakesAdd(WorkerMistakeSalix(vUserFk,vTypeFk))
|
||||||
silex.workerMistake_Add(vUserFk, vTypeFk)
|
silex.workerMistake_Add(vUserFk, vTypeFk)
|
||||||
.enqueue(object :
|
.enqueue(object :
|
||||||
SilexCallback<Any>(context) {
|
SilexCallback<Any>(context) {
|
||||||
|
@ -411,8 +381,11 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
fun expeditionMistake_add(
|
fun expeditionMistake_add(
|
||||||
vExpeditionFk: Int,
|
vExpeditionFk: Int,
|
||||||
vTypeFk: String
|
vTypeFk: String,
|
||||||
|
// userId:Int= (context as MobileApplication).userId!!
|
||||||
) {
|
) {
|
||||||
|
//Tarea 5134
|
||||||
|
//salix.expeditionMistakesAdd(ExpeditionMistakeSalix(expeditionFk = vExpeditionFk, typeFk = vTypeFk, workerFk = (context as MobileApplication).userId!!)
|
||||||
silex.expeditionMistake_add(vExpeditionFk, vTypeFk)
|
silex.expeditionMistake_add(vExpeditionFk, vTypeFk)
|
||||||
.enqueue(object :
|
.enqueue(object :
|
||||||
SilexCallback<Any>(context) {
|
SilexCallback<Any>(context) {
|
||||||
|
@ -642,39 +615,39 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun expeditionMistakeType_get() {
|
fun expeditionMistakeType_get() {
|
||||||
|
// Tarea 5134 pasar a salix
|
||||||
|
//salix.getExpeditionMistakeTypes()
|
||||||
silex.expeditionMistakeType_get()
|
silex.expeditionMistakeType_get()
|
||||||
.enqueue(object : SilexCallback<List<MistakeWorkerType>>(context) {
|
.enqueue(object : SilexCallback<List<MistakeType>>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<MistakeWorkerType> = ArrayList()
|
val listError: ArrayList<MistakeType> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
MistakeWorkerType(
|
MistakeType(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(
|
errorMessage = getMessageFromAllResponse(
|
||||||
nameofFunction(this),
|
nameofFunction(this),
|
||||||
t.message!!
|
t.message!!
|
||||||
),
|
),
|
||||||
id = "0",
|
|
||||||
description = ""
|
description = ""
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
_mistakeWorkerList.value = workerMistakeTypeList(listError)
|
_mistakeWorkerList.value = workerMistakeTypeList(listError)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSuccess(response: Response<List<MistakeWorkerType>>) {
|
override fun onSuccess(response: Response<List<MistakeType>>) {
|
||||||
|
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
_mistakeWorkerList.value =
|
_mistakeWorkerList.value =
|
||||||
response.body()?.let { workerMistakeTypeList(it) }
|
response.body()?.let { workerMistakeTypeList(it) }
|
||||||
} else {
|
} else {
|
||||||
val listError: ArrayList<MistakeWorkerType> = ArrayList()
|
val listError: ArrayList<MistakeType> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
MistakeWorkerType(
|
MistakeType(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(
|
errorMessage = getMessageFromAllResponse(
|
||||||
nameofFunction(this),
|
nameofFunction(this),
|
||||||
response.message()
|
response.message()
|
||||||
),
|
),
|
||||||
id = "0",
|
|
||||||
description = ""
|
description = ""
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -17,6 +17,7 @@ import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.Printers
|
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.SectorItemVO
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.WorkerPrintersList
|
import es.verdnatura.presentation.view.feature.ajustes.model.WorkerPrintersList
|
||||||
|
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.DeviceLogSalix
|
||||||
import es.verdnatura.presentation.view.feature.login.model.DataUserSalix
|
import es.verdnatura.presentation.view.feature.login.model.DataUserSalix
|
||||||
import es.verdnatura.presentation.view.feature.login.model.LoginDevice
|
import es.verdnatura.presentation.view.feature.login.model.LoginDevice
|
||||||
import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO
|
import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO
|
||||||
|
@ -203,6 +204,8 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
fun deviceLog_add(
|
fun deviceLog_add(
|
||||||
app: String, versionApp: String, android_id: String
|
app: String, versionApp: String, android_id: String
|
||||||
) {
|
) {
|
||||||
|
//Tarea 4815
|
||||||
|
// salix.deviceLogInsert(DeviceLogSalix(androidId = android_id,userFk,nameApp= app,versionApp= versionApp))
|
||||||
silex.deviceLog_add(app, versionApp, android_id)
|
silex.deviceLog_add(app, versionApp, android_id)
|
||||||
.enqueue(object : SilexCallback<Void>(context) {
|
.enqueue(object : SilexCallback<Void>(context) {
|
||||||
|
|
||||||
|
@ -381,7 +384,9 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun operator_add() {
|
fun operator_add() {
|
||||||
|
//Tarea 5134 no se puede modificar directamente con un upsertWith, hay que modificar front. Y si al hacer login en Salix hacer el insertIgnore en -> operator_add, back de Salix sabe
|
||||||
|
//si es de app?
|
||||||
|
//salix.operatorAdd()
|
||||||
silex.operator_add().enqueue(object : SilexCallback<Any>(context) {
|
silex.operator_add().enqueue(object : SilexCallback<Any>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_operatorAdd.value = ResponseItemVO(
|
_operatorAdd.value = ResponseItemVO(
|
||||||
|
@ -403,7 +408,7 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<Printers> = ArrayList()
|
val listError: ArrayList<Printers> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
Printers(
|
Printers(0,"",
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(
|
errorMessage = getMessageFromAllResponse(
|
||||||
nameofFunction(this),
|
nameofFunction(this),
|
||||||
|
@ -424,7 +429,7 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
} else {
|
} else {
|
||||||
val listError: ArrayList<Printers> = ArrayList()
|
val listError: ArrayList<Printers> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
Printers(
|
Printers(0,"",
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(
|
errorMessage = getMessageFromAllResponse(
|
||||||
nameofFunction(this),
|
nameofFunction(this),
|
||||||
|
|
|
@ -69,6 +69,8 @@ class ExpeditionPalletDetailViewModel(var context: Context) : BaseViewModel(cont
|
||||||
}
|
}
|
||||||
|
|
||||||
fun expeditionPalletDel(vPalletFk: Int) {
|
fun expeditionPalletDel(vPalletFk: Int) {
|
||||||
|
//Tarea 5134
|
||||||
|
//salix.expeditionPalletDel(vPalletFk).enqueue(object : SalixCallback<Any>(context) {
|
||||||
silex.expeditionPalletDel(vPalletFk).enqueue(object : SilexCallback<Any>(context) {
|
silex.expeditionPalletDel(vPalletFk).enqueue(object : SilexCallback<Any>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_response.value = ResponseItemVO(
|
_response.value = ResponseItemVO(
|
||||||
|
|
|
@ -257,7 +257,7 @@ class ExpeditionPalletFragment(
|
||||||
)
|
)
|
||||||
////Log.i("VERDNATURA:"," palletizando ${it.list.get(0).palletFk} expedi: ${customDialogList.getValue()}")
|
////Log.i("VERDNATURA:"," palletizando ${it.list.get(0).palletFk} expedi: ${customDialogList.getValue()}")
|
||||||
viewModel.checkRouteExpeditionScanPut(
|
viewModel.checkRouteExpeditionScanPut(
|
||||||
it.list.get(0).palletFk,
|
it.list[0].palletFk,
|
||||||
customDialogList.getValue().toInt()
|
customDialogList.getValue().toInt()
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -179,6 +179,8 @@ class ExpeditionScanViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
|
|
||||||
fun expeditionScanDel( vScanFk: Int) {
|
fun expeditionScanDel( vScanFk: Int) {
|
||||||
|
//Tarea 5134
|
||||||
|
//salix.expeditionScanDel(vScanFk).enqueue(object : SalixCallback<Any> (context){
|
||||||
silex.expeditionScanDel(vScanFk)
|
silex.expeditionScanDel(vScanFk)
|
||||||
.enqueue(object : SilexCallback<Any> (context){
|
.enqueue(object : SilexCallback<Any> (context){
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
|
|
|
@ -4,8 +4,10 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
|
import android.os.Build
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
|
import androidx.annotation.RequiresApi
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
|
@ -43,6 +45,7 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
|
||||||
|
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_expedition_truck_list
|
override fun getLayoutId(): Int = R.layout.fragment_expedition_truck_list
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
override fun init() {
|
override fun init() {
|
||||||
customDialogHor = CustomDialogHour(requireContext())
|
customDialogHor = CustomDialogHour(requireContext())
|
||||||
|
@ -70,6 +73,7 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
|
||||||
|
|
||||||
|
|
||||||
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
|
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
override fun onOptionsItemSelected(item: Drawable) {
|
override fun onOptionsItemSelected(item: Drawable) {
|
||||||
if (item == iconReload){
|
if (item == iconReload){
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
|
@ -91,6 +95,7 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
|
||||||
return df.format(c)
|
return df.format(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
with(viewModel){
|
with(viewModel){
|
||||||
loadExpeditionTruckList.observe(viewLifecycleOwner, Observer { event ->
|
loadExpeditionTruckList.observe(viewLifecycleOwner, Observer { event ->
|
||||||
|
@ -117,6 +122,7 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
|
||||||
////Log.i("VERDNATURA:","2-Rellenamos adapter")
|
////Log.i("VERDNATURA:","2-Rellenamos adapter")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
private fun addTruck(){
|
private fun addTruck(){
|
||||||
customDialogHor.setTitle(getString(R.string.newTruck)).setOkButton(getString(R.string.save)){
|
customDialogHor.setTitle(getString(R.string.newTruck)).setOkButton(getString(R.string.save)){
|
||||||
ma.hideKeyboard(customDialogHor.getDestinoEditText())
|
ma.hideKeyboard(customDialogHor.getDestinoEditText())
|
||||||
|
|
|
@ -2,19 +2,24 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment
|
||||||
|
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.os.Build
|
||||||
|
import androidx.annotation.RequiresApi
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
import androidx.lifecycle.Transformations
|
||||||
|
import es.verdnatura.domain.SalixCallback
|
||||||
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
|
||||||
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.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
|
import es.verdnatura.presentation.view.feature.paletizador.model.ExpeditionTruckSalix
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckList
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckList
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
import java.time.LocalDate
|
||||||
|
import java.time.LocalTime
|
||||||
|
|
||||||
class ExpeditionTruckListViewModel(val context: Context) : BaseViewModel(context) {
|
class ExpeditionTruckListViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
|
@ -25,9 +30,15 @@ class ExpeditionTruckListViewModel(val context: Context) : BaseViewModel(context
|
||||||
val loadResponseExpeditionAdd = Transformations.map(_response) { Event(it) }
|
val loadResponseExpeditionAdd = Transformations.map(_response) { Event(it) }
|
||||||
|
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
fun expeditionTruckList() {
|
fun expeditionTruckList() {
|
||||||
silex.expeditionTruckList().enqueue(object :
|
// Tarea 5134 modificar fecha para que se vea correctamente y no con 0.00Z
|
||||||
SilexCallback<List<ItemExpeditionTruckVO>>(context) {
|
/* salix.expeditionTruckGet(
|
||||||
|
"""{"where": { "eta": {
|
||||||
|
"between": ["${LocalDate.now().atTime(LocalTime.MIN)}", "${LocalDate.now().atTime(LocalTime.MAX)}"]}}}"""
|
||||||
|
).enqueue(object : SalixCallback<List<ItemExpeditionTruckVO>>(context) {*/
|
||||||
|
silex.expeditionTruckList().enqueue(object :
|
||||||
|
SilexCallback<List<ItemExpeditionTruckVO>>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
val listError: ArrayList<ItemExpeditionTruckVO> = ArrayList()
|
val listError: ArrayList<ItemExpeditionTruckVO> = ArrayList()
|
||||||
listError.add(
|
listError.add(
|
||||||
|
@ -63,8 +74,14 @@ class ExpeditionTruckListViewModel(val context: Context) : BaseViewModel(context
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
fun expeditionTruckAdd(vHour: String, vDescription: String) {
|
fun expeditionTruckAdd(vHour: String, vDescription: String) {
|
||||||
silex.expeditionTruckAdd(vHour, vDescription).enqueue(object : Callback<Any> {
|
salix.expeditionTrucksInsert(
|
||||||
|
ExpeditionTruckSalix(
|
||||||
|
eta = "${LocalDate.now()} $vHour",
|
||||||
|
description = vDescription
|
||||||
|
)
|
||||||
|
).enqueue(object : SalixCallback<Any>(context) {
|
||||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||||
_response.value = ResponseItemVO(
|
_response.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
|
|
|
@ -13,7 +13,7 @@ class ItemExpeditionTruckVO(
|
||||||
var isError: Boolean = false,
|
var isError: Boolean = false,
|
||||||
var errorMessage: String = ""
|
var errorMessage: String = ""
|
||||||
)
|
)
|
||||||
|
data class ExpeditionTruckSalix(val eta:String,val description: String)
|
||||||
|
|
||||||
class ItemExpeditionTruckList(
|
class ItemExpeditionTruckList(
|
||||||
var list: List<ItemExpeditionTruckVO> = listOf()
|
var list: List<ItemExpeditionTruckVO> = listOf()
|
||||||
|
|
|
@ -1230,67 +1230,6 @@ class EndSacadorFragment(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*private fun checkAndCall(position: Int, value: Int, action: String) {
|
|
||||||
|
|
||||||
when (action) {
|
|
||||||
getString(R.string.Agregar) -> increaseQuantity(position, value)
|
|
||||||
*//* getString(R.string.BasuraRechazar) -> TrashMissingReject(position, value, "TRUE")
|
|
||||||
getString(R.string.titleFaults) -> TrashMissingReject(position, value, "FALSE")
|
|
||||||
getString(R.string.Reject) -> TrashMissingReject(position, value, "reject")
|
|
||||||
getString(R.string.Split) -> split(position, value)*//*
|
|
||||||
|
|
||||||
}
|
|
||||||
scanRequest()
|
|
||||||
customDialogThreeButtons.dismiss()
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/* private fun TrashMissingReject(
|
|
||||||
position: Int,
|
|
||||||
quantity: Int,
|
|
||||||
typeCollectionTrashMissingReject: String
|
|
||||||
) {
|
|
||||||
typeCollectionMissing = typeCollectionTrashMissingReject
|
|
||||||
positionCollectionMissing = position
|
|
||||||
quantityCollectionMissing = quantity
|
|
||||||
|
|
||||||
var totalQuantity: Int = 0
|
|
||||||
try {
|
|
||||||
totalQuantity = sales[position].saldo.toInt() - quantity.toInt()
|
|
||||||
} catch (e: Exception) {
|
|
||||||
}
|
|
||||||
|
|
||||||
viewModel.collectionMissingTrash(
|
|
||||||
saleFk = sales[position].idMovimiento,
|
|
||||||
quantity = totalQuantity.toString(),
|
|
||||||
warehouseFk = getDataInt(WAREHOUSEFK),
|
|
||||||
type = "FALSE",
|
|
||||||
originalQuantity = quantity
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun split(position: Int, quantity: Int) {
|
|
||||||
|
|
||||||
positionCollectionSplit = position
|
|
||||||
quantityCollectionSplit = quantity
|
|
||||||
|
|
||||||
var totalQuantity: Int = 0
|
|
||||||
try {
|
|
||||||
totalQuantity = sales[position].saldo.toInt() - quantity.toInt()
|
|
||||||
} catch (e: Exception) {
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.splashProgress.visibility = VISIBLE
|
|
||||||
|
|
||||||
viewModel.transferSalesSalix(
|
|
||||||
ticketFk = sales[position].id,
|
|
||||||
saleFk = sales[position].idMovimiento,
|
|
||||||
quantity = totalQuantity.toString()
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
private fun increaseQuantity(position: Int, quantity: Int) {
|
private fun increaseQuantity(position: Int, quantity: Int) {
|
||||||
positionIncreaseQuantity = position
|
positionIncreaseQuantity = position
|
||||||
|
|
|
@ -4,6 +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 com.google.gson.JsonObject
|
||||||
|
import es.verdnatura.domain.SalixCallback
|
||||||
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
|
||||||
|
@ -47,7 +49,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
val loadResponseCode = Transformations.map(_responseCode) { Event(it) }
|
val loadResponseCode = Transformations.map(_responseCode) { Event(it) }
|
||||||
|
|
||||||
private val _responseAddList by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _responseAddList by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
val responseAddList: LiveData<ResponseItemVO> = _responseAddList
|
val responseAddList: LiveData<ResponseItemVO> = _responseAddList
|
||||||
|
|
||||||
val loadAddList = Transformations.map(_responseAddList) { Event(it) }
|
val loadAddList = Transformations.map(_responseAddList) { Event(it) }
|
||||||
|
|
||||||
|
@ -104,7 +106,8 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
shelving: String
|
shelving: String
|
||||||
|
|
||||||
) {
|
) {
|
||||||
silex.shelvingPriorityUpdate(priority, shelving)
|
//Tarea 5134 ok
|
||||||
|
salix.updateShelvingPriority("""{"code": "$shelving"}""", hashMapOf("priority" to priority))
|
||||||
.enqueue(object : SilexCallback<Any>(context) {
|
.enqueue(object : SilexCallback<Any>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_responsepriority.value = ResponseItemVO(
|
_responsepriority.value = ResponseItemVO(
|
||||||
|
@ -119,6 +122,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun itemShelving_addList(
|
fun itemShelving_addList(
|
||||||
shelving: String,
|
shelving: String,
|
||||||
items: Any,
|
items: Any,
|
||||||
|
@ -147,6 +151,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun itemShelvingMake(
|
fun itemShelvingMake(
|
||||||
shelving: String,
|
shelving: String,
|
||||||
item: Int,
|
item: Int,
|
||||||
|
@ -185,6 +190,10 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
grouping: Int?
|
grouping: Int?
|
||||||
|
|
||||||
) {
|
) {
|
||||||
|
/* salix.itemShelvingUpdate(
|
||||||
|
params = ,
|
||||||
|
id = ,
|
||||||
|
).enqueue(object : SalixCallback<Any>(context) {*/
|
||||||
silex.itemShelvingMakeEdit(
|
silex.itemShelvingMakeEdit(
|
||||||
quantity,
|
quantity,
|
||||||
packing,
|
packing,
|
||||||
|
@ -262,6 +271,8 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
vShelvingFk: String
|
vShelvingFk: String
|
||||||
|
|
||||||
) {
|
) {
|
||||||
|
/*salix.itemShelvingUpdate()
|
||||||
|
.enqueue(object : SilexCallback<Any>(context) {*/
|
||||||
silex.itemShelving_merge(vShelf, vShelvingFk)
|
silex.itemShelving_merge(vShelf, vShelvingFk)
|
||||||
.enqueue(object : SilexCallback<Any>(context) {
|
.enqueue(object : SilexCallback<Any>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
|
@ -369,8 +380,13 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
shelvingFk: String
|
shelvingFk: String
|
||||||
|
|
||||||
) {
|
) {
|
||||||
silex.clearShelvingList(shelvingFk)
|
|
||||||
.enqueue(object : SilexCallback<Any>(context) {
|
// silex.clearShelvingList(shelvingFk)
|
||||||
|
salix.itemShelvingsUpdate(
|
||||||
|
id = JsonObject().apply { addProperty("shelvingFk", shelvingFk) },
|
||||||
|
hashMapOf("visible" to 0)
|
||||||
|
)
|
||||||
|
.enqueue(object : SalixCallback<Any>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
_response.value = ResponseItemVO(
|
_response.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
|
@ -407,8 +423,10 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun itemShelvingDelete(itemFk: Int) {
|
fun itemShelvingDelete(itemFk: Int) {
|
||||||
silex.itemShelvingDelete(itemFk)
|
salix.itemShelvingsDelete(itemFk)
|
||||||
.enqueue(object : SilexCallback<Any>(context) {
|
.enqueue(object : SalixCallback<Any>(context) {
|
||||||
|
/*silex.itemShelvingDelete(itemFk)
|
||||||
|
.enqueue(object : SilexCallback<Any>(context) {*/
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
|
|
||||||
_response.value = ResponseItemVO(
|
_response.value = ResponseItemVO(
|
||||||
|
@ -425,7 +443,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun itemShelving_selfConsumption(shelvingFk:String, itemFk: Int, quantity: Int) {
|
fun itemShelving_selfConsumption(shelvingFk: String, itemFk: Int, quantity: Int) {
|
||||||
silex.itemShelving_selfConsumption(shelvingFk, itemFk, quantity)
|
silex.itemShelving_selfConsumption(shelvingFk, itemFk, quantity)
|
||||||
.enqueue(object : SilexCallback<Any>(context) {
|
.enqueue(object : SilexCallback<Any>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
|
||||||
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryViewModel
|
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryViewModel
|
||||||
import es.verdnatura.presentation.view.feature.inventario.fragment.SearchDepartmentModel
|
import es.verdnatura.presentation.view.feature.inventario.fragment.SearchDepartmentModel
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake
|
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.MistakeType
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.model.WorkerFromMistake
|
import es.verdnatura.presentation.view.feature.workermistake.model.WorkerFromMistake
|
||||||
import ir.mirrajabi.searchdialog.SimpleSearchDialogCompat
|
import ir.mirrajabi.searchdialog.SimpleSearchDialogCompat
|
||||||
|
|
||||||
|
@ -62,15 +62,7 @@ class WorkermistakeFragment(
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
|
||||||
|
viewModel.department_getHasMistake()
|
||||||
var working_in_test = false //sergio:No posar a true fins que Salix puje versió 8.3
|
|
||||||
|
|
||||||
if (!working_in_test) {
|
|
||||||
viewModel.department_getHasMistake(
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
// viewModel.department_getHasMistakeSalix(getData(TOKEN))
|
|
||||||
}
|
|
||||||
|
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
}
|
}
|
||||||
|
@ -237,7 +229,7 @@ class WorkermistakeFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun showMistakeList(list: List<MistakeWorkerType>) {
|
private fun showMistakeList(list: List<MistakeType>) {
|
||||||
binding.splashProgress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
listMistakes = ArrayList()
|
listMistakes = ArrayList()
|
||||||
list.forEach {
|
list.forEach {
|
||||||
|
|
|
@ -1,38 +1,49 @@
|
||||||
package es.verdnatura.presentation.view.feature.workermistake.model
|
package es.verdnatura.presentation.view.feature.workermistake.model
|
||||||
|
|
||||||
|
|
||||||
class MistakeWorkerType (
|
class MistakeType(
|
||||||
var id: String = "",
|
var code: String = "",
|
||||||
var code:String = "",
|
var description: String = "",
|
||||||
var description: String = "",
|
var isError: Boolean = false,
|
||||||
var isError:Boolean = false,
|
var errorMessage: String = ""
|
||||||
var errorMessage:String = ""
|
)
|
||||||
)
|
|
||||||
|
|
||||||
class DepartmentMistake(
|
class ExpeditionMistakeSalix(
|
||||||
|
var expeditionFk: Int,
|
||||||
|
var typeFk: String,
|
||||||
|
var workerFk: Int
|
||||||
|
|
||||||
var id:Int? =null,
|
)
|
||||||
var name:String="",
|
|
||||||
var isError:Boolean = false,
|
class DepartmentMistake(
|
||||||
var errorMessage:String = ""
|
|
||||||
|
var id: Int? = null,
|
||||||
|
var name: String = "",
|
||||||
|
var isError: Boolean = false,
|
||||||
|
var errorMessage: String = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
class WorkerFromMistake(
|
class WorkerFromMistake(
|
||||||
|
|
||||||
var id:Int?=null,
|
var id: Int? = null,
|
||||||
var firstName: String="",
|
var firstName: String = "",
|
||||||
var lastName: String="",
|
var lastName: String = "",
|
||||||
var isError:Boolean = false,
|
var isError: Boolean = false,
|
||||||
var errorMessage:String = ""
|
var errorMessage: String = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class WorkerMistakeSalix(
|
||||||
|
var userFk: Int,
|
||||||
|
var workerMistakeTypeFk: String,
|
||||||
|
)
|
||||||
class workerMistakeTypeList(
|
class workerMistakeTypeList(
|
||||||
var list: List<MistakeWorkerType> = listOf()
|
var list: List<MistakeType> = listOf()
|
||||||
)
|
)
|
||||||
|
|
||||||
class departmentMistakeList(
|
class departmentMistakeList(
|
||||||
var list: List<DepartmentMistake> = listOf()
|
var list: List<DepartmentMistake> = listOf()
|
||||||
)
|
)
|
||||||
|
|
||||||
class workerFromMistakeList(
|
class workerFromMistakeList(
|
||||||
var list: List<WorkerFromMistake> = listOf()
|
var list: List<WorkerFromMistake> = listOf()
|
||||||
)
|
)
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
android:background="@color/verdnatura_black_9">
|
android:background="@color/verdnatura_black_1">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,11 +66,21 @@
|
||||||
android:paddingRight="5dp"
|
android:paddingRight="5dp"
|
||||||
android:layout_marginBottom="5dp"
|
android:layout_marginBottom="5dp"
|
||||||
>
|
>
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/lateralLayout"
|
||||||
|
android:layout_width="5dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/verdnatura_warm_grey"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/linearLayout"
|
app:layout_constraintEnd_toStartOf="@+id/linearLayout"
|
||||||
|
@ -82,6 +92,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{item.driver}"
|
android:text="@{item.driver}"
|
||||||
|
android:textSize="16sp"
|
||||||
android:textColor="@color/verdnatura_white" />
|
android:textColor="@color/verdnatura_white" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -89,6 +100,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{String.valueOf(item.id)}"
|
android:text="@{String.valueOf(item.id)}"
|
||||||
|
android:textSize="16sp"
|
||||||
android:textColor="@color/verdnatura_white" />
|
android:textColor="@color/verdnatura_white" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
android:text="@{item.longName}"
|
android:text="@{item.longName}"
|
||||||
android:textSize="@dimen/body2"
|
android:textSize="@dimen/body2"
|
||||||
android:textColor="@color/verdnatura_white"
|
android:textColor="@color/verdnatura_white"
|
||||||
android:layout_weight="1"
|
android:layout_weight="0.85"
|
||||||
android:gravity="center"/>
|
android:gravity="center"/>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/saledate"
|
android:id="@+id/saledate"
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
android:text="@{item.dated}"
|
android:text="@{item.dated}"
|
||||||
android:textSize="@dimen/body2"
|
android:textSize="@dimen/body2"
|
||||||
android:textColor="@color/verdnatura_white"
|
android:textColor="@color/verdnatura_white"
|
||||||
android:layout_weight="1"
|
android:layout_weight="0.85"
|
||||||
android:gravity="center"/>
|
android:gravity="center"/>
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
android:id="@+id/textView21"
|
android:id="@+id/textView21"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{String.valueOf(item.id)}"
|
android:text="@{String.valueOf(item.client)}"
|
||||||
app:autoSizeMaxTextSize="18sp"
|
app:autoSizeMaxTextSize="18sp"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textColor="@color/verdnatura_white"
|
android:textColor="@color/verdnatura_white"
|
||||||
|
|
Loading…
Reference in New Issue