From bfcf7916b451660658c671fc2d46f5170932f739 Mon Sep 17 00:00:00 2001 From: Sergio De la torre Date: Wed, 6 Mar 2024 13:27:33 +0100 Subject: [PATCH] refs #6607 feat:checking_boxes --- .idea/workspace.xml | 55 ++++++++----------- .../feature/collection/adapter/SaleAdapter.kt | 18 +++--- .../collection/fragment/CollectionFragment.kt | 45 ++++++++++++++- .../feature/sacador/model/TicketItemVO.kt | 3 +- .../res/layout/item_article_row_fragment.xml | 15 ++++- 5 files changed, 87 insertions(+), 49 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index c3fb37d6..166ed8f4 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -116,17 +116,13 @@ - + - - - - - + @@ -499,20 +495,6 @@ @@ -888,13 +884,6 @@ - - - - - - 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 10e188db..336f1d72 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 @@ -23,7 +23,6 @@ import es.verdnatura.presentation.common.onPackingClickListener import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO import es.verdnatura.presentation.view.feature.sacador.model.SaleVO - class SaleAdapter( private val items: List, private val onPasillerosItemClickListener: OnPasillerosItemClickListener, @@ -41,7 +40,6 @@ class SaleAdapter( var isExpanded: Boolean = type == "PRECHECKER" - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AjustesItemHolder { this.context = parent.context @@ -118,7 +116,6 @@ class SaleAdapter( } - /*itemRowLayout.setOnLongClickListener{ onMistakeClickListener.onMistakeClickListener(sale) false @@ -129,7 +126,6 @@ class SaleAdapter( false } - //ERROR if (sale.originalQuantity != sale.quantity) { layoutError.visibility = View.VISIBLE @@ -287,7 +283,6 @@ class SaleAdapter( contentLayout.setBackgroundColor(getColor(context!!, R.color.verdnatura_black)) } - //sergio: para de momento que pinten las lineas sin actualizar ni nada if (sale.isControlled == "2") { DrawableCompat.setTint( @@ -335,7 +330,6 @@ class SaleAdapter( imageErrorMessage.visibility = View.INVISIBLE ivArrow.visibility = View.VISIBLE - } else { itemArticleItemFk.visibility = View.VISIBLE //itemPackingText.visibility = View.VISIBLE @@ -377,7 +371,6 @@ class SaleAdapter( itemArticlePlacements.visibility = View.VISIBLE } - /* rvHeadlines.adapter=SaleAdapter(sale.sonSales,onPasillerosItemClickListener,onQuantityClick,onSaleClickListener,onMistakeClickListener,onPackingClick) rvHeadlines.visibility=View.VISIBLE rvHeadlines.layoutManager = LinearLayoutManager(context)}*/ @@ -397,6 +390,13 @@ class SaleAdapter( // isExpanded=!isExpanded } + //Tarea 6607 + itemArticleCel2Count.visibility = View.GONE + /*itemArticleCel2Count.visibility = if (type == CONTROLADOR) { + View.VISIBLE + } else { + View.GONE + }*/ //ASIGNAMOS VALOR A LA VSITA this.sale = sale @@ -405,7 +405,6 @@ class SaleAdapter( } } - private fun paintTicketcolor(color: String?, itemView: View) { if (color.isNullOrBlank()) { @@ -418,7 +417,6 @@ class SaleAdapter( private fun paintTicketcolorOld(color: String, itemView: View) { - when (color.uppercase().trim()) { "ROJO" -> itemView.setBackgroundColor(Color.RED) @@ -460,7 +458,6 @@ class SaleAdapter( "CIAN" -> itemView.setBackgroundColor(0xFF00ffff.toInt()) - "BEIGE" -> itemView.setBackgroundColor(0xFFf2e7bf.toInt()) else -> { @@ -471,6 +468,5 @@ class SaleAdapter( } // itemTicketColor.setBackgroundResource((R.drawable.rectangle)) - } } \ No newline at end of file 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 c46a53e3..459b5808 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 @@ -140,7 +140,7 @@ class CollectionFragment( ) //tarea 6458 - viewModel.ticketState(collection.collectionFk) + viewModel.ticketState(collection.collectionFk) workerFkFromTicket = collection.tickets.get(0).sales.get(0).workerFk } @@ -967,6 +967,13 @@ class CollectionFragment( tickets.add(saleVO.ticketFk) } else if (type == CONTROLADOR) { salesList.add(saleVO) + //Tarea 6607 + /* if (saleVO.cel2.contains("pack de")) { + saleVO.packingChecked = + saleVO.cel2.substringBefore("pack de").trim().toInt() + } else { + saleVO.packingChecked = 1 + }*/ if (tickets.firstOrNull { it == saleVO.ticketFk }.isNullOrEmpty()) tickets.add(saleVO.ticketFk) } else if (type == PRECHECKER) { @@ -1202,7 +1209,13 @@ class CollectionFragment( if (txtscan == saleVO.itemFk.toString()) { if (mpok != null) mpok!!.start() isOk = true + //Tarea 6067 + // if (saleVO.packingChecked == 1) { markLine(index, type) + // } else { + // saleVO.packingChecked = saleVO.packingChecked - 1 + //} + //saleAdapter!!.notifyDataSetChanged() break } //2- Por barcode @@ -1211,7 +1224,13 @@ class CollectionFragment( if (txtscan == barcode) { if (mpok != null) mpok!!.start() isOk = true + //Tarea 6067 + //if (saleVO.packingChecked == 1) { markLine(index, type) + //} else { + // saleVO.packingChecked = saleVO.packingChecked - 1 + //} + saleAdapter!!.notifyDataSetChanged() isBreak = true } } @@ -1341,7 +1360,24 @@ class CollectionFragment( } checkStateParent() } else if (type == CONTROLADOR) { + //tarea 6067 + //if (sales[position].packingChecked == 1) { sales[position].isControlled = if (sales[position].isControlled == "1") "0" else "1" + //tarea 6067 + /*if (sales[position].isControlled=="0"){ + + if (sales[position].cel2.contains("pack de")){ + sales[position].packingChecked = sales[position].cel2.substringBefore("pack de").trim().toInt()} + }*/ + + saleAdapter!!.notifyDataSetChanged() + saleTrackingReplace(position, newType) + setListPosition(position, false) + /* } else { + sales[position].packingChecked = sales[position].packingChecked - 1 + saleAdapter!!.notifyDataSetChanged() + }*/ + //En primera instancia coge el primer elemento hijo para realizar la copia y segĂșn se va interactuando con las sales ya se actualiza el // estado del padre checkStateParent() @@ -1352,6 +1388,9 @@ class CollectionFragment( sales[position].isPreControlled = if (sales[position].isPreControlled == "1") "0" else "1" checkStateParent() + saleAdapter!!.notifyDataSetChanged() + saleTrackingReplace(position, newType) + setListPosition(position, false) } @@ -1362,11 +1401,11 @@ class CollectionFragment( if (type == SACADOR) { saleTracking_mark(position, newType) //saleTrackingReplace(position,newType) - } else { + } /*else { saleAdapter!!.notifyDataSetChanged() saleTrackingReplace(position, newType) setListPosition(position, false) - } + }*/ isMarking = true setTotalLines() } 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 26096341..946c0c09 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 @@ -145,7 +145,8 @@ class SaleVO( var sonSales: MutableList = mutableListOf(), var code: String = "", var hasMistake: Boolean = false, - var sectorFk: Int? = null + var sectorFk: Int? = null, + var packingChecked:Int = 1 ) diff --git a/app/src/main/res/layout/item_article_row_fragment.xml b/app/src/main/res/layout/item_article_row_fragment.xml index 15ec5091..de516757 100644 --- a/app/src/main/res/layout/item_article_row_fragment.xml +++ b/app/src/main/res/layout/item_article_row_fragment.xml @@ -249,7 +249,6 @@ app:layout_constraintTop_toTopOf="parent" tool:text="10" /> - + +