refs #6061 silex→salix
This commit is contained in:
parent
e89d58afee
commit
56437162ca
|
@ -5,6 +5,7 @@ import es.verdnatura.presentation.common.itemBarCodeSalix
|
|||
import es.verdnatura.presentation.common.packingSiteSalix
|
||||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
||||
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
|
||||
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
||||
import es.verdnatura.presentation.view.feature.collection.listSaleSalix
|
||||
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.model.DeviceId
|
||||
|
@ -21,11 +22,13 @@ 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.Supplier
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
|
||||
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.ExpeditionMistakeSalix
|
||||
import es.verdnatura.presentation.view.feature.workermistake.model.MistakeType
|
||||
import es.verdnatura.presentation.view.feature.workermistake.model.SaleMistakeSalix
|
||||
import es.verdnatura.presentation.view.feature.workermistake.model.WorkerMistakeSalix
|
||||
import okhttp3.MultipartBody
|
||||
import retrofit2.Call
|
||||
|
@ -62,6 +65,18 @@ interface SalixService {
|
|||
fun getCollectionSalix(
|
||||
): Call<List<CollectionVO>>
|
||||
|
||||
@GET("Buyers")
|
||||
fun getBuyers(
|
||||
): Call<List<BuyerVO>>
|
||||
@GET("collections/getCollection")
|
||||
fun getCollectionSalixLocal(
|
||||
): Call<List<CollectionTicket>>
|
||||
|
||||
@POST("collections/{id}/getTickets")
|
||||
fun getCollectionTickets(
|
||||
@Path("id") id: Number,
|
||||
@Body params: Any
|
||||
): Call<CollectionTicket>
|
||||
|
||||
@GET("collections/sectorCollection_get")
|
||||
fun sectorCollection_get(
|
||||
|
@ -122,6 +137,11 @@ interface SalixService {
|
|||
@Query("filter") filter:String = """{"fields": {"id": true,"name": true},"where": {"hasToMistake": true}}"""
|
||||
): Call<List<DepartmentMistake>>
|
||||
|
||||
@GET("Workers")
|
||||
fun worker_idF11Allowed(
|
||||
@Query("filter") filter:String
|
||||
): Call<List<DepartmentMistake>>
|
||||
|
||||
@DELETE("ExpeditionPallets/{id}")
|
||||
fun expeditionPalletDel(
|
||||
@Path("id") id: Number
|
||||
|
@ -167,10 +187,10 @@ interface SalixService {
|
|||
@Body params: Any
|
||||
): Call<Any>
|
||||
|
||||
@PUT("DeviceLogs")
|
||||
@POST("DeviceLogs")
|
||||
fun deviceLogInsert(
|
||||
@Body params: Any
|
||||
): Call<Any>
|
||||
): Call<Void>
|
||||
|
||||
@POST("ExpeditionTrucks")
|
||||
fun expeditionTrucksInsert(
|
||||
|
@ -281,10 +301,39 @@ interface SalixService {
|
|||
|
||||
@POST("ItemShelvings/update")
|
||||
fun itemShelvingsUpdate(
|
||||
@Query("where") id: JsonObject,
|
||||
@Query("where") id : Any ,
|
||||
@Body params: Any
|
||||
): Call<Any>
|
||||
|
||||
|
||||
@POST("TicketCollections/update")
|
||||
fun ticketCollectionUpdate(
|
||||
@Query("where") filter: Any,//revisar si con Any vale, update generalmente pongo json (ejemplo: itemShelvingReset)
|
||||
@Body params: Any
|
||||
): Call<Any>
|
||||
|
||||
@POST("ItemShelvingSales/itemShelvingSaleSetQuantity")
|
||||
fun itemShelvingsConfirmRerserved(
|
||||
@Body params: Any
|
||||
): Call<Any>
|
||||
|
||||
@PATCH("ItemShelvingSales/{id}")
|
||||
fun itemShelvingsReservedUpdate(
|
||||
@Path("id") id: Number,
|
||||
@Body params: Any
|
||||
): Call<Any>
|
||||
|
||||
@POST("ItemShelvingSales/itemShelvingSale_addByCollection")
|
||||
fun itemShelvingSale_addByCollection(
|
||||
@Body params: Any,
|
||||
): Call<Any>
|
||||
|
||||
@POST("ItemShelvingSales/itemShelvingSale_addBySale")
|
||||
fun itemShelvingSale_addBySale(
|
||||
@Body params: Any,
|
||||
): Call<Any>
|
||||
|
||||
|
||||
@POST("ItemShelvings/getInventory")
|
||||
fun getInventoryParking(
|
||||
@Query("parkingFrom") parkingFrom: String, @Query("parkingTo") parkingTo: String
|
||||
|
@ -308,6 +357,11 @@ interface SalixService {
|
|||
fun workerMistakesAdd(workerMistake: WorkerMistakeSalix
|
||||
): Call<Any>
|
||||
|
||||
@POST("SaleMistakes")
|
||||
fun saleMistakeAdd(
|
||||
@Body saleMistakeSalix: SaleMistakeSalix
|
||||
): Call<Any>
|
||||
|
||||
@GET("MistakeTypes")
|
||||
fun getMistakeTypes(
|
||||
): Call<List<MistakeTypeVO>>
|
||||
|
|
|
@ -478,7 +478,7 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
saveWorkForm(
|
||||
WorkForms(
|
||||
"TestHome",
|
||||
"http://192.168.1.37:9000",
|
||||
"http://192.168.1.51:9000",
|
||||
urlSalix = "https://test-salix.verdnatura.es"
|
||||
)
|
||||
)
|
||||
|
@ -492,7 +492,7 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
saveWorkForm(
|
||||
WorkForms(
|
||||
"TestLOCALHOME",
|
||||
"http://192.168.1.37:9000",
|
||||
"http://192.168.1.51:9000",
|
||||
urlSalix = "http://localhost:3000"
|
||||
)
|
||||
)
|
||||
|
|
|
@ -7,6 +7,7 @@ import android.view.View.VISIBLE
|
|||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import es.verdnatura.MobileApplication
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.domain.SalixCallback
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
|
@ -56,9 +57,6 @@ class AjustesViewModel(val context: Context) : BaseViewModel(context) {
|
|||
val actionUpdatePackingTicket: LiveData<ResponseItemVO>
|
||||
get() = _actionUpdatePackingTicket
|
||||
|
||||
private val _workerupdatePrinter by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val workerupdatePrinter: LiveData<ResponseItemVO>
|
||||
get() = _workerupdatePrinter
|
||||
|
||||
private val _printerList by lazy { MutableLiveData<PrintersList>() }
|
||||
val printerList: LiveData<PrintersList>
|
||||
|
@ -423,6 +421,9 @@ class AjustesViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
|
||||
fun worker_isF11Allowed() {
|
||||
//Hi ha que canviar front, torna [] si no troba i [{"isF11Allowed":true}] si troba el usuario
|
||||
//salix.worker_idF11Allowed( """{"where":{"id":${(context as MobileApplication).userId},"isF11Allowed":false},"fields":{"isF11Allowed":true}}""")
|
||||
|
||||
silex.worker_isF11Allowed()
|
||||
.enqueue(object : SilexCallback<Boolean>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
|
|
|
@ -2673,8 +2673,8 @@ class CollectionFragment(
|
|||
if (it.description == item.code) {
|
||||
|
||||
viewModel.saleMistakeAdd(
|
||||
vSaleFk = mistakeSale?.saleFk!!,
|
||||
vTypeFk = it.id
|
||||
saleFk = mistakeSale?.saleFk!!,
|
||||
typeFk = it.id
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -2774,8 +2774,8 @@ import org.json.JSONObject
|
|||
if (it.description == item.code) {
|
||||
|
||||
viewModel.saleMistakeAdd(
|
||||
vSaleFk = mistakeSale?.saleFk!!,
|
||||
vTypeFk = it.id
|
||||
saleFk = mistakeSale?.saleFk!!,
|
||||
typeFk = it.id
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -2657,8 +2657,8 @@ class CollectionFragmentPreChecker(
|
|||
if (it.description == item.code) {
|
||||
|
||||
viewModel.saleMistakeAdd(
|
||||
vSaleFk = mistakeSale?.saleFk!!,
|
||||
vTypeFk = it.id
|
||||
saleFk = mistakeSale?.saleFk!!,
|
||||
typeFk = it.id
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -32,8 +32,9 @@ class ShelvingLogSalix(
|
|||
)
|
||||
|
||||
data class DeviceLogSalix(
|
||||
val androidId: String,
|
||||
val userFk: Int?,
|
||||
val nameApp: String?,
|
||||
val versionApp: String?,
|
||||
val android_id: String,
|
||||
val userFk: Int,
|
||||
val nameApp: String,
|
||||
val versionApp: String,
|
||||
val serialNumber :String?
|
||||
)
|
|
@ -4,6 +4,7 @@ package es.verdnatura.presentation.view.feature.sacador.fragment
|
|||
import android.content.Context
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.SalixCallback
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
|
@ -11,8 +12,12 @@ import es.verdnatura.presentation.base.nameofFunction
|
|||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
||||
import es.verdnatura.presentation.view.feature.sacador.mapper.toDateFormat
|
||||
import es.verdnatura.presentation.view.feature.sacador.mapper.toDateFormating
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionListVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicketList
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.collectionLocal
|
||||
import retrofit2.Call
|
||||
import retrofit2.Response
|
||||
|
||||
|
@ -22,6 +27,10 @@ class SacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
val collectionList: LiveData<CollectionListVO>
|
||||
get() = _collectionList
|
||||
|
||||
private val _collectionListLocal by lazy { MutableLiveData<CollectionTicketList>() }
|
||||
val collectionListLocal: LiveData<CollectionTicketList>
|
||||
get() = _collectionListLocal
|
||||
|
||||
private val _collectionTicketList by lazy { MutableLiveData<CollectionVO>() }
|
||||
val collectionTicketList: LiveData<CollectionVO>
|
||||
get() = _collectionTicketList
|
||||
|
@ -78,6 +87,7 @@ class SacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun sectorCollection_new(
|
||||
sectorFk: Int
|
||||
) {
|
||||
|
@ -108,6 +118,7 @@ class SacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun ticket_printLabelPrevious(ticketFk: Int) {
|
||||
|
||||
silex.ticket_printLabelPrevious(ticketFk).enqueue(object : SilexCallback<Any>(context) {
|
||||
|
@ -125,10 +136,11 @@ class SacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
|
||||
}
|
||||
|
||||
fun collection_assign() {
|
||||
silex.collection_assign().enqueue(
|
||||
object :
|
||||
SilexCallback<String>(context) {
|
||||
SilexCallback<Int>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value =
|
||||
ResponseItemVO(
|
||||
|
@ -140,7 +152,7 @@ class SacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<String>) {
|
||||
override fun onSuccess(response: Response<Int>) {
|
||||
if (response.body() != null) {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.body()!!.toString())
|
||||
|
@ -159,6 +171,77 @@ class SacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun collection_assignNew() {
|
||||
silex.collection_assign().enqueue(
|
||||
object :
|
||||
SilexCallback<Int>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value =
|
||||
ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
t.message!!
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<Int>) {
|
||||
if (response.body() != null) {
|
||||
|
||||
itemShelvingSale_addByCollection(response.body()!!)
|
||||
/* _response.value =
|
||||
ResponseItemVO(isError = false, response = response.body()!!.toString())*/
|
||||
} else {
|
||||
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun itemShelvingSale_addByCollection(collection:Int) {
|
||||
salix.itemShelvingSale_addByCollection(collection).enqueue(
|
||||
object :
|
||||
SalixCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value =
|
||||
ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
t.message!!
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
if (response.body() != null) {
|
||||
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = collection.toString())
|
||||
} else {
|
||||
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun collectionGet() {
|
||||
silex.collectionGet().enqueue(object :
|
||||
SilexCallback<List<CollectionVO>>(context) {
|
||||
|
@ -284,5 +367,44 @@ class SacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun collectionGetSalixLocal() {
|
||||
salix.getCollectionSalixLocal().enqueue(object :
|
||||
SilexCallback<List<CollectionTicket>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<CollectionTicket> = ArrayList()
|
||||
listError.add(
|
||||
CollectionTicket(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
)
|
||||
_collectionListLocal.value = CollectionTicketList(listError)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<List<CollectionTicket>>) {
|
||||
|
||||
if (response.body() != null) {
|
||||
_collectionListLocal.value =
|
||||
// CollectionTicketList(mutableListOf(collectionLocal))
|
||||
response.body()?.let { CollectionTicketList(it.toDateFormating(context)) }
|
||||
} else {
|
||||
val listError: ArrayList<CollectionTicket> = ArrayList()
|
||||
listError.add(
|
||||
CollectionTicket(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
)
|
||||
_collectionListLocal.value = CollectionTicketList(listError)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.sacador.mapper
|
|||
import android.content.Context
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.presentation.common.convertToDateString
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
@ -22,6 +23,21 @@ fun List<CollectionVO>.toDateFormat(context: Context): ArrayList<CollectionVO> {
|
|||
return collections
|
||||
}
|
||||
|
||||
fun List<CollectionTicket>.toDateFormating(context: Context): ArrayList<CollectionTicket> {
|
||||
val collections: ArrayList<CollectionTicket> = ArrayList()
|
||||
this.forEach {
|
||||
collections.add(
|
||||
CollectionTicket(
|
||||
collectionFk = it.collectionFk,
|
||||
created = getCalendarFromDate(it.created, context).convertToDateString(),
|
||||
ticketTotalCount = it.ticketTotalCount
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
return collections
|
||||
}
|
||||
|
||||
|
||||
private fun getCalendarFromDate(date: String, context: Context): Calendar {
|
||||
val sdf = SimpleDateFormat(context.getString(R.string.dateFormat))
|
||||
|
|
|
@ -36,6 +36,12 @@ class WorkerMistakeSalix(
|
|||
var userFk: Int,
|
||||
var workerMistakeTypeFk: String,
|
||||
)
|
||||
|
||||
class SaleMistakeSalix(
|
||||
var userFk: Number,
|
||||
var typeFk: Number,
|
||||
var saleFk :Number
|
||||
)
|
||||
class workerMistakeTypeList(
|
||||
var list: List<MistakeType> = listOf()
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue