expedition pallet print

This commit is contained in:
Enrique Blasco 2020-06-01 06:42:55 +02:00
parent e2c27ce2bc
commit ddf18a59ce
24 changed files with 1309 additions and 27 deletions

View File

@ -12,8 +12,8 @@ android {
applicationId "es.verdnatura"
minSdkVersion 21
targetSdkVersion 29
versionCode 4
versionName "5.0.3"
versionCode 5
versionName "5.0.5"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

@ -7,7 +7,9 @@ import es.verdnatura.presentation.view.feature.faltas.fragment.FaltasViewModel
import es.verdnatura.presentation.view.feature.historico.fragment.HistoricoViewModel
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryViewModel
import es.verdnatura.presentation.view.feature.login.fragment.LoginViewModel
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPalletDetailViewModel
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPalletViewModel
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanViewModel
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionTruckListViewModel
import es.verdnatura.presentation.view.feature.pasillero.fragment.PasilleroViewModel
import es.verdnatura.presentation.view.feature.shelvingparking.fragment.ShelvingParkingViewModel
@ -79,4 +81,12 @@ val viewModelModule = module{
viewModel {
ExpeditionPalletViewModel()
}
viewModel {
ExpeditionPalletDetailViewModel()
}
viewModel {
ExpeditionScanViewModel()
}
}

View File

@ -1,8 +1,6 @@
package es.verdnatura.domain
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanVO
import es.verdnatura.presentation.view.feature.paletizador.model.*
import retrofit2.Call
class GetPaletizadoresUserCase: RestClient() {
@ -32,4 +30,41 @@ class GetPaletizadoresUserCase: RestClient() {
return restClient!!.expeditionScanAdd("json","1",usuario,password,"application/json",params)
}
}
fun expeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String) : Call<String> {
val params:ArrayList<String> = ArrayList();
params.add(vPalletFk)
params.add(vExpeditionFk)
return restClient!!.expeditionScanPut("json","1",usuario,password,"application/json",params)
}
fun expeditionPalletView(usuario:String,password:String,vPalletFk:String) : Call<List<ItemPalletViewVO>> {
val params:ArrayList<String> = ArrayList();
params.add(vPalletFk)
return restClient!!.expeditionPalletView("json","1",usuario,password,"application/json",params)
}
fun expeditionPalletDel(usuario:String,password:String,vPalletFk:String) : Call<String> {
val params:ArrayList<String> = ArrayList();
params.add(vPalletFk)
return restClient!!.expeditionPalletDel("json","1",usuario,password,"application/json",params)
}
fun expeditionScanList(usuario:String,password:String,vPalletFk:String) : Call<List<ItemExpeditionScanVO>> {
val params:ArrayList<String> = ArrayList();
params.add(vPalletFk)
return restClient!!.expeditionScanList("json","1",usuario,password,"application/json",params)
}
fun expeditionScanDel(usuario:String,password:String,vScanFk:String) : Call<String> {
val params:ArrayList<String> = ArrayList();
params.add(vScanFk)
return restClient!!.expeditionScanDel("json","1",usuario,password,"application/json",params)
}
fun expeditionPalletPrintSet(usuario:String,password:String,vPalletFk:String) : Call<String> {
val params:ArrayList<String> = ArrayList();
params.add(vPalletFk)
return restClient!!.expeditionPalletPrintSet("json","1",usuario,password,"application/json",params)
}
}

View File

@ -8,9 +8,7 @@ import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoVO
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanVO
import es.verdnatura.presentation.view.feature.paletizador.model.*
import es.verdnatura.presentation.view.feature.shelvingparking.model.ItemShelvingParkingVO
import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO
import retrofit2.Call
@ -285,4 +283,58 @@ interface VerdnaturaService {
@Body params: List<String>):
Call<List<ItemScanVO>>
@POST("almacennew/expeditionScanPut")
fun expeditionScanPut(@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<String>):
Call<String>
@POST("almacennew/expeditionPalletView")
fun expeditionPalletView(@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<String>):
Call<List<ItemPalletViewVO>>
@POST("almacennew/expeditionPalletDel")
fun expeditionPalletDel(@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<String>):
Call<String>
@POST("almacennew/expeditionScanList")
fun expeditionScanList(@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<String>):
Call<List<ItemExpeditionScanVO>>
@POST("almacennew/expeditionScanDel")
fun expeditionScanDel(@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<String>):
Call<String>
@POST("almacennew/expeditionPalletPrintSet")
fun expeditionPalletPrintSet(@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<String>):
Call<String>
}

View File

@ -7,8 +7,10 @@ import es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionScanVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanVO
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO
@ -66,5 +68,13 @@ interface OnTruckClickListener {
}
interface OnPalletClickListener {
fun onPalletClickListener(item: ItemPalletVO,entryPoint: String)
fun onPalletClickListener(itemTruck: ItemExpeditionTruckVO,itemPallet: ItemPalletVO)
}
interface OnComprobarPalletViewClickListener {
fun onComprobarPalletViewClickListener(itemTruck: ItemExpeditionTruckVO,itemPallet: ItemPalletVO)
}
interface OnScanLongClickListener {
fun onScanLongClickListener(ItemExpeditionScanVO: ItemExpeditionScanVO)
}

View File

@ -1,6 +1,7 @@
package es.verdnatura.presentation.view.feature.articulo.adapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.databinding.ItemBarcodeRowBinding
@ -9,7 +10,8 @@ import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
class BarcodeAdapter(
private val items: List<BarcodeVO>,
private val onBarcodeRowClickListener: OnBarcodeRowClickListener
private val onBarcodeRowClickListener: OnBarcodeRowClickListener,
private var showDelete: Boolean = true
): RecyclerView.Adapter<BarcodeAdapter.ItemHolder> () {
@ -31,13 +33,15 @@ class BarcodeAdapter(
}
class ItemHolder(
inner class ItemHolder(
val binding: ItemBarcodeRowBinding
) : RecyclerView.ViewHolder(binding.root){
private val res = binding.root.context.resources
fun bind(item: BarcodeVO) {
binding.apply {
this.item = item
if (showDelete) itemImage.visibility = View.VISIBLE
else itemImage.visibility = View.GONE
}
}
}

View File

@ -19,7 +19,9 @@ import es.verdnatura.presentation.view.feature.faltas.fragment.FaltasFragment
import es.verdnatura.presentation.view.feature.historico.fragment.HistoricoFragment
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryFragment
import es.verdnatura.presentation.view.feature.main.model.ItemMenuVO
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPalletDetailFragment
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPalletFragment
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanFragment
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionTruckListFragment
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
@ -35,7 +37,7 @@ import kotlinx.coroutines.launch
class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClickListener,
OnTruckClickListener, OnPalletClickListener {
OnTruckClickListener, OnPalletClickListener,OnComprobarPalletViewClickListener {
private var lastBottomMenuItemSelected: ItemMenuVO? = null
private lateinit var customDialog: CustomDialog
@ -212,8 +214,15 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
addFragmentOnTop(ExpeditionPalletFragment.newInstance(item))
}
override fun onPalletClickListener(item: ItemPalletVO, entryPoint: String) {
// addFragmentOnTop(ItemCardFragment.newInstance(entryPoint))
override fun onPalletClickListener(itemTruck: ItemExpeditionTruckVO,itemPallet: ItemPalletVO) {
addFragmentOnTop(ExpeditionScanFragment.newInstance(itemTruck,itemPallet))
}
override fun onComprobarPalletViewClickListener(
itemTruck: ItemExpeditionTruckVO,
itemPallet: ItemPalletVO
) {
addFragmentOnTop(ExpeditionPalletDetailFragment.newInstance(itemTruck,itemPallet))
}
}

View File

@ -7,12 +7,16 @@ import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.R
import es.verdnatura.databinding.ItemExpeditionpalletRowBinding
import es.verdnatura.presentation.common.OnComprobarPalletViewClickListener
import es.verdnatura.presentation.common.OnPalletClickListener
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
class ExpeditionPalletAdapter (
private val items: List<ItemPalletVO>,
private val onPalletClickListener: OnPalletClickListener
private val onPalletClickListener: OnPalletClickListener,
private val onComprobarPalletViewClickListener: OnComprobarPalletViewClickListener,
private val itemExpeditionTruckVO: ItemExpeditionTruckVO
): RecyclerView.Adapter<ExpeditionPalletAdapter.ItemHolder> () {
private var context:Context? = null
@ -28,7 +32,11 @@ class ExpeditionPalletAdapter (
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
holder.bind(items[position])
holder.binding.root.setOnClickListener {
onPalletClickListener.onPalletClickListener(items[position],"")
onPalletClickListener.onPalletClickListener(itemExpeditionTruckVO,items[position])
}
holder.binding.root.setOnLongClickListener {
onComprobarPalletViewClickListener.onComprobarPalletViewClickListener(itemExpeditionTruckVO,items[position])
true
}
}

View File

@ -0,0 +1,39 @@
package es.verdnatura.presentation.view.feature.paletizador.adapter
import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.databinding.ItemExpeditionViewRowBinding
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletViewVO
class ExpeditionPalletViewAdapter (
private val items: List<ItemPalletViewVO>
): RecyclerView.Adapter<ExpeditionPalletViewAdapter.ItemHolder> () {
private var context: Context? = null
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
this.context = parent.context
return ItemHolder(
ItemExpeditionViewRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
)
}
override fun getItemCount() =items.size
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
holder.bind(items[position])
}
inner class ItemHolder(
val binding: ItemExpeditionViewRowBinding
) : RecyclerView.ViewHolder(binding.root){
private val res = binding.root.context.resources
fun bind(item: ItemPalletViewVO) {
binding.apply {
this.item = item
}
}
}
}

View File

@ -0,0 +1,50 @@
package es.verdnatura.presentation.view.feature.paletizador.adapter
import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.R
import es.verdnatura.databinding.ItemExpeditionpalletRowBinding
import es.verdnatura.databinding.ItemExpeditionscanRowBinding
import es.verdnatura.presentation.common.OnComprobarPalletViewClickListener
import es.verdnatura.presentation.common.OnPalletClickListener
import es.verdnatura.presentation.common.OnScanLongClickListener
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionScanVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
class ExpeditionScanAdapter (
private val items: List<ItemExpeditionScanVO>,
private val onScanLongClickListener: OnScanLongClickListener
): RecyclerView.Adapter<ExpeditionScanAdapter.ItemHolder> () {
private var context: Context? = null
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
this.context = parent.context
return ItemHolder(
ItemExpeditionscanRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
)
}
override fun getItemCount() =items.size
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
holder.bind(items[position])
holder.binding.root.setOnClickListener {
onScanLongClickListener.onScanLongClickListener(items[position])
}
}
inner class ItemHolder(
val binding: ItemExpeditionscanRowBinding
) : RecyclerView.ViewHolder(binding.root){
private val res = binding.root.context.resources
fun bind(item: ItemExpeditionScanVO) {
binding.apply {
this.item = item
}
}
}
}

View File

@ -0,0 +1,167 @@
package es.verdnatura.presentation.view.feature.paletizador.fragment
import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import androidx.lifecycle.ViewModelProviders
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentExpeditionPalletBinding
import es.verdnatura.databinding.FragmentExpeditionPalletDetailBinding
import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.OnPalletClickListener
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogList
import es.verdnatura.presentation.view.feature.articulo.adapter.BarcodeAdapter
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.paletizador.adapter.ExpeditionPalletAdapter
import es.verdnatura.presentation.view.feature.paletizador.adapter.ExpeditionPalletViewAdapter
import es.verdnatura.presentation.view.feature.paletizador.model.*
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_expedition_pallet_detail.*
import kotlinx.android.synthetic.main.toolbar.*
import java.text.SimpleDateFormat
import java.util.*
import kotlin.collections.ArrayList
class ExpeditionPalletDetailFragment(
var itemExpeditionTruckVO: ItemExpeditionTruckVO? = null,
var itemPallet: ItemPalletVO? = null
) : BaseFragment<FragmentExpeditionPalletDetailBinding, ExpeditionPalletDetailViewModel>(
ExpeditionPalletDetailViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var adapter : ExpeditionPalletViewAdapter? = null
private lateinit var customDialogList: CustomDialogList
private var onPalletClickListener:OnPalletClickListener? = null
private lateinit var customDialog: CustomDialog
companion object {
fun newInstance(item: ItemExpeditionTruckVO,itemPallet: ItemPalletVO) =
ExpeditionPalletDetailFragment(item,itemPallet)
}
override fun onAttach(context: Context) {
if (context is OnPalletClickListener) onPalletClickListener = context
super.onAttach(context)
}
override fun getLayoutId(): Int = R.layout.fragment_expedition_pallet_detail
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)
}
override fun init() {
customDialog = CustomDialog(requireContext())
customDialogList = CustomDialogList(requireContext())
expedition_pallet_detail_pallet.text = "Pallet "+itemPallet!!.Pallet
splash_progress.visibility = View.VISIBLE
activity!!.main_bottom_navigation.visibility = View.GONE
toolbar_title.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino
setToolBar()
setEvents()
viewModel.expeditionPallet_List(user,password,itemPallet!!.Pallet)
super.init()
}
private fun setEvents(){
backButton.setOnClickListener {
activity!!.onBackPressed()
}
button_ok.setOnClickListener {
activity!!.onBackPressed()
}
}
private fun setToolBar(){
val listIcons:ArrayList<Drawable> = ArrayList()
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
val iconEditar : Drawable = resources.getDrawable(R.drawable.ic_mode_edit_black_24dp,resources.newTheme())
val iconBorrar : Drawable = resources.getDrawable(R.drawable.ic_delete_forever_black_24dp,resources.newTheme())
val iconPrint : Drawable = resources.getDrawable(R.drawable.ic_print_black_24dp,resources.newTheme())
listIcons.add(iconEditar)
listIcons.add(iconBorrar)
listIcons.add(iconPrint)
toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload){
splash_progress.visibility = View.VISIBLE
viewModel.expeditionPallet_List(user,password,itemPallet!!.Pallet)
}else if(item == iconEditar){
onPalletClickListener!!.onPalletClickListener(itemExpeditionTruckVO!!,itemPallet!!)
}else if(item == iconBorrar){
splash_progress.visibility = View.VISIBLE
viewModel.expeditionPalletDel(user,password,itemPallet!!.Pallet)
}else if(item == iconPrint){
splash_progress.visibility = View.VISIBLE
viewModel.expeditionPalletPrintSet(user,password,itemPallet!!.Pallet)
}
}
})
toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
private fun getCURDATE(date:String):String{
val c = Calendar.getInstance()
val df = SimpleDateFormat("yyyy-mm-dd HH:mm")
val df2 = SimpleDateFormat("HH:mm")
c.time = df.parse(date)
return df2.format(c.time);
}
override fun observeViewModel() {
with(viewModel){
loadExpeditionPalletList.observe(viewLifecycleOwner, Observer { event ->
event.getContentIfNotHandled().notNull {printExpeditionList(it) }
})
response.observe(viewLifecycleOwner, Observer {
if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.hide()
}.show()
}else{
activity!!.onBackPressed()
}
})
}
}
private fun printExpeditionList(it: ItemPalletViewListVO){
splash_progress.visibility = View.GONE
val lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
adapter = ExpeditionPalletViewAdapter(it.list)
expedition_pallet_recyclerview.adapter = adapter
expedition_pallet_recyclerview.layoutManager = lm
}
}

View File

@ -0,0 +1,82 @@
package es.verdnatura.presentation.view.feature.paletizador.fragment
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.paletizador.model.*
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
class ExpeditionPalletDetailViewModel: BaseViewModel() {
private val getPaletizadoresUserCase: GetPaletizadoresUserCase = GetPaletizadoresUserCase()
private val _expeditionPalletList by lazy { MutableLiveData<ItemPalletViewListVO>() }
val loadExpeditionPalletList = Transformations.map(_expeditionPalletList) { Event(it) }
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
val response: LiveData<ResponseItemVO>
get() = _response
fun expeditionPallet_List(usuario:String,password:String,vPalletFk:String){
getPaletizadoresUserCase.expeditionPalletView(usuario,password,vPalletFk).enqueue(object :
Callback<List<ItemPalletViewVO>> {
override fun onFailure(call: Call<List<ItemPalletViewVO>>, t: Throwable) {
val listError:ArrayList<ItemPalletViewVO> = ArrayList()
listError.add(ItemPalletViewVO(isError = true,errorMessage = t.message!!))
_expeditionPalletList.value = ItemPalletViewListVO(listError)
}
override fun onResponse(
call: Call<List<ItemPalletViewVO>>,
response: Response<List<ItemPalletViewVO>>
) {
if (response.body() != null){
_expeditionPalletList.value = response.body()?.let { ItemPalletViewListVO(it) }
}else{
val listError:ArrayList<ItemPalletViewVO> = ArrayList()
listError.add(ItemPalletViewVO(isError = true,errorMessage = "Error en la llamada de expeditionPallet_View"))
_expeditionPalletList.value = ItemPalletViewListVO(listError)
}
}
})
}
fun expeditionPalletDel(usuario:String,password:String,vPalletFk:String){
getPaletizadoresUserCase.expeditionPalletDel(usuario,password,vPalletFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al borrar pallet "+vPalletFk+ " Respuesta:"+t.message!!)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada expeditionPallet_Del")
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
}
})
}
fun expeditionPalletPrintSet(usuario:String,password:String,vPalletFk:String){
getPaletizadoresUserCase.expeditionPalletPrintSet(usuario,password,vPalletFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al borrar pallet "+vPalletFk+ " Respuesta:"+t.message!!)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada expeditionPallet_Del")
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
}
})
}
}

View File

@ -13,8 +13,10 @@ import es.verdnatura.databinding.FragmentExpeditionPalletBinding
import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
import es.verdnatura.presentation.common.OnComprobarPalletViewClickListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.OnPalletClickListener
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogHour
import es.verdnatura.presentation.view.component.CustomDialogList
import es.verdnatura.presentation.view.feature.articulo.adapter.BarcodeAdapter
@ -24,6 +26,7 @@ import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.paletizador.adapter.ExpeditionPalletAdapter
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletListVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanList
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_expedition_pallet.*
@ -43,9 +46,11 @@ class ExpeditionPalletFragment(
private var warehouseFk = ""
private var adapter : ExpeditionPalletAdapter? = null
private var onPalletClickListener: OnPalletClickListener? = null
private var onComprobarPalletViewClickListener:OnComprobarPalletViewClickListener? = null
private lateinit var customDialogList: CustomDialogList
private var listExpeditions:ArrayList<BarcodeVO> = ArrayList()
private var expeditionAdapter : BarcodeAdapter? = null
private lateinit var customDialog: CustomDialog
companion object {
@ -55,6 +60,7 @@ class ExpeditionPalletFragment(
override fun onAttach(context: Context) {
if (context is OnPalletClickListener) onPalletClickListener = context
if (context is OnComprobarPalletViewClickListener) onComprobarPalletViewClickListener = context
super.onAttach(context)
}
@ -71,7 +77,7 @@ class ExpeditionPalletFragment(
}
override fun init() {
customDialog = CustomDialog(requireContext())
customDialogList = CustomDialogList(requireContext())
splash_progress.visibility = View.VISIBLE
activity!!.main_bottom_navigation.visibility = View.GONE
@ -125,13 +131,21 @@ class ExpeditionPalletFragment(
loadScanList.observe(viewLifecycleOwner, Observer { event ->
event.getContentIfNotHandled().notNull {showScanExpeditions(it) }
})
response.observe(viewLifecycleOwner, Observer {
if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.hide()
}.show()
}
})
}
}
private fun printExpeditionList(it: ItemPalletListVO){
splash_progress.visibility = View.GONE
val lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
adapter = ExpeditionPalletAdapter(it.list,onPalletClickListener!!)
adapter = ExpeditionPalletAdapter(it.list,onPalletClickListener!!,onComprobarPalletViewClickListener!!,itemExpeditionTruckVO!!)
expedition_pallet_recyclerview.adapter = adapter
expedition_pallet_recyclerview.layoutManager = lm
}
@ -144,16 +158,26 @@ class ExpeditionPalletFragment(
private fun showScanExpeditions(it:ItemScanList){
splash_progress.visibility = View.GONE
it.list.forEach {
listExpeditions.add(BarcodeVO(code = it.expeditionFk))
if(it.expeditionFk != "0")
listExpeditions.add(BarcodeVO(code = it.expeditionFk))
}
customDialogList.setTitle("Expedition ("+toolbar_title.text+")").setOkButton("Comprobar"){
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
splash_progress.visibility = View.VISIBLE
viewModel.expeditionPallet_List(user,password,itemExpeditionTruckVO!!.truckFk)
listExpeditions = ArrayList()
if (listExpeditions.size > 0){
onComprobarPalletViewClickListener!!.onComprobarPalletViewClickListener(itemExpeditionTruckVO!!,
ItemPalletVO(Pallet = it.list.get(0).palletFk))
}else{
customDialog.setTitle("Atención").setDescription("No ha escaneado expediciones").setOkButton("Ok"){
customDialog.hide()
}.show()
}
customDialogList.hide()
}.setKoButton("Cerrar"){
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
splash_progress.visibility = View.VISIBLE
@ -169,6 +193,8 @@ class ExpeditionPalletFragment(
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!customDialogList.getValue().isNullOrEmpty()){
listExpeditions.add(BarcodeVO(code = customDialogList.getValue()))
viewModel.expeditionScanPut(user,password,it.list.get(0).palletFk,customDialogList.getValue())
expeditionAdapter!!.notifyDataSetChanged()
}
customDialogList.setValue("")
@ -180,10 +206,9 @@ class ExpeditionPalletFragment(
expeditionAdapter = BarcodeAdapter(listExpeditions,object: OnBarcodeRowClickListener {
override fun onBarcodeRowClickListener(item: BarcodeVO) {
listExpeditions.remove(item)
expeditionAdapter!!.notifyDataSetChanged()
}
})
},showDelete = false)
customDialogList.getRecyclerView().adapter = expeditionAdapter
customDialogList.getRecyclerView().layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)

View File

@ -1,10 +1,12 @@
package es.verdnatura.presentation.view.feature.paletizador.fragment
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletListVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanList
@ -24,6 +26,10 @@ class ExpeditionPalletViewModel : BaseViewModel() {
private val _scanList by lazy { MutableLiveData<ItemScanList>() }
val loadScanList = Transformations.map(_scanList) { Event(it) }
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
val response: LiveData<ResponseItemVO>
get() = _response
fun expeditionPallet_List(usuario:String,password:String,vTruckFk:String){
getPaletizadoresUserCase.expeditionPallet_List(usuario,password,vTruckFk).enqueue(object :
Callback<List<ItemPalletVO>> {
@ -74,6 +80,19 @@ class ExpeditionPalletViewModel : BaseViewModel() {
})
}
fun expeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String){
getPaletizadoresUserCase.expeditionScanPut(usuario,password,vPalletFk,vExpeditionFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar expedition "+vExpeditionFk+ " Respuesta:"+t.message!!)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada expeditionScan_Put")
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
}
})
}
}

View File

@ -0,0 +1,253 @@
package es.verdnatura.presentation.view.feature.paletizador.fragment
import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import androidx.lifecycle.ViewModelProviders
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentExpeditionPalletBinding
import es.verdnatura.databinding.FragmentExpeditionScanBinding
import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.*
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogList
import es.verdnatura.presentation.view.component.CustomDialogTwoButtons
import es.verdnatura.presentation.view.feature.articulo.adapter.BarcodeAdapter
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.paletizador.adapter.ExpeditionPalletAdapter
import es.verdnatura.presentation.view.feature.paletizador.adapter.ExpeditionScanAdapter
import es.verdnatura.presentation.view.feature.paletizador.model.*
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_expedition_scan.*
import kotlinx.android.synthetic.main.toolbar.*
import java.text.SimpleDateFormat
import java.util.*
import kotlin.collections.ArrayList
class ExpeditionScanFragment (
var itemExpeditionTruckVO: ItemExpeditionTruckVO? = null,
var itemPalletVO: ItemPalletVO? = null
) : BaseFragment<FragmentExpeditionScanBinding, ExpeditionScanViewModel>(
ExpeditionScanViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var adapter : ExpeditionScanAdapter? = null
private var onPalletClickListener: OnPalletClickListener? = null
private var onComprobarPalletViewClickListener: OnComprobarPalletViewClickListener? = null
private lateinit var customDialogList: CustomDialogList
private lateinit var customDialogTwoButtons: CustomDialogTwoButtons
private var listExpeditions:ArrayList<BarcodeVO> = ArrayList()
private var expeditionAdapter : BarcodeAdapter? = null
private lateinit var customDialog: CustomDialog
companion object {
fun newInstance(item: ItemExpeditionTruckVO,itemPalletVO: ItemPalletVO) =
ExpeditionScanFragment(item,itemPalletVO)
}
override fun onAttach(context: Context) {
if (context is OnPalletClickListener) onPalletClickListener = context
if (context is OnComprobarPalletViewClickListener) onComprobarPalletViewClickListener = context
super.onAttach(context)
}
override fun getLayoutId(): Int = R.layout.fragment_expedition_scan
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)
}
override fun init() {
customDialog = CustomDialog(requireContext())
customDialogList = CustomDialogList(requireContext())
customDialogTwoButtons = CustomDialogTwoButtons(requireContext())
expedition_scan_detail_pallet.text = "Pallet "+itemPalletVO!!.Pallet
splash_progress.visibility = View.VISIBLE
activity!!.main_bottom_navigation.visibility = View.GONE
toolbar_title.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino
setToolBar()
setEvents()
viewModel.expeditionScanList(user,password,itemPalletVO!!.Pallet)
super.init()
}
private fun setEvents(){
backButton.setOnClickListener {
activity!!.onBackPressed()
}
}
private fun setToolBar(){
val listIcons:ArrayList<Drawable> = ArrayList()
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
val iconPlus : Drawable = resources.getDrawable(R.drawable.ic_add_black_24dp,resources.newTheme())
listIcons.add(iconReload)
listIcons.add(iconPlus)
toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload){
splash_progress.visibility = View.VISIBLE
viewModel.expeditionScanList(user,password,itemPalletVO!!.Pallet)
}else if(item == iconPlus){
expeditionScanAdd()
}
}
})
toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
private fun getCURDATE(date:String):String{
val c = Calendar.getInstance()
val df = SimpleDateFormat("yyyy-mm-dd HH:mm")
val df2 = SimpleDateFormat("HH:mm")
c.time = df.parse(date)
return df2.format(c.time);
}
override fun observeViewModel() {
with(viewModel){
loadExpeditionScanList.observe(viewLifecycleOwner, Observer { event ->
event.getContentIfNotHandled().notNull {printExpeditionList(it) }
})
loadScanList.observe(viewLifecycleOwner, Observer { event ->
event.getContentIfNotHandled().notNull {showScanExpeditions(it) }
})
response.observe(viewLifecycleOwner, Observer {
if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.hide()
}.show()
}
})
responseDeleteScan.observe(viewLifecycleOwner, Observer {
if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.hide()
}.show()
}else{
viewModel.expeditionScanList(user,password,itemPalletVO!!.Pallet)
}
})
}
}
private fun printExpeditionList(it: ItemExpeditionScanList){
splash_progress.visibility = View.GONE
val lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
adapter = ExpeditionScanAdapter(it.list,object: OnScanLongClickListener{
override fun onScanLongClickListener(itemExpeditionScanVO: ItemExpeditionScanVO) {
customDialogTwoButtons.setTitle("Ticket: "+itemExpeditionScanVO.Ticket+" Pallet: "+itemPalletVO!!.Pallet)
.setDescription("Expedition: "+itemExpeditionScanVO!!.expeditionFk)
.setOkButton("Borrar"){
splash_progress.visibility = View.VISIBLE
viewModel.expeditionScanDel(user,password,itemExpeditionScanVO.id)
customDialogTwoButtons.hide()
}.setKoButton("Cancelar"){
customDialogTwoButtons.hide()
}.show()
}
})
expedition_pallet_recyclerview.adapter = adapter
expedition_pallet_recyclerview.layoutManager = lm
}
private fun expeditionScanAdd(){
splash_progress.visibility = View.VISIBLE
viewModel.expeditionScanAdd(usuario = user,password = password,vPalletFk = itemPalletVO!!.Pallet,vTruckFk = itemExpeditionTruckVO!!.truckFk)
}
private fun showScanExpeditions(it: ItemScanList){
listExpeditions = ArrayList()
splash_progress.visibility = View.GONE
it.list.forEach {
if(it.expeditionFk != "0")
listExpeditions.add(BarcodeVO(code = it.expeditionFk))
}
customDialogList.setTitle("Pallet"+itemPalletVO!!.Pallet+" ("+toolbar_title.text+")").setOkButton("Comprobar"){
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
if (listExpeditions.size > 0){
onComprobarPalletViewClickListener!!.onComprobarPalletViewClickListener(itemExpeditionTruckVO!!,
ItemPalletVO(Pallet = it.list.get(0).palletFk)
)
}else{
customDialog.setTitle("Atención").setDescription("No ha escaneado expediciones").setOkButton("Ok"){
customDialog.hide()
}.show()
}
customDialogList.hide()
}.setKoButton("Cerrar"){
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
listExpeditions = ArrayList()
customDialogList.hide()
}.setValue("").show()
customDialogList.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
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()){
listExpeditions.add(BarcodeVO(code = customDialogList.getValue()))
viewModel.expeditionScanPut(user,password,it.list.get(0).palletFk,customDialogList.getValue())
expeditionAdapter!!.notifyDataSetChanged()
}
customDialogList.setValue("")
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
return@setOnEditorActionListener true
}
false
}
expeditionAdapter = BarcodeAdapter(listExpeditions,object: OnBarcodeRowClickListener {
override fun onBarcodeRowClickListener(item: BarcodeVO) {
}
},showDelete = false)
customDialogList.getRecyclerView().adapter = expeditionAdapter
customDialogList.getRecyclerView().layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
}
}

View File

@ -0,0 +1,114 @@
package es.verdnatura.presentation.view.feature.paletizador.fragment
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel
import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.paletizador.model.*
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
class ExpeditionScanViewModel : BaseViewModel() {
private val getPaletizadoresUserCase: GetPaletizadoresUserCase = GetPaletizadoresUserCase()
private val _expeditionScanList by lazy { MutableLiveData<ItemExpeditionScanList>() }
val loadExpeditionScanList = Transformations.map(_expeditionScanList) { Event(it) }
private val _scanList by lazy { MutableLiveData<ItemScanList>() }
val loadScanList = Transformations.map(_scanList) { Event(it) }
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
val response: LiveData<ResponseItemVO>
get() = _response
private val _responseDeleteScan by lazy { MutableLiveData<ResponseItemVO>() }
val responseDeleteScan: LiveData<ResponseItemVO>
get() = _responseDeleteScan
fun expeditionScanList(usuario:String,password:String,vPalletFk:String){
getPaletizadoresUserCase.expeditionScanList(usuario,password,vPalletFk).enqueue(object :
Callback<List<ItemExpeditionScanVO>> {
override fun onFailure(call: Call<List<ItemExpeditionScanVO>>, t: Throwable) {
val listError:ArrayList<ItemExpeditionScanVO> = ArrayList()
listError.add(ItemExpeditionScanVO(isError = true,errorMessage = t.message!!))
_expeditionScanList.value = ItemExpeditionScanList(listError)
}
override fun onResponse(
call: Call<List<ItemExpeditionScanVO>>,
response: Response<List<ItemExpeditionScanVO>>
) {
if (response.body() != null){
_expeditionScanList.value = response.body()?.let { ItemExpeditionScanList(it) }
}else{
val listError:ArrayList<ItemExpeditionScanVO> = ArrayList()
listError.add(ItemExpeditionScanVO(isError = true,errorMessage = "Error en la llamada de expeditionScan_List"))
_expeditionScanList.value = ItemExpeditionScanList(listError)
}
}
})
}
fun expeditionScanAdd(usuario:String,password:String,vPalletFk:String,vTruckFk:String){
getPaletizadoresUserCase.expeditionScanAdd(usuario,password,vPalletFk,vTruckFk).enqueue(object :
Callback<List<ItemScanVO>> {
override fun onFailure(call: Call<List<ItemScanVO>>, t: Throwable) {
val listError:ArrayList<ItemScanVO> = ArrayList()
listError.add(ItemScanVO(isError = true,errorMessage = t.message!!))
_scanList.value = ItemScanList(listError)
}
override fun onResponse(
call: Call<List<ItemScanVO>>,
response: Response<List<ItemScanVO>>
) {
if (response.body() != null){
_scanList.value = response.body()?.let { ItemScanList(it) }
}else{
val listError:ArrayList<ItemScanVO> = ArrayList()
listError.add(ItemScanVO(isError = true,errorMessage = "Error en la llamada de expeditionTruck_List"))
_scanList.value = ItemScanList(listError)
}
}
})
}
fun expeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String){
getPaletizadoresUserCase.expeditionScanPut(usuario,password,vPalletFk,vExpeditionFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar expedition "+vExpeditionFk+ " Respuesta:"+t.message!!)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada expeditionScan_Put")
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
}
})
}
fun expeditionScanDel(usuario:String,password:String,vScanFk:String){
getPaletizadoresUserCase.expeditionScanDel(usuario,password,vScanFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_responseDeleteScan.value = ResponseItemVO(isError = true,errorMessage = "Error al eliminar expedition "+vScanFk+ " Respuesta:"+t.message!!)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_responseDeleteScan.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada expeditionScan_Del")
}else{
_responseDeleteScan.value = ResponseItemVO(isError = false,response = response.body()!!)
}
}
})
}
}

View File

@ -11,4 +11,17 @@ class ItemPalletVO(
class ItemPalletListVO(
var list:List<ItemPalletVO> = listOf()
)
class ItemPalletViewVO(
var Pallet:String = "",
var Rutas:String = "",
var Cajas:String = "",
var isError: Boolean = false,
var errorMessage: String = ""
)
class ItemPalletViewListVO(
var list:List<ItemPalletViewVO> = listOf()
)

View File

@ -10,3 +10,18 @@ class ItemScanVO (
class ItemScanList(
var list:List<ItemScanVO> = listOf()
)
class ItemExpeditionScanVO(
var id:String = "",
var expeditionFk:String = "",
var Ruta:String = "",
var Ticket:String = "",
var Caja:String = "",
var isError:Boolean = false,
var errorMessage:String = ""
)
class ItemExpeditionScanList(
var list:List<ItemExpeditionScanVO> = listOf()
)

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFFFFF" android:pathData="M19,8L5,8c-1.66,0 -3,1.34 -3,3v6h4v4h12v-4h4v-6c0,-1.66 -1.34,-3 -3,-3zM16,19L8,19v-5h8v5zM19,12c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1 1,0.45 1,1 -0.45,1 -1,1zM18,3L6,3v4h12L18,3z"/>
</vector>

View File

@ -56,6 +56,7 @@
android:textSize="@dimen/body2" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView

View File

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="viewModel"
type="es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPalletDetailViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/verdnatura_black"
>
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal"
android:paddingLeft="@dimen/layout_margin_min"
android:paddingRight="@dimen/layout_margin_min"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/main_toolbar">
<TextView
android:id="@+id/expedition_pallet_detail_pallet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/verdnatura_pumpkin_orange"
android:text="Pallet: "
android:gravity="center"
android:textSize="@dimen/h6"/>
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal"
android:paddingLeft="@dimen/layout_margin_min"
android:paddingRight="@dimen/layout_margin_min"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Ruta"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Cajas"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/expedition_pallet_recyclerview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:clipToPadding="false"
app:layout_constraintBottom_toTopOf="@+id/button_ok"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout2"
tools:listitem="@layout/item_expedition_view_row" />
<include
android:id="@+id/main_toolbar"
layout="@layout/toolbar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button_ok"
style="@style/DefaultButton"
android:layout_width="0dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:background="@drawable/btn_orange"
android:text="Ok"
android:textColor="@color/verdnatura_white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<LinearLayout
android:id="@+id/splash_progress"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/verdnatura_black_8_alpha_6"
android:gravity="center"
android:orientation="vertical"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.airbnb.lottie.LottieAnimationView
android:layout_width="wrap_content"
android:layout_height="@dimen/verdnatura_logo_large_height"
app:lottie_autoPlay="true"
app:lottie_loop="true"
app:lottie_rawRes="@raw/orange_loading"
app:lottie_speed="2" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="viewModel"
type="es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/verdnatura_black"
>
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal"
android:paddingLeft="@dimen/layout_margin_min"
android:paddingRight="@dimen/layout_margin_min"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/main_toolbar">
<TextView
android:id="@+id/expedition_scan_detail_pallet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/verdnatura_pumpkin_orange"
android:text="Pallet: "
android:gravity="center"
android:textSize="@dimen/h6"/>
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal"
android:paddingLeft="@dimen/layout_margin_min"
android:paddingRight="@dimen/layout_margin_min"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Ruta"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Ticket"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Caja"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/expedition_pallet_recyclerview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:clipToPadding="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout2"
tools:listitem="@layout/item_expeditionscan_row" />
<include
android:id="@+id/main_toolbar"
layout="@layout/toolbar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/splash_progress"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/verdnatura_black_8_alpha_6"
android:gravity="center"
android:orientation="vertical"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.airbnb.lottie.LottieAnimationView
android:layout_width="wrap_content"
android:layout_height="@dimen/verdnatura_logo_large_height"
app:lottie_autoPlay="true"
app:lottie_loop="true"
app:lottie_rawRes="@raw/orange_loading"
app:lottie_speed="2" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="item"
type="es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletViewVO" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/item_row_layout"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/verdnatura_black_5"
android:paddingLeft="@dimen/layout_margin_min"
android:paddingRight="@dimen/layout_margin_min"
android:paddingTop="@dimen/pasilleros_margin_main_menu"
android:paddingBottom="@dimen/pasilleros_margin_main_menu">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{item.Rutas}"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{item.Cajas}"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/verdnatura_black_9"/>
</LinearLayout>
</layout>

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tool="http://schemas.android.com/tools">
<data>
<variable
name="item"
type="es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionScanVO" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/item_row_layout"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/verdnatura_black_5"
android:paddingLeft="@dimen/layout_margin_min"
android:paddingRight="@dimen/layout_margin_min"
android:paddingTop="@dimen/pasilleros_margin_main_menu"
android:paddingBottom="@dimen/pasilleros_margin_main_menu">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{item.Ruta}"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
<TextView
android:id="@+id/expedition_pallet_rutas"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{item.Ticket}"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{item.Caja}"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/verdnatura_black_9"/>
</LinearLayout>
</layout>