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