Versión 6.1.3 más textos cambiados y quitadas llamadas a collection_updateState

This commit is contained in:
Sergio De la torre 2021-07-05 17:09:00 +02:00
parent e45d31b6cd
commit d63c74c055
11 changed files with 191 additions and 9 deletions

View File

@ -99,6 +99,9 @@ class CollectionFragment(
override fun getLayoutId(): Int = R.layout.fragment_collection
override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
user = prefs.getString(USER,"").toString()
password = prefs.getString(PASSWORD,"").toString()
@ -135,7 +138,10 @@ class CollectionFragment(
setToolBar()
setEvents()
// Log.i("VERDNATURA","el type es $type")
Log.i("VERDNATURA","el type es $type")
if (type=="PRECONTROLADOR"){
}
if (type == SACADOR && voz != "NO"){
setSpeak()
}

View File

@ -32,6 +32,7 @@ import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
import es.verdnatura.presentation.view.feature.parking.fragment.ParkingFragment
import es.verdnatura.presentation.view.feature.pasillero.fragment.PasilleroFragment
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.PreSacadorFragment
import es.verdnatura.presentation.view.feature.reposicion.fragment.ReposicionFragment
import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorFragment
@ -188,6 +189,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
"Pre Sacador" -> {
addFragmentOnTop(PreSacadorFragment.newInstance())
}
"Ver Ticket" -> {
addFragmentOnTop(PreControladorFragment.newInstance())
}
"Reposición" -> {
addFragmentOnTop(ReposicionFragment.newInstance())
}
@ -204,7 +210,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
// addFragmentOnTop(BuscarItemAllFragment.newInstance(entryPoint))
// }
"Historico" -> {
//addFragmentOnTop(HistoricoFragment.newInstance(entryPoint))
addFragmentOnTop(HistoricoFragment.newInstance(entryPoint))
}
"Inventario" -> {
addFragmentOnTop(InventaryFragment.newInstance())

View File

@ -19,6 +19,11 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
R.drawable.ic_streetview_black_24dp,
"Pre Sacador",R.string.PreSacador)
)
_pasillerositem.add(
PasillerosItemVO(10,
R.drawable.ic_streetview_black_24dp,
"Ver Ticket",R.string.verticket)
)
_pasillerositem.add(
PasillerosItemVO(7,

View File

@ -0,0 +1,115 @@
package es.verdnatura.presentation.view.feature.precontrol
import android.content.Context
import android.content.SharedPreferences
import android.os.Bundle
import android.util.Log
import android.view.View
import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer
import es.verdnatura.R
import es.verdnatura.databinding.FragmentControladorBinding
import es.verdnatura.domain.ConstAndValues
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnCollectionSelectedListener
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.controlador.fragment.ControladorViewModel
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
import kotlinx.android.synthetic.main.fragment_controlador.*
import kotlinx.android.synthetic.main.toolbar.*
class PreControladorFragment: BaseFragment<FragmentControladorBinding,ControladorViewModel>(ControladorViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var goBack:Boolean = false
private var onCollectionSelectedListener : OnCollectionSelectedListener? = null
override fun getLayoutId(): Int = R.layout.fragment_controlador
private lateinit var customDialog: CustomDialog
companion object {
fun newInstance() = PreControladorFragment()
}
override fun onAttach(context: Context) {
super.onAttach(context)
if (context is OnCollectionSelectedListener) onCollectionSelectedListener = context
}
override fun init() {
splash_progress.visibility = View.GONE
customDialog = CustomDialog(requireContext())
toolbar_title.text = getString(R.string.getcollection)
setEvents()
super.init()
}
override fun onPause() {
goBack = true
super.onPause()
}
override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
user = prefs.getString(USER,"").toString()
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,1).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
super.onCreate(savedInstanceState)
}
private fun setEvents(){
scan_input.requestFocus()
scan_input.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
if (!scan_input.text.isNullOrEmpty()) {
splash_progress.visibility = View.VISIBLE
viewModel.collectionTicketGet(
usuario = user,
password = password,
sectorFk = sectorFk,
collectionFk = scan_input.text.toString()
)
Log.i("VERDNATURA","La collection es ${scan_input.text.toString()}")
}
scan_input.setText("")
(activity as MainActivity).hideKeyboard(scan_input)
return@setOnEditorActionListener true
}
false
}
}
override fun observeViewModel() {
with(viewModel){
collectionTicketList.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.GONE
if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Aceptar"){
customDialog.dismiss()
}.show()
}else{
if (!goBack)navigateToCollectionList(it)
goBack = false
}
})
}
}
private fun navigateToCollectionList(collection: CollectionVO){
onCollectionSelectedListener?.onCollectionSelected(collection, ConstAndValues.CONTROLADOR)
//onCollectionSelectedListener?.onCollectionSelected(collection, "PRECONTROLADOR")
// onCollectionSelectedListener=null
}
}

View File

@ -0,0 +1,43 @@
package es.verdnatura.presentation.view.feature.precontrol
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetSacadorControladorUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.view.feature.collection.mapper.map
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
class PreControladorViewModel(context: Context) : BaseViewModel() {
private val _collectionTicketList by lazy { MutableLiveData<CollectionVO>() }
private val getSacadorControladorUserCase: GetSacadorControladorUserCase = GetSacadorControladorUserCase(context)
val collectionTicketList: LiveData<CollectionVO>
get() = _collectionTicketList
fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String){
getSacadorControladorUserCase.collectionTicketGet(usuario,password,collectionFk,sectorFk,"0").enqueue(object :
Callback<CollectionVO> {
override fun onFailure(call: Call<CollectionVO>, t: Throwable) {
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = t.message!!)
}
override fun onResponse(
call: Call<CollectionVO>,
response: Response<CollectionVO>
) {
if (response.body() != null){
_collectionTicketList.value = response.body()?.let { it.map() }
}else{
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = "No hay tickets para sacar")
}
}
})
}
}

View File

@ -34,6 +34,9 @@ import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyList
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_pre_sacador.*
import kotlinx.android.synthetic.main.fragment_pre_sacador.fragment_sacador_collections
import kotlinx.android.synthetic.main.fragment_pre_sacador.splash_progress
import kotlinx.android.synthetic.main.fragment_sacador.*
import kotlinx.android.synthetic.main.toolbar.*
class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorViewModel>(PreSacadorViewModel::class) {
@ -613,10 +616,14 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
val listIcons:ArrayList<Drawable> = ArrayList()
val iconPrint : Drawable = resources.getDrawable(R.drawable.ic_print_black_24dp,resources.newTheme())
val iconParking : Drawable = resources.getDrawable(R.drawable.ic_local_parking_black_24dp,resources.newTheme())
//sergio para hacer el presacador como sacador
val iconAdd : Drawable = resources.getDrawable(R.drawable.ic_add_black_24dp,resources.newTheme())
//val iconTransferir : Drawable = resources.getDrawable(R.drawable.ic_swap_horiz_black_24dp,resources.newTheme())
listIcons.add(iconPrint)
listIcons.add(iconParking)
listIcons.add(iconAdd)
//listIcons.add(iconTransferir)
toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {

View File

@ -88,7 +88,6 @@ class SacadorFragment : BaseFragment<FragmentSacadorBinding,SacadorViewModel>(Sa
override fun onOptionsItemSelected(item: Drawable) {
if(item == iconAdd){
////Log.i("VERDNATURA","pulsando el +")
splash_progress_two.visibility = View.VISIBLE
viewModel.collectionNew(user,password,sectorFk,carros)
}

View File

@ -75,11 +75,8 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
}
})
}
// fun collectionNew(usuario:String,password:String,sectorFk:String){
// getSacadorControladorUserCase.collectionNew(usuario,password,sectorFk).enqueue(object :
fun collectionNew(usuario: String, password: String, sectorFk: String, carros: String){
////Log.i("VERDNATURA", "El sector para CollectionNew es $sectorFk y los carros son $carros")
fun collectionNew(usuario: String, password: String, sectorFk: String, carros: String){
getSacadorControladorUserCase.collectionNew(usuario, password, sectorFk, carros).enqueue(
object :
Callback<String> {

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:app="http://schemas.android.com/apk/res-auto"
android:clickable="false">
<data>
<variable
@ -12,7 +13,8 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/verdnatura_black">
android:background="@color/verdnatura_black"
>

View File

@ -119,4 +119,5 @@
<string name="faultsReview">Faltas</string>
<string name="shelvingParking_get">Parking estanterías</string>
<string name="test">Buscar item search</string>
<string name="verticket">Ver ticket</string>
</resources>

View File

@ -118,5 +118,6 @@
<string name="faultsReview">Faults review</string>
<string name="shelvingParking_get">Shelving parking</string>
<string name="test">Search item test</string>
<string name="verticket">Show ticket</string>
</resources>