diff --git a/.idea/misc.xml b/.idea/misc.xml index 44e00da1..10071818 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -104,6 +104,7 @@ + @@ -187,6 +188,7 @@ + @@ -202,6 +204,7 @@ + diff --git a/app/build.gradle b/app/build.gradle index 294d8a7a..1c203312 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,10 +11,11 @@ android { defaultConfig { applicationId "es.verdnatura" - minSdkVersion 21 + minSdkVersion 26 //21 targetSdkVersion 30 - versionCode 122 - versionName = "8.5.1Beta" + versionCode 123 + versionName = "8.5.2Beta" + //versionName = "8.5.1Beta" versionCode 122 //versionName = "8.5Beta" //versionCode 121 //versionName = "8.4"// versionCode 120 //versionName "8.4.2Beta" versioncode 119 diff --git a/app/release/app-release.apk b/app/release/app-release.apk deleted file mode 100644 index 09fb1017..00000000 Binary files a/app/release/app-release.apk and /dev/null differ diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json index 89310fad..13477fd1 100644 --- a/app/release/output-metadata.json +++ b/app/release/output-metadata.json @@ -11,8 +11,8 @@ "type": "SINGLE", "filters": [], "attributes": [], - "versionCode": 122, - "versionName": "8.5.1Beta", + "versionCode": 123, + "versionName": "8.5.2Beta", "outputFile": "app-release.apk" } ], diff --git a/app/release/vn-pickingBeta.apk b/app/release/vn-pickingBeta.apk new file mode 100644 index 00000000..3d543efb Binary files /dev/null and b/app/release/vn-pickingBeta.apk differ diff --git a/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt index b37cc395..31e6c64f 100644 --- a/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt @@ -1,6 +1,7 @@ package es.verdnatura.domain import android.content.Context +import es.verdnatura.presentation.view.feature.reubication.model.Reubication import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO import retrofit2.Call @@ -167,6 +168,26 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) { ) } + fun itemShelving_return( + usuario: String, + password: String, + shelvingFk: String + + ): Call> { + val params: ArrayList = ArrayList() + params.add(shelvingFk) + + return restClient!!.itemShelving_return( + "json", + "1", + usuario, + password, + "application/json", + params + ) + } + + fun clearShelvingList(usuario: String, password: String, shelvingFk: String): Call { val params: ArrayList = ArrayList() params.add(shelvingFk) @@ -198,7 +219,24 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) { params ) } - + fun itemShelving_merge( + usuario: String, + password: String, + vShelf: String, + vShelvingFk: String, + ): Call { + val params: ArrayList = ArrayList() + params.add(vShelf) + params.add(vShelvingFk) + return restClient!!.itemShelving_merge( + "json", + "1", + usuario, + password, + "application/json", + params + ) + } fun itemShelvingDelete(usuario: String, password: String, itemFk: String): Call { val params: ArrayList = ArrayList() params.add(itemFk) diff --git a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt index 4b6d6422..56b4e942 100644 --- a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt +++ b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt @@ -22,6 +22,7 @@ import es.verdnatura.presentation.view.feature.login.model.LoginDevice import es.verdnatura.presentation.view.feature.login.model.versionApp import es.verdnatura.presentation.view.feature.paletizador.model.* import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO +import es.verdnatura.presentation.view.feature.reubication.model.Reubication 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.PlacementSupplyVO @@ -1024,6 +1025,18 @@ interface VerdnaturaService { ): Call + @POST("almacennew/itemShelving_return") + fun itemShelving_return( + @Header("aplicacion") aplicacion: String, + @Header("version") version: String, + @Header("user") user: String, + @Header("pass") pass: String, + @Header("Content-Type") content_type: String, + @Body params: List + ): + Call> + + @POST("almacennew/clearShelvingList")//REVISADA fun clearShelvingList( @Header("aplicacion") aplicacion: String, @@ -1046,6 +1059,17 @@ interface VerdnaturaService { ): Call + @POST("almacennew/itemShelving_merge")//REVISADA + fun itemShelving_merge( + @Header("aplicacion") aplicacion: String, + @Header("version") version: String, + @Header("user") user: String, + @Header("pass") pass: String, + @Header("Content-Type") content_type: String, + @Body params: List + ): + Call + @POST("almacennew/itemShelvingDelete")//REVISADA fun itemShelvingDelete( @Header("aplicacion") aplicacion: String, diff --git a/app/src/main/java/es/verdnatura/presentation/common/UICallbacks.kt b/app/src/main/java/es/verdnatura/presentation/common/UICallbacks.kt index 2b6f48d4..1b03cde3 100644 --- a/app/src/main/java/es/verdnatura/presentation/common/UICallbacks.kt +++ b/app/src/main/java/es/verdnatura/presentation/common/UICallbacks.kt @@ -12,6 +12,7 @@ import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionS import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO +import es.verdnatura.presentation.view.feature.reubication.model.Reubication import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO import es.verdnatura.presentation.view.feature.sacador.model.SaleVO import es.verdnatura.presentation.view.feature.smarttag.model.SmartTag @@ -127,6 +128,10 @@ interface OnSaleClickListener { fun onSaleClick(sale: SaleVO) } +interface OnReubicationClickListener { + fun onReubicationClick(reubication: Reubication) +} + interface OnMistakeClickListener { fun onMistakeClickListener(sale: SaleVO) } 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 ac72811c..7e5bc16b 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 @@ -126,7 +126,7 @@ class SaleAdapter( } paintTicketcolor(sale.level, itemTicketColor) - paintTicketcolor(sale.color, itemColor) + //paintTicketcolor(sale.color, itemColor) if (!sale.isNew && sale.originalQuantity == sale.quantity) { 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 3d8c1fdf..fbf58451 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 @@ -9,6 +9,7 @@ import android.net.Uri import android.os.Build import android.os.Bundle import android.speech.SpeechRecognizer +import android.util.Log import android.view.View import android.view.View.GONE import android.view.View.VISIBLE @@ -63,6 +64,7 @@ class CollectionFragment( private lateinit var customDialog: CustomDialog private var goBack: Boolean = false private var goBack2: Boolean = false + private var goMistakeBack:Boolean=false var mperror: MediaPlayer? = null var mpok: MediaPlayer? = null private var itemShelvingFkStored: String = "" @@ -109,7 +111,7 @@ class CollectionFragment( mperror = MediaPlayer.create((activity as MainActivity), R.raw.error) mpok = MediaPlayer.create((activity as MainActivity), R.raw.ok) - + Log.d("VERDNATURA::","El type es "+type) if ((collection.collectionFk != null) && type.equals(CONTROLADOR)) { @@ -134,12 +136,12 @@ class CollectionFragment( ) } - //sergio:falta subir - // get_salesModifiedFromTicket() + super.onCreate(savedInstanceState) } override fun onResume() { + super.onResume() scanRequest() } @@ -167,6 +169,8 @@ class CollectionFragment( super.onPause() goBack = true goBack2 = true + goMistakeBack = true + } private fun setToolBar() { @@ -245,6 +249,7 @@ class CollectionFragment( /* var working_in_test = true // sergio: en proves app if (working_in_test) {*/ + goMistakeBack=false viewModel.sip_getExtensionSalix(getData(TOKEN), workerFkFromTicket) /* } else { viewModel.sip_getExtension( @@ -594,28 +599,29 @@ class CollectionFragment( binding.splashProgress.visibility = GONE if (it.isError) { - if (!goBack) + if (!goMistakeBack) ma.messageWithSound( getString(R.string.noSIP) + it.errorMessage + getString(R.string.user) + workerFkFromTicket, isError = true, true ) - goBack = false - } else { - if (!goBack) - callPicker(it.response) - goBack = false - } + } else { + if (!goMistakeBack) + callPicker(it.response) + + } + goMistakeBack=true }) mistakeList.observe(viewLifecycleOwner, Observer { if (binding.splashProgress != null) binding.splashProgress.visibility = GONE /*sergio:se quita y se pone esta comprobacion porque si no aparece de nuevo otra vez al volver atrás */ - if (!goBack) + + if (!goMistakeBack) showMistakeList(it.list) - goBack = false + goMistakeBack=true }) //sergio: para si hay algun ticket por revisar responsecheckfully.observe(viewLifecycleOwner, Observer { @@ -807,19 +813,18 @@ class CollectionFragment( salesList.add(saleVO) if (tickets.firstOrNull { it == saleVO.ticketFk }.isNullOrEmpty()) tickets.add(saleVO.ticketFk) - //Refactor #4030// - } else if (type == CONTROLADOR || type == PRECHECKER) { + } else if (type == CONTROLADOR) { salesList.add(saleVO) if (tickets.firstOrNull { it == saleVO.ticketFk }.isNullOrEmpty()) tickets.add(saleVO.ticketFk) }//Refactor #4030// - /*else if (type==PRECHECKER){ + else if (type==PRECHECKER){ if (saleVO.saleGroupFk!=""){ salesList.add(saleVO) if (tickets.firstOrNull { it == saleVO.ticketFk }.isNullOrEmpty()) tickets.add(saleVO.ticketFk) } - }*/ + } } observations = observations + " " + ticket.observations @@ -884,6 +889,7 @@ class CollectionFragment( if (binding.splashProgress != null) binding.splashProgress.visibility = View.VISIBLE mistakeSale = sale + goMistakeBack=false viewModel.mistakeType( usuario = getData(USER), getData(PASSWORD) @@ -943,6 +949,7 @@ class CollectionFragment( goBack = false goBack2 = false + if (type == SACADOR) { for (saleVO in sales) { //sergio: pita si encuentra ticket o el saleGroupFk @@ -1811,15 +1818,15 @@ class CollectionFragment( } else if (it.quantity == "0") { totalMark += 1 } - } else if (type == CONTROLADOR || type == PRECHECKER) { + } else if (type == CONTROLADOR ) { if (it.isControlled == "1" || it.isControlled == "2") totalMark += 1 - }/*//Refactor #4030 - else if(type==PRECHECKER){//Refactor #4030 + }//Refactor #4030 + else if(type==PRECHECKER){ if (it.isPreControlled == "1"){totalMark += 1} - }*/ + } } if (binding.mainToolbar.toolbarTitle != null) binding.mainToolbar.toolbarTitle.text = @@ -2365,17 +2372,16 @@ class CollectionFragment( } ////Refactor #4030 - }/*else if (type==PRECHECKER){ + } else if (type == PRECHECKER) { tickets.forEach { viewModel.ticket_setState( usuario = getData(USER), password = getData(PASSWORD), ticketFk = it, - state = "PREVIOUS_CONTROLLED", - callFunction = "ticket_setState" + state = "PREVIOUS_CONTROLLED" ) + } } - }*/ } /* private fun changeInitTicketState() { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/controlador/fragment/WebFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/controlador/fragment/WebFragment.kt index 8a851432..b750cdcc 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/controlador/fragment/WebFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/controlador/fragment/WebFragment.kt @@ -1,11 +1,23 @@ package es.verdnatura.presentation.view.feature.controlador.fragment +import android.content.Context +import android.graphics.drawable.Drawable +import android.os.Build +import android.print.PrintAttributes +import android.print.PrintManager import android.webkit.WebChromeClient +import android.webkit.WebView +import android.widget.ImageView +import androidx.recyclerview.widget.LinearLayoutManager import es.verdnatura.R import es.verdnatura.databinding.FragmentWebBinding +import es.verdnatura.domain.ConstAndValues import es.verdnatura.presentation.base.BaseFragment +import es.verdnatura.presentation.common.OnOptionsSelectedListener +import es.verdnatura.presentation.common.ToolBarAdapterTooltip import es.verdnatura.presentation.view.component.CustomDialog +import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO class WebFragment( @@ -59,10 +71,60 @@ class WebFragment( binding.mainToolbar.toolbarTitle.text = getString(R.string.item)+entryPoint // binding.splashProgress.visibility= View.GONE + + val listIcons: ArrayList = ArrayList() + val iconPrint = ImageView(context) + iconPrint.setImageResource(R.drawable.ic_print_black_24dp) + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + + iconPrint.tooltipText = getTooltip(R.drawable.ic_print_black_24dp) + + } + + //listIcons.add(iconPrint) + + + binding.mainToolbar.toolbarIcons.adapter = + ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener { + override fun onOptionsItemSelected(item: Drawable) { + + when (item) { + iconPrint.drawable -> createWebPrintJob(binding.webView) + } + + } + }) + binding.mainToolbar.toolbarIcons.layoutManager = + LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) + + } + private fun createWebPrintJob(webView: WebView) { + // Get a PrintManager instance + (activity?.getSystemService(Context.PRINT_SERVICE) as? PrintManager)?.let { printManager -> + + val jobName = "${getString(R.string.app_name)} Document" + + // Get a print adapter instance + val printAdapter = webView.createPrintDocumentAdapter(jobName) + + // Create a print job with name and adapter instance + printManager.print( + jobName, + printAdapter, + PrintAttributes.Builder().build() + ).also { printJob -> + + // Save the job object for later status checking + // printJobs += printJob + } + } + } + } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt index 3100e04d..79ae6e7a 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt @@ -50,9 +50,11 @@ import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO import es.verdnatura.presentation.view.feature.precontrol.PreControladorFragment import es.verdnatura.presentation.view.feature.presacador.fragment.EndSacadorFragment import es.verdnatura.presentation.view.feature.presacador.fragment.InitPreSacadorFragment -import es.verdnatura.presentation.view.feature.presacador.fragment.PreSacadorFragment import es.verdnatura.presentation.view.feature.qr.QrFragment import es.verdnatura.presentation.view.feature.reposicion.fragment.ReposicionFragment +import es.verdnatura.presentation.view.feature.reubication.fragment.ReubicationCollectionFragment +import es.verdnatura.presentation.view.feature.reubication.fragment.ReubicationFragment +import es.verdnatura.presentation.view.feature.reubication.model.Reubication import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorFragment import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO import es.verdnatura.presentation.view.feature.shelvingparking.fragment.ShelvingParkingFragment @@ -499,7 +501,9 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL addFragmentOnTop(ClaimFragment.newInstance(item.title)) } - + getString(R.string.titleReUbicator) -> { + addFragmentOnTop(ReubicationFragment.newInstance(item.title)) + } } } @@ -630,6 +634,12 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL } + fun openFragmentReubications(list: List,shelving:String) { + + addFragmentOnTop(ReubicationCollectionFragment.newInstance(list,shelving)) + + } + fun hideBottomNavigation(visible: Int) { binding.mainBottomNavigation.visibility = visible } 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 7b3b6557..006de9ce 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 @@ -119,6 +119,19 @@ class PasilleroViewModel(context: Context) : BaseViewModel() { ) ) + //Tarea #3754 --> Falta arreglar la colección que se le pasa a ReubicationCollectionFragment y diseño más visual + /* _pasillerositem.add( + PasillerosItemVO( + 1, + R.drawable.ic_reubication, + contextApp.getString(R.string.titleReUbicator), + R.string.titleReUbicator, + contextApp.getString( + R.string.titleReubicatorDescrip + ) + ) + )*/ + _pasillerositem.add( PasillerosItemVO( 3, diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt index 07b85fbf..bda82cbb 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt @@ -5,6 +5,7 @@ import android.graphics.drawable.Drawable import android.media.MediaPlayer import android.os.Build import android.os.Bundle +import android.util.Log import android.view.View import android.view.View.GONE import android.view.View.VISIBLE @@ -107,7 +108,6 @@ class EndSacadorFragment( binding.mainToolbar.toolbarTitle.text = getString(R.string.getticketpre) setToolBar() setEvents() - searchSaleCollection() super.init() } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/reubication/adapter/ReubicatorAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/reubication/adapter/ReubicatorAdapter.kt new file mode 100644 index 00000000..4ff54b69 --- /dev/null +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/reubication/adapter/ReubicatorAdapter.kt @@ -0,0 +1,454 @@ +package es.verdnatura.presentation.view.feature.reubication.adapter + + import android.content.Context + import android.graphics.BlendMode + import android.graphics.BlendModeColorFilter + import android.graphics.Color + import android.graphics.PorterDuff + import android.os.Build + import android.view.LayoutInflater + import android.view.View + import android.view.ViewGroup + import androidx.core.content.ContextCompat.getColor + import androidx.recyclerview.widget.LinearLayoutManager + import androidx.recyclerview.widget.RecyclerView + import es.verdnatura.R + import es.verdnatura.databinding.ItemArticleRowFragmentBinding + import es.verdnatura.databinding.ItemArticleRowReubicationFragmentBinding + import es.verdnatura.presentation.common.* + import es.verdnatura.presentation.view.feature.collection.adapter.PlacementAdapter + import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO + import es.verdnatura.presentation.view.feature.reubication.model.Reubication + import es.verdnatura.presentation.view.feature.sacador.model.SaleVO + + +class ReubicatorAdapter( + private val items: List, + private val onPasillerosItemClickListener: OnPasillerosItemClickListener, + private val onReubicationClickListener: OnReubicationClickListener + /*private val onQuantityClick: OnQuantityClickListener, + private val onSaleClickListener: OnSaleClickListener, + private val onMistakeClickListener: OnMistakeClickListener, + private val onPackingClick: onPackingClickListener,*/ + ) : RecyclerView.Adapter() { + var context: Context? = null + var position: Int = 0 + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AjustesItemHolder { + this.context = parent.context + return AjustesItemHolder( + + ItemArticleRowReubicationFragmentBinding.inflate( + LayoutInflater.from(parent.context), + parent, + false + ) + ) + } + + override fun getItemCount() = items.size + + override fun onBindViewHolder(holder: AjustesItemHolder, position: Int) { + this.position = position + holder.bind(items[position]) + } + + inner class AjustesItemHolder( + val binding: ItemArticleRowReubicationFragmentBinding + ) : RecyclerView.ViewHolder(binding.root) { + fun bind(reubication: Reubication) { + binding.apply { + + itemArticleItemFk.setOnClickListener { + onPasillerosItemClickListener.onPasillerosItemClickListener( + PasillerosItemVO( + title = binding.root.context.getString(R.string.titleItemConsult) + ), reubication.itemFk + )} + contentLayout.setOnClickListener { + onReubicationClickListener.onReubicationClick(reubication) + } + /* if (sale.pickedQuantity.isNullOrEmpty()) + sale.pickedQuantity = "0" + + val childLayoutManager = + LinearLayoutManager(context!!, RecyclerView.HORIZONTAL, false) + + itemArticlePlacements.apply { + layoutManager = childLayoutManager + adapter = PlacementAdapter(sale.placements, onPasillerosItemClickListener) + }*/ + + //CLICK EVENTS + /* + + itemArticleItemFk.setOnClickListener { + onPasillerosItemClickListener.onPasillerosItemClickListener( + PasillerosItemVO( + title = binding.root.context.getString(R.string.titleItemConsult) + ), sale.itemFk + ) + } + + itemPackingItemFk.setOnClickListener { + onPackingClick.onPackingClick(sale) + } + + itemArticleQuantity.setOnClickListener { + onQuantityClick.onQuantityClick(sale) + } + + itemArticleQuantityPicked.setOnClickListener { + onQuantityClick.onQuantityClick(sale) + } + + txtde.setOnClickListener { + onQuantityClick.onQuantityClick(sale) + }*/ + + contentLayout.setOnLongClickListener { + //"Nueva funcionalidad en el icono de la derecha".toast(context!!) + //onMistakeClickListener.onMistakeClickListener(sale) + false + } + + /*itemRowLayout.setOnLongClickListener{ + onMistakeClickListener.onMistakeClickListener(sale) + false + }*/ + /* imageErrorMessage.setOnClickListener { + onMistakeClickListener.onMistakeClickListener(sale) + false + } + + + //ERROR + if (sale.originalQuantity != sale.quantity) { + layoutError.visibility = View.VISIBLE + txtError.text = binding.root.context.getString(R.string.originalQuantity) + sale.originalQuantity + if (sale.isPrepared == "1" || sale.isControlled == "1") + sale.pickedQuantity = sale.quantity + } + + if (sale.isNew) { + layoutError.visibility = View.VISIBLE + txtError.text = binding.root.context.getString(R.string.newItem) + + } + + // paintTicketcolor(sale.level, itemTicketColor) + // paintTicketcolor(sale.color, itemColor) + + + if (!sale.isNew && sale.originalQuantity == sale.quantity) { + layoutError.visibility = View.GONE + } +*/ + + //SEMAFORO + /* if (sale.isPreviousPrepared == "1") { + itemArticleRowSemaforoPre.setBackgroundColor( + ContextCompat.getColor( + context!!, + R.color.verdnatura_dark_sky_blue + ) + ) + } else { + itemArticleRowSemaforoPre.setBackgroundColor( + ContextCompat.getColor( + context!!, + R.color.verdnatura_warm_grey + ) + ) + } + + if (sale.isPrepared == "1") { + itemArticleRowSemaforoSac.setBackgroundColor( + ContextCompat.getColor( + context!!, + R.color.verdnatura_pumpkin_orange + ) + ) + } else { + itemArticleRowSemaforoSac.setBackgroundColor( + ContextCompat.getColor( + context!!, + R.color.verdnatura_warm_grey + ) + ) + } + + + + if (sale.isControlled == "1") { + itemArticleRowSemaforoCon.setBackgroundColor( + ContextCompat.getColor( + context!!, + R.color.verdnatura_dark_mint + ) + ) + } else { + itemArticleRowSemaforoCon.setBackgroundColor( + ContextCompat.getColor( + context!!, + R.color.verdnatura_warm_grey + ) + ) + } + + + if (sale.isControlled == "1") { + contentLayout.setBackgroundColor( + ContextCompat.getColor( + context!!, + R.color.verdnatura_dark_mint + ) + ) + } else if (sale.isPrepared == "1") { + contentLayout.setBackgroundColor( + ContextCompat.getColor( + context!!, + R.color.verdnatura_pumpkin_orange + ) + ) + } *//*else if (sale.isPreviousPrepared == "1") { + contentLayout.setBackgroundColor( + getColor( + context!!, + R.color.verdnatura_dark_sky_blue + ) + ) + }*//* else if (sale.isPreControlled == "1") { + + contentLayout.setBackgroundColor( + ContextCompat.getColor( + context!!, + R.color.verdnatura_dark_mint_light_precontrolled + ) + ) + itemArticleRowSemaforoCon.setBackgroundColor( + ContextCompat.getColor( + context!!, + R.color.verdnatura_dark_mint_light_precontrolled + ) + ) + } else if (sale.isPreviousPrepared == "1") { + contentLayout.setBackgroundColor( + ContextCompat.getColor( + context!!, + R.color.verdnatura_dark_sky_blue + ) + ) + } else { + contentLayout.setBackgroundColor( + ContextCompat.getColor( + context!!, + R.color.verdnatura_black + ) + ) + } + + + //sergio: para de momento que pinten las lineas sin actualizar ni nada + if (sale.isControlled == "2") { + itemArticleRowSemaforoCon.setBackgroundColor( + ContextCompat.getColor( + context!!, + R.color.verdnatura_white + ) + ) + contentLayout.setBackgroundColor( + ContextCompat.getColor( + context!!, + R.color.verdnatura_dark_mint_light + ) + ) + }*/ + + + //ASIGNAMOS VALOR A LA VSITA + this.reubication = reubication + + } + } + } + + + /* private fun paintTicketcolor(color: String, itemView: View) { + + + when (color.uppercase().trim()) { + "ROJO" -> 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) + } + // itemView.background.setColorFilter(Color.RED, PorterDuff.Mode.SRC_ATOP) + + "AMARILLO" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(Color.YELLOW, BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter(Color.YELLOW, PorterDuff.Mode.SRC_ATOP) + } + "VERDE" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(Color.GREEN, BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter(Color.GREEN, PorterDuff.Mode.SRC_ATOP) + } + "AZUL" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(Color.BLUE, BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter(Color.BLUE, PorterDuff.Mode.SRC_ATOP) + } + "BLANCO" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(Color.WHITE, BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP) + } + // "NEGRO"-> itemView.setBackgroundResource((R.drawable.rectangle)) + + "NEGRO" -> { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(Color.BLACK, BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter(Color.BLACK, PorterDuff.Mode.SRC_ATOP) + } + + itemView.setBackgroundResource((R.drawable.border)) + } + "VIOLETA" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(0xFF4c2882.toInt(), BlendMode.SRC_ATOP) + // BlendModeColorFilter(Color.YELLOW, BlendMode.SRC_ATOP) + //Log.d("VERDNATURA::", "EL COLOR ES " + color) + } else { + itemView.background.setColorFilter(0xFF4c2882.toInt(), PorterDuff.Mode.SRC_ATOP) + } + + "GRIS" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(Color.GRAY, BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter(Color.GRAY, PorterDuff.Mode.SRC_ATOP) + } + "ORANGE" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter( + ContextCompat.getColor( + context!!, + android.R.color.holo_orange_light + ), BlendMode.SRC_ATOP + ) + } else { + itemView.background.setColorFilter( + ContextCompat.getColor( + context!!, + android.R.color.holo_orange_light + ), PorterDuff.Mode.SRC_ATOP + ) + } + + "MORADO" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter( + ContextCompat.getColor( + context!!, + android.R.color.holo_purple + ), BlendMode.SRC_ATOP + ) + } else { + itemView.background.setColorFilter( + ContextCompat.getColor( + context!!, + android.R.color.holo_purple + ), PorterDuff.Mode.SRC_ATOP + ) + } + + "CELESTE" ->if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(0xFF5b85F5.toInt(), BlendMode.SRC_ATOP) + } + + + "ROSA" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(0xFFfc0fc0.toInt(), BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter( + 0xFFfc0fc0.toInt(), + PorterDuff.Mode.SRC_ATOP + ) + } + + "DORADO" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(0xFFb8860b.toInt(), BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter( + 0xFFb8860b.toInt(), + PorterDuff.Mode.SRC_ATOP + ) + } + "MARRON" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(0xFF663300.toInt(), BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter( + 0xFF663300.toInt(), + PorterDuff.Mode.SRC_ATOP + ) + } + "PERLA" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(0xFFcdcecf.toInt(), BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter( + 0xFFcdcecf.toInt(), + PorterDuff.Mode.SRC_ATOP + ) + } + "MARFIL" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(0xFFf7eada.toInt(), BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter( + 0xFFf7eada.toInt(), + PorterDuff.Mode.SRC_ATOP + ) + } + "CIAN" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(0xFF00ffff.toInt(), BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter( + 0xFF00ffff.toInt(), + PorterDuff.Mode.SRC_ATOP + ) + } + "BEIGE" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(0xFFf2e7bf.toInt(), BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter( + 0xFFf2e7bf.toInt(), + PorterDuff.Mode.SRC_ATOP + ) + } + + else -> { + // itemView.setBackgroundColor(Color.TRANSPARENT) + //itemView.setBackgroundResource(R.drawable.background_item_color) + // itemView.visibility=View.INVISIBLE + } + } + // itemTicketColor.setBackgroundResource((R.drawable.rectangle)) + + + }*/ + } \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/reubication/fragment/ReubicationCollectionFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/reubication/fragment/ReubicationCollectionFragment.kt new file mode 100644 index 00000000..df2c047a --- /dev/null +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/reubication/fragment/ReubicationCollectionFragment.kt @@ -0,0 +1,215 @@ +package es.verdnatura.presentation.view.feature.reubication.fragment + +import android.annotation.SuppressLint +import android.content.Context +import android.text.Editable +import android.util.Log +import android.view.View.GONE +import android.view.View.VISIBLE +import android.view.inputmethod.EditorInfo +import androidx.recyclerview.widget.LinearLayoutManager +import es.verdnatura.R +import es.verdnatura.databinding.FragmentReubicationCollectionBinding +import es.verdnatura.domain.notNull +import es.verdnatura.presentation.base.BaseFragment +import es.verdnatura.presentation.common.OnPasillerosItemClickListener +import es.verdnatura.presentation.common.OnReubicationClickListener +import es.verdnatura.presentation.view.component.CustomDialogThreeButtons +import es.verdnatura.presentation.view.feature.reubication.adapter.ReubicatorAdapter +import es.verdnatura.presentation.view.feature.reubication.model.Reubication +import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorViewModel + + +//Tarea #3754 +class ReubicationCollectionFragment( + var list: List, + var shelving: String +) : BaseFragment( + UbicadorViewModel::class +) { + private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null + private var adapter: ReubicatorAdapter? = null + private lateinit var customDialogThreeButtons: CustomDialogThreeButtons + + companion object { + fun newInstance( + entryPoint: List, + shelving: String + ): ReubicationCollectionFragment { + + return ReubicationCollectionFragment(entryPoint, shelving) + } + } + + override fun getLayoutId(): Int = R.layout.fragment_reubication_collection + + override fun onAttach(context: Context) { + //sergio: necesario para pasarle el context al recyclerViewer + if (context is OnPasillerosItemClickListener) pasillerosItemClickListener = context + super.onAttach(context) + } + + @SuppressLint("SetTextI18n") + override fun init() { + customDialogThreeButtons = CustomDialogThreeButtons(requireContext()) + ma.hideBottomNavigation(GONE) + binding.splashProgress.visibility = GONE + binding.mainToolbar.toolbarTitle.text = + "${getString(R.string.wagoon)}:${shelving.uppercase()}" + setEvents() + + for (item in list) { + Log.d("VERDNATURA::", "item " + item.itemFk) + } + showList(list) + super.init() + } + + + private fun showList(list: List) { + adapter = ReubicatorAdapter(list, pasillerosItemClickListener!!, object : + OnReubicationClickListener { + override fun onReubicationClick(reubication: Reubication) { + binding.splashProgress.visibility = VISIBLE + viewModel.itemShelving_merge( + getData(USER), + getData(PASSWORD), + reubication.id, + "xxx" + ) + + } + + }) + binding.reubicatorCollectionsRecycler.adapter = adapter + binding.reubicatorCollectionsRecycler.layoutManager = + LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) + + } + + private fun setEvents() { + binding.mainToolbar.backButton.setOnClickListener { + requireActivity().onBackPressed() + } + + binding.collectionSwipe.setOnRefreshListener { + + callItemShelvingReturn() + binding.collectionSwipe.isRefreshing = false + + } + + binding.scanInput.requestFocus() + binding.scanInput.setOnEditorActionListener { v, actionId, event -> + if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { + + if (!binding.scanInput.text.isNullOrEmpty()) { + scanPlate(binding.scanInput.text.toString().uppercase()) + } + + binding.scanInput.setText("") + ma.hideKeyboard(binding.scanInput) + return@setOnEditorActionListener true + } + false + } + + + } + + private fun scanPlate(plate: String) { + showLeaveItemDialog(plate) + /* for (items in list){ + for (placements in items.placements!!){ + if (placements.plate==plate){ + Log.d("VERDNATURA::","Encontrada matrícula") + showLeaveItemDialog(plate) + + } + } + }*/ + } + + private fun showLeaveItemDialog(plate: String) { + customDialogThreeButtons.setDescription("¿ Dejar item:XXX en el carro :$plate ?").setValue("1000") + .setOkButton(getString(R.string.leaveItem)) { + + + }.setKoButton(getString(R.string.cancel)) { + scanRequest() + customDialogThreeButtons.dismiss() + }.show() + } + + + private fun scanRequest() { + if (binding.scanInput != null) { + binding.scanInput.requestFocus() + } + + } + + override fun observeViewModel() { + with(viewModel) { + + + loadReubicationList.observe(viewLifecycleOwner) { event -> + event.getContentIfNotHandled().notNull { + binding.splashProgress.visibility = GONE + + + if (it.list.isEmpty()) { + ma.messageWithSound( + getString(R.string.errorReubication), true, true, getString( + R.string.info + ) + ) + } else { + if (it.list[0].isError) { + ma.messageWithSound( + it.list[0].errorMessage, true, true, getString( + R.string.info + ) + ) + } else { + showList(it.list) + + } + } + + } + } + + response.observe(viewLifecycleOwner) { + binding.splashProgress.visibility = GONE + + if (it.isError) { + + ma.messageWithSound(it.errorMessage, true, true) + + } else { + + ma.messageWithSound(it.response, false, false, "", false) + + callItemShelvingReturn() + + } + } + + } + } + + private fun callItemShelvingReturn() { + binding.splashProgress.visibility = VISIBLE + + viewModel.itemShelving_return( + usuario = getData(USER), + password = getData(PASSWORD), + shelvingFk = shelving, + + ) + + } + + +} \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/reubication/fragment/ReubicationFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/reubication/fragment/ReubicationFragment.kt new file mode 100644 index 00000000..6340d71d --- /dev/null +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/reubication/fragment/ReubicationFragment.kt @@ -0,0 +1,133 @@ +package es.verdnatura.presentation.view.feature.reubication.fragment + +import android.content.Context +import android.util.Log +import android.view.View +import android.view.View.GONE +import android.view.inputmethod.EditorInfo +import es.verdnatura.R +import es.verdnatura.databinding.FragmentControladorBinding +import es.verdnatura.domain.notNull +import es.verdnatura.presentation.base.BaseFragment +import es.verdnatura.presentation.common.OnCollectionSelectedListener +import es.verdnatura.presentation.view.feature.reubication.model.Reubication +import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorViewModel + +//Tarea #3754 +class ReubicationFragment(var entrypoint: String) : + BaseFragment( + UbicadorViewModel::class + ) { + + private var goBack: Boolean = false + private var onCollectionSelectedListener: OnCollectionSelectedListener? = null + override fun getLayoutId(): Int = R.layout.fragment_controlador + private var shelvingScaned: String = "" + + companion object { + fun newInstance(entrypoint: String) = ReubicationFragment(entrypoint = entrypoint) + } + + override fun onAttach(context: Context) { + super.onAttach(context) + if (context is OnCollectionSelectedListener) onCollectionSelectedListener = context + } + + override fun init() { + + binding.mainToolbar.toolbarTitle.text = entrypoint + binding.splashProgress.visibility = GONE + setEvents() + + super.init() + } + + override fun onPause() { + goBack = true + super.onPause() + } + + + private fun setEvents() { + + binding.mainToolbar.backButton.setOnClickListener { + requireActivity().onBackPressed() + } + + binding.scanInput.requestFocus() + binding.scanInput.setOnEditorActionListener { v, actionId, event -> + if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { + goBack = false + if (!binding.scanInput.text.isNullOrEmpty()) { + binding.splashProgress.visibility = View.VISIBLE + shelvingScaned = binding.scanInput.text.toString() + viewModel.itemShelving_return( + usuario = getData(USER), + password = getData(PASSWORD), + shelvingFk = binding.scanInput.text.toString(), + + ) + } + + binding.scanInput.setText("") + ma.hideKeyboard(binding.scanInput) + return@setOnEditorActionListener true + } + false + } + } + + override fun observeViewModel() { + with(viewModel) { + loadReubicationList.observe(viewLifecycleOwner) { event -> + event.getContentIfNotHandled().notNull { + binding.splashProgress.visibility = GONE + + + if (it.list.isEmpty()) { + ma.messageWithSound( + getString(R.string.errorReubication), true, true, getString( + R.string.info + ) + ) + } else { + if (it.list[0].isError) { + ma.messageWithSound( + it.list[0].errorMessage, true, true, getString( + R.string.info + ) + ) + } else { + createReubications(it.list) + + } + } + + } + } + + + } + + + } + + private fun createReubications(list: List) { + + for (item in list) { + + if (item.shelvingFk != shelvingScaned && item.itemFk == "5987") { + + // TODO("FALTA CREAR REUBICACIONES") + // item.placements!!.add(PlacementReubication(item.shelvingFk, item.visible)) + + } + } + Log.d("VERDNATURA::","LA MATRICULA ES "+shelvingScaned) + ma.openFragmentReubications(list,shelvingScaned) + } + + +} + + diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/reubication/model/Reubication.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/reubication/model/Reubication.kt new file mode 100644 index 00000000..ddfb9d8b --- /dev/null +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/reubication/model/Reubication.kt @@ -0,0 +1,23 @@ +package es.verdnatura.presentation.view.feature.reubication.model + +class ReubicationList( + var list: List = listOf() +) + +class Reubication( + var id: String = "", + var shelvingFk: String = "", + var code: String = "", + var itemFk: String = "", + var longName: String = "", + var visible: String = "", + var placements: MutableList? = null, + var isError: Boolean, + var errorMessage: String +) + +class PlacementReubication( + var plate: String = "", + var visible: String = "", + +) \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/showticket/ShowTicketViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/showticket/ShowTicketViewModel.kt index 4803d61d..97a2da08 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/showticket/ShowTicketViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/showticket/ShowTicketViewModel.kt @@ -16,9 +16,10 @@ import retrofit2.Response class ShowTicketViewModel(context: Context) : BaseViewModel() { private val contextApp=context - private val _collectionTicketList by lazy { MutableLiveData() } + private val getPreControladorUserCase: GetPreControladorUserCase = GetPreControladorUserCase(context) + private val _collectionTicketList by lazy { MutableLiveData() } val collectionTicketList: LiveData get() = _collectionTicketList diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/smarttag/sacador/fragment/AssociateSmartTagsFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/smarttag/sacador/fragment/AssociateSmartTagsFragment.kt index 85c45b27..4561b98c 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/smarttag/sacador/fragment/AssociateSmartTagsFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/smarttag/sacador/fragment/AssociateSmartTagsFragment.kt @@ -222,7 +222,7 @@ class AssociateSmartTagsFragment( return when (TagScaned) { 0 -> getString(R.string.scanned) - 1 -> getString(R.string.wagon) + 1 -> getString(R.string.wagoon) 2 -> getString(R.string.scanHighLabel) 3 -> getString(R.string.scanMedLabel) 4 -> getString(R.string.scanLowLabel) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt index ceb035c5..373dcfb8 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt @@ -6,11 +6,12 @@ import androidx.lifecycle.MutableLiveData import androidx.lifecycle.Transformations import es.verdnatura.domain.GetUbicadorUserCase 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.reubication.model.Reubication +import es.verdnatura.presentation.view.feature.reubication.model.ReubicationList import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorListVO import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO import retrofit2.Call @@ -41,6 +42,11 @@ class UbicadorViewModel(context: Context) : BaseViewModel() { val loadShelvingList = Transformations.map(_shelvingList) { Event(it) } + private val _reubicationList by lazy { MutableLiveData() } + val loadReubicationList = Transformations.map(_reubicationList) { Event(it) } + + + fun itemShelvingList( usuario: String, password: String, @@ -288,6 +294,86 @@ class UbicadorViewModel(context: Context) : BaseViewModel() { }) } + fun itemShelving_merge( + usuario: String, + password: String, + vShelf: String, + vShelvingFk: String + + ) { + getUbicadorUserCase.itemShelving_merge(usuario, password, vShelf, vShelvingFk) + .enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) + } + + override fun onResponse(call: Call, response: Response) { + if (!response.isSuccessful) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _response.value = + ResponseItemVO(isError = false, response = response.message()!!) + } + } + }) + } + + fun itemShelving_return( + usuario: String, + password: String, + shelvingFk: String, + + ) { + getUbicadorUserCase.itemShelving_return(usuario, password, shelvingFk) + .enqueue(object : Callback> { + override fun onFailure(call: Call>, t: Throwable) { + val listError: ArrayList = ArrayList() + listError.add( + Reubication( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + t.message!! + ) + ) + ) + _reubicationList.value = ReubicationList(listError) + } + + override fun onResponse( + call: Call>, + response: Response> + ) { + if (response.body()==null) { + val listError: ArrayList = ArrayList() + listError.add( + Reubication( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + ) + _reubicationList.value = ReubicationList(listError) + } else { + + _reubicationList.value = response.body()?.let { ReubicationList(it) } + + } + } + }) + } + fun clearShelvingList( usuario: String, password: String, diff --git a/app/src/main/res/drawable/ic_reubication.xml b/app/src/main/res/drawable/ic_reubication.xml new file mode 100644 index 00000000..1516a532 --- /dev/null +++ b/app/src/main/res/drawable/ic_reubication.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_reubication_collection.xml b/app/src/main/res/layout/fragment_reubication_collection.xml new file mode 100644 index 00000000..968a9995 --- /dev/null +++ b/app/src/main/res/layout/fragment_reubication_collection.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_web.xml b/app/src/main/res/layout/fragment_web.xml index 1971b094..9d9abb83 100644 --- a/app/src/main/res/layout/fragment_web.xml +++ b/app/src/main/res/layout/fragment_web.xml @@ -26,7 +26,6 @@ android:layout_height="match_parent" android:orientation="vertical" android:background="@color/verdnatura_black_8_alpha_6" - android:gravity="center"> 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 8e26e9cb..6534d182 100644 --- a/app/src/main/res/layout/item_article_row_fragment.xml +++ b/app/src/main/res/layout/item_article_row_fragment.xml @@ -335,7 +335,7 @@ android:layout_width="15dp" android:layout_height="15dp" android:layout_marginLeft="5dp" - + android:visibility="gone" android:background="@drawable/background_item_color" app:layout_constraintStart_toEndOf="@+id/item_article_quantity_line3" app:layout_constraintBottom_toBottomOf="@+id/item_article_quantity_line3" /> diff --git a/app/src/main/res/layout/item_article_row_reubication_fragment.xml b/app/src/main/res/layout/item_article_row_reubication_fragment.xml new file mode 100644 index 00000000..c604a02f --- /dev/null +++ b/app/src/main/res/layout/item_article_row_reubication_fragment.xml @@ -0,0 +1,393 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 26fd297a..52d715cd 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -136,7 +136,7 @@ Controlar ticket Escanear expedición Día de venta - Carro + Carro Referencia Historico de ítems del carro Histórico del carro @@ -302,9 +302,9 @@ Revisar Se ha enviado a Split el articulo del ticket - "Se ha añadido el articulo " + Se ha añadido el articulo unidad/es al ticket - " con " + con La cantidad supera a la disponible cantidad introducida erronea Escanea item para validar @@ -351,8 +351,8 @@ Lector Qr Desactivado buffer Pre Control - Histórico Shelving - Log Shelving + Histórico ítems del carro + Histórico del carro Elemento escaneado no encontrado: No existen pedidos para reponer Pedido completado @@ -369,7 +369,7 @@ Expedition ( ¿Estás seguro de cerrar la sesión? Causa del error registada - "Artículo: " + Artículo: "Cantidad original: " No se puede realizar la llamada. El usuario no tiene la extensión configurada. Solicítelo a informática. Historico Vehículo @@ -384,8 +384,8 @@ Usuario sin permisos para realizar la acción Revisa tu usuario y contraseña. En caso de no poder acceder contacta co Informática Ok - "Ticket: " - "Expedition: " + Ticket: + Expedición: dd/MM/yyyy [a-zA-Z ]+ Ticket insertado OK @@ -400,6 +400,7 @@ Permite aparcar tickets o carros Busca donde se encuentra un ítem Permite ubicar/saber los ítems de un carro + Permite reubicar los ítems de un carro Visualiza que falta o está desubicado Permite añadir fallos a un trabajador Permite saber modificaciones de items en un carro @@ -421,24 +422,27 @@ Pone en modo desactivado un buffer Pone en modo flejado un buffer Pone en modo cargar un buffer - Accede menú de los pasilleros:presacar, ver ticket, ubicador... + Accede menú de los pasilleros:presacar, ver ticket, ubicador… Accede a sacar pedidos Accede a la revisión de los tickets - Accede al menú de paletizadores: paletizar, buffer... + Accede al menú de paletizadores: paletizar, buffer… Accede al menú de reclamaciones Ubicación de reclamaciones Error al construir la colección. Descripción del error: Principal - "Se ha enviado desde previa a Basura " - "Se ha enviado desde previa a Faltas la cantidad de " - "Se ha modificado desde previa la cantidad de " - " del articulo " - " ticket " + Se ha enviado desde previa a Basura + Se ha enviado desde previa a Faltas la cantidad de + Se ha modificado desde previa la cantidad de + del articulo + ticket Ticket completo - " a nueva cantidad: " + a nueva cantidad: Obtener colección previa Sale/s aparcada/s - "Se ha modificado desde previa la cantidad de " + Se ha modificado desde previa la cantidad de url title + Reubicación + No aparecen item para el carro escaneado + Dejar item diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 39e637c3..fb78dc85 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -144,7 +144,7 @@ Control ticket Scan expedition Day of sale - Wagon + Wagoon Reference Item Log Shelving Log @@ -210,15 +210,15 @@ Save Allow you to change a wagoon plate Delete all items of wagoon - Cambia la prioridad de los items del carro. Cuanto más alta antes cogerán los sacadores. - Permite añadir items al carro de manera continuada. No uno a uno + Change priority of wagoon items. When priority higher pickers pick faster. + Allows you to add items to the wagoon continuously. Not one on one New item Edit item Fill required fields Packing required Select an action Delete - Solo puedes visualizar cuando has cogido tu mismo el vehículo a no ser que tengas permisos para ello. + You can only view when you have taken the vehicle yourself unless you have permission to do so. Information Accept You have to select a printer @@ -233,11 +233,11 @@ Error to perform action Scan expedition label Buffer: - Packing guardado + Packing saved Previous collected Availability Unmark line - "You are going to unmark the line: " + You are going to unmark the line: are you sure? Unmark ALGEMESI V @@ -245,11 +245,11 @@ Cause of error registered Select printer Observations - "Scan plate for looking historical " + Scan plate for looking historical Scan vehicle plate "Scan plate to take off " Rescan - "What do you want to do with the plate vehicle " + What do you want to do with the plate vehicle Priority modified "Confirm for delete item: " Incorrect wagoon @@ -266,7 +266,7 @@ Search item Historical Similar items - "Current value: " + Current value: Search similar items Indicate the reason for removing stock: Indicate the amount to register @@ -276,7 +276,7 @@ Element introduced is not a number Buyer Access Salix to see more information - "Ítem : " + Ítem : Change plate Wagoon scaned¿Do you want register another? Exit @@ -303,20 +303,20 @@ Parking OK Scan Parking The purchase line of the scanned label does not exist. - "Pending review : " + Pending review : Review - "The article has been sent to Split " - " from ticket " - "Item added " - " unity to ticket " - " with " + The article has been sent to Split + from ticket + Item added + unity to ticket + with Quantity exceeds available " wrong amount entered" - " Scan item to validate" + Scan item to validate Amount you take: Error when marking the line Error printing - " Number of ticket shelves" + Number of ticket shelves Indicates the number of shelves that the ticket occupies Number of packages on shelf Indicates the number of packages that fit on a shelf @@ -345,6 +345,7 @@ Replacement Consult item Ubicator + Reubication Automatic Quality Web viewer @@ -362,7 +363,7 @@ New The following collection is still pending preparation: Scan wagoon for item selected - "The answer is: " + The answer is: Previous OK Colección no tickets. Scan tickets for adding Pallet @@ -370,7 +371,7 @@ Are you sure to log out? Error cause logged "Item: " - "Original amount: " + Original amount: " " The call cannot be made. The user does not have the extension configured. Request it from IT." Vehicle historical HH:mm @@ -393,35 +394,36 @@ Error adding ticket to collection. Failed to change state to previous collection. complete - " Get preview collections" + Get preview collections It is used to review a previous ticket Show a ticket without the possibility to modify it " Find information on an item" Allows parking tickets or cars Search where an item is located - " Allows you to locate/know the items in a wagoon" + Allows you to locate/know the items in a wagoon + Allows you to relocate the items from a wagoon Visualize that it is missing or misplaced Allows to add faults to a worker Allows to know modifications of items in a wagoon Allows to know the movements in a wagoon Visualize who and when has taken a vehicle - " Allows you to know the sale date of the items in a cart" + Allows you to know the sale date of the items in a wagoon Indicates that it needs to be replenished View fault stock in warehouse Shelves Parking It allows to know the quality of some products by buyer - Allows scanning pallet to incorporate it into the sytem + Allows scanning pallet to incorporate it into the system Allows you to know the status of an expedition Allows scanning shipments that have not passed through the sorter Access to the operations menu with the sorter buffers Allows you to read information in a qr Puts a buffer in flush mode Puts a buffer in full mode - " Put a buffer in accumulation mode" + Put a buffer in accumulation mode" Puts a buffer in disabled mode - " Puts a buffer in strapping mode" - " Puts in load mode a buffer" - " Access the menu of the corridors: presacar, see ticket, locator…" + Puts a buffer in strapping mode + Puts in load mode a buffer + Access the menu of the corridors: presacar, see ticket, locator… Access to order Access the ticket review Access the palletizers menu: palletize, buffer… @@ -429,17 +431,19 @@ Claims Location Error building collection. Error description: Main - " It has been sent from previous to Trash " - " It has been sent from previous to Fault the quantity of " - "Changed from previous amount of " - "Changed from previous amount of " - " from item " + It has been sent from previous to Trash + It has been sent from previous to Fault the quantity of + Changed from previous amount of + Changed from previous amount of + from item ticket Complete ticket - " to new quantity: " + to new quantity: Sale/s park/ed url title + There are not items for scanned wagoon + Dejar item