diff --git a/.idea/misc.xml b/.idea/misc.xml
index 63d3027a..97b3f254 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -276,7 +276,7 @@
-
+
diff --git a/.idea/modules/app/Gestor_Almacén.app.iml b/.idea/modules/app/Gestor_Almacén.app.iml
index 2acb6145..027b5be9 100644
--- a/.idea/modules/app/Gestor_Almacén.app.iml
+++ b/.idea/modules/app/Gestor_Almacén.app.iml
@@ -14,9 +14,6 @@
-
+
+
+
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index d7d7c014..111cf5d4 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -83,12 +83,19 @@
-
+
+
+
+
-
+
+
+
+
+
@@ -99,7 +106,7 @@
-
+
@@ -237,12 +244,14 @@
"keyToString": {
"ApkExportedModule": "Gestor_Almacén.app",
"ExportApk.ApkPathForGestor_Almacén.app": "C:\\Users\\sergiodt\\AndroidStudioProjects\\vn-warehouseManager\\app",
+ "PROJECT_TRUSTED_KEY": "true",
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.cidr.known.project.marker": "true",
+ "ScreenRecorder.SavePath": "C:\\Users\\sergiodt\\device-2023-03-17-114045.mp4",
"cidr.known.project.marker": "true",
"com.google.services.firebase.aqiPopupShown": "true",
- "last_opened_file_path": "C:/Users/sergiodt/proyectos/Rocket.Chat.ReactNative/android/app",
+ "last_opened_file_path": "C:/Users/sergiodt",
"project.structure.last.edited": "Modules",
"project.structure.proportion": "0.17",
"project.structure.side.proportion": "0.2",
@@ -396,62 +405,6 @@
1618825571576
-
- 1653663791334
-
-
-
- 1653663791335
-
-
- 1654145430078
-
-
-
- 1654145430079
-
-
- 1654670479261
-
-
-
- 1654670479262
-
-
- 1654772518409
-
-
-
- 1654772518410
-
-
- 1654781827179
-
-
-
- 1654781827179
-
-
- 1655369652090
-
-
-
- 1655369652090
-
-
- 1655960861634
-
-
-
- 1655960861634
-
-
- 1656322885999
-
-
-
- 1656322886000
-
1656930096719
@@ -739,7 +692,63 @@
1676562624751
-
+
+ 1679050268326
+
+
+
+ 1679050268327
+
+
+ 1679050285819
+
+
+
+ 1679050285819
+
+
+ 1679050359974
+
+
+
+ 1679050359974
+
+
+ 1679305084809
+
+
+
+ 1679305084810
+
+
+ 1679378828592
+
+
+
+ 1679378828593
+
+
+ 1679389139208
+
+
+
+ 1679389139208
+
+
+ 1679389189173
+
+
+
+ 1679389189174
+
+
+ 1679389331215
+
+
+
+ 1679389331215
+
+
@@ -781,7 +790,7 @@
-
+
@@ -840,12 +849,6 @@
-
-
-
-
-
-
@@ -865,23 +868,15 @@
-
+
+
+
+
+
+
+
-
-
-
- file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoFragment.kt
- 362
-
-
-
- file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoViewModel.kt
- 123
-
-
-
-
diff --git a/app/build.gradle b/app/build.gradle
index ec77a5e7..f50adca1 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -40,7 +40,6 @@ android {
}
}
-
buildFeatures {
viewBinding = true
}
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 73e40adf..0bdc07d6 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
@@ -25,12 +25,20 @@ class SaleAdapter(
private val onSaleClickListener: OnSaleClickListener,
private val onMistakeClickListener: OnMistakeClickListener,
private val onPackingClick: onPackingClickListener,
+ private var onTicketClick: OnTicketClickListener? = null,
+ private var SaleAdapter: SaleAdapter? = null,
- ) : RecyclerView.Adapter() {
+
+) : RecyclerView.Adapter() {
var context: Context? = null
var position: Int = 0
+
+ var isExpanded: Boolean = false
+
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AjustesItemHolder {
this.context = parent.context
+
+
return AjustesItemHolder(
ItemArticleRowFragmentBinding.inflate(
@@ -59,6 +67,9 @@ class SaleAdapter(
val childLayoutManager =
LinearLayoutManager(context!!, RecyclerView.HORIZONTAL, false)
+ val childLayoutManagerV =
+ LinearLayoutManager(context!!, RecyclerView.VERTICAL, false)
+
itemArticlePlacements.apply {
layoutManager = childLayoutManager
adapter = PlacementAdapter(sale.placements, onPasillerosItemClickListener)
@@ -66,7 +77,9 @@ class SaleAdapter(
//CLICK EVENTS
contentLayout.setOnClickListener {
- onSaleClickListener.onSaleClick(sale)
+ if (!sale.isParent) {
+ onSaleClickListener.onSaleClick(sale)
+ }
}
itemArticleItemFk.setOnClickListener {
@@ -92,22 +105,24 @@ class SaleAdapter(
txtde.setOnClickListener {
onQuantityClick.onQuantityClick(sale)
}
+ ticketFk.setOnClickListener {
+
+ if (onTicketClick != null) {
+ onTicketClick!!.onTicketClickListener(sale)
+ }
- contentLayout.setOnLongClickListener {
- //"Nueva funcionalidad en el icono de la derecha".toast(context!!)
- //onMistakeClickListener.onMistakeClickListener(sale)
- false
}
+
/*itemRowLayout.setOnLongClickListener{
onMistakeClickListener.onMistakeClickListener(sale)
false
}*/
- //Tarea #5004
- /* if (sale.hasMistake){
- imageErrorMessage.setBackgroundColor(color.RED)
- }*/
+ //Tarea #5004
+ /* if (sale.hasMistake){
+ imageErrorMessage.setBackgroundColor(color.RED)
+ }*/
imageErrorMessage.setOnClickListener {
onMistakeClickListener.onMistakeClickListener(sale)
@@ -127,7 +142,7 @@ class SaleAdapter(
sale.pickedQuantity = sale.quantity
}
}
- // d("VERDNATURA::","La quantity de ${sale.saleFk} es ${sale.pickedQuantity} y está ${sale.isPrepared}")
+ // d("VERDNATURA::","La quantity de ${sale.saleFk} es ${sale.pickedQuantity} y está ${sale.isPrepared}")
if (sale.isNew) {
layoutError.visibility = View.VISIBLE
@@ -294,6 +309,88 @@ class SaleAdapter(
)
)
}
+ if (isExpanded) {
+ itemArticlePlacements.visibility = View.VISIBLE
+ ivArrow.setImageResource(R.drawable.ic_arrow_down)
+
+ } else {
+ itemArticlePlacements.visibility = View.GONE
+ ivArrow.setImageResource(R.drawable.ic_arrow_up)
+ }
+
+ itemArticlePlacements.visibility = if (isExpanded) View.VISIBLE else {
+ View.GONE
+ }
+
+ if (sale.isParent) {
+ itemArticleItemFk.visibility = View.INVISIBLE
+ itemPackingText.visibility = View.INVISIBLE
+ itemPackingItemFk.visibility = View.INVISIBLE
+ itemArticleCel1.visibility = View.INVISIBLE
+ itemArticleCel2.visibility = View.INVISIBLE
+ itemArticleCel3.visibility = View.INVISIBLE
+ itemArticleQuantity.visibility = View.INVISIBLE
+ txtdeNew.visibility = View.INVISIBLE
+ itemArticleQuantityPicked.visibility = View.INVISIBLE
+ itemArticleQuantityLine3.visibility = View.VISIBLE
+ imageErrorMessage.visibility = View.INVISIBLE
+ ivArrow.visibility = View.VISIBLE
+
+
+ } else {
+ itemArticleItemFk.visibility = View.VISIBLE
+ itemPackingText.visibility = View.VISIBLE
+ itemPackingItemFk.visibility = View.VISIBLE
+ itemArticleCel1.visibility = View.VISIBLE
+ itemArticleCel2.visibility = View.VISIBLE
+ itemArticleCel3.visibility = View.VISIBLE
+ itemArticleQuantity.visibility = View.VISIBLE
+ txtdeNew.visibility = View.VISIBLE
+ itemArticleQuantityPicked.visibility = View.VISIBLE
+ itemArticleQuantityLine3.visibility = View.VISIBLE
+ imageErrorMessage.visibility = View.VISIBLE
+ ivArrow.visibility = View.INVISIBLE
+ }
+
+ if (!sale.sonSales.isNullOrEmpty()) {
+ itemArticlePlacements.apply {
+ layoutManager = childLayoutManagerV
+ adapter = SaleAdapter(
+ sale.sonSales,
+ onPasillerosItemClickListener,
+ onQuantityClick,
+ onSaleClickListener,
+ onMistakeClickListener,
+ onPackingClick
+ )
+ }
+
+ } else {
+ //revisar porque incosistencia
+ itemArticlePlacements.visibility = View.VISIBLE
+ }
+
+
+ /* rvHeadlines.adapter=SaleAdapter(sale.sonSales,onPasillerosItemClickListener,onQuantityClick,onSaleClickListener,onMistakeClickListener,onPackingClick)
+ rvHeadlines.visibility=View.VISIBLE
+ rvHeadlines.layoutManager = LinearLayoutManager(context)}*/
+
+ ivArrow.setOnClickListener {
+ d("VERDNATURA::", "click on line1 PADRE")
+ //Revisar lunes
+
+ if (isExpanded!!) {
+ ivArrow.setImageResource(R.drawable.ic_arrow_up)
+ itemArticlePlacements.visibility = View.GONE
+ } else {
+
+ ivArrow.setImageResource(R.drawable.ic_arrow_down)
+ itemArticlePlacements.visibility = View.VISIBLE
+ }
+ isExpanded = !isExpanded
+
+ // isExpanded=!isExpanded
+ }
//ASIGNAMOS VALOR A LA VSITA
@@ -303,50 +400,7 @@ class SaleAdapter(
}
}
- /* private fun paintTicketcolorOld(color: String, itemView: View) {
- when (color.uppercase()) {
- "ROJO" -> itemView.setBackgroundColor(Color.RED)
- "AMARILLO" -> itemView.setBackgroundColor(Color.YELLOW)
- "VERDE" -> itemView.setBackgroundColor(Color.GREEN)
- "AZUL" -> itemView.setBackgroundColor(Color.BLUE)
- "BLANCO" -> {
- itemView.setBackgroundColor(Color.WHITE)
- itemView.setBackgroundResource((R.drawable.border))
- }
- "NEGRO" -> {
- itemView.setBackgroundColor(Color.BLACK)
- }
- "VIOLETA" -> itemView.setBackgroundColor(0xFF4c2882.toInt())
- "GRIS" -> itemView.setBackgroundColor(Color.GRAY)
- "ORANGE" -> itemView.setBackgroundColor(
- getColor(
- context!!,
- android.R.color.holo_orange_light
- )
- )
- "MORADO" -> itemView.setBackgroundColor(
- getColor(
- context!!,
- android.R.color.holo_purple
- )
- )
- "CELESTE" -> itemView.setBackgroundColor(0xFF5b85F5.toInt())
- "ROSA" -> itemView.setBackgroundColor(0xFFfc0fc0.toInt())
- "DORADO" -> itemView.setBackgroundColor(0xFFb8860b.toInt())
- "MARRON" -> itemView.setBackgroundColor(0xFF663300.toInt())
- "PERLA" -> itemView.setBackgroundColor(0xFFcdcecf.toInt())
- "MARFIL" -> itemView.setBackgroundColor(0xFFf7eada.toInt())
- "CIAN" -> itemView.setBackgroundColor(0xFF00ffff.toInt())
- "BEIGE" -> itemView.setBackgroundColor(0xFFf2e7bf.toInt())
- "transparente" -> itemView.setBackgroundColor(0xFFf2e7bf.toInt())
- else -> {
- itemView.setBackgroundColor(Color.TRANSPARENT)
- itemView.setBackgroundResource(R.drawable.background_item_color)
-
- }
- }
- }*/
private fun paintTicketcolor(color: String?, itemView: View) {
if (color.isNullOrBlank()) {
@@ -363,12 +417,6 @@ class SaleAdapter(
when (color.uppercase().trim()) {
"ROJO" ->
itemView.setBackgroundColor(Color.RED)
- /*if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
- itemView.background.colorFilter =
- BlendModeColorFilter(Color.RED, BlendMode.SRC_ATOP)
- } else {
- itemView.background.setColorFilter(Color.RED, PorterDuff.Mode.SRC_ATOP)
- }*/
"AMARILLO" ->
itemView.setBackgroundColor(Color.YELLOW)
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 6f4dd3f4..9b2a24b6 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
@@ -10,12 +10,14 @@ import android.os.Build
import android.os.Bundle
import android.os.Parcelable
import android.text.InputType
+import android.text.InputType.TYPE_CLASS_TEXT
import android.util.Log.d
import android.view.KeyEvent
import android.view.KeyEvent.ACTION_DOWN
import android.view.View
import android.view.View.GONE
import android.view.View.VISIBLE
+import android.view.WindowManager
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
import android.widget.ImageView
@@ -24,12 +26,14 @@ import androidx.annotation.RequiresApi
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
+import com.google.gson.Gson
import es.verdnatura.R
import es.verdnatura.databinding.FragmentCollectionBinding
import es.verdnatura.domain.ConstAndValues.CONTROLADOR
import es.verdnatura.domain.ConstAndValues.OK
import es.verdnatura.domain.ConstAndValues.PRECHECKER
import es.verdnatura.domain.ConstAndValues.SACADOR
+import es.verdnatura.domain.notNull
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.*
@@ -54,6 +58,7 @@ class CollectionFragment(
private lateinit var dataMessageSalix: DataMessageSalix
private var sales: List = listOf()
+ private var salesParent: List = listOf()
private var saleAdapter: SaleAdapter? = null
private var lm: LinearLayoutManager? = null
private var storedPosition: Int = 0
@@ -103,6 +108,8 @@ class CollectionFragment(
private var recylerViewState: Parcelable? = null
private var isScanned: Boolean? = null
+ private lateinit var myGroupList: List
+
companion object {
fun newInstance(collection: CollectionVO, type: String) =
CollectionFragment(collection, type)
@@ -122,12 +129,10 @@ class CollectionFragment(
if (type.equals(CONTROLADOR)) {
//sergio: comprueba si viene de la pantalla de controlador
//Tarea #4280 cambiar a ticket_isOutClosureZone
- /* viewModel.ticket_checkFullyControlled(
- getData(USER),
- getData(PASSWORD),
- collection.collectionFk
+ /* viewModel.ticket_isOutClosureZone(
+ collection.collectionFk
- )*/
+ )*/
workerFkFromTicket = collection.tickets.get(0).sales.get(0).workerFk
}
@@ -348,7 +353,19 @@ class CollectionFragment(
//sergio:para ver si ha marcado dos veces el mismo ticket
binding.scanInput.setText(textScanned_filterDouble(binding.scanInput.text!!.toString()))
- findSale(binding.scanInput.text.toString())
+ //de momento solo está el qr de artículo
+ isScanned =
+ event != null && event.action == ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
+ var myItem = try {
+ itemScanValue(
+ binding.scanInput.text.toString(),
+ "buy",
+ "more"
+ ).toString()
+ } catch (ex: Exception) {
+ binding.scanInput.text.toString()
+ }
+
buttonPushedGetCollection = false
}
@@ -628,20 +645,20 @@ class CollectionFragment(
})*/
//Tarea 4280
- /* responseTicketClosure.observe(viewLifecycleOwner, Observer {
- binding.splashProgress.visibility = GONE
- if (!goBack) {
+ responseTicketClosure.observe(viewLifecycleOwner, Observer {
+ binding.splashProgress.visibility = GONE
+ if (!goBack) {
if (it.response.toBoolean()) {
- var customDialogWarning = CustomDialog(requireContext())
- customDialogWarning.setTitle(getString(R.string.urgentWarning))
- customDialogWarning.setDescription(getString(R.string.ticketWarning))
- .setOkButton(getString(R.string.aware)) {
- customDialogWarning.dismiss()
- }.show()
- }
- }
+ var customDialogWarning = CustomDialog(requireContext())
+ customDialogWarning.setTitle(getString(R.string.urgentWarning))
+ customDialogWarning.setDescription(getString(R.string.ticketWarning))
+ .setOkButton(getString(R.string.aware)) {
+ customDialogWarning.dismiss()
+ }.show()
+ }
+ }
- })*/
+ })
responseIncQuantity.observe(viewLifecycleOwner, Observer {
@@ -755,50 +772,88 @@ class CollectionFragment(
//goBack = false
}
})
- responseDel.observe(viewLifecycleOwner, Observer {
- if (it.isError) {
- binding.splashProgress.visibility = GONE
- if (!goBack) {
+ loadResponseDel.observe(viewLifecycleOwner) { event ->
+ event.getContentIfNotHandled().notNull {
+ binding.splashProgress.visibility = View.INVISIBLE
+ if (it.isError) {
+ binding.splashProgress.visibility = GONE
+ if (!goBack) {
+ ma.messageWithSound(it.errorMessage, it.isError, false)
+
+ }
+ } else {
+
+ viewModel.collectionTicketGet(
+ collection.collectionFk,
+ getDataInt(SECTORFK),
+ print = "0",
+ type
+ )
+
+ goBack = false
+ }
+ }
+ }
+
+
+ /* responseDel.observe(viewLifecycleOwner, Observer {
+
+ if (it.isError) {
+ binding.splashProgress.visibility = GONE
+ if (!goBack) {
+
+ ma.messageWithSound(it.errorMessage, it.isError, false)
+
+ }
+ } else {
+
+ viewModel.collectionTicketGet(
+ collection.collectionFk,
+ getDataInt(SECTORFK),
+ print = "0",
+ type
+ )
+
+ goBack = false
+ }
+
+ })*/
+
+ loadResponseItemShelvingUpdate.observe(viewLifecycleOwner) { event ->
+ event.getContentIfNotHandled().notNull {
+ if (it.isError) {
ma.messageWithSound(it.errorMessage, it.isError, false)
+ } else {
+ viewModel.saleTrackingDel(
+ saleFk = sales[positionUnmarked].saleFk
+ )
}
- } else {
-
- viewModel.collectionTicketGet(
- collection.collectionFk,
- getDataInt(SECTORFK),
- print = "0",
- type
- )
-
- goBack = false
}
+ }
- })
+ /* responseItemShelvingUpdate.observe(viewLifecycleOwner, Observer {
+
+ if (it.isError) {
+
+ if (!goBack) {
+
+ ma.messageWithSound(it.errorMessage, it.isError, false)
+
+ }
-
- responseItemShelvingUpdate.observe(viewLifecycleOwner, Observer {
-
- if (it.isError) {
-
- if (!goBack) {
-
- ma.messageWithSound(it.errorMessage, it.isError, false)
-
+ } else {
+ //Test volver atrás
+ if (!goBack){
+ viewModel.saleTrackingDel(
+ saleFk = sales[positionUnmarked].saleFk
+ )}
+ goBack = false
}
-
-
- } else {
- viewModel.saleTrackingDel(
- saleFk = sales[positionUnmarked].saleFk
- )
-
- goBack = false
- }
- })
+ })*/
responseSaleReplace.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = GONE
@@ -823,14 +878,51 @@ class CollectionFragment(
goBack = false
}
})
+
+
+
+ loadResponseSaleTrackingMark.observe(viewLifecycleOwner) { event ->
+ event.getContentIfNotHandled().notNull {
+ binding.splashProgress.visibility = GONE
+ if (it.isError) {
+ //TEST3
+ /* if (getDataInt(USERFK) == 18890 || getDataInt(USERFK) == 19591) {
+ "La línea NO se ha marcado correctamente".toast(context)
+ }*/
+
+ if (!goBack) {
+ ma.messageWithSound(it.errorMessage, it.isError, true)
+ binding.splashProgress.visibility = VISIBLE
+ viewModel.collectionTicketGet(
+ collection.collectionFk,
+ getDataInt(SECTORFK),
+ print = "0",
+ type
+ )
+ }
+
+ } else {
+ // pintar línea
+
+ saleAdapter!!.notifyDataSetChanged()
+
+ ReviewQuantityForRefreshingAndSorting(
+ sales[storedPosition].quantity!!.toInt(),
+ sales[storedPosition].pickedQuantity!!.toInt()
+ )
+ goBack = false
+ }
+
+ }
+ }
////Tarea #4371
- responseSaleTracking_mark.observe(viewLifecycleOwner, Observer {
- binding.splashProgress.visibility = GONE
- if (it.isError) {
- //TEST3
- /* if (getDataInt(USERFK) == 18890 || getDataInt(USERFK) == 19591) {
+ /* responseSaleTracking_mark.observe(viewLifecycleOwner, Observer {
+ binding.splashProgress.visibility = GONE
+ if (it.isError) {
+ //TEST3
+ *//* if (getDataInt(USERFK) == 18890 || getDataInt(USERFK) == 19591) {
"La línea NO se ha marcado correctamente".toast(context)
- }*/
+ }*//*
if (!goBack) {
ma.messageWithSound(it.errorMessage, it.isError, true)
@@ -850,14 +942,14 @@ class CollectionFragment(
"La línea se ha marcado correctamente".toast(context)
}
saleAdapter!!.notifyDataSetChanged()
- setListPosition(storedPosition, false)
+
ReviewQuantityForRefreshingAndSorting(
sales[storedPosition].quantity!!.toInt(),
sales[storedPosition].pickedQuantity!!.toInt()
)
goBack = false
}
- })
+ })*/
responseItemShelvingSaleSupplyAdd.observe(viewLifecycleOwner, Observer {
@@ -993,92 +1085,119 @@ class CollectionFragment(
sales = salesList.sortedWith(compareBy({ it.saleOrder }))
- /* for (s in sales) {
- d("VERDNATURA::", "El id es " + s.saleFk + " tiene saleOrder" + s.saleOrder)
- }*/
+ myGroupList = groupSaleGroup(salesList).sortedWith(compareBy({ it.saleOrder }))
if (type == CONTROLADOR) {
sales = salesList.sortedWith(compareBy({ it.picked }))
+ myGroupList = groupSaleGroup(salesList).sortedWith(compareBy({ it.picked }))
}
-
saleAdapter =
- SaleAdapter(sales, pasillerosItemClickListener!!, object : OnQuantityClickListener {
+ SaleAdapter(
+ myGroupList,
+ pasillerosItemClickListener!!,
+ object : OnQuantityClickListener {
- override fun onQuantityClick(sale: SaleVO) {
+ override fun onQuantityClick(sale: SaleVO) {
- sales.forEachIndexed { index, saleVO ->
- if (saleVO.saleFk == sale.saleFk) {
- if (type != "PRECHECKER") {
- showQuantityDialog(index)
- }
-
- }
- }
-
- }
- }, object : OnSaleClickListener {
- override fun onSaleClick(sale: SaleVO) {
-
- sales.forEachIndexed { index, saleVO ->
- if (saleVO.saleFk == sale.saleFk) {
-
- if (type == CONTROLADOR || type == PRECHECKER) {// sergio:cuidado , esta es de lo último para marcar colores
- markLine(index, type)
- /// Log.i("VERDNATURA:","marcamos linea")
- } else if (type == SACADOR) {
-
- if (sale.isPrepared == "0" || sale.isPrepared.isNullOrEmpty()) {
- showScanner(index, sale)
- } else {
- unMarkLine(index, OK)
+ sales.forEachIndexed { index, saleVO ->
+ if (saleVO.saleFk == sale.saleFk) {
+ if (type != "PRECHECKER") {
+ showQuantityDialog(index)
}
}
}
}
- }
+ },
+ object : OnSaleClickListener {
+ override fun onSaleClick(sale: SaleVO) {
- }, object : OnMistakeClickListener {
- override fun onMistakeClickListener(sale: SaleVO) {
- //Tarea #4969
- binding.splashProgress.visibility = VISIBLE
- viewModel.mistakeType()
- mistakeSale = sale
- goMistakeBack = false
+ sales.forEachIndexed { index, saleVO ->
+ if (saleVO.saleFk == sale.saleFk) {
- }
- }, object : onPackingClickListener {
- override fun onPackingClick(sale: SaleVO) {
- item_updatePackingShelve(sale.itemFk)
- }
- }
+ if (type == CONTROLADOR || type == PRECHECKER) {// sergio:cuidado , esta es de lo último para marcar colores
+ isScanned = false
+ markLine(index, type)
+ /// Log.i("VERDNATURA:","marcamos linea")
+ } else if (type == SACADOR) {
+
+ if (sale.isPrepared == "0" || sale.isPrepared.isNullOrEmpty()) {
+ showScanner(index, sale)
+ } else {
+ unMarkLine(index, OK)
+ }
+
+ }
+ }
+
+ }
+ }
+
+ },
+ object : OnMistakeClickListener {
+ override fun onMistakeClickListener(sale: SaleVO) {
+ //Tarea #4969
+ binding.splashProgress.visibility = VISIBLE
+ viewModel.mistakeType()
+ mistakeSale = sale
+ goMistakeBack = false
+
+ }
+ },
+ object : onPackingClickListener {
+ override fun onPackingClick(sale: SaleVO) {
+ item_updatePackingShelve(sale.itemFk)
+ }
+ },
+ object : OnTicketClickListener {
+ override fun onTicketClickListener(sale: SaleVO) {
+ if (type == CONTROLADOR) {
+ //var ticketFk = sale.ticketFk
+
+ var entryPoint = Gson().toJson(
+ mutableMapOf(
+ "entryPoint" to sale.ticketFk,
+ "web" to "https://salix.verdnatura.es/#!/ticket/${sale.ticketFk}/sale"
+ )
+ )
+ ma.onPasillerosItemClickListener(
+ PasillerosItemVO(
+ title = getString(R.string.titleWebViewer),
+ ), entryPoint = entryPoint
+ )
+ }
+ }
+ },
)
+
+
+
lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
+
+
binding.fragmentSacadorCollections.adapter = saleAdapter
+
binding.fragmentSacadorCollections.layoutManager = lm
setTotalLines()
//Tarea #4628
if (type == CONTROLADOR) {
setListPosition(storedBackPosition, true)
setScrollListener(lm!!)
- } else {
- if (storedPosition != 0)
- setListPosition(storedPosition, true)
- else if (storedBackPosition != 0)
- setListPosition(storedBackPosition, true)
-
}
//CAU ISMAELCT
- if (type == SACADOR) {
- for (indice in sales.indices) {
- if (sales[indice].isPrepared == "0") {
- setListPosition(position = indice, isFromBack = true)
- break
- }
+ else {
+
+ if (type == SACADOR) {
+ setStoredPosition(true)
+ } else {
+ if (storedPosition != 0)
+ setListPosition(storedPosition, true)
+ else if (storedBackPosition != 0)
+ setListPosition(storedBackPosition, true)
}
}
@@ -1203,6 +1322,7 @@ class CollectionFragment(
}
//2- Por barcode
saleVO.Barcodes.forEach { barcode ->
+
if (txtscan == barcode) {
if (mpok != null) mpok!!.start()
isOk = true
@@ -1256,12 +1376,10 @@ class CollectionFragment(
if (type.equals(CONTROLADOR)) {
//Tarea #4280 cambiar a ticket_isOutClosureZone
- /* viewModel.ticket_checkFullyControlled(
- getData(USER),
- getData(PASSWORD),
- txtscan
+ /* viewModel.ticket_isOutClosureZone(
+ txtscan.toInt()
- )*/
+ )*/
}
}
@@ -1335,15 +1453,22 @@ class CollectionFragment(
if (sales[position].isPrepared == "1") {
sales[position].pickedQuantity = sales[position].quantity!!
}
-
- } else if (type == CONTROLADOR)
+ checkStateParent()
+ } else if (type == CONTROLADOR) {
sales[position].isControlled = if (sales[position].isControlled == "1") "0" else "1"
+ //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()
+
+ }
if (type == PRECHECKER) {
sales[position].isPreControlled =
if (sales[position].isPreControlled == "1") "0" else "1"
+ checkStateParent()
}
+
//Tarea #4371 se quita y se deja en el response de viewmodel saleTracking_mark
//saleAdapter!!.notifyDataSetChanged()
//setListPosition(position, false)
@@ -1360,6 +1485,41 @@ class CollectionFragment(
setTotalLines()
}
+ private fun checkStateParent() {
+ for (s in myGroupList) {
+ if (s.isParent) {
+ var totalLines = s.sonSales.size
+ var isPreviousPrepared = s.sonSales.filter { it.isPreviousPrepared == "1" }.size
+ var isPrepared = s.sonSales.filter { it.isPrepared == "1" }.size
+ var isControlled = s.sonSales.filter { it.isControlled == "1" }.size
+ var isPreControlled = s.sonSales.filter { it.isPreControlled == "1" }.size
+ if (totalLines == isPreviousPrepared) {
+ s.isPreviousPrepared = "1"
+ } else {
+ s.isPreviousPrepared = "0"
+ }
+ if (totalLines == isPrepared) {
+ s.isPrepared = "1"
+ } else {
+ s.isPrepared = "0"
+ }
+ if (totalLines == isControlled) {
+ s.isControlled = "1"
+ } else {
+ s.isControlled = "0"
+ }
+ if (totalLines == isPreControlled) {
+ s.isPreControlled = "1"
+ } else {
+ s.isPreControlled = "0"
+ }
+
+
+ }
+ }
+
+ }
+
private fun setListPosition(position: Int, isFromBack: Boolean) {
storedPosition = position
//tarea #4628, se asigna storedBackPosition
@@ -1375,6 +1535,7 @@ class CollectionFragment(
binding.fragmentSacadorCollections.addViewObserver {
lm!!.scrollToPositionWithOffset(position, 0)
}
+
}
} else if (isFromBack) {
@@ -1386,6 +1547,7 @@ class CollectionFragment(
}
}
+
}
private fun saleTrackingReplace(position: Int, type: String) {
@@ -1397,7 +1559,8 @@ class CollectionFragment(
vIsChecked = if (type == SACADOR) sales[position].isPrepared else if (type == CONTROLADOR) sales[position].isControlled else if (type == "PRECHECKER") sales[position].isPreControlled else "1",
vOriginalQuantity = sales[position].pickedQuantity!!,
vStateFk = if (type == CONTROLADOR) "CHECKED" else if (type == "PRECHECKER") "PREVIOUS_CONTROL" else type,//type.toString(),
- vBuyFk = originalItemScan!!
+ vBuyFk = originalItemScan!!,
+ vIsScanned = isScanned
)
@@ -1408,17 +1571,19 @@ class CollectionFragment(
private fun saleTracking_mark(position: Int, type: String) {
binding.splashProgress.visibility = VISIBLE
- viewModel.saleTracking_mark(
- saleFk = sales[position].saleFk,
- vIsChecked = if (type == SACADOR) sales[position].isPrepared else if (type == CONTROLADOR) sales[position].isControlled else if (type == "PRECHECKER") sales[position].isPreControlled else "1",
- vOriginalQuantity = sales[position].pickedQuantity!!,
- vStateFk = if (type == CONTROLADOR) "CHECKED" else if (type == "PRECHECKER") "PREVIOUS_CONTROL" else type,//type.toString(),
- vBuyFk = originalItemScan!!,
- vItemShelvingFk = itemShelvingTracking_mark,
- vQuantity = customDialogList.getValue().toInt(),
- vIsScanned = isScanned
+ viewModel.run {
+ saleTracking_mark(
+ saleFk = sales[position].saleFk,
+ vIsChecked = if (type == SACADOR) sales[position].isPrepared else if (type == CONTROLADOR) sales[position].isControlled else if (type == "PRECHECKER") sales[position].isPreControlled else "1",
+ vOriginalQuantity = sales[position].pickedQuantity!!,
+ vStateFk = if (type == CONTROLADOR) "CHECKED" else if (type == "PRECHECKER") "PREVIOUS_CONTROL" else type,//type.toString(),
+ vBuyFk = originalItemScan!!,
+ vItemShelvingFk = itemShelvingTracking_mark,
+ vQuantity = customDialogList.getValue().toInt(),
+ vIsScanned = isScanned
- )
+ )
+ }
isScanned = null
}
@@ -1437,6 +1602,7 @@ class CollectionFragment(
binding.splashProgress.visibility = VISIBLE
+
viewModel.itemShelving_updateFromSale(
sales[position].saleFk
)
@@ -1604,7 +1770,7 @@ class CollectionFragment(
} catch (e: Exception) {
}
try {
- customDialogList.getEditTextTwo().setRawInputType(InputType.TYPE_CLASS_NUMBER)
+ customDialogList.getEditTextTwo().setRawInputType(InputType.TYPE_CLASS_NUMBER)
customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
@@ -1722,10 +1888,29 @@ class CollectionFragment(
type
)
+ } else {
+ setStoredPosition(false)
+
}
}
+ private fun setStoredPosition(isFromBack: Boolean) {
+ if (type == SACADOR) {
+ for (indice in myGroupList.indices) {
+ if (myGroupList[indice].isPrepared == "0") {
+ storedPosition = if (indice != 0) {
+ indice - 1
+ } else {
+ indice
+ }
+ break
+ }
+ }
+ }
+ setListPosition(storedPosition, isFromBack)
+ }
+
private fun checkItemScan(valueToCheck: String): Boolean {
d("VERDNATURA::", "Entramos a ver el checkItem")
@@ -1834,10 +2019,12 @@ class CollectionFragment(
if (listPlacementSupply.size == 1) {
ticketSelected = listPlacementSupply[0].code!!.toInt()
}
+ customDialogList.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
customDialogList.getEditTextTwo().inputType = InputType.TYPE_CLASS_NUMBER
- customDialogList.getEditText().inputType = InputType.TYPE_CLASS_NUMBER
+ customDialogList.getEditText().setRawInputType(InputType.TYPE_CLASS_NUMBER)
customDialogList.setTitle(getString(R.string.Agregarartículoparaticket) + " " + ticketSelected)
.setOkButton(getString(R.string.Agregar)) {
+
if (ticketSelected == 0) {
getString(R.string.Seleccionaunticketdelaista).toast(requireContext())
} else if (customDialogList.getValue()
@@ -1874,21 +2061,36 @@ class CollectionFragment(
customDialogList.dismiss()
}.setHintValue(getString(R.string.Artículo)).setValue("")
.setHintValueTwo(getString(R.string.Cantidad)).setValueTwo("").show()
-
customDialogList.getEditText().requestFocus()
hideKeyboards()
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!customDialogList.getValue().isNullOrEmpty()) {
+ try {
+ customDialogList.setValue(
+ itemScanValue(
+ customDialogList.getValue(),
+ "buy",
+ "more"
+ ).toString()
+ )
+
+ } catch (e: Exception) {
+ ma.messageWithSound(e.message.toString(), true, true)
+ }
customDialogList.getEditTextTwo().requestFocus()
}
- hideKeyboards()
+ //hideKeyboards()
return@setOnEditorActionListener true
+
+
}
false
+
}
+
customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!customDialogList.getValueTwo().isNullOrEmpty()) {
@@ -1941,6 +2143,7 @@ class CollectionFragment(
customDialogList.getRecyclerView().layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
+
}
/* private fun showDisponibility() {
@@ -2021,7 +2224,7 @@ class CollectionFragment(
totalMark += 1
}
} else if (type == CONTROLADOR) {
- if (it.isControlled == "1" || it.isControlled == "2")
+ if ((it.isControlled == "1" || it.isControlled == "2") && !it.isParent)
totalMark += 1
}//Refactor #4030
@@ -2035,11 +2238,18 @@ class CollectionFragment(
if (binding.mainToolbar.toolbarTitle != null) binding.mainToolbar.toolbarTitle.text =
if (collection.collectionFk != 0) collection.collectionFk.toString() else ""
+
+ var total = sales.size
+ var totalParents = sales.filter { it.isParent }.size
+ total = total - totalParents
+
if (binding.mainToolbar.toolbarSubtitle != null && totalMark != null) binding.mainToolbar.toolbarSubtitle.text =
- "" + totalMark + "/" + sales.size
+ "" + totalMark + "/" + total
if (totalMark == sales.size) {
getString(R.string.Coleccióncompleta).toast(this.context, Toast.LENGTH_SHORT)
+ saleAdapter!!.notifyDataSetChanged()
+
if (!goBack)
ticketCollection_setUsedShelves()
goBack = false
@@ -2448,6 +2658,7 @@ class CollectionFragment(
//OTROS
private fun showScanner(index: Int, sale: SaleVO) {
+ customDialogInput.getEditText().inputType = TYPE_CLASS_TEXT
customDialogInput.setTitle("" + sale.itemFk)
.setDescription(getString(R.string.scanWagonForItem))
.setOkButton(getString(R.string.accept)) {
@@ -2575,6 +2786,62 @@ class CollectionFragment(
}
+ private fun groupSaleGroup(salesList: ArrayList): MutableList {
+ var myMap = salesList.groupBy { it.saleGroupFk }
+ var myList: MutableList = mutableListOf()
+
+ for ((key, value) in myMap.entries) {
+ if (key.isNullOrEmpty()) { // si no tiene saleGroup se añaden las líneas
+ for (s in value) {
+ myList.add(s)
+ }
+ } else { // si tiene saleGroup se crea el padre con el tamaño e indicando que es padre, como ejemplo se toma el primer elemento
+
+ /*crea padre*/
+ if (value.size > 1) {
+ var mySale = SaleVO(
+ saleOrder = value[0].saleOrder,
+ workerFk = value[0].workerFk,
+ originalQuantity = null,
+ quantity = null,
+ rgb = null,
+ saleFk = value[0].saleFk,
+ saleGroupFk = value[0].saleGroupFk,
+ isPreControlled = value[0].isPreControlled,
+ isPrepared = value[0].isPrepared,
+ isPreviousPrepared = value[0].isPreviousPrepared,
+ isControlled = value[0].isControlled,
+ line3 = value[0].code,
+ picked = value[0].picked,
+ ticketFk = value[0].ticketFk,
+ level = value[0].level
+
+ )//prime elemento//hay que hacer una copia si no queda la referencia
+ mySale.totalSales = value.size //total líneas
+ mySale.isParent = true
+ value as MutableList
+ mySale.sonSales = value as MutableList
+
+ mySale.line1 = "Previa :${mySale.saleGroupFk}"
+ mySale.line2 = "Líneas: ${value.size}"
+ mySale.line3 = value[0].code
+ mySale.placements = listOf(PlacementVO(shelving = value[0].code))
+
+ myList.add(mySale)
+ } else {
+ for (s in value) {
+ myList.add(s)
+ }
+ }
+
+
+ }
+
+ }
+
+ return myList
+ }
+
}
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 a1ef21d2..eaa298f9 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
@@ -3,10 +3,12 @@ package es.verdnatura.presentation.view.feature.collection.fragment
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.Transformations
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.*
import es.verdnatura.presentation.view.feature.collection.mapper.map
@@ -143,6 +145,12 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
get() = _responseGetExtensionFromUserId
+ val loadResponseDel = Transformations.map(_responseDel) { Event(it) }
+ val loadResponseSaleTrackingMark=Transformations.map(_responseSaleTracking_mark) { Event(it) }
+ val loadResponseItemShelvingUpdate=Transformations.map(_responseItemShelvingUpdate) { Event(it) }
+
+
+
fun collectionTicketGet(
collectionFk: Int,
sectorFk: Int,
@@ -226,14 +234,16 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
vOriginalQuantity: Int,
vStateFk: String,
vIsChecked: String,
- vBuyFk: Int
+ vBuyFk: Int,
+ vIsScanned:Boolean?
) {
silex.saleTrackingReplace(
saleFk,
vOriginalQuantity,
vStateFk,
vIsChecked != "0",
- vBuyFk
+ vBuyFk,
+ vIsScanned!!
).enqueue(object : SilexCallback(context) {
override fun onError(t: Throwable) {
_responseSaleReplace.value = ResponseItemVO(
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/mapper/CollectionMapper.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/mapper/CollectionMapper.kt
index 9c86e92a..7dbb2343 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/mapper/CollectionMapper.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/mapper/CollectionMapper.kt
@@ -21,6 +21,9 @@ fun CollectionVO.map(context: Context): CollectionVO {
it.agencyName = ticket.agencyName
it.isNew = it.isAdded == "1"
+ //tarea 4723
+ it.code= it.cel3
+
// sergio: OBLIGAR A ACTUALIZAR VERSIÓN PARA SUBIR DESPUÉS FICHEROS DEL BACK collection_getTickets al mismo tiempo")
//it.quantity = it.quantity.substring(0, it.quantity.indexOf("."))
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt
index c2ab132e..c246f232 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt
@@ -120,7 +120,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
)
//Tarea 5095
- /* _pasillerositem.add(
+ /* _pasillerositem.add(
PasillerosItemVO(
1,
R.drawable.ic_shopping_self,
diff --git a/app/src/main/res/drawable/ic_arrow_down.xml b/app/src/main/res/drawable/ic_arrow_down.xml
new file mode 100644
index 00000000..ad33063c
--- /dev/null
+++ b/app/src/main/res/drawable/ic_arrow_down.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_arrow_up.xml b/app/src/main/res/drawable/ic_arrow_up.xml
new file mode 100644
index 00000000..57387ee4
--- /dev/null
+++ b/app/src/main/res/drawable/ic_arrow_up.xml
@@ -0,0 +1,9 @@
+
+
+
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 d462a6bd..e35c9fa5 100644
--- a/app/src/main/res/layout/item_article_row_fragment.xml
+++ b/app/src/main/res/layout/item_article_row_fragment.xml
@@ -32,9 +32,15 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
-
-
>
+
+ >
-
+
+
+