refs #6276 feat:silex →salix
This commit is contained in:
parent
91de8dd3e9
commit
64ebe19a42
|
@ -193,6 +193,8 @@ interface SalixService {
|
|||
@Query("routeFk") params: Int,
|
||||
): Call<List<ExpeditionInfoSummary>>
|
||||
|
||||
|
||||
|
||||
@POST("Applications/addNoteFromDelivery/execute-proc")
|
||||
fun addNote(
|
||||
@Query("params") params: Any? = null,
|
||||
|
@ -291,13 +293,19 @@ interface SalixService {
|
|||
Call<List<Printers>>
|
||||
|
||||
@GET("Collections/getSales")//REVISADA
|
||||
fun collectionGetTickets(
|
||||
fun getSalesFromTicketOrCollection(
|
||||
@Query("collectionOrTicketFk") collectionOrTicketFk: Number,
|
||||
@Query("print") printFk: Boolean,
|
||||
@Query("print") print: Boolean,
|
||||
@Query("source") source: String,
|
||||
|
||||
):
|
||||
Call<CollectionVO>
|
||||
@GET("TicketCollections/hasUncheckedTicket")//REVISADA
|
||||
fun hasUncheckedTicket(
|
||||
@Query("ticketFk") ticketFk: Number,
|
||||
|
||||
):
|
||||
Call<String>
|
||||
|
||||
@POST("SaleTrackings/setPicked")//REVISADA
|
||||
fun saleTrackingMark(
|
||||
|
@ -354,7 +362,7 @@ interface SalixService {
|
|||
|
||||
@POST("MachineWorkers/updateInTime")//REVISADA
|
||||
fun machineWorkerUpdateInTime(
|
||||
@Query("plate") plate: Any
|
||||
@Body params: Any
|
||||
):
|
||||
Call<Any>
|
||||
|
||||
|
@ -821,7 +829,7 @@ interface SalixService {
|
|||
): Call<Unit>
|
||||
|
||||
@PUT("ItemBarCodes")//REVISADA
|
||||
fun barcodes_edit(
|
||||
fun barcodesEdit(
|
||||
@Body params: ItemBarCodeSalix
|
||||
): Call<Any>
|
||||
|
||||
|
@ -889,6 +897,11 @@ interface SalixService {
|
|||
@Query("filter") filter: String
|
||||
): Call<List<ShelvingLogSalix>>
|
||||
|
||||
@GET("Parkings")
|
||||
fun getPickingOrder(
|
||||
@Query("filter") filter: String
|
||||
): Call<List<JsonObject>>
|
||||
|
||||
@GET("DeviceProductions")
|
||||
fun deviceProductionsGetName(
|
||||
@Query("filter") filter: String
|
||||
|
@ -959,6 +972,11 @@ interface SalixService {
|
|||
@Body params: Any
|
||||
): Call<Unit>
|
||||
|
||||
@GET("TicketCollections")
|
||||
fun getCollectionId(
|
||||
@Query("filter") filter: Any
|
||||
): Call<List<JsonObject>>
|
||||
|
||||
@POST("ItemShelvingSales/itemShelvingSaleSetQuantity")
|
||||
fun itemShelvingSaleSetQuantity(
|
||||
@Body params: Any
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import es.verdnatura.presentation.view.feature.packaging.model.ItemSupplier
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import retrofit2.Call
|
||||
import retrofit2.http.Body
|
||||
|
@ -168,11 +167,11 @@ interface VerdnaturaService {
|
|||
Call<Any>*/
|
||||
|
||||
//Tarea 3520
|
||||
@POST("almacennew/collection_getUncheckedTicket")//NO SALIX
|
||||
/* @POST("almacennew/collection_getUncheckedTicket")//NO SALIX
|
||||
fun collection_getUncheckedTicket(
|
||||
@Body vararg params: Any
|
||||
):
|
||||
Call<String>
|
||||
Call<String>*/
|
||||
|
||||
//sergio: de momento se separa para ir viendo como funciona. El precontrol llamara a collectionTicketGet con otro parametro.
|
||||
@POST("almacennew/collection_getTickets")//REVISADA
|
||||
|
@ -181,12 +180,12 @@ interface VerdnaturaService {
|
|||
):
|
||||
Call<CollectionVO>
|
||||
|
||||
// SE SACA CON LA DE ARRIBA collection_get_Tickets //
|
||||
@POST("almacennew/collection_get")//REVISADA
|
||||
// SE SACA CON LA DE ARRIBA HECHO 3520 PR .collection_get_Tickets //
|
||||
/* @POST("almacennew/collection_get")//REVISADA
|
||||
fun collection_get(
|
||||
@Body vararg params: Any
|
||||
):
|
||||
Call<CollectionVO>
|
||||
Call<CollectionVO>*/
|
||||
|
||||
/* @POST("almacennew/saleTrackingReplace")//REVISADA
|
||||
fun saleTrackingReplace(
|
||||
|
@ -744,11 +743,11 @@ interface VerdnaturaService {
|
|||
Call<Unit>*/
|
||||
|
||||
//SUPPLIERS NO VA A UTILIZARSE
|
||||
@POST("almacennew/supplier_getItems")//REVISADA
|
||||
/* @POST("almacennew/supplier_getItems")//REVISADA
|
||||
fun supplier_getItems(
|
||||
@Body vararg params: Any
|
||||
):
|
||||
Call<List<ItemSupplier>>
|
||||
Call<List<ItemSupplier>>*/
|
||||
|
||||
/* @POST("delivery/getInfoCompany")//NO SALIX
|
||||
fun getInfoCompany(
|
||||
|
|
|
@ -341,9 +341,9 @@ class SaleAdapter(
|
|||
txtdeNew.visibility = View.VISIBLE
|
||||
itemArticleQuantityPicked.visibility = View.VISIBLE
|
||||
itemArticleQuantityLine3.visibility = View.VISIBLE
|
||||
if (type != SACADOR) {
|
||||
if (type != SACADOR) {//6276 hasMistake == retrocompatibilidad
|
||||
val colorRes =
|
||||
if (sale.hasMistake) R.color.verdnatura_red_salix else R.color.verdnatura_black
|
||||
if (sale.hasMistake == true || sale.hasMistake == 1) R.color.verdnatura_red_salix else R.color.verdnatura_black
|
||||
imageErrorMessage.imageTintList =
|
||||
ColorStateList.valueOf(getColor(context!!, colorRes))
|
||||
imageErrorMessage.visibility = View.VISIBLE
|
||||
|
|
|
@ -353,12 +353,19 @@ class CollectionFragment(
|
|||
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
if (!buttonPushedGetCollection) {
|
||||
viewModel.collection_get(
|
||||
//Tarea 3520
|
||||
viewModel.collectionGetId(
|
||||
collection.collectionFk,
|
||||
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
|
||||
print = "0",
|
||||
type
|
||||
)
|
||||
/* viewModel.collection_get(
|
||||
collection.collectionFk,
|
||||
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
|
||||
print = "0",
|
||||
type
|
||||
)*/
|
||||
buttonPushedGetCollection = true
|
||||
} else {
|
||||
viewModel.collectionTicketGet(
|
||||
|
@ -962,7 +969,7 @@ class CollectionFragment(
|
|||
var salePerson = ""
|
||||
for (it in sales) {
|
||||
if (it.ticketFk.equals(ticketFk)) {
|
||||
salePerson = it.salePersonFk
|
||||
salePerson = it.salePersonFk?:""
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -1006,7 +1013,7 @@ class CollectionFragment(
|
|||
}
|
||||
}
|
||||
|
||||
observations = observations + " " + ticket.observations
|
||||
observations = observations.takeIf { !it.isNullOrBlank() }?.plus(" ${ticket.observations}") ?: ""
|
||||
}//}
|
||||
|
||||
sales = salesList.sortedWith(compareBy({ it.saleOrder }))
|
||||
|
@ -1248,7 +1255,7 @@ class CollectionFragment(
|
|||
break
|
||||
}
|
||||
//2- Por barcode
|
||||
saleVO.Barcodes.forEach { barcode ->
|
||||
saleVO.barcodes.forEach { barcode ->
|
||||
|
||||
if (txtscan == barcode) {
|
||||
if (mpok != null) mpok!!.start()
|
||||
|
@ -1280,7 +1287,7 @@ class CollectionFragment(
|
|||
ticketToParking = tickets[0]
|
||||
ticketScanTxt = txtscan
|
||||
//#tarea4107
|
||||
viewModel.collection_getUncheckedTicket(
|
||||
viewModel.hasUncheckedTicket(
|
||||
collectionFk = tickets[0].toInt()
|
||||
)
|
||||
}
|
||||
|
@ -1319,7 +1326,7 @@ class CollectionFragment(
|
|||
viewModel.ticketState(myScan)
|
||||
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
mperror!!.start()
|
||||
}
|
||||
|
||||
|
@ -1594,7 +1601,7 @@ class CollectionFragment(
|
|||
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
|
||||
viewModel.itemShelving_updateFromSale(
|
||||
viewModel.itemShelvingUpdateFromSale(
|
||||
sales[position].saleFk
|
||||
)
|
||||
positionUnmarked = position
|
||||
|
@ -1894,7 +1901,7 @@ class CollectionFragment(
|
|||
if (saleToCheck.itemFk.toString() == valueToCheck)
|
||||
return true
|
||||
else {
|
||||
saleToCheck.Barcodes.forEach { barcode ->
|
||||
saleToCheck.barcodes.forEach { barcode ->
|
||||
if (barcode == valueToCheck)
|
||||
return true
|
||||
}
|
||||
|
@ -2498,7 +2505,7 @@ class CollectionFragment(
|
|||
isPrepared = value[0].isPrepared,
|
||||
isPreviousPrepared = value[0].isPreviousPrepared,
|
||||
isControlled = value[0].isControlled,
|
||||
line3 = value[0].code,
|
||||
line3 = value[0].code?:"", //6676
|
||||
picked = value[0].picked,
|
||||
ticketFk = value[0].ticketFk,
|
||||
level = value[0].level
|
||||
|
@ -2512,8 +2519,8 @@ class CollectionFragment(
|
|||
|
||||
mySale.line1 = "Previa :${mySale.saleGroupFk}"
|
||||
mySale.line2 = "Líneas: ${value.size}"
|
||||
mySale.line3 = value[0].code
|
||||
mySale.placements = listOf(PlacementVO(shelving = value[0].code))
|
||||
mySale.line3 = value[0].code?:"" //6276
|
||||
mySale.placements = listOf(PlacementVO(shelving = value[0].code?:"")) //6276
|
||||
|
||||
myList.add(mySale)
|
||||
} else {
|
||||
|
|
|
@ -36,7 +36,22 @@ import es.verdnatura.domain.ConstAndValues.WAREHOUSEFK
|
|||
import es.verdnatura.domain.notNull
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.*
|
||||
import es.verdnatura.presentation.common.DataMessageSalix
|
||||
import es.verdnatura.presentation.common.ItemScanned
|
||||
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
|
||||
import es.verdnatura.presentation.common.OnMistakeClickListener
|
||||
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||
import es.verdnatura.presentation.common.OnQuantityClickListener
|
||||
import es.verdnatura.presentation.common.OnSaleClickListener
|
||||
import es.verdnatura.presentation.common.OnTicketClickListener
|
||||
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||
import es.verdnatura.presentation.common.hideKeyboard
|
||||
import es.verdnatura.presentation.common.itemScanIsQr
|
||||
import es.verdnatura.presentation.common.itemScanValue
|
||||
import es.verdnatura.presentation.common.onPackingClickListener
|
||||
import es.verdnatura.presentation.common.showKeyboard
|
||||
import es.verdnatura.presentation.common.showKeyboardIn
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.component.CustomDialogInput
|
||||
import es.verdnatura.presentation.view.component.CustomDialogList
|
||||
|
@ -47,7 +62,12 @@ import es.verdnatura.presentation.view.feature.collection.ItemVO
|
|||
import es.verdnatura.presentation.view.feature.collection.adapter.SaleAdapter
|
||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.*
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
|
||||
import org.json.JSONObject
|
||||
|
||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||
|
@ -237,7 +257,7 @@ class CollectionFragmentPicker(
|
|||
override fun onOptionsItemSelected(item: Drawable) {
|
||||
|
||||
when (item) {
|
||||
iconViewCollection.drawable -> getCollection()
|
||||
// iconViewCollection.drawable -> getCollection()
|
||||
iconPrint.drawable -> print()
|
||||
iconAdd.drawable -> addItem()
|
||||
iconWorker.drawable -> showUser()
|
||||
|
@ -321,7 +341,7 @@ class CollectionFragmentPicker(
|
|||
hideKeyboard()
|
||||
}
|
||||
|
||||
private fun getCollection() {
|
||||
/* private fun getCollection() {
|
||||
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
if (!buttonPushedGetCollection) {
|
||||
|
@ -343,7 +363,7 @@ class CollectionFragmentPicker(
|
|||
buttonPushedGetCollection = false
|
||||
}
|
||||
lastScanned = collection.collectionFk
|
||||
}
|
||||
}*/
|
||||
|
||||
private fun scanRequest() {
|
||||
binding.scanInput.requestFocus()
|
||||
|
@ -947,7 +967,7 @@ class CollectionFragmentPicker(
|
|||
var salePerson = ""
|
||||
for (it in sales) {
|
||||
if (it.ticketFk.equals(ticketFk)) {
|
||||
salePerson = it.salePersonFk
|
||||
salePerson = it.salePersonFk?:""
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -984,7 +1004,7 @@ class CollectionFragmentPicker(
|
|||
}
|
||||
}
|
||||
|
||||
observations = observations + " " + ticket.observations
|
||||
observations = observations.takeIf { !it.isNullOrBlank() }?.plus(" ${ticket.observations}") ?: ""
|
||||
}//}
|
||||
|
||||
sales = salesList.sortedWith(compareBy({ it.saleOrder }))
|
||||
|
@ -1228,7 +1248,7 @@ class CollectionFragmentPicker(
|
|||
break
|
||||
}
|
||||
//2- Por barcode
|
||||
saleVO.Barcodes.forEach { barcode ->
|
||||
saleVO.barcodes.forEach { barcode ->
|
||||
|
||||
if (txtscan == barcode) {
|
||||
if (mpok != null) mpok!!.start()
|
||||
|
@ -1251,7 +1271,7 @@ class CollectionFragmentPicker(
|
|||
ticketToParking = tickets[0]
|
||||
ticketScanTxt = txtscan
|
||||
//#tarea4107
|
||||
viewModel.collection_getUncheckedTicket(
|
||||
viewModel.hasUncheckedTicket(
|
||||
collectionFk = tickets[0].toInt()
|
||||
)
|
||||
}
|
||||
|
@ -1550,7 +1570,7 @@ class CollectionFragmentPicker(
|
|||
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
|
||||
viewModel.itemShelving_updateFromSale(
|
||||
viewModel.itemShelvingUpdateFromSale(
|
||||
sales[position].saleFk
|
||||
)
|
||||
positionUnmarked = position
|
||||
|
@ -1666,6 +1686,7 @@ class CollectionFragmentPicker(
|
|||
hideKeyboards()
|
||||
|
||||
} catch (ex: Exception) {
|
||||
ex.toast(requireContext())
|
||||
ma.messageWithSound(
|
||||
getString(R.string.errorReviewItem),
|
||||
true,
|
||||
|
@ -1852,7 +1873,7 @@ class CollectionFragmentPicker(
|
|||
if (saleToCheck.itemFk.toString() == valueToCheck)
|
||||
return true
|
||||
else {
|
||||
saleToCheck.Barcodes.forEach { barcode ->
|
||||
saleToCheck.barcodes.forEach { barcode ->
|
||||
if (barcode == valueToCheck)
|
||||
return true
|
||||
}
|
||||
|
@ -2475,7 +2496,7 @@ class CollectionFragmentPicker(
|
|||
isPrepared = value[0].isPrepared,
|
||||
isPreviousPrepared = value[0].isPreviousPrepared,
|
||||
isControlled = value[0].isControlled,
|
||||
line3 = value[0].code,
|
||||
line3 = value[0].code?:"", //6276
|
||||
picked = value[0].picked,
|
||||
ticketFk = value[0].ticketFk,
|
||||
level = value[0].level
|
||||
|
@ -2489,8 +2510,8 @@ class CollectionFragmentPicker(
|
|||
|
||||
mySale.line1 = "Previa :${mySale.saleGroupFk}"
|
||||
mySale.line2 = "Líneas: ${value.size}"
|
||||
mySale.line3 = value[0].code
|
||||
mySale.placements = listOf(PlacementVO(shelving = value[0].code))
|
||||
mySale.line3 = value[0].code?:""//6276
|
||||
mySale.placements = listOf(PlacementVO(shelving = value[0].code?:""))//6276
|
||||
|
||||
myList.add(mySale)
|
||||
} else {
|
||||
|
|
|
@ -40,7 +40,23 @@ import es.verdnatura.domain.ConstAndValues.WAREHOUSEFK
|
|||
import es.verdnatura.domain.notNull
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.*
|
||||
import es.verdnatura.presentation.common.DataMessageSalix
|
||||
import es.verdnatura.presentation.common.ItemScanned
|
||||
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
|
||||
import es.verdnatura.presentation.common.OnMistakeClickListener
|
||||
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||
import es.verdnatura.presentation.common.OnQuantityClickListener
|
||||
import es.verdnatura.presentation.common.OnSaleClickListener
|
||||
import es.verdnatura.presentation.common.OnTicketClickListener
|
||||
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||
import es.verdnatura.presentation.common.addViewObserver
|
||||
import es.verdnatura.presentation.common.hideKeyboard
|
||||
import es.verdnatura.presentation.common.itemScanIsQr
|
||||
import es.verdnatura.presentation.common.itemScanValue
|
||||
import es.verdnatura.presentation.common.onPackingClickListener
|
||||
import es.verdnatura.presentation.common.showKeyboard
|
||||
import es.verdnatura.presentation.common.showKeyboardIn
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.component.CustomDialogInput
|
||||
import es.verdnatura.presentation.view.component.CustomDialogList
|
||||
|
@ -51,7 +67,12 @@ import es.verdnatura.presentation.view.feature.collection.ItemVO
|
|||
import es.verdnatura.presentation.view.feature.collection.adapter.SaleAdapter
|
||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.*
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
|
||||
import org.json.JSONObject
|
||||
|
||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||
|
@ -239,7 +260,6 @@ class CollectionFragmentPreChecker(
|
|||
override fun onOptionsItemSelected(item: Drawable) {
|
||||
|
||||
when (item) {
|
||||
iconViewCollection.drawable -> getCollection()
|
||||
iconPrint.drawable -> print()
|
||||
iconAdd.drawable -> addItem()
|
||||
iconWorker.drawable -> showUser()
|
||||
|
@ -322,10 +342,11 @@ class CollectionFragmentPreChecker(
|
|||
hideKeyboard()
|
||||
}
|
||||
|
||||
private fun getCollection() {
|
||||
/* private fun getCollection() {
|
||||
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
if (!buttonPushedGetCollection) {
|
||||
//Tarea 3520
|
||||
viewModel.collection_get(
|
||||
collection.collectionFk,
|
||||
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
|
||||
|
@ -344,7 +365,7 @@ class CollectionFragmentPreChecker(
|
|||
buttonPushedGetCollection = false
|
||||
}
|
||||
lastScanned = collection.collectionFk
|
||||
}
|
||||
}*/
|
||||
|
||||
private fun scanRequest() {
|
||||
binding.scanInput.requestFocus()
|
||||
|
@ -389,7 +410,15 @@ class CollectionFragmentPreChecker(
|
|||
markPrevia(myQr.id.toString())
|
||||
} else {
|
||||
binding.scanInput.setText(myQr.id.toString())
|
||||
findSale(binding.scanInput.text.toString())
|
||||
storedBackPosition = 0
|
||||
storedPosition = 0
|
||||
viewModel.getSales(
|
||||
binding.scanInput.text.toString().toInt(),
|
||||
print = "0",
|
||||
source = type
|
||||
)
|
||||
|
||||
//findSale(binding.scanInput.text.toString())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -416,7 +445,14 @@ class CollectionFragmentPreChecker(
|
|||
}
|
||||
|
||||
} else {
|
||||
findSale(binding.scanInput.text.toString())
|
||||
storedBackPosition = 0
|
||||
storedPosition = 0
|
||||
viewModel.getSales(
|
||||
binding.scanInput.text.toString().toInt(),
|
||||
print = "0",
|
||||
source = type
|
||||
)
|
||||
// findSale(binding.scanInput.text.toString())
|
||||
}
|
||||
|
||||
buttonPushedGetCollection = false
|
||||
|
@ -812,7 +848,6 @@ class CollectionFragmentPreChecker(
|
|||
|
||||
}
|
||||
} else {
|
||||
|
||||
viewModel.collectionTicketGet(
|
||||
collection.collectionFk,
|
||||
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
|
||||
|
@ -966,7 +1001,7 @@ class CollectionFragmentPreChecker(
|
|||
var salePerson = ""
|
||||
for (it in sales) {
|
||||
if (it.ticketFk.equals(ticketFk)) {
|
||||
salePerson = it.salePersonFk
|
||||
salePerson = it.salePersonFk ?: ""
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -1003,8 +1038,9 @@ class CollectionFragmentPreChecker(
|
|||
}
|
||||
}
|
||||
|
||||
observations = observations + " " + ticket.observations
|
||||
}//}
|
||||
observations =
|
||||
observations.takeIf { !it.isNullOrBlank() }?.plus(" ${ticket.observations}") ?: ""
|
||||
}
|
||||
|
||||
sales = salesList.sortedWith(compareBy({ it.saleOrder }))
|
||||
|
||||
|
@ -1029,9 +1065,9 @@ class CollectionFragmentPreChecker(
|
|||
|
||||
sales.forEachIndexed { index, saleVO ->
|
||||
if (saleVO.saleFk == sale.saleFk) {
|
||||
if (type != "PRECHECKER") {
|
||||
//if (type != "PRECHECKER") {
|
||||
showQuantityDialog(index)
|
||||
}
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1235,7 +1271,8 @@ class CollectionFragmentPreChecker(
|
|||
break
|
||||
}
|
||||
//2- Por barcode
|
||||
saleVO.Barcodes.forEach { barcode ->
|
||||
if (saleVO.barcodes.isNotEmpty())
|
||||
saleVO.barcodes.forEach { barcode ->
|
||||
|
||||
if (txtscan == barcode) {
|
||||
if (mpok != null) mpok!!.start()
|
||||
|
@ -1258,7 +1295,7 @@ class CollectionFragmentPreChecker(
|
|||
ticketToParking = tickets[0]
|
||||
ticketScanTxt = txtscan
|
||||
//#tarea4107
|
||||
viewModel.collection_getUncheckedTicket(
|
||||
viewModel.hasUncheckedTicket(
|
||||
collectionFk = tickets[0].toInt()
|
||||
)
|
||||
}
|
||||
|
@ -1485,8 +1522,6 @@ class CollectionFragmentPreChecker(
|
|||
}
|
||||
|
||||
private fun saleTrackingReplace(position: Int, type: String) {
|
||||
|
||||
//Tarea #4371 se quita para ver si funciona correctamente
|
||||
//binding.splashProgress.visibility=VISIBLE
|
||||
viewModel.saleTrackingReplace(
|
||||
saleFk = sales[position].saleFk,
|
||||
|
@ -1535,7 +1570,7 @@ class CollectionFragmentPreChecker(
|
|||
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
|
||||
viewModel.itemShelving_updateFromSale(
|
||||
viewModel.itemShelvingUpdateFromSale(
|
||||
sales[position].saleFk
|
||||
)
|
||||
positionUnmarked = position
|
||||
|
@ -1788,7 +1823,6 @@ class CollectionFragmentPreChecker(
|
|||
) {
|
||||
|
||||
if (quantityPicked < quantityTotal) {
|
||||
|
||||
viewModel.collectionTicketGet(
|
||||
collection.collectionFk,
|
||||
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
|
||||
|
@ -1827,7 +1861,7 @@ class CollectionFragmentPreChecker(
|
|||
if (saleToCheck.itemFk.toString() == valueToCheck)
|
||||
return true
|
||||
else {
|
||||
saleToCheck.Barcodes.forEach { barcode ->
|
||||
saleToCheck.barcodes.forEach { barcode ->
|
||||
if (barcode == valueToCheck)
|
||||
return true
|
||||
}
|
||||
|
@ -2448,7 +2482,7 @@ class CollectionFragmentPreChecker(
|
|||
isPrepared = value[0].isPrepared,
|
||||
isPreviousPrepared = value[0].isPreviousPrepared,
|
||||
isControlled = value[0].isControlled,
|
||||
line3 = value[0].code,
|
||||
line3 = value[0].code ?: "", //6276
|
||||
picked = value[0].picked,
|
||||
ticketFk = value[0].ticketFk,
|
||||
level = value[0].level
|
||||
|
@ -2462,8 +2496,8 @@ class CollectionFragmentPreChecker(
|
|||
|
||||
mySale.line1 = "Previa :${mySale.saleGroupFk}"
|
||||
mySale.line2 = "Líneas: ${value.size}"
|
||||
mySale.line3 = value[0].code
|
||||
mySale.placements = listOf(PlacementVO(shelving = value[0].code))
|
||||
mySale.line3 = value[0].code ?: "" //6276
|
||||
mySale.placements = listOf(PlacementVO(shelving = value[0].code ?: ""))//6276
|
||||
|
||||
myList.add(mySale)
|
||||
} else {
|
||||
|
|
|
@ -12,9 +12,12 @@ import es.verdnatura.domain.formatWithQuotes
|
|||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.common.CollectionItemSalix
|
||||
import es.verdnatura.presentation.common.Event
|
||||
import es.verdnatura.presentation.common.ResponseItemExistsItemShelvingSale
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import es.verdnatura.presentation.common.SaleTrackingReplaceSalix
|
||||
import es.verdnatura.presentation.common.SaleTrackingSalix
|
||||
import es.verdnatura.presentation.common.TicketState
|
||||
import es.verdnatura.presentation.view.feature.collection.ItemVO
|
||||
import es.verdnatura.presentation.view.feature.collection.SalesModifiedList
|
||||
|
@ -27,6 +30,7 @@ import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
|
|||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
||||
import es.verdnatura.presentation.view.feature.workermistake.model.SaleMistakeSalix
|
||||
import es.verdnatura.presentation.view.feature.workermistake.model.SaleTrackingDelSalix
|
||||
import retrofit2.Response
|
||||
|
||||
class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
@ -41,6 +45,10 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
val collectionTicketList: LiveData<CollectionVO>
|
||||
get() = _collectionTicketList
|
||||
|
||||
private val _responseCollectionId by lazy { MutableLiveData<Int>() }
|
||||
val responseCollectionId: LiveData<Int>
|
||||
get() = _responseCollectionId
|
||||
|
||||
private val _responseExistsItemShelvingSale by lazy { MutableLiveData<ResponseItemExistsItemShelvingSale>() }
|
||||
val responseExistsItemShelvingSale: LiveData<ResponseItemExistsItemShelvingSale>
|
||||
get() = _responseExistsItemShelvingSale
|
||||
|
@ -49,6 +57,10 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
val collectionTicketSalix: LiveData<CollectionTicket>
|
||||
get() = _collectionTicketSalix
|
||||
|
||||
private val _getSalesResponse by lazy { MutableLiveData<CollectionVO>() }
|
||||
val getSalesResponse: LiveData<CollectionVO>
|
||||
get() = _getSalesResponse
|
||||
|
||||
val loadCollectionTicketSalix: LiveData<Event<CollectionTicket>> =
|
||||
_collectionTicketSalix.map { Event(it) }
|
||||
|
||||
|
@ -179,31 +191,26 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
val responseGetExtensionFromUserId: LiveData<ResponseItemVO>
|
||||
get() = _responseGetExtensionFromUserId
|
||||
|
||||
|
||||
val loadResponseDel: LiveData<Event<ResponseItemVO>> = _responseDel.map { Event(it) }
|
||||
|
||||
|
||||
val loadResponseSaleTrackingMark: LiveData<Event<ResponseItemVO>> =
|
||||
_responseSaleTracking_mark.map { Event(it) }
|
||||
|
||||
|
||||
val loadResponseItemShelvingUpdate: LiveData<Event<ResponseItemVO>> =
|
||||
_responseItemShelvingUpdate.map { Event(it) }
|
||||
|
||||
fun collectionTicketGet(
|
||||
fun getSales(
|
||||
collectionFk: Int,
|
||||
sectorFk: Int,
|
||||
print: String,
|
||||
type: String
|
||||
source: String
|
||||
|
||||
) {
|
||||
//Tarea 6276 Salix collection_getTickets
|
||||
silex.collection_getTickets(
|
||||
collectionFk,
|
||||
sectorFk,
|
||||
print,
|
||||
type
|
||||
salix.getSalesFromTicketOrCollection(
|
||||
collectionOrTicketFk = collectionFk,
|
||||
print = print != "0",
|
||||
source = source
|
||||
).enqueue(object :
|
||||
SilexCallback<CollectionVO>(context) {
|
||||
SalixCallback<CollectionVO>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_collectionTicketList.value = CollectionVO(
|
||||
0,
|
||||
|
@ -214,8 +221,47 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
|
||||
override fun onSuccess(response: Response<CollectionVO>) {
|
||||
|
||||
if (response.body() != null) {
|
||||
_collectionTicketList.value = response.body()?.let { it.map(contextApp) }
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun collectionTicketGet(
|
||||
collectionFk: Int,
|
||||
sectorFk: Int,
|
||||
print: String,
|
||||
type: String
|
||||
) {
|
||||
if (type == "PRECHECKER" || type == "PREPARED" || type == "CHECKER" || type == "SHOWTICKET") {
|
||||
getSales(collectionFk, print, type)
|
||||
} else {
|
||||
|
||||
silex.collection_getTickets(
|
||||
collectionFk,
|
||||
sectorFk,
|
||||
print,
|
||||
type
|
||||
)
|
||||
|
||||
.enqueue(object :
|
||||
SilexCallback<CollectionVO>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_collectionTicketList.value = CollectionVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
t.message!!
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<CollectionVO>) {
|
||||
|
||||
if (response.body() != null) {
|
||||
_collectionTicketList.value =
|
||||
response.body()?.let { it.map(contextApp) }
|
||||
} else {
|
||||
_collectionTicketList.value = CollectionVO(
|
||||
0,
|
||||
|
@ -229,7 +275,9 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
//Tarea 6276 Salix collection_getTickets
|
||||
fun collectionTicketGetSalix(
|
||||
collectionFk: Int,
|
||||
print: Boolean,
|
||||
|
@ -265,10 +313,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
})
|
||||
}
|
||||
/* _collectionTicketListLocal.value = collectionLocal
|
||||
}*/
|
||||
|
||||
fun collection_get(
|
||||
/* fun collection_get(
|
||||
collectionFk: Int,
|
||||
sectorFk: Int,
|
||||
print: String,
|
||||
|
@ -308,6 +354,44 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
}
|
||||
})
|
||||
}*/
|
||||
|
||||
fun collectionGetId(
|
||||
ticketFk: Int,
|
||||
sectorFk: Int,
|
||||
print: String,
|
||||
type: String
|
||||
) {
|
||||
salix.getCollectionId(
|
||||
filter = """{"where":{"ticketFk":$ticketFk},"fields":"collectionFk"}"""
|
||||
)
|
||||
.enqueue(object :
|
||||
SalixCallback<List<JsonObject>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_collectionTicketList.value = CollectionVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<List<JsonObject>>) {
|
||||
|
||||
if (response.body()!!.isNotEmpty()) {
|
||||
collectionTicketGet(
|
||||
response.body()!![0].entrySet().first().value.toString().toInt(),
|
||||
sectorFk,
|
||||
print,
|
||||
type
|
||||
)
|
||||
} else {
|
||||
_collectionTicketList.value = CollectionVO(
|
||||
0,
|
||||
isError = false
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun itemShelvingSaleExists(
|
||||
|
@ -338,18 +422,20 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
buyFk: Long,
|
||||
isScanned: Boolean?
|
||||
) {
|
||||
//Tarea 6276
|
||||
/* salix.saleTrackingUpdate(SaleTrackingReplaceSalix(
|
||||
saleFk,originalQuantity,code, isChecked != "0",buyFk,isScanned!!
|
||||
))*/
|
||||
silex.saleTrackingReplace(
|
||||
//Tarea 6276 OK
|
||||
salix.saleTrackingUpdate(
|
||||
SaleTrackingReplaceSalix(
|
||||
saleFk, originalQuantity, code, isChecked != "0", buyFk, isScanned!!
|
||||
)
|
||||
)
|
||||
/* silex.saleTrackingReplace(
|
||||
saleFk,
|
||||
originalQuantity,
|
||||
code,
|
||||
isChecked != "0",
|
||||
buyFk,
|
||||
isScanned!!
|
||||
)
|
||||
)*/
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseSaleReplace.value = ResponseItemVO(
|
||||
|
@ -375,17 +461,19 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
isScanned: Boolean?
|
||||
) {
|
||||
//Tarea 6276 flata probar
|
||||
/* salix.saleTrackingMark(
|
||||
SaleTrackingSalix(saleFk,
|
||||
originalQuantity,
|
||||
code,
|
||||
isChecked!="0",
|
||||
buyFk,
|
||||
salix.saleTrackingMark(
|
||||
SaleTrackingSalix(
|
||||
saleFk = saleFk,
|
||||
originalQuantity = originalQuantity,
|
||||
code = code,
|
||||
isChecked = isChecked != "0",
|
||||
buyFk = buyFk,
|
||||
itemShelvingFk = itemShelvingFk,
|
||||
quantity = quantity,
|
||||
isScanned = isScanned)
|
||||
)*/
|
||||
silex.saleTracking_mark(
|
||||
isScanned = isScanned!!
|
||||
)
|
||||
)
|
||||
/* silex.saleTracking_mark(
|
||||
saleFk,
|
||||
originalQuantity,
|
||||
code,
|
||||
|
@ -393,8 +481,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
buyFk,
|
||||
itemShelvingFk,
|
||||
quantity,
|
||||
isScanned
|
||||
).enqueue(object : SilexCallback<Any>(context) {
|
||||
isScanned)*/
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseSaleTracking_mark.value = ResponseItemVO(
|
||||
isError = true,
|
||||
|
@ -671,15 +759,22 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
ticketFk: Int,
|
||||
warehouseFk: Int
|
||||
) {
|
||||
//Tarea 6276
|
||||
//salix.collectionAddItem(CollectionItemSalix(itemFk,quantityFk,ticketFk,warehouseFk))
|
||||
silex.collectionAddItem(
|
||||
itemFk,
|
||||
//Tarea 6276 OK
|
||||
salix.addSaleByCode(
|
||||
CollectionItemSalix(
|
||||
itemFk.toString(),
|
||||
quantityFk,
|
||||
ticketFk,
|
||||
warehouseFk
|
||||
)
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
)
|
||||
/*silex.collectionAddItem(
|
||||
itemFk,
|
||||
quantityFk,
|
||||
ticketFk,
|
||||
warehouseFk
|
||||
)*/
|
||||
.enqueue(object : SalixCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
|
||||
_responseNew.value = ResponseItemVO(
|
||||
|
@ -775,8 +870,13 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
|
||||
fun saleTrackingDel(saleFk: Int) {
|
||||
//Tarea 6276
|
||||
//salix.saleTrackingDel(SaleTrackingDelSalix(saleFk = saleFk, stateCodes = listOf("CHECKED","OK","PREPARED")))
|
||||
silex.saleTrackingDel(saleFk)
|
||||
salix.saleTrackingDel(
|
||||
SaleTrackingDelSalix(
|
||||
saleFk = saleFk,
|
||||
stateCodes = listOf("CHECKED", "OK", "PREPARED")
|
||||
)
|
||||
)
|
||||
//silex.saleTrackingDel(saleFk)
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseDel.value = ResponseItemVO(
|
||||
|
@ -792,12 +892,12 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun itemShelving_updateFromSale(
|
||||
fun itemShelvingUpdateFromSale(
|
||||
saleFk: Int
|
||||
) {
|
||||
//Tarea 6276
|
||||
//salix.itemShelvingUpdateFromSale(hashMapOf("saleFk" to saleFk))
|
||||
silex.itemShelving_updateFromSale(saleFk)
|
||||
//Tarea 6276 OK
|
||||
salix.itemShelvingUpdateFromSale(hashMapOf("saleFk" to saleFk))
|
||||
// silex.itemShelving_updateFromSale(saleFk)
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseItemShelvingUpdate.value = ResponseItemVO(
|
||||
|
@ -1019,7 +1119,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun collection_getUncheckedTicket(
|
||||
/* fun collection_getUncheckedTicket(
|
||||
collectionFk: Int
|
||||
) {
|
||||
silex.collection_getUncheckedTicket(
|
||||
|
@ -1033,6 +1133,42 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<String>) {
|
||||
if (response.body() != null) {
|
||||
|
||||
_responseCollectionUnchecked.value = ResponseItemVO(
|
||||
isError = false,
|
||||
response = response.body()!!,
|
||||
errorMessage = ""
|
||||
)
|
||||
} else {
|
||||
_responseCollectionUnchecked.value = ResponseItemVO(
|
||||
isError = true,
|
||||
response = response.body()!!.toString(),
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
}*/
|
||||
|
||||
fun hasUncheckedTicket(
|
||||
collectionFk: Int
|
||||
) {
|
||||
salix.hasUncheckedTicket(collectionFk)
|
||||
//silex.collection_getUncheckedTicket(collectionFk)
|
||||
.enqueue(object :
|
||||
SalixCallback<String>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseCollectionUnchecked.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<String>) {
|
||||
if (response.body() != null) {
|
||||
|
||||
|
|
|
@ -3,9 +3,7 @@ package es.verdnatura.presentation.view.feature.collection.fragment
|
|||
import android.app.AlertDialog
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.View.GONE
|
||||
import android.view.View.VISIBLE
|
||||
import android.view.inputmethod.EditorInfo
|
||||
|
@ -34,8 +32,7 @@ import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
|||
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
|
||||
|
||||
class CollectionShowTicketFragment(
|
||||
var collection: CollectionVO = CollectionVO(0),
|
||||
var type: String = ""
|
||||
var collection: CollectionVO = CollectionVO(0), var type: String = ""
|
||||
) : BaseFragment<FragmentCollectionBinding, CollectionViewModel>(CollectionViewModel::class) {
|
||||
|
||||
private var sales: List<SaleVO> = listOf()
|
||||
|
@ -62,13 +59,13 @@ class CollectionShowTicketFragment(
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
||||
if (collection.tickets.isEmpty()) {
|
||||
viewModel.collectionTicketGet(
|
||||
if (collection.tickets.isEmpty()) {/* viewModel.collectionTicketGet(
|
||||
collection.collectionFk,
|
||||
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
|
||||
print = "0",
|
||||
type
|
||||
)
|
||||
)*/
|
||||
viewModel.getSales(collection.collectionFk, print = "0", type)
|
||||
}
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -77,7 +74,7 @@ class CollectionShowTicketFragment(
|
|||
override fun init() {
|
||||
customDialog = CustomDialog(requireContext())
|
||||
//84ma.hideBottomNavigation(GONE)
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
binding.splashProgress.visibility = GONE
|
||||
setEvents()
|
||||
setToolBarIcon()
|
||||
binding.mainToolbar.toolbarSubtitle.visibility = VISIBLE
|
||||
|
@ -97,11 +94,8 @@ class CollectionShowTicketFragment(
|
|||
|
||||
iconViewCollection.setImageResource(R.drawable.ic_collection)
|
||||
iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
iconPrint.tooltipText = getTooltip(R.drawable.ic_print_black_24dp)
|
||||
|
||||
}
|
||||
listIcons.add(iconPrint)
|
||||
listIcons.add(iconViewCollection)
|
||||
|
||||
|
@ -121,22 +115,27 @@ class CollectionShowTicketFragment(
|
|||
|
||||
private fun getCollection() {
|
||||
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
//binding.splashProgress.visibility = VISIBLE
|
||||
|
||||
if (!buttonPushedGetCollection) {
|
||||
viewModel.collection_get(
|
||||
//Tarea 3520
|
||||
viewModel.collectionGetId(
|
||||
collection.collectionFk,
|
||||
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
|
||||
print = "0",
|
||||
type
|
||||
)
|
||||
buttonPushedGetCollection = true
|
||||
} else {
|
||||
viewModel.collectionTicketGet(
|
||||
lastScanned,
|
||||
/*viewModel.collection_get(
|
||||
collection.collectionFk,
|
||||
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
|
||||
print = "0",
|
||||
type
|
||||
)*/
|
||||
buttonPushedGetCollection = true
|
||||
} else {
|
||||
//Tarea 6276
|
||||
viewModel.getSales(
|
||||
lastScanned, print = "0", type
|
||||
|
||||
)
|
||||
buttonPushedGetCollection = false
|
||||
|
@ -159,8 +158,7 @@ class CollectionShowTicketFragment(
|
|||
val labelCount = arrayOf("1", "2", "3", "4", "5", "6", "7", "8", "9", "10")
|
||||
builder.setItems(labelCount) { dialog, which ->
|
||||
viewModel.collectionStickerPrint(
|
||||
collectionFk = collection.collectionFk,
|
||||
labelCount = (which + 1)
|
||||
collectionFk = collection.collectionFk, labelCount = (which + 1)
|
||||
)
|
||||
}
|
||||
val dialog = builder.create()
|
||||
|
@ -168,8 +166,7 @@ class CollectionShowTicketFragment(
|
|||
} else {
|
||||
viewModel.collectionStickerPrint(
|
||||
|
||||
collectionFk = collection.collectionFk,
|
||||
labelCount = null
|
||||
collectionFk = collection.collectionFk, labelCount = null
|
||||
)
|
||||
|
||||
}
|
||||
|
@ -187,13 +184,11 @@ class CollectionShowTicketFragment(
|
|||
if (!binding.scanInput.text.toString().isNullOrEmpty()) {
|
||||
|
||||
try {
|
||||
viewModel.collectionTicketGet(
|
||||
binding.scanInput.text.toString().toInt(),
|
||||
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
|
||||
print = "0",
|
||||
type
|
||||
//tarea 6276
|
||||
viewModel.getSales(
|
||||
binding.scanInput.text.toString().toInt(), print = "0", type
|
||||
)
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
//binding.splashProgress.visibility = VISIBLE
|
||||
} catch (ex: Exception) {
|
||||
getString(R.string.scanLabelTicket).toast(requireContext())
|
||||
}
|
||||
|
@ -213,12 +208,10 @@ class CollectionShowTicketFragment(
|
|||
binding.collectionSwipe.setOnRefreshListener {
|
||||
|
||||
binding.collectionSwipe.isRefreshing = false
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
viewModel.collectionTicketGet(
|
||||
collection.collectionFk,
|
||||
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
|
||||
print = "0",
|
||||
type
|
||||
//binding.splashProgress.visibility = VISIBLE
|
||||
//Tarea 6276
|
||||
viewModel.getSales(
|
||||
collection.collectionFk, print = "0", type
|
||||
)
|
||||
binding.collectionSwipe.isRefreshing = false
|
||||
|
||||
|
@ -235,7 +228,7 @@ class CollectionShowTicketFragment(
|
|||
override fun observeViewModel() {
|
||||
with(viewModel) {
|
||||
|
||||
binding.splashProgress.visibility = GONE
|
||||
//binding.splashProgress.visibility = GONE
|
||||
collectionTicketList.observe(viewLifecycleOwner, Observer {
|
||||
|
||||
if (!it.isError) {
|
||||
|
@ -244,7 +237,9 @@ class CollectionShowTicketFragment(
|
|||
createCollectionList()
|
||||
|
||||
} else {
|
||||
binding.mainToolbar.toolbarSubtitle.text = "0/0"
|
||||
getString(R.string.collectionNoTicketsError).toast(requireContext())
|
||||
ma.onMyBackPressed()
|
||||
|
||||
}
|
||||
} else {
|
||||
ma.messageWithSound(it.errorMessage, it.isError, false)
|
||||
|
@ -255,15 +250,16 @@ class CollectionShowTicketFragment(
|
|||
})
|
||||
|
||||
responsePrint.observe(viewLifecycleOwner, Observer {
|
||||
binding.splashProgress.visibility = GONE
|
||||
// binding.splashProgress.visibility = GONE
|
||||
|
||||
if (it.isError) {
|
||||
ma.messageWithSound(
|
||||
it.errorMessage,
|
||||
it.isError, true
|
||||
it.errorMessage, it.isError, true
|
||||
)
|
||||
} else {
|
||||
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(PRINTERNAME)).toast(requireContext())
|
||||
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
||||
PRINTERNAME
|
||||
)).toast(requireContext())
|
||||
}
|
||||
|
||||
})
|
||||
|
@ -273,20 +269,24 @@ class CollectionShowTicketFragment(
|
|||
private fun createCollectionList() {
|
||||
|
||||
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString()
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
var salesList: ArrayList<SaleVO> = ArrayList()
|
||||
//binding.splashProgress.visibility = GONE
|
||||
val salesList: ArrayList<SaleVO> = ArrayList()
|
||||
tickets = ArrayList()
|
||||
var observations = ""
|
||||
collection.tickets.forEach { ticket ->
|
||||
ticket.sales.forEach { saleVO ->
|
||||
if (type == VERTICKET) {
|
||||
salesList.add(saleVO)
|
||||
if (tickets.firstOrNull { it == saleVO.ticketFk }.isNullOrEmpty())
|
||||
tickets.add(saleVO.ticketFk)
|
||||
if (tickets.firstOrNull { it == saleVO.ticketFk }.isNullOrEmpty()) tickets.add(
|
||||
saleVO.ticketFk
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
observations = observations + " " + ticket.observations
|
||||
observations =
|
||||
observations.takeIf { !it.isNullOrBlank() }?.plus(" ${ticket.observations}")
|
||||
?: ""
|
||||
|
||||
}
|
||||
}
|
||||
sales = salesList.sortedWith(compareBy({ it.saleOrder }))
|
||||
|
@ -308,8 +308,7 @@ class CollectionShowTicketFragment(
|
|||
override fun onPackingClick(sale: SaleVO) {
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
binding.fragmentSacadorCollections.adapter = saleAdapter
|
||||
|
@ -333,13 +332,10 @@ class CollectionShowTicketFragment(
|
|||
var totalMark = 0
|
||||
sales.forEach {
|
||||
|
||||
if (it.isControlled == "1")
|
||||
totalMark += 1
|
||||
if (it.isControlled == "1") totalMark += 1
|
||||
}
|
||||
binding.mainToolbar.toolbarTitle.text =
|
||||
collection.collectionFk.toString()
|
||||
binding.mainToolbar.toolbarSubtitle.text =
|
||||
"" + totalMark + "/" + sales.size
|
||||
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString()
|
||||
binding.mainToolbar.toolbarSubtitle.text = "" + totalMark + "/" + sales.size
|
||||
if (totalMark == sales.size) {
|
||||
getString(R.string.Coleccióncompleta).toast(this.context, Toast.LENGTH_SHORT)
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.controlador.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
|
||||
|
@ -27,9 +28,41 @@ class ControladorViewModel(var context: Context) : BaseViewModel(context) {
|
|||
val collectionTicketList: LiveData<CollectionVO>
|
||||
get() = _collectionTicketList
|
||||
|
||||
fun getSales(collectionFk: Int, print: Boolean, source: String) {
|
||||
|
||||
salix.getSalesFromTicketOrCollection(collectionFk, print, source)
|
||||
.enqueue(object :
|
||||
SalixCallback<CollectionVO>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_collectionTicketList.value = CollectionVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<CollectionVO>) {
|
||||
if (response.body() != null) {
|
||||
_collectionTicketList.value = response.body()?.let { it.map(context) }
|
||||
} else {
|
||||
_collectionTicketList.value = CollectionVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun collectionTicketGet(collectionFk: Int, sectorFk: Int, print: String, type: String) {
|
||||
//Tarea 6276 collection_getTickets
|
||||
if (type == "CHECKER") {
|
||||
getSales(collectionFk, false, type)
|
||||
} else {
|
||||
silex.collection_getTickets(collectionFk, sectorFk, print, type).enqueue(object :
|
||||
SilexCallback<CollectionVO>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
|
@ -61,6 +94,6 @@ class ControladorViewModel(var context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package es.verdnatura.presentation.view.feature.historicoshelvinglog.model
|
||||
|
||||
|
||||
class ShelvingLog(
|
||||
var id: String = "",
|
||||
var originFk: String = "",
|
||||
|
@ -11,7 +10,6 @@ class ShelvingLog(
|
|||
var errorMessage: String = ""
|
||||
)
|
||||
|
||||
|
||||
class ShelvingLogList(
|
||||
var list: List<ShelvingLog> = listOf()
|
||||
)
|
||||
|
@ -19,16 +17,22 @@ class ShelvingLogList(
|
|||
class ShelvingLogSalixList(
|
||||
var list: List<ShelvingLogSalix> = listOf()
|
||||
)
|
||||
|
||||
data class ParkingSalix(
|
||||
var id: Int,
|
||||
var pickingOder: Int
|
||||
)
|
||||
|
||||
class ShelvingLogSalix(
|
||||
var id: Int?=null,
|
||||
var code: String?=null,
|
||||
var parkingFk: Int?=null,
|
||||
var isPrinted: Boolean?=null,
|
||||
var priority: Int?=null,
|
||||
var userFk: Int?=null,
|
||||
var isRecyclable: Boolean?=null,
|
||||
var isError:Boolean?=null,
|
||||
var errorMessage: String?=null
|
||||
var id: Int? = null,
|
||||
var code: String? = null,
|
||||
var parkingFk: Int? = null,
|
||||
var isPrinted: Boolean? = null,
|
||||
var priority: Int? = null,
|
||||
var userFk: Int? = null,
|
||||
var isRecyclable: Boolean? = null,
|
||||
var isError: Boolean? = null,
|
||||
var errorMessage: String? = null,
|
||||
)
|
||||
|
||||
data class DeviceLogSalix(
|
||||
|
@ -36,5 +40,5 @@ data class DeviceLogSalix(
|
|||
val userFk: Int,
|
||||
val nameApp: String,
|
||||
val versionApp: String,
|
||||
val serialNumber :String?
|
||||
val serialNumber: String?
|
||||
)
|
|
@ -9,13 +9,11 @@ import androidx.lifecycle.Observer
|
|||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentGeneralBlackBinding
|
||||
import es.verdnatura.domain.ConstAndValues
|
||||
import es.verdnatura.domain.ConstAndValues.SECTORFK
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.OnCollectionSelectedListener
|
||||
import es.verdnatura.presentation.view.feature.sacador.fragment.showticket.ShowTicketViewModel
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
|
||||
|
||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||
class PreControladorFragment :
|
||||
BaseFragment<FragmentGeneralBlackBinding, ShowTicketViewModel>(ShowTicketViewModel::class) {
|
||||
|
@ -66,12 +64,21 @@ class PreControladorFragment :
|
|||
if (!binding.scanInput.text.isNullOrEmpty()) {
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
|
||||
viewModel.collectionTicketGet(
|
||||
sectorFk = mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
|
||||
try {
|
||||
//Tara 6276
|
||||
/*viewModel.getSalesFromTicketOrCollection(
|
||||
collectionFk = binding.scanInput.text.toString().toInt(),
|
||||
print="0",
|
||||
type = type
|
||||
print = false,
|
||||
source = type
|
||||
)*/
|
||||
viewModel.getSales(
|
||||
collectionFk = binding.scanInput.text.toString().toInt(),
|
||||
print = false,
|
||||
source = type
|
||||
)
|
||||
} catch (ex: Exception) {
|
||||
getString(R.string.errorInput)
|
||||
}
|
||||
|
||||
}
|
||||
binding.scanInput.setText("")
|
||||
|
|
|
@ -3,13 +3,8 @@ package es.verdnatura.presentation.view.feature.precontrol
|
|||
import android.content.Context
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import retrofit2.Response
|
||||
|
||||
class PreControladorViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
|
@ -18,7 +13,8 @@ class PreControladorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
get() = _collectionTicketList
|
||||
//Tarea 6276
|
||||
//a salix
|
||||
fun collectionTicketGet(collectionFk: String, sectorFk: String, type: String) {
|
||||
|
||||
/* fun collectionTicketGet(collectionFk: String, sectorFk: String, type: String) {
|
||||
silex.collection_getTickets(collectionFk, sectorFk, "0", type).enqueue(object :
|
||||
SilexCallback<CollectionVO>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
|
@ -44,6 +40,6 @@ class PreControladorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
|
@ -6,7 +6,6 @@ import androidx.lifecycle.MutableLiveData
|
|||
import androidx.lifecycle.map
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.domain.SalixCallback
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
import es.verdnatura.domain.formatWithQuotes
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
|
@ -77,7 +76,8 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
private val _responseSaleGroupAdd by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseSaleGroupAdd: LiveData<ResponseItemVO>
|
||||
get() = _responseSaleGroupAdd
|
||||
val loadResponseSaleGropAdd: LiveData<Event<ResponseItemVO>> = _responseSaleGroupAdd.map { Event(it) }
|
||||
val loadResponseSaleGropAdd: LiveData<Event<ResponseItemVO>> =
|
||||
_responseSaleGroupAdd.map { Event(it) }
|
||||
|
||||
private val _responseSaleAddPrevOK by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseSaleAddPrevOK: LiveData<ResponseItemVO>
|
||||
|
@ -293,15 +293,15 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun sectorCollection_getSale(
|
||||
fun sectorCollectionGetSale(
|
||||
sectorCollectionFK: Int, sectorFk: Int
|
||||
) {
|
||||
//Tarea 6276
|
||||
// salix.sectorCollectionGetSale( sectorFk = sectorFk, sectorCollectionFk = sectorCollectionFK)
|
||||
silex.sectorCollection_getSale(
|
||||
salix.sectorCollectionGetSale(sectorFk = sectorFk, sectorCollectionFk = sectorCollectionFK)
|
||||
/* silex.sectorCollection_getSale(
|
||||
sectorCollectionFK, sectorFk.toString()
|
||||
)
|
||||
.enqueue(object : SilexCallback<List<PreSacadorItemVO>>(context) {
|
||||
)*/
|
||||
.enqueue(object : SalixCallback<List<PreSacadorItemVO>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_salesList.value = listOf()
|
||||
}
|
||||
|
@ -399,11 +399,10 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
saleFk: Int
|
||||
) {
|
||||
//Tarea 6276 pasar a Salix
|
||||
//salix.itemShelvingUpdateFromSale(saleFk). Revisar si ok
|
||||
salix.itemShelvingUpdateFromSale(saleFk)
|
||||
|
||||
silex.itemShelving_updateFromSale(
|
||||
saleFk
|
||||
).enqueue(object : SilexCallback<Any>(context) {
|
||||
// silex.itemShelving_updateFromSale(saleFk)
|
||||
.enqueue(object : SalixCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
|
||||
_responseItemShelvingUpdate.value = ResponseItemVO(
|
||||
|
|
|
@ -3,20 +3,21 @@ package es.verdnatura.presentation.view.feature.sacador.fragment
|
|||
import android.content.Context
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.map
|
||||
import com.google.gson.JsonObject
|
||||
import es.verdnatura.domain.SalixCallback
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.common.Event
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalixList
|
||||
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 retrofit2.Call
|
||||
import retrofit2.Response
|
||||
|
||||
class SacadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
@ -45,7 +46,11 @@ class SacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
val responseNew: LiveData<ResponseItemVO>
|
||||
get() = _responseNew
|
||||
|
||||
fun collectionTicketGet(
|
||||
private val _itemShelvingLogSalixList by lazy { MutableLiveData<ShelvingLogSalixList>() }
|
||||
val loadShelvingLogSalixList: LiveData<Event<ShelvingLogSalixList>> =
|
||||
_itemShelvingLogSalixList.map { Event(it) }
|
||||
|
||||
/* fun collectionTicketGet(
|
||||
collectionFk: Int,
|
||||
sectorFk: String,
|
||||
print: String,
|
||||
|
@ -86,7 +91,7 @@ class SacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}*/
|
||||
|
||||
fun sectorCollectionNew(
|
||||
sectorFk: Int
|
||||
|
@ -131,11 +136,11 @@ class SacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
|
||||
fun collection_assign() {
|
||||
//Tarea 6276
|
||||
//salix.collectionAssign()
|
||||
silex.collection_assign()
|
||||
salix.collectionAssign()
|
||||
// silex.collection_assign()
|
||||
.enqueue(
|
||||
object :
|
||||
SilexCallback<Int>(context) {
|
||||
SalixCallback<Int>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value =
|
||||
ResponseItemVO(
|
||||
|
@ -155,7 +160,7 @@ class SacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
|
||||
fun collection_assignNew() {
|
||||
salix.collectionAssign()
|
||||
salix.collectionAssigned()
|
||||
// silex.collection_assign()
|
||||
.enqueue(
|
||||
object :
|
||||
|
@ -175,7 +180,10 @@ class SacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
if (response.body() != null) {
|
||||
// itemShelvingSale_addByCollection(response.body()!!)
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.body()!!.toString())
|
||||
ResponseItemVO(
|
||||
isError = false,
|
||||
response = response.body()!!.toString()
|
||||
)
|
||||
} else {
|
||||
|
||||
_response.value = ResponseItemVO(
|
||||
|
@ -318,6 +326,23 @@ class SacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun getPickingOrder(parkingCode: String) {
|
||||
salix.getPickingOrder(filter = """{"where":{"code": "$parkingCode"},"fields":"pickingOrder"}""")
|
||||
.enqueue(object :
|
||||
SalixCallback<List<JsonObject>>(context) {
|
||||
override fun onSuccess(response: Response<List<JsonObject>>) {
|
||||
_response.value = ResponseItemVO(
|
||||
response = response.body()?.get(0)!!.entrySet().first().value.toString()
|
||||
)
|
||||
}
|
||||
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value = ResponseItemVO(response = "", isError = true)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun collectionGetSalixLocal() {
|
||||
salix.getCollectionSalixLocal().enqueue(object :
|
||||
SalixCallback<List<CollectionTicket>>(context) {
|
||||
|
|
|
@ -9,7 +9,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentShowTicketBinding
|
||||
import es.verdnatura.domain.ConstAndValues
|
||||
import es.verdnatura.domain.ConstAndValues.SECTORFK
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.OnCollectionSelectedListener
|
||||
import es.verdnatura.presentation.view.feature.sacador.adapter.TicketLastStateAdapter
|
||||
|
@ -82,12 +81,12 @@ class ShowTicketFragment(var menuOrigin: String) :
|
|||
if (!binding.scanInput.text.isNullOrEmpty()) {
|
||||
|
||||
try {
|
||||
//Tarea 6276
|
||||
|
||||
viewModel.collectionTicketGet(
|
||||
sectorFk = mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
|
||||
viewModel.getSales(
|
||||
collectionFk = binding.scanInput.text.toString().toInt(),
|
||||
print = "0",
|
||||
type = type
|
||||
print = false,
|
||||
source= type
|
||||
)
|
||||
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
|
@ -141,8 +140,7 @@ class ShowTicketFragment(var menuOrigin: String) :
|
|||
}
|
||||
|
||||
private fun navigateToCollectionList(collection: CollectionVO) {
|
||||
|
||||
onCollectionSelectedListener?.onCollectionSelected(collection, ConstAndValues.VERTICKET)
|
||||
if (collection.collectionFk != 0) onCollectionSelectedListener?.onCollectionSelected(collection, ConstAndValues.VERTICKET)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import androidx.annotation.RequiresApi
|
|||
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
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
|
@ -24,9 +23,8 @@ class ShowTicketViewModel(val context: Context) : BaseViewModel(context) {
|
|||
private val _lastTicketList by lazy { MutableLiveData<TicketStateList>() }
|
||||
val lastTicketList: LiveData<TicketStateList> = _lastTicketList
|
||||
|
||||
fun collectionTicketGet(collectionFk: Int, sectorFk: Int, print: String, type: String) {
|
||||
//Tarea 6276
|
||||
//salix.collectionGetTickets(collectionFk,sectorFk,print.toInt(),type)
|
||||
/* fun collectionTicketGet(collectionFk: Int, sectorFk: Int, print: String, type: String) {
|
||||
|
||||
silex.collection_getTickets(collectionFk, sectorFk, print, type)
|
||||
.enqueue(object :
|
||||
SilexCallback<CollectionVO>(context) {
|
||||
|
@ -38,6 +36,38 @@ class ShowTicketViewModel(val context: Context) : BaseViewModel(context) {
|
|||
)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<CollectionVO>) {
|
||||
if (response.body() != null) {
|
||||
_collectionTicketList.value = response.body()?.let { it.map(context) }
|
||||
} else {
|
||||
_collectionTicketList.value = CollectionVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
}*/
|
||||
|
||||
//Tarea 6276
|
||||
//salix.collectionGetTickets(collectionFk,sectorFk,print.toInt(),type)
|
||||
fun getSales(collectionFk: Int, print: Boolean, source: String) {
|
||||
|
||||
salix.getSalesFromTicketOrCollection(collectionFk,print,source)
|
||||
.enqueue(object :
|
||||
SalixCallback<CollectionVO>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_collectionTicketList.value = CollectionVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<CollectionVO>) {
|
||||
if (response.body() != null) {
|
||||
_collectionTicketList.value = response.body()?.let { it.map(context) }
|
||||
|
|
|
@ -87,10 +87,19 @@ class CollectionVO(
|
|||
var rgb: String? = null,
|
||||
var ticketTotalCount: Int? = null
|
||||
)
|
||||
|
||||
class TicketVO(
|
||||
class CollectionSalix(
|
||||
var collectionFk: Int,
|
||||
var created: String = "",
|
||||
var tickets: List<TicketVO> = listOf(),
|
||||
var isError: Boolean = false,
|
||||
var errorMessage: String = "",
|
||||
var itemPackingTypeFk: String = "",
|
||||
var rgb: String? = null,
|
||||
var ticketTotalCount: Int? = null
|
||||
)
|
||||
class TicketSalix(
|
||||
var ticketFk: String = "",
|
||||
var level: String = "",
|
||||
var level: String? = "",
|
||||
var rgb: String?,
|
||||
var agencyName: String = "",
|
||||
var salesPersonFk: String = "",
|
||||
|
@ -101,7 +110,71 @@ class TicketVO(
|
|||
|
||||
class SaleVO(
|
||||
var ticketFk: String = "",
|
||||
var level: String = "",
|
||||
var level: String? = "",
|
||||
var rgb: String?,
|
||||
var agencyName: String = "",
|
||||
var saleOrder: Int = 9999,
|
||||
var saleFk: Int,
|
||||
var itemFk: Int = 0,
|
||||
var quantity: Int?,
|
||||
var longName: String = "",
|
||||
var size: String = "",
|
||||
var reserved: String = "",
|
||||
var isPreviousPrepared: String = "",
|
||||
var isPrepared: String = "",
|
||||
var isControlled: String = "",
|
||||
var isPreControlled: String = "",
|
||||
var color: String = "",
|
||||
var productor: String = "",
|
||||
var discount: String = "",
|
||||
var price: String = "",
|
||||
var stems: String = "",
|
||||
var category: String = "",
|
||||
var origin: String = "",
|
||||
var clientFk: String = "",
|
||||
var originalQuantity: Int?,
|
||||
var line1: String = "",
|
||||
var line2: String? = "",
|
||||
var line3: String = "",
|
||||
var isAdded: String = "",
|
||||
var pickedQuantity: Int? = 0,
|
||||
var workerFk: String,
|
||||
var placements: List<PlacementVO> = listOf(),
|
||||
var barcodes: List<String> = listOf(),
|
||||
var isNew: Boolean = false,
|
||||
var salePersonFk: String? = "",
|
||||
var packingType: String? = "",
|
||||
var cel1: String = "",
|
||||
var cel2: String = "",
|
||||
var cel3: String = "",
|
||||
var saleGroupFk: String = "",
|
||||
var picked: String = "",
|
||||
var isParent: Boolean = false,
|
||||
var totalSales: Int = 0,
|
||||
var sonSales: MutableList<SaleVO> = mutableListOf(),
|
||||
var code: String? = "", //6276 nulable
|
||||
var hasMistake: Any? = false, //modificar a Int 6276
|
||||
var sectorFk: Int? = null,
|
||||
var packingChecked:Int = 1
|
||||
|
||||
)
|
||||
class TicketVO(
|
||||
var ticketFk: String = "",
|
||||
var level: String? = "",
|
||||
var rgb: String?,
|
||||
var agencyName: String = "",
|
||||
var salesPersonFk: String = "",
|
||||
var sales: List<SaleVO> = listOf(),
|
||||
var observations: String = "",
|
||||
|
||||
)
|
||||
data class CollectionIdSalix(
|
||||
var id:Int
|
||||
)
|
||||
|
||||
class SaleSalix(
|
||||
var ticketFk: String = "",
|
||||
var level: String? = "",
|
||||
var rgb: String?,
|
||||
var agencyName: String = "",
|
||||
var saleOrder: Int = 9999,
|
||||
|
@ -133,7 +206,7 @@ class SaleVO(
|
|||
var placements: List<PlacementVO> = listOf(),
|
||||
var Barcodes: List<String> = listOf(),
|
||||
var isNew: Boolean = false,
|
||||
var salePersonFk: String = "",
|
||||
var salePersonFk: String? = "",
|
||||
var packingType: String? = "",
|
||||
var cel1: String = "",
|
||||
var cel2: String = "",
|
||||
|
@ -143,8 +216,8 @@ class SaleVO(
|
|||
var isParent: Boolean = false,
|
||||
var totalSales: Int = 0,
|
||||
var sonSales: MutableList<SaleVO> = mutableListOf(),
|
||||
var code: String = "",
|
||||
var hasMistake: Boolean = false,
|
||||
var code: String? = "", //6276 nulable
|
||||
var hasMistake: Any = false, //modificar a Int 6276
|
||||
var sectorFk: Int? = null,
|
||||
var packingChecked:Int = 1
|
||||
|
||||
|
|
Loading…
Reference in New Issue