refs #5652
This commit is contained in:
parent
76d6daf34b
commit
718e418d30
|
@ -1,9 +1,9 @@
|
||||||
package es.verdnatura.domain
|
package es.verdnatura.domain
|
||||||
|
|
||||||
import com.google.gson.JsonObject
|
|
||||||
import es.verdnatura.presentation.common.itemBarCodeSalix
|
import es.verdnatura.presentation.common.itemBarCodeSalix
|
||||||
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.AddressLoses
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
||||||
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
|
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
|
||||||
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
||||||
|
@ -65,9 +65,14 @@ interface SalixService {
|
||||||
fun getCollectionSalix(
|
fun getCollectionSalix(
|
||||||
): Call<List<CollectionVO>>
|
): Call<List<CollectionVO>>
|
||||||
|
|
||||||
|
@GET("Addresses/getAddress")
|
||||||
|
fun getAddressSalix(
|
||||||
|
): Call<List<AddressLoses>>
|
||||||
|
|
||||||
@GET("Buyers")
|
@GET("Buyers")
|
||||||
fun getBuyers(
|
fun getBuyers(
|
||||||
): Call<List<BuyerVO>>
|
): Call<List<BuyerVO>>
|
||||||
|
|
||||||
@GET("collections/getCollection")
|
@GET("collections/getCollection")
|
||||||
fun getCollectionSalixLocal(
|
fun getCollectionSalixLocal(
|
||||||
): Call<List<CollectionTicket>>
|
): Call<List<CollectionTicket>>
|
||||||
|
@ -134,12 +139,12 @@ interface SalixService {
|
||||||
|
|
||||||
@GET("Departments")
|
@GET("Departments")
|
||||||
fun department_getHasMistake(
|
fun department_getHasMistake(
|
||||||
@Query("filter") filter:String = """{"fields": {"id": true,"name": true},"where": {"hasToMistake": true}}"""
|
@Query("filter") filter: String = """{"fields": {"id": true,"name": true},"where": {"hasToMistake": true}}"""
|
||||||
): Call<List<DepartmentMistake>>
|
): Call<List<DepartmentMistake>>
|
||||||
|
|
||||||
@GET("Workers")
|
@GET("Workers")
|
||||||
fun worker_idF11Allowed(
|
fun worker_idF11Allowed(
|
||||||
@Query("filter") filter:String
|
@Query("filter") filter: String
|
||||||
): Call<List<DepartmentMistake>>
|
): Call<List<DepartmentMistake>>
|
||||||
|
|
||||||
@DELETE("ExpeditionPallets/{id}")
|
@DELETE("ExpeditionPallets/{id}")
|
||||||
|
@ -174,6 +179,11 @@ interface SalixService {
|
||||||
@Body params: Any
|
@Body params: Any
|
||||||
): Call<Any>
|
): Call<Any>
|
||||||
|
|
||||||
|
@POST("Items/setVisibleDiscard")
|
||||||
|
fun setVisibleDiscard(
|
||||||
|
@Body params: Any
|
||||||
|
): Call<Any>
|
||||||
|
|
||||||
@POST("Shelvings/upsertWithWhere")
|
@POST("Shelvings/upsertWithWhere")
|
||||||
fun updateShelvingPriority(
|
fun updateShelvingPriority(
|
||||||
@Query("where") where: String,
|
@Query("where") where: String,
|
||||||
|
@ -199,12 +209,12 @@ interface SalixService {
|
||||||
|
|
||||||
@GET("ItemPackingTypes")
|
@GET("ItemPackingTypes")
|
||||||
fun get_ItemPackingType(
|
fun get_ItemPackingType(
|
||||||
@Query("filter") filter:String = """{"where": {"isActive": true}}"""
|
@Query("filter") filter: String = """{"where": {"isActive": true}}"""
|
||||||
): Call<List<ItemPackingType>>
|
): Call<List<ItemPackingType>>
|
||||||
|
|
||||||
@GET("ExpeditionTrucks")
|
@GET("ExpeditionTrucks")
|
||||||
fun expeditionTruckGet(
|
fun expeditionTruckGet(
|
||||||
@Query("filter") filter:String
|
@Query("filter") filter: String
|
||||||
): Call<List<ItemExpeditionTruckVO>>
|
): Call<List<ItemExpeditionTruckVO>>
|
||||||
|
|
||||||
@POST("PackingSiteAdvanceds")
|
@POST("PackingSiteAdvanceds")
|
||||||
|
@ -301,7 +311,7 @@ interface SalixService {
|
||||||
|
|
||||||
@POST("ItemShelvings/update")
|
@POST("ItemShelvings/update")
|
||||||
fun itemShelvingsUpdate(
|
fun itemShelvingsUpdate(
|
||||||
@Query("where") id : Any ,
|
@Query("where") id: Any,
|
||||||
@Body params: Any
|
@Body params: Any
|
||||||
): Call<Any>
|
): Call<Any>
|
||||||
|
|
||||||
|
@ -351,10 +361,13 @@ interface SalixService {
|
||||||
): Call<List<MistakeType>>
|
): Call<List<MistakeType>>
|
||||||
|
|
||||||
@POST("ExpeditionMistakes")
|
@POST("ExpeditionMistakes")
|
||||||
fun expeditionMistakesAdd(expeditionMistake:ExpeditionMistakeSalix
|
fun expeditionMistakesAdd(
|
||||||
|
expeditionMistake: ExpeditionMistakeSalix
|
||||||
): Call<Any>
|
): Call<Any>
|
||||||
|
|
||||||
@POST("WorkerMistakes")
|
@POST("WorkerMistakes")
|
||||||
fun workerMistakesAdd(workerMistake: WorkerMistakeSalix
|
fun workerMistakesAdd(
|
||||||
|
workerMistake: WorkerMistakeSalix
|
||||||
): Call<Any>
|
): Call<Any>
|
||||||
|
|
||||||
@POST("SaleMistakes")
|
@POST("SaleMistakes")
|
||||||
|
|
|
@ -16,3 +16,9 @@ data class ItemShelvingSaleSalix(
|
||||||
var quantity:Int,
|
var quantity:Int,
|
||||||
var isItemShelvingSaleEmpty:Boolean?
|
var isItemShelvingSaleEmpty:Boolean?
|
||||||
)
|
)
|
||||||
|
|
||||||
|
data class ItemDiscardSalix(
|
||||||
|
var itemFk :Int,
|
||||||
|
var warehouseFk:Int,
|
||||||
|
var quantity:Int,
|
||||||
|
var addressFk:Int)
|
|
@ -42,7 +42,7 @@ class CustomDialogDynamicButtons(context: Context, private val onClickDynamic: O
|
||||||
|
|
||||||
fun createDynamicButtons(buttonInfoList: List<AddressLoses>) {
|
fun createDynamicButtons(buttonInfoList: List<AddressLoses>) {
|
||||||
for (buttonInfo in buttonInfoList) {
|
for (buttonInfo in buttonInfoList) {
|
||||||
setDynamicButton(buttonInfo.nickname,buttonInfo.addressFk)
|
setDynamicButton(buttonInfo.nickname,buttonInfo.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ class ItemCardFragment(
|
||||||
private var listItemsRow: ArrayList<ItemCardRowVO> = ArrayList()
|
private var listItemsRow: ArrayList<ItemCardRowVO> = ArrayList()
|
||||||
private var listBarcodes: ArrayList<BarcodeVO> = ArrayList()
|
private var listBarcodes: ArrayList<BarcodeVO> = ArrayList()
|
||||||
private var itemsPackingType: ArrayList<ItemPackingType> = ArrayList()
|
private var itemsPackingType: ArrayList<ItemPackingType> = ArrayList()
|
||||||
|
private var quantityToDiscard = 0
|
||||||
|
|
||||||
|
|
||||||
private var itemInfoG: ItemCardVO? = null
|
private var itemInfoG: ItemCardVO? = null
|
||||||
|
@ -58,6 +59,7 @@ class ItemCardFragment(
|
||||||
private lateinit var customDialogInput: CustomDialogInput
|
private lateinit var customDialogInput: CustomDialogInput
|
||||||
private lateinit var customDialogList: CustomDialogList
|
private lateinit var customDialogList: CustomDialogList
|
||||||
private lateinit var customDialogTwo: CustomDialogTwoButtons
|
private lateinit var customDialogTwo: CustomDialogTwoButtons
|
||||||
|
private lateinit var customDynamic: CustomDialogDynamicButtons
|
||||||
|
|
||||||
|
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_item_card
|
override fun getLayoutId(): Int = R.layout.fragment_item_card
|
||||||
|
@ -73,6 +75,7 @@ class ItemCardFragment(
|
||||||
customDialogInput = CustomDialogInput(requireContext())
|
customDialogInput = CustomDialogInput(requireContext())
|
||||||
customDialogList = CustomDialogList(requireContext())
|
customDialogList = CustomDialogList(requireContext())
|
||||||
customDialogTwo = CustomDialogTwoButtons(requireContext())
|
customDialogTwo = CustomDialogTwoButtons(requireContext())
|
||||||
|
customDynamic = CustomDialogDynamicButtons(requireContext(), this)
|
||||||
|
|
||||||
|
|
||||||
if (!itemFk.isNullOrEmpty()) {
|
if (!itemFk.isNullOrEmpty()) {
|
||||||
|
@ -607,9 +610,10 @@ class ItemCardFragment(
|
||||||
//Tarea 5652 , quitar código cuando está asignada tarea
|
//Tarea 5652 , quitar código cuando está asignada tarea
|
||||||
var test = false
|
var test = false
|
||||||
if (test) {
|
if (test) {
|
||||||
println("Vamos a getAddress")
|
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
viewModel.getAddressLoses()
|
viewModel.getAddress()
|
||||||
|
quantityToDiscard = value
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
value.toInt()
|
value.toInt()
|
||||||
|
@ -668,8 +672,6 @@ class ItemCardFragment(
|
||||||
|
|
||||||
private fun showDialogTrashFault(listAddress: List<AddressLoses>) {
|
private fun showDialogTrashFault(listAddress: List<AddressLoses>) {
|
||||||
|
|
||||||
val customDynamic =
|
|
||||||
CustomDialogDynamicButtons(requireContext(), this)// Instancia de tu customDialogTwo
|
|
||||||
customDynamic.setTitle("")
|
customDynamic.setTitle("")
|
||||||
customDynamic.setDescription(getString(R.string.deleteStock))
|
customDynamic.setDescription(getString(R.string.deleteStock))
|
||||||
customDynamic.createDynamicButtons(listAddress)
|
customDynamic.createDynamicButtons(listAddress)
|
||||||
|
@ -775,6 +777,9 @@ class ItemCardFragment(
|
||||||
|
|
||||||
override fun onClickDynamic(addressFK: Int) {
|
override fun onClickDynamic(addressFK: Int) {
|
||||||
println("Acabas de pulsar" + addressFK)
|
println("Acabas de pulsar" + addressFK)
|
||||||
|
customDynamic.dismiss()
|
||||||
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
|
viewModel.setVisibleDiscard(itemInfoG!!.id, warehouseFk!!, quantityToDiscard, addressFK)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ 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.ItemDiscardSalix
|
||||||
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.view.feature.articulo.model.AddressLoses
|
import es.verdnatura.presentation.view.feature.articulo.model.AddressLoses
|
||||||
|
@ -159,10 +160,11 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
fun setVisibleDiscard(
|
fun setVisibleDiscard(
|
||||||
itemFk: Int,
|
itemFk: Int,
|
||||||
warehouseFk: Int,
|
warehouseFk: Int,
|
||||||
newValue: Int,
|
quantity: Int,
|
||||||
isTrash: Boolean
|
addressFk: Int,
|
||||||
) {
|
|
||||||
silex.itemTrash(itemFk, warehouseFk, newValue, isTrash)
|
) {
|
||||||
|
salix.setVisibleDiscard(ItemDiscardSalix(itemFk, warehouseFk, quantity, addressFk))
|
||||||
.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(
|
||||||
|
@ -291,7 +293,7 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
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
|
) {//Tarea 5134 cambiar Silex para obtener el id y así poder hacer un DELETE y un PATCH
|
||||||
// salix.barcodes_edit(idBarcode:Int, )
|
// 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) {
|
||||||
|
@ -371,10 +373,44 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun getAddress() {
|
||||||
|
salix.getAddressSalix().enqueue(object : SilexCallback<List<AddressLoses>>(context) {
|
||||||
|
override fun onError(t: Throwable) {
|
||||||
|
|
||||||
|
val listError: ArrayList<AddressLoses> = ArrayList()
|
||||||
|
listError.add(AddressLoses(isError = true, errorMessage = t.message!!))
|
||||||
|
_addressLosesList.value = AddressLosesList(listError)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onSuccess(response: Response<List<AddressLoses>>) {
|
||||||
|
|
||||||
|
if (response.body() != null) {
|
||||||
|
_addressLosesList.value = response.body()?.let { AddressLosesList(it) }
|
||||||
|
} else {
|
||||||
|
val listError: ArrayList<AddressLoses> = ArrayList()
|
||||||
|
listError.add(
|
||||||
|
AddressLoses(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
nameofFunction(this),
|
||||||
|
response.message()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
_addressLosesList.value = AddressLosesList(listError)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fun getAddressLoses(
|
fun getAddressLoses(
|
||||||
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
|
||||||
val mermaRecords = listOf(
|
val mermaRecords = listOf(
|
||||||
AddressLoses(77, "MERMA: CONTENEDOR", "BASURA"),
|
AddressLoses(77, "MERMA: CONTENEDOR", "BASURA"),
|
||||||
AddressLoses(317, "MERMA: FALTAS", "FALTAS"),
|
AddressLoses(317, "MERMA: FALTAS", "FALTAS"),
|
||||||
|
|
|
@ -2,24 +2,24 @@ package es.verdnatura.presentation.view.feature.articulo.model
|
||||||
|
|
||||||
class ItemProposal(
|
class ItemProposal(
|
||||||
|
|
||||||
var itemFk: String ="",
|
var itemFk: String = "",
|
||||||
var longName: String="",
|
var longName: String = "",
|
||||||
var subName: String="",
|
var subName: String = "",
|
||||||
var tag5: String = "",
|
var tag5: String = "",
|
||||||
var value5: String="",
|
var value5: String = "",
|
||||||
var match5: String="",
|
var match5: String = "",
|
||||||
var tag6: String="",
|
var tag6: String = "",
|
||||||
var value6: String="",
|
var value6: String = "",
|
||||||
var match6: String="",
|
var match6: String = "",
|
||||||
var tag7: String="",
|
var tag7: String = "",
|
||||||
var value7: String="",
|
var value7: String = "",
|
||||||
var match7: String="",
|
var match7: String = "",
|
||||||
var tag8: String="",
|
var tag8: String = "",
|
||||||
var value8: String="",
|
var value8: String = "",
|
||||||
var match8: String="",
|
var match8: String = "",
|
||||||
var available: String="",
|
var available: String = "",
|
||||||
var counter: String="",
|
var counter: String = "",
|
||||||
var minQuantity: String="",
|
var minQuantity: String = "",
|
||||||
|
|
||||||
var isError: Boolean = false,
|
var isError: Boolean = false,
|
||||||
var errorMessage: String = ""
|
var errorMessage: String = ""
|
||||||
|
@ -35,8 +35,10 @@ class AddressLosesList(
|
||||||
)
|
)
|
||||||
|
|
||||||
data class AddressLoses(
|
data class AddressLoses(
|
||||||
val addressFk: Int,
|
val id: Int = 0,
|
||||||
val nickname: String,
|
val nickname: String = "",
|
||||||
val name: String
|
val name: String = "",
|
||||||
|
var isError: Boolean = false,
|
||||||
|
var errorMessage: String = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue