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