Version 7.5.1 solucionado presacador que salian desordenadas al sacar, llamadas a sacador, enlaces rocket ok, pantalla precontrol.Tooltip hecho.

This commit is contained in:
Sergio De la torre 2022-01-13 09:43:43 +01:00
parent f36ab51499
commit 0973600efa
74 changed files with 2204 additions and 1241 deletions

View File

@ -71,6 +71,7 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/pallet_shipping.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/pallet_shipping_black.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/pallet_shipping_selected.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/phone_call.xml" value="0.26145833333333335" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/qrcode_scan.xml" value="0.17395833333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/rectangle.xml" value="0.31979166666666664" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/revision_icon.xml" value="0.1" />
@ -138,6 +139,7 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_shelvingdayofsale_row.xml" value="0.2375" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_shelvinglog_row.xml" value="0.21739130434782608" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_smarttag_row.xml" value="0.20153985507246377" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_toolbar_row.xml" value="0.15307971014492755" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_ubication_row.xml" value="0.11822916666666666" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_worker_image.xml" value="0.23177083333333334" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/shelvinglog_row.xml" value="0.18385416666666668" />

View File

@ -14,8 +14,11 @@ android {
applicationId "es.verdnatura"
minSdkVersion 21
targetSdkVersion 29
versionCode 94
versionName "7.3" //VERSION CODE 94. Se ve productos en balda y posibilidad de modificarlo.
versionCode 97
versionName "7.5.1" //VERSION CODE 97. Control de previa, Llamadas ok, menú ok y textos en iconos y imágenes.
//versionName "7.5" //VERSION CODE 96. Control de previa, Llamadas ok, menú ok y textos en iconos y imágenes.
//versionName "7.4" //VERSION CODE 95. Envio desde App enlaces correctos, un click controladores y llamadas sacador-controlador hecho pero no probado.
//versionName "7.3" //VERSION CODE 94. Se ve productos en balda y posibilidad de modificarlo.
//versionName "7.2.1" //VERSION CODE 93. Si eliges sector en V no aparece insertar las baldas.
//versionName "7.2" //VERSION CODE 92. Ordena sales en presacador por pickingOrder, ya no llama siempre para poner numero de baldas.
//versionName "7" //VERSION CODE 88. Se añade llamadas a parkingsales,incorpora poner numero de baldas

View File

@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 94,
"versionName": "7.3",
"versionCode": 97,
"versionName": "7.5.1",
"outputFile": "app-release.apk"
}
],

Binary file not shown.

View File

@ -4,15 +4,17 @@
package="es.verdnatura">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.PREVENT_POWER_KEY" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<!--
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="com.zebra.provider.READ"/>
<uses-permission android:name="com.zebra.provider.READ"/>-->
<queries>
<provider android:authorities="oem_info" />

View File

@ -89,20 +89,20 @@ class GetLoginUserCase(context: Context) : RestClient(context)
*/
//SALIX SERGIO MENSAJE : PARA NO ENVIAR MENSAJES A COMERCIALES PONGO QUE LAS MODIFICACIONES SE ENVIAN AL CANAL CREADO.
fun sendChekingPresence(token:String,workerId:Int,message:String) : Call<Boolean>{
/*fun sendChekingPresence(token:String,workerId:Int,message:String) : Call<Boolean>{
return salixClient!!.sendChekingPresence(content_type = "application/json", authorization = token, params = SalixMessageVO(workerId = workerId,message = message))
}
}*/
// SERGIO: PARA DESARROLLO SE DESCOMENTA ESTAS LÍNEAS Y SE COMENTAN LAS DE ARRIBA
/* fun sendChekingPresence(token: String, workerId: Int, message: String): Call<Boolean>
fun sendChekingPresence(token: String, workerId: Int, message: String): Call<Boolean>
{
return salixClient!!.sendGroup(
content_type = "application/json",
authorization = token,
params = SalixGrupo(to = "#android-test", message = message)
)
}*/
}
fun checkVersion(usuario: String, password: String, nameApp: String): Call<versionApp>
{

View File

@ -42,6 +42,22 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
)
}
fun sip_getExtension(
usuario: String,
password: String,
WorkerId: String
): Call<String> {
val params: ArrayList<String> = ArrayList()
params.add(WorkerId)
return restClient!!.sip_getExtension(
"json",
"1",
usuario,
password,
"application/json",
params
)
}
fun ticketOrCollection_checkFullyControlled(
usuario: String,
password: String,
@ -58,7 +74,6 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
params
)
}
fun collectionNew(
usuario: String,
password: String,

View File

@ -179,7 +179,7 @@ interface VerdnaturaService {
):
Call<CollectionVO>*/
@POST("almacennew/ticketOrCollection_checkFullyControlled")//REVISADA
@POST("almacennew/ticket_checkFullyControlled")//REVISADA
fun ticketOrCollection_checkFullyControlled(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@ -190,6 +190,17 @@ interface VerdnaturaService {
):
Call<String>
@POST("almacennew/sip_getExtension")//REVISADA
fun sip_getExtension(
@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>
//sergio: de momento se separa para ir viendo como funciona. El precontrol llamara a collectionTicketGet con otro parametro.
@POST("almacennew/collection_getTickets")//REVISADA
fun collection_getTickets(

View File

@ -6,7 +6,6 @@ import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.content.pm.PackageManager
import android.media.AudioManager
import android.os.Build
import android.os.Bundle
@ -21,20 +20,16 @@ import android.view.View
import android.view.ViewGroup
import androidx.activity.result.contract.ActivityResultContracts
import androidx.annotation.LayoutRes
import androidx.core.app.ActivityCompat
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.fragment.app.Fragment
import com.google.gson.Gson
import com.google.gson.JsonObject
import com.google.gson.reflect.TypeToken
import es.verdnatura.R
import es.verdnatura.domain.toast
import es.verdnatura.presentation.common.mediaCurrentVolume
import es.verdnatura.presentation.common.mediaMaxVolume
import org.json.JSONObject
import org.koin.androidx.viewmodel.ext.android.viewModel
import timber.log.Timber
import java.text.SimpleDateFormat
import java.util.*
import kotlin.reflect.KClass
@ -120,6 +115,7 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
runSound()
//requestRecordAudioPermission()
requestRecordAudioPermissionNew()
requestCallPhonePermissionNew()
init()
}
@ -180,7 +176,37 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
lifecycle.addObserver(this@BaseFragment.viewModel)
addBindingVariables()
}
fun getTooltip(image: Int):String {
return when (image) {
//itemCard
R.drawable.ic_autorenew_black_24dp -> "Recarga datos del elemento escaneado/seleccionado"
R.drawable.ic_history_black_24dp -> "Ver Histórico del ítem"
//presacador
R.drawable.ic_local_parking_black_24dp->"Permite aparcar ticket/carro"
//collection
R.drawable.ic_print_black_24dp->"Imprime ticket"
R.drawable.ic_playlist_add_black_24dp->"Añade ítem"
R.drawable.face_man_outline->"Visualiza la foto del sacador"
R.drawable.phone_call->"Realiza llamada al sacador"
R.drawable.car->"Permite coger vehículo"
R.drawable.car_off->"Permite dejar el vehículo"
//REPETIDO:R.drawable.ic_history_black_24dp->"Realiza llamada al sacador"
//sacador
R.drawable.ic_add_black_24dp->"Genera colección para sacar"
//REPETIDO: R.drawable.car->"Permite coger vehículo"
//ubicador:
//REPETIDO: R.drawable.ic_add_black_24dp->"Genera colección para sacar"
//REPETIDO: ic_autorenew_black_24dp
//historico articulo
R.drawable.ic_transaction->"Ver filtro "
R.drawable.alpha_f_circle_outline->"Ver movimientos de Faltas"
R.drawable.alpha_b_circle_outline->"Ver movimientos de Basura"
else -> {""}
}
}
override fun onInit(status: Int) {
if (status == TextToSpeech.SUCCESS) {
@ -374,6 +400,23 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
}
}
}*/
private fun requestCallPhonePermission(){
val permissionLauncher = registerForActivityResult(
ActivityResultContracts.RequestPermission()
)
{ isGranted ->
if (isGranted) {
Timber.i("permisos ok")
}
else {
Timber.i("Denegados permisos")
}
}
permissionLauncher.launch(Manifest.permission.CALL_PHONE)
}
private fun requestRecordAudioPermissionNew() {
val permissionLauncher = registerForActivityResult(
@ -391,7 +434,23 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
permissionLauncher.launch(Manifest.permission.RECORD_AUDIO)
}
private fun requestCallPhonePermissionNew() {
val permissionLauncher = registerForActivityResult(
ActivityResultContracts.RequestPermission()
)
{ isGranted ->
if (isGranted) {
Timber.i("permisos ok")
}
else {
Timber.i("Denegados permisos")
}
}
permissionLauncher.launch(Manifest.permission.CALL_PHONE)
}
fun cancelSpeech() {
if (mSpeechRecognizer != null) {
mSpeechRecognizer!!.destroy()

View File

@ -0,0 +1,59 @@
package es.verdnatura.presentation.common
import android.graphics.drawable.Drawable
import android.os.Build
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.ImageView
import androidx.annotation.RequiresApi
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.R
import es.verdnatura.databinding.ItemToolbarRowBinding
class ToolBarAdapterTooltip (
private val items: List<ImageView>,
private val onOptionsSelectedListener: OnOptionsSelectedListener
) : RecyclerView.Adapter<ToolBarAdapterTooltip.ItemHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
return ItemHolder(
ItemToolbarRowBinding.inflate(LayoutInflater.from(parent.context), parent, false)
)
}
override fun getItemCount() = items.size
@RequiresApi(Build.VERSION_CODES.O)
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
holder.bind(items[position])
}
inner class ItemHolder(
val binding: ItemToolbarRowBinding
) : RecyclerView.ViewHolder(binding.root) {
private val res = binding.root.context.resources
fun bind(item: ImageView) {
binding.apply {
imagebuttonIcon.setImageDrawable(item.drawable)
imagebuttonIcon.setOnClickListener {
onOptionsSelectedListener.onOptionsItemSelected(item.drawable)
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
imagebuttonIcon.tooltipText=item.tooltipText
}
}
}
}
}

View File

@ -22,6 +22,7 @@ interface OnOptionsSelectedListener {
fun onOptionsItemSelected(item: Drawable)
}
interface OnPasillerosItemClickListener {
fun onPasillerosItemClickListener(item: PasillerosItemVO,entryPoint:String)
}

View File

@ -1,20 +1,15 @@
package es.verdnatura.presentation.view.feature.articulo.fragment
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.buyers_fragment.*
import kotlinx.android.synthetic.main.fragment_item_card.*
import kotlinx.android.synthetic.main.fragment_item_card.binding.splashProgress
import kotlinx.android.synthetic.main.toolbar.**/
import android.app.AlertDialog
import android.content.Intent
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.util.Log
import android.os.Build
import android.view.View
import android.view.View.GONE
import android.view.inputmethod.EditorInfo
import android.widget.ImageView
import androidx.annotation.RequiresApi
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
@ -22,10 +17,8 @@ import es.verdnatura.databinding.FragmentItemCardBinding
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
import es.verdnatura.presentation.common.OnItemCardRowClickListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.loadUrl
import es.verdnatura.presentation.common.*
import es.verdnatura.presentation.common.ToolBarAdapterTooltip.*
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.component.CustomDialogList
@ -37,7 +30,6 @@ import es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
import es.verdnatura.presentation.view.feature.imageview.activity.ImageViewActivity
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
@ -57,12 +49,12 @@ class ItemCardFragment(
private var itemsPackingType: ArrayList<ItemPackingType> = ArrayList()
private var itemInfoG: ItemCardVO? = null
companion object {
fun newInstance(entryPoint: String) = ItemCardFragment(entryPoint)
}
private lateinit var customDialog: CustomDialog
private lateinit var customDialogInput: CustomDialogInput
private lateinit var customDialogList: CustomDialogList
@ -71,6 +63,7 @@ class ItemCardFragment(
override fun getLayoutId(): Int = R.layout.fragment_item_card
@RequiresApi(Build.VERSION_CODES.O)
override fun init() {
binding.itemcardLayout.visibility = View.GONE
@ -95,16 +88,75 @@ class ItemCardFragment(
}
private fun setToolBar() {
val listIcons: ArrayList<ImageView> = ArrayList()
val iconReload = ImageView(context)
iconReload.setImageResource(R.drawable.ic_autorenew_black_24dp)
val iconHistory = ImageView(context)
iconHistory.setImageResource(R.drawable.ic_history_black_24dp)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconReload.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
iconHistory.tooltipText = getTooltip(R.drawable.ic_history_black_24dp)
}
listIcons.add(iconReload)
listIcons.add(iconHistory)
/*
val listIcons:ArrayList<Drawable> = ArrayList()
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
val iconHistory : Drawable = resources.getDrawable(R.drawable.ic_history_black_24dp,resources.newTheme())
listIcons.add(iconReload)
listIcons.add(iconHistory)
//toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
listIcons.add(iconHistory)*/
binding.mainToolbar.toolbarIcons.adapter =
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
when (item) {
iconReload.drawable -> {
binding.splashProgress.visibility = View.VISIBLE
getItemCard(itemFk)
}
iconHistory.drawable -> {
if (itemFk.isNullOrEmpty()) {
"Escanea un item".toast(requireActivity())
} else {
(activity as MainActivity).onPasillerosItemClickListener(
PasillerosItemVO(title = "Historico"),
itemInfoG!!.id
)
}
}
}
/* if (item == iconReload.drawable) {
binding.splashProgress.visibility = View.VISIBLE
getItemCard(itemFk)
}
if (item == iconHistory.drawable) {
if (itemFk.isNullOrEmpty()) {
"Escanea un item".toast(requireActivity())
} else {
(activity as MainActivity).onPasillerosItemClickListener(
PasillerosItemVO(title = "Historico"),
itemInfoG!!.id
)
}
}*/
}
})
/* binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload){
@ -125,11 +177,13 @@ class ItemCardFragment(
}
}
})
})*/
//toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
binding.mainToolbar.toolbarIcons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
binding.mainToolbar.toolbarIcons.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
private fun setEvents() {
//edit_itemFk.requestFocus()
binding.editItemFk.requestFocus()
@ -182,7 +236,8 @@ class ItemCardFragment(
binding.itemcardLayout.visibility = GONE
binding.splashProgressTwo.visibility = GONE
binding.mainToolbar.toolbarTitle.text = "ItemCard"
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
} else {
@ -193,7 +248,9 @@ class ItemCardFragment(
binding.splashProgressTwo.visibility = GONE
binding.itemcardLayout.visibility = View.GONE
binding.mainToolbar.toolbarTitle.text = "ItemCard"
customDialog.setTitle("Sin resultados").setDescription("No hemos podido encontrar el articulo. Revisa el sector.").setOkButton("Cerrar"){
customDialog.setTitle("Sin resultados")
.setDescription("No hemos podido encontrar el articulo. Revisa el sector.")
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
}
@ -210,7 +267,8 @@ class ItemCardFragment(
response.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.GONE
if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
} else {
@ -228,11 +286,11 @@ class ItemCardFragment(
try {
itemsPackingType.add(ItemPackingType(item.code, item.description))
}catch (e:Exception){}
} catch (e: Exception) {
}
}
}
}
}}
private fun setItemCard(itemInfo: ItemCardVO) {
@ -247,27 +305,131 @@ class ItemCardFragment(
binding.itemcardTag3.text = itemInfo.value6
binding.itemcardTag4.text = itemInfo.value7 + " " + itemInfo.origin
listItemsRow = ArrayList()
listItemsRow.add(ItemCardRowVO(title = getString(R.string.total),value = itemInfo.total,isEditable = false))
listItemsRow.add(ItemCardRowVO(title = getString(R.string.Disponible),value = itemInfo.available,isEditable = false))
listItemsRow.add(ItemCardRowVO(title = getString(R.string.Ubicado),value = itemInfo.enAltillo,isEditable = false))
listItemsRow.add(ItemCardRowVO(title = getString(R.string.SINUBICAR),value = itemInfo.enNicho,isEditable = false, action = "itemStockUpdate"))
//sergio itemcard por item_getInfo
/* listItemsRow.add(
ItemCardRowVO(
title = getString(R.string.total),
value = itemInfo.total,
isEditable = false
)
)*/
listItemsRow.add(ItemCardRowVO(title = getString(R.string.total),value = itemInfo.visible,isEditable = false))
listItemsRow.add(
ItemCardRowVO(
title = getString(R.string.Disponible),
value = itemInfo.available,
isEditable = false
)
)
//sergio itemcard por item_getInfo
/* listItemsRow.add(
ItemCardRowVO(
title = getString(R.string.Ubicado),
value = itemInfo.enAltillo,
isEditable = false
)
)*/
listItemsRow.add(ItemCardRowVO(title = getString(R.string.Ubicado),value = itemInfo.vVisibleItemShelving,isEditable = false))
//sergio itemcard por item_getInfo
/* listItemsRow.add(
ItemCardRowVO(
title = getString(R.string.SINUBICAR),
value = itemInfo.enNicho,
isEditable = false,
action = "itemStockUpdate"
)
)*/
listItemsRow.add(ItemCardRowVO(title = getString(R.string.SINUBICAR),value = itemInfo.unlocated,isEditable = false, action = "itemStockUpdate"))
//EDITABLES
listItemsRow.add(ItemCardRowVO(title = "Artículos similares",isEditable = true, action = "itemProposal"))
listItemsRow.add(ItemCardRowVO(title = getString(R.string.DARALTA),value = "",isEditable = true, action = "itemStockUpdateAdd"))
listItemsRow.add(ItemCardRowVO(title = getString(R.string.DARBAJA),value = "",isEditable = true, action = "itemStockUpdateRemove"))
listItemsRow.add(ItemCardRowVO(title = getString(R.string.BuscarItem),value = "",isEditable = true, action = "buscarItem"))
listItemsRow.add(
ItemCardRowVO(
title = "Artículos similares",
isEditable = true,
action = "itemProposal"
)
)
listItemsRow.add(
ItemCardRowVO(
title = getString(R.string.DARALTA),
value = "",
isEditable = true,
action = "itemStockUpdateAdd"
)
)
listItemsRow.add(
ItemCardRowVO(
title = getString(R.string.DARBAJA),
value = "",
isEditable = true,
action = "itemStockUpdateRemove"
)
)
listItemsRow.add(
ItemCardRowVO(
title = getString(R.string.BuscarItem),
value = "",
isEditable = true,
action = "buscarItem"
)
)
//listItemsRow.add(ItemCardRowVO(title = "NICHO",value = itemInfo.nicho,isEditable = true, action = "itemPlacementSave"))
// listItemsRow.add(ItemCardRowVO(title = "RESERVA",value = itemInfo.reserva,isEditable = true, action = "itemPlacementSave"))
listItemsRow.add(ItemCardRowVO(title = getString(R.string.Grouping),value = itemInfo.grouping,isEditable = true, action = "updateGrouping"))
listItemsRow.add(ItemCardRowVO(title = getString(R.string.Packing),value = itemInfo.packing,isEditable = true, action = "updatePacking"))
listItemsRow.add(ItemCardRowVO(title = getString(R.string.MINIMO),value = itemInfo.min,isEditable = true, action = "itemSaveMin"))
listItemsRow.add(ItemCardRowVO(title = getString(R.string.Referencia),value = itemInfo.referencia,isEditable = true, action = "item_saveReference"))
listItemsRow.add(ItemCardRowVO(title = getString(R.string.Barcode),barcodes = itemInfo.barcodes,isEditable = true, action = "toBarcode"))
listItemsRow.add(
ItemCardRowVO(
title = getString(R.string.Grouping),
value = itemInfo.grouping,
isEditable = true,
action = "updateGrouping"
)
)
listItemsRow.add(
ItemCardRowVO(
title = getString(R.string.Packing),
value = itemInfo.packing,
isEditable = true,
action = "updatePacking"
)
)
listItemsRow.add(
ItemCardRowVO(
title = getString(R.string.MINIMO),
value = itemInfo.min,
isEditable = true,
action = "itemSaveMin"
)
)
listItemsRow.add(
ItemCardRowVO(
title = getString(R.string.Referencia),
value = itemInfo.referencia,
isEditable = true,
action = "item_saveReference"
)
)
listItemsRow.add(
ItemCardRowVO(
title = getString(R.string.Barcode),
barcodes = itemInfo.barcodes,
isEditable = true,
action = "toBarcode"
)
)
//sergio para itemTypePacking
listItemsRow.add(ItemCardRowVO(title = getString(R.string.tipodeencajado),value = itemInfo.itemPackingTypeFk,isEditable = true, action = "updateSector"))
listItemsRow.add(
ItemCardRowVO(
title = getString(R.string.tipodeencajado),
value = itemInfo.itemPackingTypeFk,
isEditable = true,
action = "updateSector"
)
)
// listItemsRow.add(ItemCardRowVO(title = "Artículos similares",value = itemInfo.itemPackingTypeFk,isEditable = true, action = "itemProposal"))
@ -284,8 +446,7 @@ class ItemCardFragment(
), itemFk
)
}
else{
} else {
if (item.action == "updateSector") {
showDialogSelectItemTypePacking()
} else {
@ -381,7 +542,8 @@ class ItemCardFragment(
//itemcard_recyclerview.adapter = adapter
binding.itemcardRecyclerview.adapter = adapter
//itemcard_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
binding.itemcardRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
binding.itemcardRecyclerview.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
binding.scrollView.post {
val position = IntArray(2)
if (binding.itemcardImage != null) {
@ -399,11 +561,44 @@ class ItemCardFragment(
// "itemStockUpdate" -> prepareItemStockUpdate(item,value)
"itemStockUpdateAdd" -> prepareItemStockUpdate2(item, value)
"itemStockUpdateRemove" -> prepareItemStockUpdate2(item, value)
"itemPlacementSave" -> viewModel.itemPlacementSave(itemFk = itemFk, warehouseFk = warehouseFk, user = user, password = password, value = value,"itemPlacementSave")
"updateGrouping" -> viewModel.updateGrouping(itemFk = itemFk, user = user, password = password, value = value,warehouseFk = warehouseFk,"buy_updateGrouping")
"updatePacking" -> viewModel.updatePacking(itemFk = itemFk, user = user, password = password, value = value,warehouseFk = warehouseFk,"buy_updatePacking")
"itemSaveMin" -> viewModel.itemSaveMin(itemFk = itemFk, user = user, password = password, value = value,"itemSaveMin")
"item_saveReference"->viewModel.item_saveReference(itemFk = itemFk, user = user, password = password, value = value,"item_saveReference")
"itemPlacementSave" -> viewModel.itemPlacementSave(
itemFk = itemFk,
warehouseFk = warehouseFk,
user = user,
password = password,
value = value,
"itemPlacementSave"
)
"updateGrouping" -> viewModel.updateGrouping(
itemFk = itemFk,
user = user,
password = password,
value = value,
warehouseFk = warehouseFk,
"buy_updateGrouping"
)
"updatePacking" -> viewModel.updatePacking(
itemFk = itemFk,
user = user,
password = password,
value = value,
warehouseFk = warehouseFk,
"buy_updatePacking"
)
"itemSaveMin" -> viewModel.itemSaveMin(
itemFk = itemFk,
user = user,
password = password,
value = value,
"itemSaveMin"
)
"item_saveReference" -> viewModel.item_saveReference(
itemFk = itemFk,
user = user,
password = password,
value = value,
"item_saveReference"
)
}
@ -473,14 +668,31 @@ class ItemCardFragment(
try {
if (itemB.action == "itemStockUpdateRemove") {
customDialogTwo.setTitle(itemB.title!!).setDescription("Indica la causa de eliminar stock:").setOkButton("Falta"){
viewModel.itemTrash(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "0","itemTrash")
customDialogTwo.setTitle(itemB.title!!)
.setDescription("Indica la causa de eliminar stock:").setOkButton("Falta") {
viewModel.itemTrash(
itemFk = itemFk,
warehouseFk = warehouseFk,
user = user,
password = password,
newValue = value,
isTrash = "0",
"itemTrash"
)
//changeOfflineValue(itemB,value, listBarcodes)
showProgress()
customDialogTwo.dismiss()
}.setOkButtonTwo("Basura") {
viewModel.itemTrash(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "1","itemTrash")
viewModel.itemTrash(
itemFk = itemFk,
warehouseFk = warehouseFk,
user = user,
password = password,
newValue = value,
isTrash = "1",
"itemTrash"
)
//changeOfflineValue(itemB,value, listBarcodes)
showProgress()
customDialogTwo.dismiss()
@ -492,11 +704,20 @@ class ItemCardFragment(
} else {
//changeOfflineValue(itemB,value, listBarcodes)
showProgress()
viewModel.itemTrash(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = (value.toInt() * -1).toString(),isTrash = "0","itemTrash")
viewModel.itemTrash(
itemFk = itemFk,
warehouseFk = warehouseFk,
user = user,
password = password,
newValue = (value.toInt() * -1).toString(),
isTrash = "0",
"itemTrash"
)
}
} catch (e: Exception) {
binding.itemcardLayout.visibility = View.GONE
customDialog.setTitle("Error").setDescription("El elemento introducido no es un número").setKoButton("Cancelar"){
customDialog.setTitle("Error").setDescription("El elemento introducido no es un número")
.setKoButton("Cancelar") {
customDialog.dismiss()
}.show()
}
@ -536,7 +757,8 @@ class ItemCardFragment(
})
customDialogList.getRecyclerView().adapter = barcodeAdapter
customDialogList.getRecyclerView().layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
customDialogList.getRecyclerView().layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
}
private fun updateBarcode(code: String, delete: String, item: ItemCardRowVO) {
@ -552,7 +774,14 @@ class ItemCardFragment(
} else {
listBarcodes.add(BarcodeVO(code))
}
viewModel.barcodesEdit(itemFk = itemInfoG!!.id, user = user, password = password, value = code, delete = delete,"itemBarcode_update")
viewModel.barcodesEdit(
itemFk = itemInfoG!!.id,
user = user,
password = password,
value = code,
delete = delete,
"itemBarcode_update"
)
// viewModel.barcodesEdit(itemFk = itemFk, user = user, password = password, value = code, delete = delete,"itemBarcode_update")
barcodeAdapter!!.notifyDataSetChanged()
//changeOfflineValue(item,"", listBarcodes)
@ -563,11 +792,13 @@ class ItemCardFragment(
var array = arrayOfNulls<String>(itemsPackingType.size)
for (indice in array.indices) {
array[indice]=itemsPackingType[indice].code + " : "+itemsPackingType[indice].description
array[indice] =
itemsPackingType[indice].code + " : " + itemsPackingType[indice].description
}
val builder = AlertDialog.Builder(this.context)
builder.setTitle(getString(R.string.mensajeseleccionencajado))
.setItems(array
.setItems(
array
) { _, position ->
updateItemPackingType(itemsPackingType[position].code.toString())
}
@ -577,7 +808,13 @@ class ItemCardFragment(
private fun updateItemPackingType(itemPackingType: String) {
binding.splashProgress.visibility = View.VISIBLE
viewModel.updatePackingType(this.itemFk,user,password,itemPackingType,"item_updatePackingType")
viewModel.updatePackingType(
this.itemFk,
user,
password,
itemPackingType,
"item_updatePackingType"
)
}
}

View File

@ -58,7 +58,7 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
if (response.body() != null){
_itemcard.value = response.body()!!
}else{
_itemcard.value = ItemCardVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_itemcard.value = ItemCardVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}
}
@ -69,7 +69,7 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
getItemCardUserCase.item_getSimilar(user,password,itemFk,warehouseFk,vShipped,vIsShowedByType).enqueue(object :Callback<List<ItemProposal>>{
override fun onFailure(call: Call<List<ItemProposal>>, t: Throwable) {
val listError:ArrayList<ItemProposal> = ArrayList()
listError.add(ItemProposal(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
listError.add(ItemProposal(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_itemProposallist.value = ItemProposalList(listError)
}
@ -80,7 +80,7 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
}else{
val listError:ArrayList<ItemProposal> = ArrayList()
listError.add(ItemProposal(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
listError.add(ItemProposal(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_itemProposallist.value = ItemProposalList(listError)
}
@ -95,7 +95,7 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
Callback<List<ItemPackingType>>{
override fun onFailure(call: Call<List<ItemPackingType>>, t: Throwable) {
val listError:ArrayList<ItemPackingType> = ArrayList()
listError.add(ItemPackingType(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
listError.add(ItemPackingType(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_itemspackinglist.value = ItemPackingTypeList(listError)
}
@ -105,7 +105,7 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
}else{
val listError:ArrayList<ItemPackingType> = ArrayList()
listError.add(ItemPackingType(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
listError.add(ItemPackingType(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_itemspackinglist.value = ItemPackingTypeList(listError)
}
}
@ -136,12 +136,12 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
fun itemTrash(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String,callFunction:String){
getItemCardUserCase.itemTrash(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -154,12 +154,12 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
fun itemPlacementSave(itemFk:String,warehouseFk:String,user:String,password:String,value:String,callFunction:String){
getItemCardUserCase.itemPlacementSave(user,password,itemFk,warehouseFk,value).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -172,12 +172,12 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
fun updateGrouping(itemFk:String,user:String,password:String,value:String,warehouseFk: String,callFunction:String){
getItemCardUserCase.updateGrouping(user,password,itemFk,value,warehouseFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -190,12 +190,12 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
fun updatePacking(itemFk:String,user:String,password:String,value:String,warehouseFk: String,callFunction:String){
getItemCardUserCase.updatePacking(user,password,itemFk,value,warehouseFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -209,12 +209,12 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
fun updatePackingType(itemFk:String,user:String,password:String,itemPackingType:String,callFunction:String){
getItemCardUserCase.updatePackingType(user,password,itemFk,itemPackingType).enqueue(object : Callback<Boolean>{
override fun onFailure(call: Call<Boolean>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<Boolean>, response: Response<Boolean>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
//if (response.body()=="Finish"){
// //Log.i("VERDNATURA:","Fisnih encontrado")}
@ -229,12 +229,12 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
fun itemSaveMin(itemFk:String,user:String,password:String,value:String,callFunction:String){
getItemCardUserCase.itemSaveMin(user,password,itemFk,value).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -247,13 +247,13 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
fun item_saveReference(itemFk:String,user:String,password:String,value:String,callFunction:String){
getItemCardUserCase.item_saveReference(user,password,itemFk,value).enqueue(object : Callback<Unit>{
override fun onFailure(call: Call<Unit>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<Unit>, response: Response<Unit>) {
if (!response.isSuccessful){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false)
}
@ -266,12 +266,12 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
fun barcodesEdit(itemFk:String,user:String,password:String,value:String,delete:String,callFunction:String){
getItemCardUserCase.barcodes_edit(user,password,itemFk,value,delete).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}

View File

@ -11,7 +11,6 @@ import androidx.core.content.ContextCompat
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentInventaryBinding
import es.verdnatura.databinding.FragmentItemproposalBinding
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnItemProposalClickListener

View File

@ -31,7 +31,15 @@ class ItemCardVO (
var urlImage200:String = "",
var urlImage:String = "",
var itemPackingTypeFk:String =" ",
var referencia:String=""
var referencia:String="",
//sergio para modificar la llamada de itemCard a item_getInfo
var vVisibleItemShelving:String = "0", // = enAltillo
var visible :String = "0",// = total
var unlocated:String = "0" //= enNicho
)
class ItemCardRowVO (

View File

@ -98,20 +98,6 @@ class BufferFragment(
)
/* if (entryPoint.equals("Vaciado buffer")){
viewModel.buffer_setTypeByName(user,password, binding.scanInput.text.toString(),"UNLOADING","buffer_setTypeByName")
}
if (entryPoint.equals("Llenado buffer")){
viewModel.buffer_setTypeByName(user,password, binding.scanInput.text.toString(),"LOADING","buffer_setTypeByName")
}
if (entryPoint.equals("Acumulación buffer")){
viewModel.buffer_setTypeByName(user,password, binding.scanInput.text.toString(),"ACCUMULATION","buffer_setTypeByName")
}
if (entryPoint.equals("Desactivado buffer")){
viewModel.buffer_setTypeByName(user,password, binding.scanInput.text.toString(),"DISABLED","buffer_setTypeByName")
}*/
}
binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard( binding.scanInput)

View File

@ -8,6 +8,7 @@ import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO
import retrofit2.Call
import retrofit2.Callback
@ -41,7 +42,7 @@ class BufferFragmentViewModel(context: Context) : BaseViewModel() {
_itembuffertype.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
@ -58,7 +59,7 @@ class BufferFragmentViewModel(context: Context) : BaseViewModel() {
//_bufferresponse.value = false
_itembuffertype.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,"Error al realizar la operación"))
errorMessage = getMessageFromAllResponse(nameofFunction(this),"Error al realizar la operación"))
}
@ -73,7 +74,7 @@ class BufferFragmentViewModel(context: Context) : BaseViewModel() {
override fun onFailure(call: Call<String>, t: Throwable) {
_bufferloadresponse.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
@ -81,14 +82,14 @@ class BufferFragmentViewModel(context: Context) : BaseViewModel() {
if (!response.isSuccessful){
_bufferloadresponse.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message()!!))
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()!!))
}else {
if (response.body()!!.isNullOrEmpty()) {
_bufferloadresponse.value = ResponseItemVO(
isError = true,
errorMessage =
getMessageFromAllResponse(callFunction,response.message()!!)
getMessageFromAllResponse(nameofFunction(this),response.message()!!)
)
} else {
_bufferloadresponse.value = ResponseItemVO(

View File

@ -40,7 +40,7 @@ class BuscarItemFragment(
override fun getLayoutId(): Int = R.layout.fragment_buscar_item
override fun init() {
//requireActivity().main_bottom_navigation.visibility = View.GONE
(activity as MainActivity).hideBottomNavigation(GONE)
binding.mainToolbar.toolbarTitle.text = getString(R.string.getubicaition)
customDialog = CustomDialog(requireContext())

View File

@ -8,6 +8,7 @@ import es.verdnatura.domain.GetBuscarItemUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
import es.verdnatura.presentation.view.feature.buscaritem.model.LocationListVO
@ -31,7 +32,7 @@ class BuscarItemViewModel(context: Context) : BaseViewModel() {
getBuscarItemUserCase.searchItemsUbicador(user,password,itemFk).enqueue(object : Callback<List<ItemLocationVO>> {
override fun onFailure(call: Call<List<ItemLocationVO>>, t: Throwable) {
val listError:ArrayList<ItemLocationVO> = ArrayList()
listError.add(ItemLocationVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
listError.add(ItemLocationVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_locationList.value = LocationListVO(listError)
}
@ -43,7 +44,7 @@ class BuscarItemViewModel(context: Context) : BaseViewModel() {
_locationList.value = response.body()?.let { LocationListVO(it) }
}else{
val listError:ArrayList<ItemLocationVO> = ArrayList()
listError.add(ItemLocationVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
listError.add(ItemLocationVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_locationList.value = LocationListVO(listError)
}
}

View File

@ -3,8 +3,10 @@ package es.verdnatura.presentation.view.feature.calidad.fragment
import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.os.Build
import android.os.Bundle
import android.view.View
import android.widget.ImageView
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
@ -15,6 +17,7 @@ import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnAjustesItemClickListener
import es.verdnatura.presentation.common.OnBuyerSelectedListener
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.ajustes.adapter.AjustesAdapter
import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO
@ -50,8 +53,6 @@ class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(Buyer
super.onAttach(context)
}
override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
user = prefs.getString(USER,"").toString()
@ -75,16 +76,31 @@ class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(Buyer
}
private fun setToolBar(){
val listIcons:ArrayList<Drawable> = ArrayList()
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
listIcons.add(iconReload)
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload){
binding.splashProgress.visibility= View.VISIBLE
viewModel.itemShelvingBuyerGet(user = user,password = password,"itemShelving_BuyerGet")
val listIcons: ArrayList<ImageView> = ArrayList()
val iconReload = ImageView(context)
iconReload.setImageResource(R.drawable.ic_autorenew_black_24dp)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconReload.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
}
listIcons.add(iconReload)
/* val listIcons:ArrayList<Drawable> = ArrayList()
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
listIcons.add(iconReload)*/
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons,object: OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
when(item){
iconReload.drawable->{
binding.splashProgress.visibility= View.VISIBLE
viewModel.itemShelvingBuyerGet(user = user,password = password,"itemShelving_BuyerGet")
}
}
}
})
binding.mainToolbar.toolbarIcons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)

View File

@ -7,6 +7,7 @@ import es.verdnatura.domain.GetQualityUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.view.feature.calidad.model.BuyerListVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
import es.verdnatura.presentation.view.feature.inventario.model.InventaryListVO
@ -28,7 +29,7 @@ class BuyersViewModel(context: Context) : BaseViewModel() {
Callback<List<BuyerVO>> {
override fun onFailure(call: Call<List<BuyerVO>>, t: Throwable) {
val listError:ArrayList<BuyerVO> = ArrayList()
listError.add(BuyerVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
listError.add(BuyerVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_buyersList.value = BuyerListVO(listError)
}
@ -40,7 +41,7 @@ class BuyersViewModel(context: Context) : BaseViewModel() {
_buyersList.value = response.body()?.let { BuyerListVO(it) }
}else{
val listError:ArrayList<BuyerVO> = ArrayList()
listError.add(BuyerVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,response.message())))
listError.add(BuyerVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),response.message())))
_buyersList.value = BuyerListVO(listError)
}
}

View File

@ -3,9 +3,11 @@ package es.verdnatura.presentation.view.feature.calidad.fragment
import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.os.Build
import android.os.Bundle
import android.view.View
import android.view.inputmethod.EditorInfo
import android.widget.ImageView
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
@ -86,10 +88,20 @@ class QaualityFragment(
}
private fun setToolBar(){
val listIcons:ArrayList<Drawable> = ArrayList()
/*val listIcons:ArrayList<Drawable> = ArrayList()
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
listIcons.add(iconReload)
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
*/
val listIcons: ArrayList<ImageView> = ArrayList()
val iconReload = ImageView(context)
iconReload.setImageResource(R.drawable.ic_autorenew_black_24dp)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconReload.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
}
listIcons.add(iconReload)
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons,object: OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload){
binding.splashProgress.visibility = View.VISIBLE

View File

@ -7,6 +7,7 @@ import es.verdnatura.domain.GetQualityUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerListVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
@ -35,7 +36,7 @@ class QaualityViewModel(context: Context) : BaseViewModel() {
Callback<List<ItemBuyerVO>> {
override fun onFailure(call: Call<List<ItemBuyerVO>>, t: Throwable) {
val listError:ArrayList<ItemBuyerVO> = ArrayList()
listError.add(ItemBuyerVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
listError.add(ItemBuyerVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_buyersList.value = ItemBuyerListVO(listError)
}
@ -47,7 +48,7 @@ class QaualityViewModel(context: Context) : BaseViewModel() {
_buyersList.value = response.body()?.let { ItemBuyerListVO(it) }
}else{
val listError:ArrayList<ItemBuyerVO> = ArrayList()
listError.add(ItemBuyerVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
listError.add(ItemBuyerVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_buyersList.value = ItemBuyerListVO(listError)
}
}

View File

@ -5,17 +5,15 @@ import android.graphics.Color
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import androidx.core.content.ContextCompat.getColor
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.R
import es.verdnatura.databinding.ItemArticleRowBinding
import es.verdnatura.domain.toast
import es.verdnatura.presentation.common.*
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
import android.graphics.drawable.GradientDrawable
import es.verdnatura.presentation.common.*
class SaleAdapter(
@ -50,7 +48,8 @@ class SaleAdapter(
if (sale.pickedQuantity.isNullOrEmpty())
sale.pickedQuantity = "0"
val childLayoutManager = LinearLayoutManager(context!!, RecyclerView.HORIZONTAL, false)
val childLayoutManager =
LinearLayoutManager(context!!, RecyclerView.HORIZONTAL, false)
itemArticlePlacements.apply {
layoutManager = childLayoutManager
@ -63,7 +62,11 @@ class SaleAdapter(
}
itemArticleItemFk.setOnClickListener {
onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = "Consultar artículo"),sale.itemFk)
onPasillerosItemClickListener.onPasillerosItemClickListener(
PasillerosItemVO(
title = "Consultar artículo"
), sale.itemFk
)
}
itemPackingItemFk.setOnClickListener {
@ -122,40 +125,117 @@ class SaleAdapter(
//SEMAFORO
if (sale.isPreviousPrepared == "1") {
itemArticleRowSemaforoPre.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_dark_sky_blue))
itemArticleRowSemaforoPre.setBackgroundColor(
getColor(
context!!,
R.color.verdnatura_dark_sky_blue
)
)
} else {
itemArticleRowSemaforoPre.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_warm_grey))
itemArticleRowSemaforoPre.setBackgroundColor(
getColor(
context!!,
R.color.verdnatura_warm_grey
)
)
}
if (sale.isPrepared == "1") {
itemArticleRowSemaforoSac.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_pumpkin_orange))
itemArticleRowSemaforoSac.setBackgroundColor(
getColor(
context!!,
R.color.verdnatura_pumpkin_orange
)
)
} else {
itemArticleRowSemaforoSac.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_warm_grey))
itemArticleRowSemaforoSac.setBackgroundColor(
getColor(
context!!,
R.color.verdnatura_warm_grey
)
)
}
if (sale.isControlled == "1") {
itemArticleRowSemaforoCon.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_dark_mint))
itemArticleRowSemaforoCon.setBackgroundColor(
getColor(
context!!,
R.color.verdnatura_dark_mint
)
)
} else {
itemArticleRowSemaforoCon.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_warm_grey))
itemArticleRowSemaforoCon.setBackgroundColor(
getColor(
context!!,
R.color.verdnatura_warm_grey
)
)
}
if (sale.isControlled == "1") {
contentLayout.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_dark_mint))
contentLayout.setBackgroundColor(
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(ContextCompat.getColor(context!!, R.color.verdnatura_dark_sky_blue))
}else{
contentLayout.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_black))
}
contentLayout.setBackgroundColor(
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(
getColor(
context!!,
R.color.verdnatura_dark_mint_light_precontrolled
)
)
itemArticleRowSemaforoCon.setBackgroundColor(
getColor(
context!!,
R.color.verdnatura_dark_mint_light_precontrolled
)
)
} else if (sale.isPreviousPrepared == "1") {
contentLayout.setBackgroundColor(
getColor(
context!!,
R.color.verdnatura_dark_sky_blue
)
)
} else {
contentLayout.setBackgroundColor(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))
itemArticleRowSemaforoCon.setBackgroundColor(
getColor(
context!!,
R.color.verdnatura_white
)
)
contentLayout.setBackgroundColor(
getColor(
context!!,
R.color.verdnatura_dark_mint_light
)
)
}
@ -176,12 +256,24 @@ class SaleAdapter(
"BLANCO" -> itemTicketColor.setBackgroundColor(Color.WHITE)
// "NEGRO"-> itemTicketColor.setBackgroundResource((R.drawable.rectangle))
"NEGRO"-> {itemTicketColor.setBackgroundColor(Color.BLACK)
itemTicketColor.setBackgroundResource((R.drawable.border))}
"NEGRO" -> {
itemTicketColor.setBackgroundColor(Color.BLACK)
itemTicketColor.setBackgroundResource((R.drawable.border))
}
"VIOLETA" -> itemTicketColor.setBackgroundColor(0xFF4c2882.toInt())
"GRIS" -> itemTicketColor.setBackgroundColor(Color.GRAY)
"ORANGE"-> itemTicketColor.setBackgroundColor(getColor(context!!,android.R.color.holo_orange_light))
"MORADO"-> itemTicketColor.setBackgroundColor(getColor(context!!,android.R.color.holo_purple))
"ORANGE" -> itemTicketColor.setBackgroundColor(
getColor(
context!!,
android.R.color.holo_orange_light
)
)
"MORADO" -> itemTicketColor.setBackgroundColor(
getColor(
context!!,
android.R.color.holo_purple
)
)
"CELESTE" -> itemTicketColor.setBackgroundColor(0xFF5b85F5.toInt())
"ROSA" -> itemTicketColor.setBackgroundColor(0xFFfc0fc0.toInt())
"DORADO" -> itemTicketColor.setBackgroundColor(0xFFb8860b.toInt())
@ -192,7 +284,6 @@ class SaleAdapter(
"BEIGE" -> itemTicketColor.setBackgroundColor(0xFFf2e7bf.toInt())
else -> {
}

View File

@ -4,9 +4,12 @@ package es.verdnatura.presentation.view.feature.collection.fragment
import kotlinx.android.synthetic.main.fragment_collection.*
import kotlinx.android.synthetic.main.toolbar.**/
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.media.MediaPlayer
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.speech.SpeechRecognizer
import android.util.Log
@ -15,6 +18,7 @@ import android.view.View.GONE
import android.view.View.VISIBLE
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
import android.widget.ImageView
import android.widget.Toast
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
@ -85,6 +89,10 @@ class CollectionFragment(
private var positionIncreaseQuantity = 0
private var positionReject = 0
private var quantityIncrease = ""
private var quantityReject = ""
private var typeCollectionMissing = ""
private var positionCollectionMissing = 0
private var quantityCollectionMissing = ""
private var isMarking = false
//private var myKM: KeyguardManager? = null
@ -166,16 +174,8 @@ class CollectionFragment(
(activity as MainActivity).hideBottomNavigation(View.GONE)
if (binding.splashProgress != null) binding.splashProgress.visibility = VISIBLE
setEvents()
if (type != PRECHECKER) {
setToolBar()
} else {
binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE
binding.scanInput.visibility = View.GONE
}
if (type == SACADOR && voz != "NO") {
setSpeak()
@ -200,47 +200,76 @@ class CollectionFragment(
binding.mainToolbar.toolbarTitle.text = collection.collectionFk
}
val listIcons: ArrayList<Drawable> = ArrayList()
/* val listIcons: ArrayList<Drawable> = ArrayList()
val iconPrint: Drawable =
resources.getDrawable(R.drawable.ic_print_black_24dp, resources.newTheme())
/*val iconSearch: Drawable =
resources.getDrawable(R.drawable.ic_visibility, resources.newTheme())*/
val iconAdd: Drawable =
resources.getDrawable(R.drawable.ic_playlist_add_black_24dp, resources.newTheme())
val iconFace: Drawable =
resources.getDrawable(R.drawable.face_man_outline, resources.newTheme())
val iconPhone: Drawable =
resources.getDrawable(R.drawable.phone_call, resources.newTheme())
*/
/*val iconSearch: Drawable =
resources.getDrawable(R.drawable.ic_visibility, resources.newTheme())*/
/* val iconShelve:Drawable =
resources.getDrawable(R.drawable.alpha_b_circle_outline, resources.newTheme())*/
//listIcons.add(iconShelve)
val listIcons: ArrayList<ImageView> = ArrayList()
val iconPrint = ImageView(context)
iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
val iconAdd = ImageView(context)
iconAdd.setImageResource(R.drawable.ic_playlist_add_black_24dp)
val iconFace = ImageView(context)
iconFace.setImageResource(R.drawable.face_man_outline)
val iconPhone = ImageView(context)
iconPhone.setImageResource(R.drawable.phone_call)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconPrint.tooltipText=getTooltip(R.drawable.ic_local_parking_black_24dp)
iconAdd.tooltipText=getTooltip(R.drawable.ic_playlist_add_black_24dp)
iconFace.tooltipText=getTooltip(R.drawable.face_man_outline)
iconPhone.tooltipText=getTooltip(R.drawable.phone_call)
}
if (type.equals("CHECKER")){
listIcons.add(iconPhone)
}
listIcons.add(iconFace)
listIcons.add(iconPrint)
// listIcons.add(iconSearch)
listIcons.add(iconAdd)
//listIcons.add(iconSearch)
binding.mainToolbar.toolbarIcons.adapter =
ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconPrint) {
print()
}/* else if (item == iconSearch) {
showDisponibility()
} */ else if (item == iconAdd) {
addItem()
} else if (item == iconFace) {
showUser()
}/*else if(item== iconShelve){
ticketCollection_setUsedShelves()
}*/
when (item){
iconPrint.drawable->print()
iconAdd.drawable->addItem()
iconFace.drawable->showUser()
iconPhone.drawable->getExtensionFromUser()
}
}
})
binding.mainToolbar.toolbarIcons.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
private fun getExtensionFromUser() {
binding.splashProgress.visibility=VISIBLE
viewModel.sip_getExtension(user,password, workerFkFromTicket,"sip_getExtension")
}
private fun scanRequest() {
if (binding.scanInput != null) {
binding.scanInput.requestFocus()
@ -306,8 +335,8 @@ class CollectionFragment(
isMarking = false
binding.collectionSwipe.isRefreshing = false
if (type != PRECHECKER) {
if (binding.splashProgress != null) binding.splashProgress.visibility = VISIBLE
// if (type != PRECHECKER) {
binding.splashProgress.visibility = VISIBLE
viewModel.collectionTicketGet(
user,
password,
@ -316,7 +345,7 @@ class CollectionFragment(
type, "collection_getTickets"
)
binding.collectionSwipe.isRefreshing = false
}
//}
}
}
@ -491,15 +520,12 @@ class CollectionFragment(
if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage, isError = true)
/* customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Aceptar") {
customDialog.dismiss()
}.show()*/
} else {
//incresaseSuccesful()
/*FALTA RELLENAR*/
TODO("FALTA ADAPTAR LA FUNCION MISSING()")
// missingTrashSuccesful()
missingTrashSuccesful()
} //sergio:esto ya estaba
/* binding.splashProgress.visibility = View.VISIBLE
@ -522,12 +548,25 @@ class CollectionFragment(
/* binding.splashProgress.visibility = View.VISIBLE
viewModel.collectionTicketGet(user,password,collection.collectionFk,sectorFk)*/
})
responseGetExtensionFromUserId.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility=GONE
if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage+"Usuario:"+workerFkFromTicket, isError = true)
} else {
callPicker(it.response)
}
})
mistakeList.observe(viewLifecycleOwner, Observer {
if (binding.splashProgress != null) binding.splashProgress.visibility = View.GONE
if (!goBack) showMistakeList(it.list)
if (binding.splashProgress != null) binding.splashProgress.visibility = GONE
/*sergio:se quita esta comprobacion if (!goBack) */
showMistakeList(it.list)
goBack = false
})
//sergio: para si hay algun ticket por revisar
@ -579,6 +618,22 @@ class CollectionFragment(
}
}
private fun callPicker(extensionNumber:String) {
try {
val intent = Intent(Intent.ACTION_DIAL).apply {
data = Uri.parse("tel:$extensionNumber")
}
startActivity(intent)
}catch (e:Exception){
d("VERDNATURA::"+e.message)
}
}
private fun getSalePerson(ticketFk: String): String {
var salePerson = ""
@ -900,7 +955,7 @@ class CollectionFragment(
View.VISIBLE
storedPosition = 0
storedBackPosition = 0
if (type != PRECHECKER) {
// if (type != PRECHECKER) {
isMarking = false
viewModel.collectionTicketGet(
user,
@ -919,9 +974,9 @@ class CollectionFragment(
"ticketOrCollection_checkFullyControlled"
)
}
} else {
binding.splashProgress.visibility = View.GONE
}
// } else {
// binding.splashProgress.visibility = View.GONE
//}
////Log.i("VERDNATURA:","La collection es ${txtscan}")
}
}
@ -1003,9 +1058,10 @@ class CollectionFragment(
sales[position].isControlled = if (sales[position].isControlled == "1") "0" else "1"
if (type == PRECHECKER) {
sales[position].isControlled =
sales[position].isPreControlled= if ( sales[position].isPreControlled == "1") "0" else "1"
/* sales[position].isControlled =
//if (sales[position].isControlled == "2") "0" else "2" //sergio: para diferenciar precontrol en previa
if (sales[position].isControlled == "1") "0" else "1"//sergio: para diferenciar precontrol en previa
if (sales[position].isControlled == "1") "0" else "1"//sergio: para diferenciar precontrol en previa*/
}
saleAdapter!!.notifyDataSetChanged()
@ -1051,9 +1107,9 @@ class CollectionFragment(
usuario = user,
password = password,
saleFk = sales[position].saleFk,
vIsChecked = if (type == SACADOR) sales[position].isPrepared else if (type == CONTROLADOR || type == PRECHECKER) sales[position].isControlled else "1",
vIsChecked = if (type == SACADOR) sales[position].isPrepared else if (type == CONTROLADOR ) sales[position].isControlled else if (type=="PRECHECKER") sales[position].isPreControlled else "1",
vOriginalQuantity = sales[position].pickedQuantity,
vStateFk = if (type == CONTROLADOR) "CHECKED" else if (type == "PRECHECKER") "PRECHECKED" else type,//type.toString(),
vStateFk = if (type == CONTROLADOR) "CHECKED" else if (type == "PRECHECKER") "PREVIOUS_CONTROL" else type,//type.toString(),
vBuyFk = originalItemScan,
callFunction = "saleTrackingReplace"
)
@ -1311,31 +1367,7 @@ class CollectionFragment(
}
/* private fun SalesSorter()
{
for (s in sales)
{
Log.i("VERDNATURA:","La sale del ticket ${s.ticketFk} es ${s.saleOrder}")
for (p in s.placements){
Log.i("VERDNATURA:","La sale del ticket ${s.saleOrder} es ${p.placement}")
//s.placements=s.placements.sortedBy { it.saleOrder}.sortedByDescending { it.visible }
s.placements=s.placements.sortedWith(compareBy({it.saleOrder})).sortedByDescending { it.visible }
//sales = salesList.sortedWith(compareBy({it.saleOrder}))
/* s.placements=s.placements.sortedWith ( compareBy(
{it.visible.equals("0")}
))*/
}
}
d("VERDNATURA","Ordenamos")
binding.fragmentSacadorCollections.adapter?.notifyDataSetChanged()
}*/
private fun checkItemScan(valueToCheck: String): Boolean {
@ -1646,9 +1678,8 @@ class CollectionFragment(
private fun ticketCollection_setUsedShelves() {
// Log.d("VERDNATURA::","la descrip es "+SectorDescription.first())
if (type.equals("CHECKER") && isMarking && !SectorDescription.first().uppercaseChar()
.equals('V')
if (type.equals("CHECKER") && (isMarking && SectorDescription.uppercase() != "ALGEMESI V")
) {
@ -1782,7 +1813,6 @@ class CollectionFragment(
//FALTAS / BASURA / SPLIT
private fun showQuantityDialog(position: Int) {
// //Log.i("VERDNATURA:","Aparece CustomDialog")
customDialogThreeButtons.setDescription(getString(R.string.txtnuevacantidad)).setValue("")
.setOkButton(getString(R.string.Faltas)) {
checkAndCall(
@ -1804,26 +1834,13 @@ class CollectionFragment(
customDialogThreeButtons.getValue(),
getString(R.string.BasuraRechazar)
)
/* if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
getString(R.string.Indicanuevacantidad).toast(requireContext())
} else {
missing(position, customDialogThreeButtons.getValue())
scanRequest()
customDialogThreeButtons.dismiss()
}*/
}.setOkButtonThree(getString(R.string.Reject)) {
checkAndCall(
position,
customDialogThreeButtons.getValue(),
getString(R.string.Reject)
)
/* if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
getString(R.string.Indicanuevacantidad).toast(requireContext())
} else {
reject(position, customDialogThreeButtons.getValue())
scanRequest()
customDialogThreeButtons.dismiss()
}*/
}.setOkButtonFour(getString(R.string.Split)) {
checkAndCall(
@ -1831,14 +1848,7 @@ class CollectionFragment(
customDialogThreeButtons.getValue(),
getString(R.string.Split)
)
/*if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
getString(R.string.Indicanuevacantidad).toast(requireContext())
} else {
split(position, customDialogThreeButtons.getValue())
scanRequest()
customDialogThreeButtons.dismiss()
}*/
}.setOkButtonAdd(getString(R.string.Agregar)) {
checkAndCall(
@ -1846,13 +1856,7 @@ class CollectionFragment(
customDialogThreeButtons.getValue(),
getString(R.string.Agregar)
)
/* if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
getString(R.string.Indicanuevacantidad).toast(requireContext())
} else {
increaseQuantity(position, customDialogThreeButtons.getValue())
scanRequest()
customDialogThreeButtons.dismiss()
}*/
}.setKoButton("Cancelar") {
scanRequest()
customDialogThreeButtons.dismiss()
@ -1866,9 +1870,9 @@ class CollectionFragment(
when (action) {
getString(R.string.Agregar) -> increaseQuantity(position, value)
getString(R.string.BasuraRechazar) -> missing(position, value)
getString(R.string.Faltas) -> trash(position, value)
getString(R.string.Reject) -> reject(position, value)
getString(R.string.BasuraRechazar) -> TrashMissingReject(position, value,"TRUE")
getString(R.string.Faltas) -> TrashMissingReject(position, value,"FALSE")
getString(R.string.Reject) -> TrashMissingReject(position, value,"reject")
getString(R.string.Split) -> split(position, value)
}
@ -1913,7 +1917,40 @@ class CollectionFragment(
}
private fun trash(position: Int, quantity: String) {
private fun TrashMissingReject(
position: Int,
quantity: String,
typeCollectionTrashMissingReject: String
) {
typeCollectionMissing = typeCollectionTrashMissingReject
positionCollectionMissing = position
quantityCollectionMissing = quantity
var totalQuantity: Int = 0
try {
totalQuantity = sales[position].quantity.toInt() - quantity.toInt()
} catch (e: Exception) {
}
viewModel.collectionMissingTrash(
usuario = user,
password = password,
saleFk = sales[position].saleFk,
quantity = totalQuantity.toString(),
warehouseFk = warehouseFk,
type = typeCollectionTrashMissingReject,
originalQuantity = quantity,
callFunction = "collectionMissingTrash"
)
/* sales[position].quantity = quantity
saleAdapter!!.notifyDataSetChanged()
if (quantity == "0")
markLine(position, type)
*/
}
/* private fun trash(position: Int, quantity: String) {
var totalQuantity: Int = 0
try {
totalQuantity = sales[position].quantity.toInt() - quantity.toInt()
@ -1927,15 +1964,15 @@ class CollectionFragment(
warehouseFk = warehouseFk,
type = "FALSE",
originalQuantity = quantity,
callFunction = "saleMistake_Add"
callFunction = "collectionMissingTrash"
)
//sales[position].originalQuantity = quantity
sales[position].quantity = quantity
//sales[position].startQuantity = quantity
saleAdapter!!.notifyDataSetChanged()
if (quantity == "0")
markLine(position, type)
//enviar mensaje a salix
val ticket =
"[" + sales[position].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].ticketFk + "/summary)"
@ -1980,12 +2017,15 @@ class CollectionFragment(
viewModel.sendChekingPresence(
token = token,
workerId = sales[position].salePersonFk,
message = message, "sendChekingPresence"
message = message,
"sendChekingPresence"
)
}
private fun reject(position: Int, quantity: String) {
positionReject = position
quantityReject = quantity
var totalQuantity: Int = 0
try {
totalQuantity = sales[position].quantity.toInt() - quantity.toInt()
@ -2006,12 +2046,12 @@ class CollectionFragment(
//sales[position].startQuantity = quantity
// saleAdapter!!.notifyDataSetChanged()
saleAdapter!!.notifyDataSetChanged()
if (quantity == "0")
markLine(position, type)
/*
//enviar mensaje a salix
val ticket =
/* val ticket =
"[" + sales[position].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].ticketFk + "/summary)"
val message =
"Se ha modificado la cantidad original " + sales[position].originalQuantity + " del artículo " + sales[position].itemFk + " a nueva cantidad: " + sales[position].quantity + " del ticket " + ticket
@ -2020,18 +2060,54 @@ class CollectionFragment(
workerId = sales[position].salePersonFk,
message = message, "sendChekingPresence"
)*/
}
}*/
private fun missingTrashSuccesful() {
var message=""
sales[positionCollectionMissing].quantity = quantityCollectionMissing
saleAdapter!!.notifyDataSetChanged()
if (quantityCollectionMissing == "0")
markLine(positionCollectionMissing, type)
var totalQuantity: Int = 0
try {
totalQuantity = sales[positionCollectionMissing].originalQuantity.toInt() - quantityCollectionMissing.toInt()
} catch (e: Exception) {
}
saleAdapter!!.notifyDataSetChanged()
val ticket =
"[" + sales[positionReject].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionReject].ticketFk + "/summary)"
val message =
"Se ha modificado la cantidad original " + sales[positionReject].originalQuantity + " del artículo " + sales[positionReject].itemFk + " a nueva cantidad: " + sales[positionReject].quantity + " del ticket " + ticket
"[" + sales[positionCollectionMissing].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionCollectionMissing].ticketFk + "/summary)"
sendSalixMessageNew(ticket, message, sales[positionReject].salePersonFk)
when (typeCollectionMissing){
"TRUE"->{
message = "Se ha enviado a Basura " + totalQuantity + " del articulo " + sales[positionCollectionMissing].itemFk + " ticket " + ticket
}
"FALSE"->{
message= "Se ha enviado a Faltas la cantidad de " + totalQuantity + " del articulo " + sales[positionCollectionMissing].itemFk + " ticket " + ticket
}
"reject"->{
message = "Se ha modificado la cantidad de " + sales[positionCollectionMissing].originalQuantity + " del artículo " + sales[positionCollectionMissing].itemFk + " a nueva cantidad: " + sales[positionCollectionMissing].quantity + " del ticket " + ticket
}
}
sendSalixMessageNew(message, sales[positionCollectionMissing].salePersonFk)
binding.splashProgress.visibility = VISIBLE
viewModel.collectionTicketGet(
user,
password,
collection.collectionFk,
sectorFk,
type,
"collection_getTickets"
)
}
@ -2053,7 +2129,7 @@ class CollectionFragment(
val message =
"Se ha modificado la cantidad original " + sales[positionIncreaseQuantity].originalQuantity + " del artículo " + sales[positionIncreaseQuantity].itemFk + " a nueva cantidad: " + sales[positionIncreaseQuantity].quantity + " del ticket " + ticket
sendSalixMessageNew(ticket, message, sales[positionIncreaseQuantity].salePersonFk)
sendSalixMessageNew(message, sales[positionIncreaseQuantity].salePersonFk)
/* val ticket =
"[" + sales[positionIncreaseQuantity].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionIncreaseQuantity].ticketFk + "/summary)"
val message =
@ -2068,12 +2144,12 @@ class CollectionFragment(
}
private fun sendSalixMessageNew(ticket: String, message: String, workerId: String) {
private fun sendSalixMessageNew(message: String, workerId: String) {
viewModel.sendChekingPresence(
token = token,
workerId = workerId,
message = message + ticket,
message = message,
"sendChekingPresence"
)
}

View File

@ -6,10 +6,7 @@ import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetLoginUserCase
import es.verdnatura.domain.GetSacadorControladorUserCase
import es.verdnatura.domain.GetUbicadorUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.getMessageFromResponse
import es.verdnatura.presentation.base.*
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.collection.ItemVO
import es.verdnatura.presentation.view.feature.collection.mapper.map
@ -84,6 +81,11 @@ class CollectionViewModel(context: Context) : BaseViewModel()
val item: LiveData<ItemVO>
get() = _item
private val _responseGetExtensionFromUserId by lazy { MutableLiveData<ResponseItemVO>() }
val responseGetExtensionFromUserId: LiveData<ResponseItemVO>
get() = _responseGetExtensionFromUserId
fun collectionTicketGet(
usuario: String,
password: String,
@ -105,7 +107,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_collectionTicketList.value = CollectionVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -121,7 +123,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_collectionTicketList.value = CollectionVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message()))
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}
}
})
@ -153,7 +155,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -163,7 +165,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message()))
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
} else
{
_response.value = ResponseItemVO(isError = false, response = response.body()!!)
@ -194,7 +196,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
listError.add(
PlacementSupplyVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
)
_placementSuppleyList.value = PlacementSupplyListVO(listError)
@ -214,7 +216,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
listError.add(
PlacementSupplyVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
)
_placementSuppleyList.value = PlacementSupplyListVO(listError)
@ -243,7 +245,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -253,7 +255,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@ -279,7 +281,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_response.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>)
@ -288,7 +290,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@ -316,7 +318,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
override fun onFailure(call: Call<Void>, t: Throwable)
{
_responseUsedShelves.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_responseUsedShelves.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<Void>, response: Response<Void>)
@ -325,7 +327,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responseUsedShelves.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@ -351,7 +353,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
override fun onFailure(call: Call<Void>, t: Throwable)
{
_responseItem_updatePackingShelve.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_responseItem_updatePackingShelve.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<Void>, response: Response<Void>)
@ -360,7 +362,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responseItem_updatePackingShelve.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@ -386,7 +388,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
override fun onFailure(call: Call<Void>, t: Throwable)
{
_responseSaleGroup.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_responseSaleGroup.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<Void>, response: Response<Void>)
@ -395,7 +397,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responseSaleGroup.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@ -414,7 +416,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_item.value = ItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -424,7 +426,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_item.value = ItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@ -456,7 +458,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responseNew.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -466,7 +468,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
if (!response.isSuccessful){
_responseNew.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message()))
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_responseNew.value =
ResponseItemVO(isError = false, response = response.body()!!)
@ -477,7 +479,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responseNew.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@ -508,7 +510,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -518,7 +520,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message()))
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
} else
{
@ -552,7 +554,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responseMissingTrash.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -562,7 +564,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responseMissingTrash.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@ -581,7 +583,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -591,7 +593,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@ -611,7 +613,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -622,7 +624,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@ -647,7 +649,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage =getMessageFromAllResponse(callFunction,t.message!!)
errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -657,7 +659,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@ -677,7 +679,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responseCode.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -687,7 +689,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responseCode.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@ -717,7 +719,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responseIncQuantity.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -727,7 +729,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responseIncQuantity.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@ -788,7 +790,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage =getMessageFromAllResponse(callFunction,t.message!!)
errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -801,7 +803,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@ -843,6 +845,53 @@ class CollectionViewModel(context: Context) : BaseViewModel()
})
}
fun sip_getExtension(
usuario: String,
password: String,
workerId: String,
callFunction:String
)
{
getSacadorControladorUserCase.sip_getExtension(
usuario,
password,
workerId
).enqueue(object :
Callback<String>
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_responseGetExtensionFromUserId.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
override fun onResponse(
call: Call<String?>,
response: Response<String>
)
{
if (response.body() != "false")
{
_responseGetExtensionFromUserId.value = ResponseItemVO(
isError = false,
response = response.body()!!,
errorMessage = ""
)
}else{
_responseGetExtensionFromUserId.value = ResponseItemVO(
isError = true,
response = response.body()!!,
errorMessage = "No se puede realizar la llamada. El usuario no tiene la extensión configurada. Solicítelo a informática.")
}
}
})
}
fun ticketOrCollection_checkFullyControlled(
usuario: String,
password: String,
@ -860,7 +909,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responsecheckfully.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}

View File

@ -3,15 +3,16 @@ package es.verdnatura.presentation.view.feature.collection.fragment
import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.os.Build
import android.os.Bundle
import android.view.View
import android.view.View.GONE
import android.view.View.VISIBLE
import android.view.inputmethod.EditorInfo
import android.widget.ImageView
import android.widget.Toast
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.R
import es.verdnatura.databinding.FragmentCollectionBinding
import es.verdnatura.domain.ConstAndValues.CONTROLADOR
@ -29,7 +30,6 @@ import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
import timber.log.Timber.d
class CollectionShowTicketFragment(
var collection: CollectionVO = CollectionVO(),
@ -49,7 +49,7 @@ class CollectionShowTicketFragment(
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
private lateinit var customDialog: CustomDialog
private var tickets: ArrayList<String> = ArrayList()
private var state = 0
companion object {
fun newInstance(collection: CollectionVO, type: String) =
@ -106,19 +106,28 @@ class CollectionShowTicketFragment(
binding.mainToolbar.toolbarSubtitle.visibility = VISIBLE
val listIcons: ArrayList<Drawable> = ArrayList()
/*val listIcons: ArrayList<Drawable> = ArrayList()
val iconPrint: Drawable =
resources.getDrawable(R.drawable.ic_print_black_24dp, resources.newTheme())
listIcons.add(iconPrint)
*/
val listIcons: ArrayList<ImageView> = 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 =
ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconPrint) {
print()
}
when (item){
iconPrint.drawable->print()}
}
})
binding.mainToolbar.toolbarIcons.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
@ -219,30 +228,24 @@ class CollectionShowTicketFragment(
private fun createCollectionList() {
state = 0
binding.mainToolbar.toolbarTitle.text = collection.collectionFk
binding.splashProgress.visibility = View.GONE
var salesList: ArrayList<SaleVO> = ArrayList()
tickets = ArrayList()
var observations = ""
collection.tickets.forEach { ticket ->
ticket.sales.forEach { saleVO ->
if (type == SACADOR && saleVO.quantity != "0") {
if (type == VERTICKET) {
salesList.add(saleVO)
if (tickets.firstOrNull { it == saleVO.ticketFk }.isNullOrEmpty())
tickets.add(saleVO.ticketFk)
} else if (type == CONTROLADOR || type == PRECHECKER || type == VERTICKET) {
salesList.add(saleVO)
if (tickets.firstOrNull { it == saleVO.ticketFk }.isNullOrEmpty())
tickets.add(saleVO.ticketFk)
}
}
observations = observations + " " + ticket.observations
}
}
sales = salesList.sortedWith(compareBy({ it.saleOrder }))
saleAdapter =
@ -284,39 +287,13 @@ class CollectionShowTicketFragment(
}
/* private fun setListPosition(position: Int, isFromBack: Boolean) {
storedPosition = position
if (type == SACADOR) {
if (binding.fragmentSacadorCollections != null) {
binding.fragmentSacadorCollections.addViewObserver {
lm!!.scrollToPositionWithOffset(position, 0)
}
}
} else if (isFromBack) {
if (binding.fragmentSacadorCollections != null) {
binding.fragmentSacadorCollections.addViewObserver {
lm!!.scrollToPositionWithOffset(position, 0)
}
}
}
}*/
private fun setTotalLines() {
var totalMark = 0
sales.forEach {
if (type == SACADOR) {
if (it.isPrepared == "1" || it.isControlled == "1" || it.isPreviousPrepared == "1") {
if (it.isControlled == "1")
totalMark += 1
} else if (it.quantity == "0") {
totalMark += 1
}
} else if (type == CONTROLADOR || type == PRECHECKER) {
if (it.isControlled == "1" || it.isControlled == "2")
totalMark += 1
}
}
binding.mainToolbar.toolbarTitle.text =
collection.collectionFk

View File

@ -8,6 +8,7 @@ import es.verdnatura.domain.GetSacadorControladorUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.collection.mapper.map
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
@ -32,7 +33,7 @@ class ControladorViewModel(context: Context) : BaseViewModel() {
getSacadorControladorUserCase.collectionTicketGet(usuario,password,collectionFk,sectorFk,"0",type).enqueue(object :
Callback<CollectionVO> {
override fun onFailure(call: Call<CollectionVO>, t: Throwable) {
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(
call: Call<CollectionVO>,
@ -49,7 +50,7 @@ class ControladorViewModel(context: Context) : BaseViewModel() {
}else{
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}
}
})

View File

@ -3,11 +3,13 @@ package es.verdnatura.presentation.view.feature.controlvehiculo.fragment
import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.os.Build
import android.os.Bundle
import android.util.Log
import android.util.TypedValue
import android.view.View.*
import android.view.inputmethod.EditorInfo
import android.widget.ImageView
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
@ -105,12 +107,27 @@ class ControlVehiculoFragment(
binding.mainToolbar.toolbarTitle.text = getString(R.string.vehiclecontrol)
binding.mainToolbar.toolbarTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13F)
val listIcons: ArrayList<Drawable> = ArrayList()
val iconHistory: Drawable =
val listIcons: ArrayList<ImageView> = ArrayList()
/* val iconHistory: Drawable =
resources.getDrawable(R.drawable.ic_history_black_24dp, resources.newTheme())
val iconVehicleIn: Drawable = resources.getDrawable(R.drawable.car, resources.newTheme())
val iconVehicleOut: Drawable =
resources.getDrawable(R.drawable.car_off, resources.newTheme())
resources.getDrawable(R.drawable.car_off, resources.newTheme())*/
val iconHistory = ImageView(context)
iconHistory.setImageResource(R.drawable.ic_history_black_24dp)
val iconVehicleIn = ImageView(context)
iconVehicleIn.setImageResource(R.drawable.car)
val iconVehicleOut = ImageView(context)
iconVehicleOut.setImageResource(R.drawable.car_off)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconHistory.tooltipText=getTooltip(R.drawable.ic_history_black_24dp)
iconVehicleIn.tooltipText=getTooltip(R.drawable.car)
iconVehicleOut.tooltipText=getTooltip(R.drawable.car_off)
}
@ -131,19 +148,24 @@ class ControlVehiculoFragment(
}
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconHistory) {
when (item){
iconHistory.drawable-> showScanner("Escanea matrícula para ver histórico", "HISTORY")
iconVehicleIn.drawable-> showScanner("Escanea matrícula del vehículo", "IN")
iconVehicleOut.drawable-> showScanner("Escanea matrícula para dejar vehículo", "OUT")
}
/* if (item == iconHistory.drawable) {
showScanner("Escanea matrícula para ver histórico", "HISTORY")
}
if (item == iconVehicleIn) {
if (item == iconVehicleIn.drawable) {
showScanner("Escanea matrícula del vehículo", "IN")
}
if (item == iconVehicleOut) {
if (item == iconVehicleOut.drawable) {
showScanner("Escanea matrícula para dejar vehículo", "OUT")
}
}*/
}
})

View File

@ -8,6 +8,7 @@ import es.verdnatura.domain.GetVehicleControlTimeUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemMachineControl
import es.verdnatura.presentation.common.ResponseItemVO
@ -42,7 +43,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
override fun onFailure(call: Call<Boolean>, t: Throwable) {
_responseinsert.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -50,7 +51,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
if (response.body() == null || response.body().toString() == "false") {
_responseinsert.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else {
@ -74,7 +75,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
override fun onFailure(call: Call<Boolean>, t: Throwable) {
_responseinsert.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -82,7 +83,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
if (response.body() == null || response.body().toString() == "false") {
_responseinsert.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else {
//_response.value = ResponseItemVO(isError = false,response = response.body()!!)
@ -104,7 +105,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
override fun onFailure(call: Call<String>, t: Throwable) {
_responsecontrol.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -112,7 +113,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
if (response.body() == null) {
_responsecontrol.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else {
_responsecontrol.value =
@ -136,7 +137,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
// Log.i("VERDNATURA::","${t.message}")
_responsemachine.value = ResponseItemMachineControl(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!),
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!),
type = ""
)
}
@ -172,7 +173,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
override fun onFailure(call: Call<String>, t: Throwable) {
_responsemachine.value = ResponseItemMachineControl(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!),
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!),
type = ""
)
}
@ -210,7 +211,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
_responsemachine.value = ResponseItemMachineControl(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!),
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!),
type = ""
)
}

View File

@ -2,11 +2,10 @@ package es.verdnatura.presentation.view.feature.diadeventa.fragment
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.view.Gravity
import android.os.Build
import android.view.View
import android.view.inputmethod.EditorInfo
import android.widget.Toast
import androidx.appcompat.widget.TooltipCompat
import android.widget.ImageView
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
@ -15,6 +14,7 @@ import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.notNull
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.component.CustomDialogList
import es.verdnatura.presentation.view.feature.diadeventa.adapter.DayOfSaleAdapter
@ -63,20 +63,20 @@ class DayOfSaleFragment(
private fun setToolBar(title: String) {
binding.mainToolbar.toolbarTitle.text = title
val listIcons: ArrayList<ImageView> = ArrayList()
val iconParking = ImageView(context)
iconParking.setImageResource(R.drawable.ic_local_parking_black_24dp)
val listIcons: ArrayList<Drawable> = ArrayList()
val iconParking: Drawable =
resources.getDrawable(R.drawable.ic_local_parking_black_24dp, resources.newTheme())
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconParking.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp)
}
listIcons.add(iconParking)
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconParking) {
if (item == iconParking.drawable) {
showParking()
}

View File

@ -5,10 +5,7 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetDayOfSaleUSerCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.getMessageFromResponse
import es.verdnatura.presentation.base.*
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.diadeventa.model.ItemShelvingSaleDate
@ -40,7 +37,7 @@ class DayOfSaleViewModel(context: Context) : BaseViewModel() {
Callback<List<ItemShelvingSaleDate>> {
override fun onFailure(call: Call<List<ItemShelvingSaleDate>>, t: Throwable) {
val listError:ArrayList<ItemShelvingSaleDate> = ArrayList()
listError.add(ItemShelvingSaleDate(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
listError.add(ItemShelvingSaleDate(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_itemShelvingSaleDateList.value = ItemShelvingSaleDateList(listError)
}
@ -63,7 +60,7 @@ class DayOfSaleViewModel(context: Context) : BaseViewModel() {
val listError:ArrayList<ItemShelvingSaleDate> = ArrayList()
listError.add(ItemShelvingSaleDate(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
listError.add(ItemShelvingSaleDate(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_itemShelvingSaleDateList.value = ItemShelvingSaleDateList(listError) }
}
}
@ -150,19 +147,19 @@ class DayOfSaleViewModel(context: Context) : BaseViewModel() {
GetDayOfSaleUSerCase.shelvingPark(usuario,password,scanItem,parking).enqueue(object :
Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
if (response.body() == "Finish")
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
else
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}
}
})

View File

@ -3,19 +3,18 @@ package es.verdnatura.presentation.view.feature.faltas.fragment
import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.os.Build
import android.os.Bundle
import android.view.View
import android.view.inputmethod.EditorInfo
import android.widget.ImageView
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentFaltasBinding
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnFaltasNichoClickListener
import es.verdnatura.presentation.common.OnFaltasReviewClickListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.common.*
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.faltas.adapter.FaltasAdapter
@ -82,12 +81,19 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
private fun setToolBar(){
val listIcons:ArrayList<Drawable> = ArrayList()
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
val listIcons: ArrayList<ImageView> = ArrayList()
val iconReload = ImageView(context)
iconReload.setImageResource(R.drawable.ic_autorenew_black_24dp)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconReload.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
}
listIcons.add(iconReload)
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons,object: OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload){
if (item == iconReload.drawable){
binding.splashProgress.visibility = View.VISIBLE
viewModel.getFaltas(user,password,warehouseFk)
}

View File

@ -9,6 +9,7 @@ import es.verdnatura.domain.GetItemCardUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
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.faltas.model.ItemFaltasListVO
@ -65,12 +66,12 @@ class FaltasViewModel(context: Context) : BaseViewModel() {
getItemCardUserCase.itemStockUpdate(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object :
Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -84,11 +85,11 @@ class FaltasViewModel(context: Context) : BaseViewModel() {
getInventaryUserCase.faultsReview_isChecked(user,password,itemFk,warehouseFk).enqueue(object :
Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}

View File

@ -12,7 +12,9 @@ import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.Color.*
import android.graphics.drawable.Drawable
import android.os.Build
import android.view.View
import android.widget.ImageView
import androidx.core.content.ContextCompat.getColor
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
@ -25,6 +27,7 @@ import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.notNull
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.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.historicoarticulo.adapter.HistoricoAdapter
@ -99,37 +102,47 @@ class HistoricoArticuloFragment(
}
private fun setToolBar() {
val listIcons: ArrayList<Drawable> = ArrayList()
/* val listIcons: ArrayList<Drawable> = ArrayList()
val iconReload: Drawable =
resources.getDrawable(R.drawable.ic_transaction, resources.newTheme())
val iconGargabe: Drawable =
resources.getDrawable(R.drawable.alpha_b_circle_outline, resources.newTheme())
val iconFault: Drawable =
resources.getDrawable(R.drawable.alpha_f_circle_outline, resources.newTheme())
resources.getDrawable(R.drawable.alpha_f_circle_outline, resources.newTheme())*/
val listIcons: ArrayList<ImageView> = ArrayList()
val iconReload = ImageView(context)
iconReload.setImageResource(R.drawable.ic_transaction)
val iconGargabe = ImageView(context)
iconGargabe.setImageResource(R.drawable.alpha_b_circle_outline)
val iconFault = ImageView(context)
iconFault.setImageResource(R.drawable.alpha_f_circle_outline)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconReload.tooltipText = getTooltip(R.drawable.ic_transaction)
iconGargabe.tooltipText = getTooltip(R.drawable.alpha_b_circle_outline)
iconFault.tooltipText = getTooltip(R.drawable.alpha_f_circle_outline)
}
listIcons.add(iconGargabe)
listIcons.add(iconFault)
listIcons.add(iconReload)
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload) {
when (item){
iconReload.drawable->viewModelwithFilter("all")
iconGargabe.drawable->{
viewModelwithFilter("contenedor")
item.setTint(getColor(context!!, verdnatura_pumpkin_orange))}
iconFault.drawable->viewModelwithFilter("falta")
}
/* if (item == iconReload) {
binding.splashProgress.visibility = View.VISIBLE
viewModelwithFilter("all")
// TooltipCompat.setTooltipText(view!!, "Recarga");
// view?.let { TooltipCompat.setTooltipText(it, "Recarga") };
/* val mytoast = Toast.makeText(
context,
"Toast Message",
Toast.LENGTH_SHORT
)
mytoast.setGravity(Gravity.TOP or Gravity.RIGHT, 0, -100)
mytoast.show()*/
}
@ -143,11 +156,10 @@ class HistoricoArticuloFragment(
binding.splashProgress.visibility = View.VISIBLE
viewModelwithFilter("falta")
}
}*/
for (it in listIcons) {
if (it != item) {
it.setTint(getColor(context!!, verdnatura_white))
it.drawable.setTint(getColor(context!!, verdnatura_white))
}
}
item.setTint(getColor(context!!, verdnatura_pumpkin_orange))
@ -162,6 +174,7 @@ class HistoricoArticuloFragment(
private fun viewModelwithFilter(keyfilter: String) {
filter = keyfilter
binding.splashProgress.visibility = View.VISIBLE
viewModel.itemDiary(user, password, itemFk, warehouseFk,"itemDiary")
}

View File

@ -7,6 +7,7 @@ import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetItemCardUserCase
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.view.feature.historicoarticulo.model.ItemHistoricoListVO
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO
@ -32,7 +33,7 @@ class HistoricoArticuloViewModel(context: Context) : BaseViewModel() {
Callback<List<ItemHistoricoVO>> {
override fun onFailure(call: Call<List<ItemHistoricoVO>>, t: Throwable) {
val listError:ArrayList<ItemHistoricoVO> = ArrayList()
listError.add(ItemHistoricoVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
listError.add(ItemHistoricoVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_historicoList.value = ItemHistoricoListVO(listError)
}
@ -44,7 +45,7 @@ class HistoricoArticuloViewModel(context: Context) : BaseViewModel() {
_historicoList.value = response.body()?.let { ItemHistoricoListVO(it) }
}else{
val listError:ArrayList<ItemHistoricoVO> = ArrayList()
listError.add(ItemHistoricoVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
listError.add(ItemHistoricoVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_historicoList.value = ItemHistoricoListVO(listError)
}
}

View File

@ -8,6 +8,7 @@ import androidx.lifecycle.Transformations
import es.verdnatura.domain.itemShelvingLogUSerCase
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
@ -37,7 +38,7 @@ class itemShelvingLogViewModel(context: Context) : BaseViewModel() {
Callback<List<ItemShelvingLog>> {
override fun onFailure(call: Call<List<ItemShelvingLog>>, t: Throwable) {
val listError:ArrayList<ItemShelvingLog> = ArrayList()
listError.add(ItemShelvingLog(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!)))
listError.add(ItemShelvingLog(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_itemShelvingLogList.value = ItemShelvingLogList(listError)
}
@ -48,7 +49,7 @@ class itemShelvingLogViewModel(context: Context) : BaseViewModel() {
if (!response.isSuccessful){
val listError:ArrayList<ItemShelvingLog> = ArrayList()
listError.add(ItemShelvingLog(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
listError.add(ItemShelvingLog(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_itemShelvingLogList.value = ItemShelvingLogList(listError)
}else{

View File

@ -7,6 +7,7 @@ import androidx.lifecycle.Transformations
import es.verdnatura.domain.itemShelvingLogUSerCase
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.view.feature.historicoshelvinglog.model.ShelvingLog
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogList
@ -30,7 +31,7 @@ class shelvingLogViewModel(context: Context) : BaseViewModel() {
Callback<List<ShelvingLog>> {
override fun onFailure(call: Call<List<ShelvingLog>>, t: Throwable) {
val listError:ArrayList<ShelvingLog> = ArrayList()
listError.add(ShelvingLog(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!)))
listError.add(ShelvingLog(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_itemShelvingLogList.value = ShelvingLogList(listError)
}
@ -41,7 +42,7 @@ class shelvingLogViewModel(context: Context) : BaseViewModel() {
if (!response.isSuccessful){
val listError:ArrayList<ShelvingLog> = ArrayList()
listError.add(ShelvingLog(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
listError.add(ShelvingLog(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_itemShelvingLogList.value = ShelvingLogList(listError)
}else{

View File

@ -6,6 +6,7 @@ import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetVehicleControlTimeUserCase
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.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculoList
@ -29,7 +30,7 @@ class HistoricoVehiculoViewModel (context: Context) : BaseViewModel() {
Callback<List<ItemHistoricoVehiculo>> {
override fun onFailure(call: Call<List<ItemHistoricoVehiculo>>, t: Throwable) {
val listError:ArrayList<ItemHistoricoVehiculo> = ArrayList()
listError.add(ItemHistoricoVehiculo(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
listError.add(ItemHistoricoVehiculo(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_historicovehiculoList.value = ItemHistoricoVehiculoList(listError)
}
@ -42,7 +43,7 @@ class HistoricoVehiculoViewModel (context: Context) : BaseViewModel() {
_historicovehiculoList.value = response.body()?.let { ItemHistoricoVehiculoList(it) }
}else{
val listError:ArrayList<ItemHistoricoVehiculo> = ArrayList()
listError.add(ItemHistoricoVehiculo(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
listError.add(ItemHistoricoVehiculo(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_historicovehiculoList.value = ItemHistoricoVehiculoList(listError)
}
}

View File

@ -1,8 +1,10 @@
package es.verdnatura.presentation.view.feature.inventario.adapter
import android.graphics.drawable.Drawable
import android.os.Build
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.annotation.RequiresApi
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.databinding.ItemToolbarRowBinding
import es.verdnatura.presentation.common.OnOptionsSelectedListener
@ -13,6 +15,8 @@ class ToolBarAdapter (
): RecyclerView.Adapter<ToolBarAdapter.ItemHolder> () {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
return ItemHolder(
ItemToolbarRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
@ -21,21 +25,29 @@ class ToolBarAdapter (
override fun getItemCount() =items.size
@RequiresApi(Build.VERSION_CODES.O)
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
holder.bind(items[position])
}
inner class ItemHolder(
val binding: ItemToolbarRowBinding
) : RecyclerView.ViewHolder(binding.root){
private val res = binding.root.context.resources
@RequiresApi(Build.VERSION_CODES.O)
fun bind(item: Drawable) {
binding.apply {
imagebuttonIcon.setImageDrawable(item)
imagebuttonIcon.setOnClickListener {
onOptionsSelectedListener.onOptionsItemSelected(item)
}
}
}
}
}

View File

@ -3,8 +3,10 @@ package es.verdnatura.presentation.view.feature.inventario.fragment
import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.os.Build
import android.os.Bundle
import android.view.View
import android.widget.ImageView
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
@ -13,6 +15,7 @@ import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnInvetoryNichoClickListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
@ -125,14 +128,20 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
private fun setToolBar(){
val listIcons:ArrayList<Drawable> = ArrayList()
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
val listIcons: ArrayList<ImageView> = ArrayList()
val iconReload = ImageView(context)
iconReload.setImageResource(R.drawable.ic_autorenew_black_24dp)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconReload.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
}
listIcons.add(iconReload)
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener{
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons,object: OnOptionsSelectedListener{
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload){
if (item == iconReload.drawable){
binding.splashProgress.visibility = View.VISIBLE
firstVisiblePosition = layoutManager?.findFirstVisibleItemPosition() ?: 0
viewModel.getInventory(user,password,buyerId,warehouseFk,"itemShelving_filterBuyer")

View File

@ -9,6 +9,7 @@ import es.verdnatura.domain.GetItemCardUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
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.calidad.model.BuyerListVO
@ -46,7 +47,7 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
Callback<List<BuyerVO>> {
override fun onFailure(call: Call<List<BuyerVO>>, t: Throwable) {
val listError:ArrayList<BuyerVO> = ArrayList()
listError.add(BuyerVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
listError.add(BuyerVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_buyersList.value = BuyerListVO(listError)
}
@ -59,7 +60,7 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
}else{
val listError:ArrayList<BuyerVO> = ArrayList()
listError.add(BuyerVO(isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())))
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_buyersList.value = BuyerListVO(listError)
}
}
@ -104,7 +105,7 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
Callback<List<ItemInventaryVO>> {
override fun onFailure(call: Call<List<ItemInventaryVO>>, t: Throwable) {
val listError:ArrayList<ItemInventaryVO> = ArrayList()
listError.add(ItemInventaryVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!)))
listError.add(ItemInventaryVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_inventaryList.value = InventaryListVO(listError)
}
@ -116,7 +117,7 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
_inventaryList.value = response.body()?.let { InventaryListVO(it) }
}else{
val listError:ArrayList<ItemInventaryVO> = ArrayList()
listError.add(ItemInventaryVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
listError.add(ItemInventaryVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_inventaryList.value = InventaryListVO(listError)
}
@ -157,12 +158,12 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}

View File

@ -131,7 +131,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
user,
password,
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
}
@ -146,7 +146,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
password,
"",
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
_loginsalixitem.value = loginSalixVO
}
@ -170,7 +170,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
{
loginDevice = LoginDevice(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message()))
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
} else
@ -192,7 +192,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
{
loginDevice = LoginDevice(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
}
}
@ -206,7 +206,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
"",
"",
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
_logindevice.value = loginDevice
}
@ -239,7 +239,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
{
workerId = workerId(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
}
@ -251,7 +251,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
val workerId =
workerId(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
_workerId.value = workerId
}
@ -290,7 +290,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
{
_devicelogresponse.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,message)
errorMessage = getMessageFromAllResponse(nameofFunction(this),message)
)
}
@ -342,7 +342,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
user,
password,
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
}
_versionappitem.value = versionApp
@ -356,7 +356,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
nameApp,
"",
isError = true,
errorMessage =getMessageFromAllResponse(callFunction, t.message!!)
errorMessage =getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
_versionappitem.value = versionApp
}

View File

@ -47,7 +47,7 @@ import es.verdnatura.presentation.view.feature.parking.fragment.ParkingSaleFragm
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.precontrol.ShowTicketFragment
import es.verdnatura.presentation.view.feature.showticket.ShowTicketFragment
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
@ -249,7 +249,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
ControladorFragment.TAG,
false
)
/*addFragment(
CollectionFragment.newInstance(type = "CHECKER", collection = CollectionVO()),
R.id.main_frame_layout,
ControladorFragment.TAG,
false)*/
// true
}
getString(R.string.Paletizadores) -> {

View File

@ -8,6 +8,7 @@ import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
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.paletizador.model.ItemPalletViewListVO
@ -32,7 +33,7 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel() {
Callback<List<ItemPalletViewVO>> {
override fun onFailure(call: Call<List<ItemPalletViewVO>>, t: Throwable) {
val listError:ArrayList<ItemPalletViewVO> = ArrayList()
listError.add(ItemPalletViewVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
listError.add(ItemPalletViewVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_expeditionPalletList.value = ItemPalletViewListVO(listError)
}
@ -44,7 +45,7 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel() {
_expeditionPalletList.value = response.body()?.let { ItemPalletViewListVO(it) }
}else{
val listError:ArrayList<ItemPalletViewVO> = ArrayList()
listError.add(ItemPalletViewVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
listError.add(ItemPalletViewVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_expeditionPalletList.value = ItemPalletViewListVO(listError)
}
}
@ -55,11 +56,11 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel() {
fun expeditionPalletDel(usuario:String,password:String,vPalletFk:String,callFunction:String){
getPaletizadoresUserCase.expeditionPalletDel(usuario,password,vPalletFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -75,11 +76,11 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel() {
getPaletizadoresUserCase.expeditionPalletPrintSet(usuario,password,vPalletFk,vSectorFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}

View File

@ -8,6 +8,7 @@ import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
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.paletizador.model.ItemPalletListVO
@ -46,7 +47,7 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
Callback<List<ItemPalletVO>> {
override fun onFailure(call: Call<List<ItemPalletVO>>, t: Throwable) {
val listError:ArrayList<ItemPalletVO> = ArrayList()
listError.add(ItemPalletVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
listError.add(ItemPalletVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_expeditionPalletList.value = ItemPalletListVO(listError)
}
@ -58,7 +59,7 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
_expeditionPalletList.value = response.body()?.let { ItemPalletListVO(it) }
}else{
val listError:ArrayList<ItemPalletVO> = ArrayList()
listError.add(ItemPalletVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
listError.add(ItemPalletVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_expeditionPalletList.value = ItemPalletListVO(listError)
}
}
@ -71,7 +72,7 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
Callback<List<ItemScanVO>> {
override fun onFailure(call: Call<List<ItemScanVO>>, t: Throwable) {
val listError:ArrayList<ItemScanVO> = ArrayList()
listError.add(ItemScanVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
listError.add(ItemScanVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_scanList.value = ItemScanList(listError)
}
@ -83,7 +84,7 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
_scanList.value = response.body()?.let { ItemScanList(it) }
}else{
val listError:ArrayList<ItemScanVO> = ArrayList()
listError.add(ItemScanVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
listError.add(ItemScanVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_scanList.value = ItemScanList(listError)
}
}
@ -94,11 +95,11 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
fun expeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String,callFunction: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 = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -109,11 +110,11 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
fun checkRouteExpeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String,callFunction:String){
getPaletizadoresUserCase.checkRouteExpeditionScanPut(usuario,password,vPalletFk,vExpeditionFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_responseCheckexpeditionScanPut.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_responseCheckexpeditionScanPut.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_responseCheckexpeditionScanPut.value = ResponseItemVO(isError = false,response = response.body()!!)

View File

@ -7,6 +7,7 @@ import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO
import retrofit2.Call
import retrofit2.Callback
@ -25,7 +26,7 @@ class ExpeditionScanSorterViewModel(context: Context) : BaseViewModel() {
GetPaletizadoresUserCase.expedition_scan(usuario,password,vExpeditionId).enqueue(object : Callback<Void>{
override fun onFailure(call: Call<Void>, t: Throwable) {
_responsescan.value = messageError(getMessageFromAllResponse(callFunction,t.message!!),"expedition_scan")
_responsescan.value = messageError(getMessageFromAllResponse(nameofFunction(this),t.message!!),"expedition_scan")
}
override fun onResponse(call: Call<Void>, response: Response<Void>) {

View File

@ -14,6 +14,7 @@ import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingTypeList
@ -105,7 +106,7 @@ class ExpeditionStateViewModel(context: Context) : BaseViewModel() {
_itemexpedition.value = itemExpedetionState(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!), list= listProperties
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!), list= listProperties
)
}
@ -131,7 +132,7 @@ class ExpeditionStateViewModel(context: Context) : BaseViewModel() {
} else {
_itemexpedition.value = itemExpedetionState(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message()),list = listProperties
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()),list = listProperties
)
}
}

View File

@ -8,6 +8,7 @@ import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
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.paletizador.model.ItemExpeditionTruckList
@ -34,7 +35,7 @@ class ExpeditionTruckListViewModel(context: Context) : BaseViewModel() {
Callback<List<ItemExpeditionTruckVO>> {
override fun onFailure(call: Call<List<ItemExpeditionTruckVO>>, t: Throwable) {
val listError:ArrayList<ItemExpeditionTruckVO> = ArrayList()
listError.add(ItemExpeditionTruckVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!)))
listError.add(ItemExpeditionTruckVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_expeditionTruckList.value = ItemExpeditionTruckList(listError)
}
@ -46,7 +47,7 @@ class ExpeditionTruckListViewModel(context: Context) : BaseViewModel() {
_expeditionTruckList.value = response.body()?.let { ItemExpeditionTruckList(it) }
}else{
val listError:ArrayList<ItemExpeditionTruckVO> = ArrayList()
listError.add(ItemExpeditionTruckVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
listError.add(ItemExpeditionTruckVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_expeditionTruckList.value = ItemExpeditionTruckList(listError)
}
}
@ -57,12 +58,12 @@ class ExpeditionTruckListViewModel(context: Context) : BaseViewModel() {
fun expeditionTruckAdd(usuario:String,password:String,vHour:String,vDescription:String,callFunction:String){
getPaletizadoresUserCase.expeditionTruckAdd(usuario,password,vHour,vDescription).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}

View File

@ -9,6 +9,7 @@ import es.verdnatura.domain.GetUbicadorUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO
import retrofit2.Call
import retrofit2.Callback
@ -43,18 +44,18 @@ class ParkingViewModel(context: Context) : BaseViewModel() {
getUbicadorUserCase.shelvingPark(usuario,password,scanItem,parking).enqueue(object :
Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
ProgressLoading(GONE)
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
if (response.body() == "Finish")
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
else
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}
}
})

View File

@ -44,8 +44,6 @@ class ParkingSaleFragment : BaseFragment<FragmentParkingBinding,ParkingSaleViewM
override fun init() {
setEvents()
binding.mainToolbar.toolbarTitle.text = getString(R.string.Parking)
//sergio: después de las últimas actualizaciones se queda activo. Se cambia opción visibilidad.
//viewModel.hideProgressLoading()
binding.splashProgress.visibility=View.GONE
setList()
customDialog = CustomDialog(requireContext())

View File

@ -9,6 +9,7 @@ import es.verdnatura.domain.GetUbicadorUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO
import retrofit2.Call
import retrofit2.Callback
@ -49,18 +50,18 @@ class ParkingSaleViewModel(context: Context) : BaseViewModel() {
getUbicadorUserCase.shelvingPark(usuario,password,scanItem,parking).enqueue(object :
Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
ProgressLoading(GONE)
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
if (response.body() == "Finish")
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
else
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}
}
})
@ -74,7 +75,7 @@ class ParkingSaleViewModel(context: Context) : BaseViewModel() {
{
_responseParkingAdd.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -84,7 +85,7 @@ class ParkingSaleViewModel(context: Context) : BaseViewModel() {
{
_responseParkingAdd.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{

View File

@ -1,6 +1,7 @@
package es.verdnatura.presentation.view.feature.pasillero.adapter
import android.content.Context
import android.os.Build
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
@ -40,6 +41,10 @@ class PasillerosAdapter (
this.item = item
this.title = context?.getString(item.titleToShow)
itemImage.setImageResource(item.iconResource)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
itemImage.tooltipText=item.description
}
}
}
}

View File

@ -30,12 +30,8 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
*/
/* _pasillerositem.add(
PasillerosItemVO(7,
R.drawable.ic_streetview_black_24dp,
"Pre Control",R.string.precontrolprevious)
)
*/
//sergio para que aparezca el nuevo menu
@ -44,52 +40,23 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
7,
R.drawable.ic_streetview_black_24dp,
"Pre Sacador", R.string.PreSacador
"Pre Sacador", R.string.PreSacador,"Carga un ticket de previa para sacarlo"
)
)
//precontrol
_pasillerositem.add(
PasillerosItemVO(7,
R.drawable.ic_verified_user_black_24dp_selected,
"Pre Control",R.string.precontrolprevious,"Sirve para revisar un ticket de previa"
)
)
//sergio para que aparezca el nuevo menu
_pasillerositem.add(
PasillerosItemVO(
10,
R.drawable.ic_visibility_black_24dp,
"Ver Ticket", R.string.verticket
)
)
_pasillerositem.add(
PasillerosItemVO(
41,
R.drawable.day_of_sale,
"Día de venta", R.string.dayofSale
)
)
_pasillerositem.add(
PasillerosItemVO(
10,
R.drawable.revision_icon,
"Histórico Shelving", R.string.itemShelvingLog
)
)
_pasillerositem.add(
PasillerosItemVO(7,
R.drawable.ic_history_orange_24dp,
"Log Shelving",R.string.shelvingLog)
)
_pasillerositem.add(
PasillerosItemVO(
22,
R.drawable.car_info,
"Historial del vehículo", R.string.vehiclediary
)
)
_pasillerositem.add(
PasillerosItemVO(
7,
R.drawable.ic_baseline_all_inbox_24,
"Reposición", R.string.reposicion
"Ver Ticket", R.string.verticket,"Muestra un ticket sin la posibilidad de modicarlo"
)
)
@ -97,14 +64,9 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
0,
R.drawable.ic_loyalty_black_24dp,
"Consultar artículo", R.string.ConsultarArticulo
"Consultar artículo", R.string.ConsultarArticulo,"Busca información de un ítem"
)
)
/* _pasillerositem.add(
PasillerosItemVO(30,
R.drawable.ic_loyalty_black_24dp,
"Consultar expedición",R.string.ExpeditionState)
)*/
@ -112,7 +74,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
6,
R.drawable.ic_local_parking_orange_24dp,
"Parking", R.string.Parking
"Parking", R.string.Parking,"Permite aparcar tickets o carros"
)
)
@ -120,7 +82,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
2,
R.drawable.ic_visibility_black_24dp,
"Buscar item", R.string.BuscarItem
"Buscar item", R.string.BuscarItem,"Busca donde se encuentra un ítem"
)
)
@ -135,7 +97,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
1,
R.drawable.ic_dashboard_black_24dp,
"Ubicador", R.string.Ubicador
"Ubicador", R.string.Ubicador,"Permite ubicar/saber los ítems de un carro"
)
)
@ -143,15 +105,53 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
3,
R.drawable.ic_spa_black_24dp,
"Inventario", R.string.Inventario
"Inventario", R.string.Inventario, "Visualiza que falta o está desubicado"
)
)
_pasillerositem.add(
PasillerosItemVO(
10,
R.drawable.revision_icon,
"Histórico Shelving", R.string.itemShelvingLog,"Permite saber modificaciones de items en un carro"
)
)
_pasillerositem.add(
PasillerosItemVO(7,
R.drawable.ic_history_orange_24dp,
"Log Shelving",R.string.shelvingLog,"Permite conocer los movimientos en un carro"
)
)
_pasillerositem.add(
PasillerosItemVO(
22,
R.drawable.car_info,
"Historial del vehículo", R.string.vehiclediary,"Visualiza quien y cuando ha llevado un vehículo"
)
)
_pasillerositem.add(
PasillerosItemVO(
41,
R.drawable.day_of_sale,
"Día de venta", R.string.dayofSale,"Permite saber la fecha de venta de los items de un carro"
)
)
_pasillerositem.add(
PasillerosItemVO(
7,
R.drawable.ic_baseline_all_inbox_24,
"Reposición", R.string.reposicion,"Indica que falta reponer"
)
)
_pasillerositem.add(
PasillerosItemVO(
4,
R.drawable.ic_move_to_inbox_black_24dp,
"Faltas", R.string.Faltas
"Faltas", R.string.Faltas,"Visualiza las faltas en almacén"
)
)
@ -159,7 +159,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
5,
R.drawable.ic_send_black_24dp,
"Shelving Parking", R.string.ShelvingParking
"Shelving Parking", R.string.ShelvingParking,""
)
)
@ -167,7 +167,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
8,
R.drawable.ic_baseline_star_24,
"Calidad", R.string.Calidad
"Calidad", R.string.Calidad,"Permite conocer la calidad de algunos productos por comprador"
)
)
@ -179,7 +179,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
30,
R.drawable.pallet_shipping_selected,
"Paletizar", R.string.PalletMake
"Paletizar", R.string.PalletMake,"Permite escanear pallet para incorporarlo al sistema"
)
)
@ -187,14 +187,14 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
31,
R.drawable.ic_visibility_black_24dp,
"Consultar expedición", R.string.ExpeditionState
"Consultar expedición", R.string.ExpeditionState,"Permite conocer el estado de una expedición"
)
)
_pasillerositem.add(
PasillerosItemVO(
40,
R.drawable.barcode_scan,
"Escanear expedición", R.string.ExpeditionScan
"Escanear expedición", R.string.ExpeditionScan,"Permite escanear expediciones que no han pasado por el sorter"
)
)
@ -203,7 +203,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
32,
R.drawable.buffer_outline,
"Gestión de buffers", R.string.BuffersManegement
"Gestión de buffers", R.string.BuffersManegement,"Se accede al menú de operaciones con los buffers del sorter"
)
)
@ -212,7 +212,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
33,
R.drawable.qrcode_scan,
"Lector Qr", R.string.QrReader
"Lector Qr", R.string.QrReader,"Permite leer información en un qr"
)
)
@ -224,7 +224,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
30,
R.drawable.buffer_empty,
"Vaciado buffer", R.string.bufferempty
"Vaciado buffer", R.string.bufferempty, "Pone en modo vaciado un buffer"
)
)
@ -232,7 +232,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
31,
R.drawable.buffer_fill,
"Llenado buffer", R.string.bufferfill
"Llenado buffer", R.string.bufferfill,"Pone en modo llenado un buffer"
)
)
@ -241,7 +241,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
32,
R.drawable.buffer_accumulation,
"Acumulación buffer", R.string.bufferaccumulate
"Acumulación buffer", R.string.bufferaccumulate,"Pone en modo acumulación un buffer"
)
)
@ -249,7 +249,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
31,
R.drawable.buffer_off,
"Desactivado buffer", R.string.bufferoff
"Desactivado buffer", R.string.bufferoff,"Pone en modo desactivado un buffer"
)
)
@ -257,7 +257,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
31,
R.drawable.buffer_flejado,
"Flejado buffer", R.string.bufferfstrapping
"Flejado buffer", R.string.bufferfstrapping,"Pone en modo flejado un buffer"
)
)
@ -266,7 +266,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
45,
R.drawable.buffer_load,
"Cargar expedición en buffer", R.string.bufferload
"Cargar expedición en buffer", R.string.bufferload, "Pone en modo cargar un buffer"
)
)
}

View File

@ -4,6 +4,7 @@ class PasillerosItemVO (
var id: Int = 0,
var iconResource: Int = 0,
val title: String = "",
val titleToShow:Int = 0
val titleToShow: Int = 0,
val description: String = ""
)

View File

@ -79,8 +79,7 @@ class PreControladorFragment: BaseFragment<FragmentControladorBinding,ShowTicket
goBack=false;
if (!binding.scanInput.text.isNullOrEmpty()) {
binding.splashProgress.visibility = View.VISIBLE
////Log.i("VERDNATURA:","lanzamos desde precontrol")
// viewModel.collection_getTickets(
viewModel.collectionTicketGet(
usuario = user,
password = password,
@ -88,7 +87,7 @@ class PreControladorFragment: BaseFragment<FragmentControladorBinding,ShowTicket
collectionFk = binding.scanInput.text.toString(),
type = type,callFunction = "collection_getTickets"
)
// //Log.i("VERDNATURA:","La collection es ${binding.scanInput.text.toString()}")
}
binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard(binding.scanInput)
@ -116,7 +115,6 @@ class PreControladorFragment: BaseFragment<FragmentControladorBinding,ShowTicket
}
private fun navigateToCollectionList(collection: CollectionVO){
// onCollectionSelectedListener?.onCollectionSelected(collection, ConstAndValues.CONTROLADOR)
onCollectionSelectedListener?.onCollectionSelected(collection, ConstAndValues.PRECHECKER)
}

View File

@ -7,6 +7,7 @@ import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.domain.GetPreControladorUserCase
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.view.feature.collection.mapper.map
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
import retrofit2.Call
@ -25,7 +26,7 @@ class PreControladorViewModel(context: Context) : BaseViewModel() {
getPreControladorUserCase.collectionTicketGet(usuario,password,collectionFk,sectorFk,"0",type).enqueue(object :
Callback<CollectionVO> {
override fun onFailure(call: Call<CollectionVO>, t: Throwable) {
_collectionTicketList.value = CollectionVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!))
_collectionTicketList.value = CollectionVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(
call: Call<CollectionVO>,
@ -34,7 +35,7 @@ class PreControladorViewModel(context: Context) : BaseViewModel() {
if (response.body() != null){
_collectionTicketList.value = response.body()?.let { it.map() }
}else{
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}
}
})

View File

@ -4,19 +4,19 @@ import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.media.MediaPlayer
import android.os.Build
import android.os.Bundle
import android.util.Log
import android.util.Log.d
import android.view.View
import android.view.View.GONE
import android.view.View.VISIBLE
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
import android.widget.ImageView
import android.widget.Toast
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.firebase.crashlytics.internal.common.CommonUtils.isNullOrEmpty
import es.verdnatura.R
import es.verdnatura.databinding.FragmentPreSacadorBinding
import es.verdnatura.domain.ConstAndValues.PRESACADOR
@ -36,7 +36,6 @@ import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import es.verdnatura.presentation.view.feature.presacador.adapter.PreSacadorAdapter
import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO
import es.verdnatura.presentation.view.feature.sacador.model.PlacementVO
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
/*import kotlinx.android.synthetic.main.activity_main.*
@ -55,8 +54,8 @@ class PreSacadorFragment :
private var SectorDescription = ""
var mperror: MediaPlayer? = null
var mpok: MediaPlayer? = null
private var sales: ArrayList<PreSacadorItemVO> = ArrayList()
//private var sales: ArrayList<PreSacadorItemVO> = ArrayList()
private lateinit var sales: MutableList<PreSacadorItemVO>
private lateinit var customDialog: CustomDialog
private lateinit var customDialogList: CustomDialogList
private var saleAdapter: PreSacadorAdapter? = null
@ -270,42 +269,26 @@ class PreSacadorFragment :
sales.add(it)
}
//sales.sortedByDescending{ it.carros.get(0).order }
/* for (s in sales){
Log.d("VERDNATURA::","item"+ s.itemFk +" pickingorder" + s.carros.get(0).pickingOrder)
}*/
//val sortedSales = sales.sortedByDescending { it.carros[0].pickingOrder }
//A provar el dilluns
// var sortedList=sales.sortedWith(compareBy<PreSacadorItemVO,Int?>(nullsLast(),{it.carros.get(0).pickingOrder}))
//sergio: se tiene que ordenar por el pickingOrder del primer carro (Pako)
for (s in sales){
if (s.carros.isNullOrEmpty()){
}else{
Log.d("VERDNATURA::","sales "+s.longName)
//sergio: para que no de error si no hay carros. Ya está asignado a 0 el pickingorder si no hay item en el carro
if (!s.carros.isNullOrEmpty()){
s.pickingOrder=s.carros.get(0).pickingOrder
d("VERDNATURA::","item sin ordenar:"+ s.itemFk + " priority:"+s.carros.get(0).pickingOrder)
d("VERDNATURA::","item sin ordenar:"+ s.itemFk + " parking :"+s.carros.get(0).parking)
}
}
// var sortedSales=sales.sortedWith(nullsLast(compareByDescending { it.carros.get(0).priority }))
var sortedSales=sales.sortedBy{ it.pickingOrder }
/*for (s in sortedSales){
d("VERDNATURA::","item ordenado:"+ s.itemFk + " picking "+ s.pickingOrder)
}*/
//sergio: Se ordena las sales por ellas mismas con With
sales.sortWith(compareBy({it.pickingOrder}))
lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
saleAdapter = PreSacadorAdapter(
sortedSales,
sales,
pasillerosItemClickListener!!,
object : OnQuantityClickListener {
override fun onQuantityClick(sale: SaleVO) {
@ -320,6 +303,7 @@ class PreSacadorFragment :
object :
OnSaleClickListener {
override fun onSaleClick(sale: SaleVO) {
//sales.forEachIndexed { index, saleVO ->
sales.forEachIndexed { index, saleVO ->
if (saleVO.idMovimiento == sale.saleFk) {
if (saleVO.quantity != saleVO.picked) {
@ -370,9 +354,12 @@ class PreSacadorFragment :
private fun setListPosition(position: Int) {
storedPosition = position
binding.fragmentSacadorCollections.addViewObserver {
lm!!.scrollToPositionWithOffset(position, 0)
}
}
//SEARCH AND MARK
@ -789,33 +776,44 @@ class PreSacadorFragment :
private fun setToolBar() {
binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE
val listIcons: ArrayList<Drawable> = ArrayList()
val listIcons:ArrayList<ImageView> = ArrayList()
val iconParking = ImageView(context)
iconParking.setImageResource(R.drawable.ic_local_parking_black_24dp)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconParking.tooltipText=getTooltip(R.drawable.ic_local_parking_black_24dp)
}
listIcons.add(iconParking)
/*val listIcons: ArrayList<Drawable> = ArrayList()
val iconEraser: Drawable = resources.getDrawable(R.drawable.eraser, resources.newTheme())
val iconParking: Drawable =
resources.getDrawable(R.drawable.ic_local_parking_black_24dp, resources.newTheme())
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(iconEraser)
listIcons.add(iconParking)
//listIcons.add(iconParking)
//listIcons.add(iconAdd)
//listIcons.add(iconTransferir)
binding.mainToolbar.toolbarIcons.adapter =
ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconEraser) {
/*if (item == iconEraser) {
// saleTracking_update()
} else if (item == iconParking) {
// showScannerTicket()
pasillerosItemClickListener?.onPasillerosItemClickListener(
} else*/
when (item){
iconParking.drawable-> pasillerosItemClickListener?.onPasillerosItemClickListener(
PasillerosItemVO(
title = "Parking"
), ""
)
}
}
})
binding.mainToolbar.toolbarIcons.layoutManager =
@ -874,7 +872,7 @@ class PreSacadorFragment :
override fun getLayoutId(): Int = R.layout.fragment_pre_sacador
override fun onPause() {
goBack = true
// goBack = true //SERGIO: se quita porque si no no entra la primera vez
goBack2 = true
super.onPause()
}

View File

@ -9,10 +9,7 @@ import es.verdnatura.domain.GetLoginUserCase
import es.verdnatura.domain.GetPreSacadorUseCase
import es.verdnatura.domain.GetSacadorControladorUserCase
import es.verdnatura.domain.GetUbicadorUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.getMessageFromResponse
import es.verdnatura.presentation.base.*
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO
@ -107,7 +104,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -117,7 +114,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@ -136,7 +133,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -146,7 +143,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@ -167,7 +164,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_responseParkingAdd.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -177,7 +174,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_responseParkingAdd.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@ -208,7 +205,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
override fun onFailure(call: Call<List<PlacementSupplyVO>>, t: Throwable)
{
val listError: ArrayList<PlacementSupplyVO> = ArrayList()
listError.add(PlacementSupplyVO(isError = true, errorMessage = getMessageFromAllResponse(callFunction,t.message!!)))
listError.add(PlacementSupplyVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_placementSuppleyList.value = PlacementSupplyListVO(listError)
}
@ -226,7 +223,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
listError.add(
PlacementSupplyVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
)
_placementSuppleyList.value = PlacementSupplyListVO(listError)
@ -253,7 +250,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
override fun onFailure(call: Call<String>, t: Throwable)
{
_response.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>)
@ -262,7 +259,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@ -299,7 +296,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -309,7 +306,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@ -328,7 +325,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_responseCode.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -338,7 +335,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_responseCode.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message()))
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
} else
{
@ -357,7 +354,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -367,7 +364,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message()))
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
} else
{
_response.value =
@ -396,7 +393,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -406,7 +403,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message()))
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
} else
{
_response.value = ResponseItemVO(isError = false, response = response.body()!!)
@ -438,7 +435,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -448,7 +445,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message()))
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
} else
{
_response.value = ResponseItemVO(isError = false, response = response.body()!!)
@ -474,7 +471,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_responseIncQuantity.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -484,7 +481,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_responseIncQuantity.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message()))
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
} else
{
_responseIncQuantity.value =

View File

@ -14,7 +14,7 @@ class PreSacadorItemVO (
var idMovimiento : String = "",
var trabajador : String = "",
var carros : List<PlacementVO> = listOf(),
var priority:Int =0,
//var priority:Int =0, 7-1-2022
var pickingOrder:Int =0
)

View File

@ -43,13 +43,6 @@ class QrFragment(
binding.splashProgress.visibility = View.GONE
customDialog = CustomDialog(requireContext())
customDialog.setTitle("Mensaje")
.setDescription("Operación " )
.setOkButton("Aceptar") {
customDialog.dismiss()
binding.mainToolbar.backButton.performClick()
}.show()
setToolbar()
setEvents()
super.init()
@ -88,7 +81,6 @@ class QrFragment(
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
goBack = false
if (!binding.scanInput.text.isNullOrEmpty()) {
binding.splashProgress.visibility = View.VISIBLE

View File

@ -9,6 +9,7 @@ import es.verdnatura.domain.GetQrReaderUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO
import retrofit2.Call
import retrofit2.Callback
@ -31,7 +32,7 @@ class QrFragmentViewModel(context: Context) : BaseViewModel() {
_qrresponse.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -61,7 +62,7 @@ class QrFragmentViewModel(context: Context) : BaseViewModel() {
if (response.body() == null) {
_qrresponse.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
}

View File

@ -4,10 +4,12 @@ import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.media.MediaPlayer
import android.os.Build
import android.os.Bundle
import android.view.View
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
import android.widget.ImageView
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
@ -495,22 +497,25 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
//OTROS
private fun setToolBar(){
binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE
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())
//val iconTransferir : Drawable = resources.getDrawable(R.drawable.ic_swap_horiz_black_24dp,resources.newTheme())
//listIcons.add(iconPrint)
listIcons.add(iconParking)
//listIcons.add(iconTransferir)
val listIcons: ArrayList<ImageView> = ArrayList()
val iconParking = ImageView(context)
iconParking.setImageResource(R.drawable.ic_local_parking_black_24dp)
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconPrint){
}else if (item == iconParking){
pasillerosItemClickListener?.onPasillerosItemClickListener(PasillerosItemVO(title = "Parking"),"")
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconParking.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp)
}
listIcons.add(iconParking)
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons,object: OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
when (item){
iconParking.drawable->pasillerosItemClickListener?.onPasillerosItemClickListener(PasillerosItemVO(title = "Parking"),"")
}
}
})
binding.mainToolbar.toolbarIcons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)

View File

@ -9,6 +9,7 @@ import es.verdnatura.domain.GetUbicadorUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO
@ -64,12 +65,12 @@ class ReposicionViewModel(context: Context) : BaseViewModel() {
fun parking(usuario: String,password: String,ticketFk: String,parking:String,callFunction:String){
getUbicadorUserCase.shelvingPark(usuario,password,ticketFk,parking).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -82,7 +83,7 @@ class ReposicionViewModel(context: Context) : BaseViewModel() {
Callback<List<PlacementSupplyVO>> {
override fun onFailure(call: Call<List<PlacementSupplyVO>>, t: Throwable) {
val listError:ArrayList<PlacementSupplyVO> = ArrayList()
listError.add(PlacementSupplyVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!)))
listError.add(PlacementSupplyVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_placementSuppleyList.value = PlacementSupplyListVO(listError)
}
override fun onResponse(
@ -93,7 +94,7 @@ class ReposicionViewModel(context: Context) : BaseViewModel() {
_placementSuppleyList.value = response.body()?.let { PlacementSupplyListVO(it) }
}else{
val listError:ArrayList<PlacementSupplyVO> = ArrayList()
listError.add(PlacementSupplyVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
listError.add(PlacementSupplyVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_placementSuppleyList.value = PlacementSupplyListVO(listError)
}
}
@ -103,12 +104,12 @@ class ReposicionViewModel(context: Context) : BaseViewModel() {
fun getIdFromCode(usuario:String,password:String,code: String,callFunction:String){
getSacadorControladorUserCase.getIdFromCode(usuario,password,code).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_responseCode.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_responseCode.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_responseCode.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_responseCode.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_responseCode.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -120,12 +121,12 @@ class ReposicionViewModel(context: Context) : BaseViewModel() {
fun itemShelvingPlacementSupplyAdd(usuario:String,password:String,itemShelvingFk:String,itemPlacementSupplyFk:String,quantity:String,callFunction:String){
getSacadorControladorUserCase.itemShelvingPlacementSupplyAdd(usuario,password,itemShelvingFk,itemPlacementSupplyFk,quantity).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -136,12 +137,12 @@ class ReposicionViewModel(context: Context) : BaseViewModel() {
fun itemPlacementSupplyCloseOrder(usuario:String,password:String,id:String,quantity:String,callFunction:String){
getPreSacadorUseCase.itemPlacementSupplyCloseOrder(usuario,password,id,quantity).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_responseClose.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_responseClose.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_responseClose.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_responseClose.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_responseClose.value = ResponseItemVO(isError = false,response = response.body()!!)
}

View File

@ -3,8 +3,10 @@ package es.verdnatura.presentation.view.feature.sacador.fragment
import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.os.Build
import android.os.Bundle
import android.view.View
import android.widget.ImageView
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
@ -13,10 +15,7 @@ import es.verdnatura.domain.ConstAndValues.SACADOR
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnCollectionSelectedListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.TAG
import es.verdnatura.presentation.common.addFragment
import es.verdnatura.presentation.common.*
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
@ -100,18 +99,39 @@ class SacadorFragment :
// requireActivity().main_bottom_navigation.visibility = View.VISIBLE
(activity as MainActivity).hideBottomNavigation(View.VISIBLE)
binding.mainToolbar.backButton.visibility = View.GONE
val listIcons: ArrayList<Drawable> = ArrayList()
val iconAdd: Drawable =
resources.getDrawable(R.drawable.ic_add_black_24dp, resources.newTheme())
val iconVehicleIn: Drawable = resources.getDrawable(R.drawable.car, resources.newTheme())
val listIcons: ArrayList<ImageView> = ArrayList()
/*val iconAdd: Drawable =
resources.getDrawable(R.drawable.ic_add_black_24dp, resources.newTheme())
val iconVehicleIn: Drawable = resources.getDrawable(R.drawable.car, resources.newTheme())*/
val iconAdd = ImageView(context)
iconAdd.setImageResource(R.drawable.ic_add_black_24dp)
val iconVehicleIn = ImageView(context)
iconVehicleIn.setImageResource(R.drawable.car)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconAdd.tooltipText=getTooltip(R.drawable.ic_add_black_24dp)
iconVehicleIn.tooltipText=getTooltip(R.drawable.car)
}
listIcons.add(iconVehicleIn)
listIcons.add(iconAdd)
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconAdd) {
when(item){
iconAdd.drawable -> {
binding.splashProgress.visibility = View.VISIBLE
viewModel.collectionNew(user,password,sectorFk,wagons,getTagsType(),"collection_new_wagon")
}
iconVehicleIn.drawable-> (activity as MainActivity).onVehicleSelected(SacadorFragment.TAG)
}
/* if (item == iconAdd) {
binding.splashProgress.visibility = View.VISIBLE
//viewModel.collectionNew(user, password, sectorFk, wagons)
viewModel.collectionNew(user,password,sectorFk,wagons,getTagsType(),"collection_new_wagon")
@ -119,9 +139,9 @@ class SacadorFragment :
}
if (item == iconVehicleIn) {
if (item.drawable == iconVehicleIn) {
(activity as MainActivity).onVehicleSelected(SacadorFragment.TAG)
}
}*/
}
})
binding.mainToolbar.toolbarIcons.layoutManager =

View File

@ -8,6 +8,7 @@ import es.verdnatura.domain.GetSacadorControladorUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.collection.mapper.map
import es.verdnatura.presentation.view.feature.sacador.mapper.toDateFormat
@ -59,7 +60,7 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
override fun onFailure(call: Call<CollectionVO>, t: Throwable) {
_collectionTicketList.value = CollectionVO(
isError = true,
errorMessage =getMessageFromAllResponse(callFunction,t.message!!)
errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@ -72,7 +73,7 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
} else {
_collectionTicketList.value = CollectionVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
}
}
@ -85,7 +86,7 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value =
ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
@ -101,7 +102,7 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
}
@ -115,7 +116,7 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value =
ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
@ -131,7 +132,7 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
}
@ -146,7 +147,7 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
Callback<List<CollectionVO>> {
override fun onFailure(call: Call<List<CollectionVO>>, t: Throwable) {
val listError: ArrayList<CollectionVO> = ArrayList()
listError.add(CollectionVO(isError = true, errorMessage = getMessageFromAllResponse(callFunction,t.message!!)))
listError.add(CollectionVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_collectionList.value = CollectionListVO(listError)
}
@ -163,7 +164,7 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
listError.add(
CollectionVO(
isError = true,
errorMessage = getMessageFromAllResponse(callFunction,response.message())
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
)
_collectionList.value = CollectionListVO(listError)

View File

@ -36,6 +36,7 @@ class SaleVO(
var isPreviousPrepared: String = "",
var isPrepared: String = "",
var isControlled: String = "",
var isPreControlled: String = "",
var color: String = "",
var productor: String = "",
var discount: String = "",

View File

@ -8,6 +8,7 @@ import es.verdnatura.domain.GetShelvingParkingUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.view.feature.shelvingparking.model.ItemShelvingParkingListVO
import es.verdnatura.presentation.view.feature.shelvingparking.model.ItemShelvingParkingVO
@ -35,7 +36,7 @@ class ShelvingParkingViewModel(context: Context) : BaseViewModel() {
Callback<List<ItemShelvingParkingVO>> {
override fun onFailure(call: Call<List<ItemShelvingParkingVO>>, t: Throwable) {
val listError:ArrayList<ItemShelvingParkingVO> = ArrayList()
listError.add(ItemShelvingParkingVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!)))
listError.add(ItemShelvingParkingVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_shelvingList.value = ItemShelvingParkingListVO(listError)
}
@ -47,7 +48,7 @@ class ShelvingParkingViewModel(context: Context) : BaseViewModel() {
_shelvingList.value = response.body()?.let { ItemShelvingParkingListVO(it) }
}else{
val listError:ArrayList<ItemShelvingParkingVO> = ArrayList()
listError.add(ItemShelvingParkingVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
listError.add(ItemShelvingParkingVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_shelvingList.value = ItemShelvingParkingListVO(listError)
}
}

View File

@ -1,4 +1,4 @@
package es.verdnatura.presentation.view.feature.precontrol
package es.verdnatura.presentation.view.feature.showticket
import android.content.Context
import android.content.SharedPreferences
@ -15,11 +15,13 @@ 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.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.precontrol.ShowTicketViewModel
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
/*import kotlinx.android.synthetic.main.fragment_controlador.*
import kotlinx.android.synthetic.main.toolbar.**/
class ShowTicketFragment: BaseFragment<FragmentControladorBinding,ShowTicketViewModel>(ShowTicketViewModel::class) {
class ShowTicketFragment: BaseFragment<FragmentControladorBinding, ShowTicketViewModel>(
ShowTicketViewModel::class) {
private var user = ""

View File

@ -6,6 +6,7 @@ import androidx.lifecycle.MutableLiveData
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.domain.GetPreControladorUserCase
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.collection.mapper.map
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
@ -29,7 +30,7 @@ class ShowTicketViewModel(context: Context) : BaseViewModel() {
getPreControladorUserCase.collectionTicketGet(usuario,password,collectionFk,sectorFk,"0",type).enqueue(object :
Callback<CollectionVO> {
override fun onFailure(call: Call<CollectionVO>, t: Throwable) {
_collectionTicketList.value = CollectionVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!))
_collectionTicketList.value = CollectionVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(
call: Call<CollectionVO>,
@ -38,7 +39,7 @@ class ShowTicketViewModel(context: Context) : BaseViewModel() {
if (response.body() != null){
_collectionTicketList.value = response.body()?.let { it.map() }
}else{
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}
}
})

View File

@ -4,10 +4,11 @@ import android.content.Context
import android.content.SharedPreferences
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.inputmethod.EditorInfo
import android.widget.ImageView
import android.widget.Toast
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
@ -18,10 +19,7 @@ import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.notNull
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnMoreClickListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.common.OnVisibleClickListener
import es.verdnatura.presentation.common.*
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.component.CustomDialogTwoButtons
@ -31,6 +29,7 @@ import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import es.verdnatura.presentation.view.feature.ubicador.adapter.UbicadorAdapter
import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_ubicador.*
import kotlinx.android.synthetic.main.toolbar.**/
@ -38,7 +37,8 @@ import kotlinx.android.synthetic.main.toolbar.**/
class UbicadorFragment(
var shelvingFk: String = ""
) : BaseFragment<FragmentUbicadorBinding, UbicadorViewModel>(
UbicadorViewModel::class) {
UbicadorViewModel::class
) {
private var user = ""
private var password = ""
@ -100,23 +100,52 @@ class UbicadorFragment(
}
private fun setToolBar() {
val listIcons:ArrayList<Drawable> = ArrayList()
/* val listIcons:ArrayList<Drawable> = ArrayList()
val iconAdd : Drawable = resources.getDrawable(R.drawable.ic_add_black_24dp,resources.newTheme())
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
listIcons.add(iconAdd)
listIcons.add(iconReload)*/
val listIcons: ArrayList<ImageView> = ArrayList()
val iconAdd = ImageView(context)
iconAdd.setImageResource(R.drawable.ic_add_black_24dp)
val iconReload = ImageView(context)
iconReload.setImageResource(R.drawable.ic_autorenew_black_24dp)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconReload.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
iconAdd.tooltipText = "Añade item al carro"
}
listIcons.add(iconAdd)
listIcons.add(iconReload)
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
binding.mainToolbar.toolbarIcons.adapter =
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconAdd){
when (item) {
iconAdd.drawable -> showAddItem("", "", "", "", false, ItemUbicadorVO(), "")
iconReload.drawable -> {
binding.splashProgress.visibility = View.VISIBLE
viewModel.itemShelvingList(
user,
password,
shelvingFk,
"itemShelvingList"
)
}
}
/*if (item == iconAdd){
showAddItem("","","","",false,ItemUbicadorVO(),"")
}else if(item == iconReload){
binding.splashProgress.visibility = View.VISIBLE
viewModel.itemShelvingList(user,password,shelvingFk,"itemShelvingList")
}
}*/
}
})
binding.mainToolbar.toolbarIcons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
binding.mainToolbar.toolbarIcons.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
private fun setEvents() {
@ -124,6 +153,7 @@ class UbicadorFragment(
requireActivity().onBackPressed()
}
setTooltips()
binding.editMatricula.requestFocus()
binding.editMatricula.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
@ -131,7 +161,12 @@ class UbicadorFragment(
binding.mainToolbar.toolbarTitle.text = binding.editMatricula.text.toString()
shelvingFk = binding.editMatricula.text.toString()
binding.splashProgress.visibility = View.VISIBLE
viewModel.itemShelvingList(user,password,binding.editMatricula.text.toString(),"itemShelvingList")
viewModel.itemShelvingList(
user,
password,
binding.editMatricula.text.toString(),
"itemShelvingList"
)
}
binding.editMatricula.setText("")
@ -145,7 +180,13 @@ class UbicadorFragment(
binding.editPrioridad.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!binding.editPrioridad.text.toString().isNullOrEmpty()) {
viewModel.shelvingPriorityUpdate(user,password,binding.editPrioridad.text.toString(),shelvingFk,"shelvingPriority_update")
viewModel.shelvingPriorityUpdate(
user,
password,
binding.editPrioridad.text.toString(),
shelvingFk,
"shelvingPriority_update"
)
}
(activity as MainActivity).hideKeyboard(binding.editPrioridad)
@ -158,16 +199,26 @@ class UbicadorFragment(
binding.automaticImg.setOnClickListener {
if (!shelvingFk.isNullOrEmpty())
(activity as MainActivity).onPasillerosItemClickListener(PasillerosItemVO(title = "Automatic"),entryPoint = shelvingFk)
(activity as MainActivity).onPasillerosItemClickListener(
PasillerosItemVO(title = "Automatic"),
entryPoint = shelvingFk
)
else
"Escanea una matrícula".toast(requireActivity(), Toast.LENGTH_SHORT)
}
binding.parkingImg.setOnClickListener {
customDialogInput.setTitle("Aparcar carro").setValue("").setOkButton("Aparcar") {
viewModel.shelvingPark(user,password,shelvingFk,customDialogInput.getValue(),"shelvingPark")
viewModel.shelvingPark(
user,
password,
shelvingFk,
customDialogInput.getValue(),
"shelvingPark"
)
parking = customDialogInput.getValue()
binding.mainToolbar.toolbarTitle.text = shelvingFk.uppercase() + " P: "+parking + " E: "+etiquetas
binding.mainToolbar.toolbarTitle.text =
shelvingFk.uppercase() + " P: " + parking + " E: " + etiquetas
if (mpok != null) mpok!!.start()
customDialogInput.dismiss()
}.setKoButton("Cancelar") {
@ -179,11 +230,18 @@ class UbicadorFragment(
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
viewModel.shelvingPark(user,password,shelvingFk,customDialogInput.getValue(),"shelvingPark")
viewModel.shelvingPark(
user,
password,
shelvingFk,
customDialogInput.getValue(),
"shelvingPark"
)
customDialogInput.dismiss()
parking = customDialogInput.getValue()
if (binding.mainToolbar.toolbarTitle != null && shelvingFk != null && parking != null && etiquetas != null) {
binding.mainToolbar.toolbarTitle.text = shelvingFk.uppercase() + " P: "+parking+ " E: "+etiquetas
binding.mainToolbar.toolbarTitle.text =
shelvingFk.uppercase() + " P: " + parking + " E: " + etiquetas
} else {
binding.mainToolbar.toolbarTitle.text = ""
}
@ -200,9 +258,16 @@ class UbicadorFragment(
binding.editImg.setOnClickListener {
customDialogInput.setTitle("Cambiar matrícula").setValue("").setOkButton("Guardar") {
viewModel.shelvingChange(user,password,shelvingFk,customDialogInput.getValue(),"shelvingChange")
viewModel.shelvingChange(
user,
password,
shelvingFk,
customDialogInput.getValue(),
"shelvingChange"
)
shelvingFk = customDialogInput.getValue()
binding.mainToolbar.toolbarTitle.text = shelvingFk.uppercase() + " P: "+parking+ " E: "+etiquetas
binding.mainToolbar.toolbarTitle.text =
shelvingFk.uppercase() + " P: " + parking + " E: " + etiquetas
if (mpok != null) mpok!!.start()
customDialogInput.dismiss()
}.setKoButton("Cancelar") {
@ -214,9 +279,16 @@ class UbicadorFragment(
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
viewModel.shelvingChange(user,password,shelvingFk,customDialogInput.getValue(),"shelvingChange")
viewModel.shelvingChange(
user,
password,
shelvingFk,
customDialogInput.getValue(),
"shelvingChange"
)
shelvingFk = customDialogInput.getValue()
binding.mainToolbar.toolbarTitle.text = shelvingFk.uppercase() + " P: "+parking+ " E: "+etiquetas
binding.mainToolbar.toolbarTitle.text =
shelvingFk.uppercase() + " P: " + parking + " E: " + etiquetas
if (mpok != null) mpok!!.start()
customDialogInput.dismiss()
return@setOnEditorActionListener true
@ -227,7 +299,8 @@ class UbicadorFragment(
}
binding.deleteImg.setOnClickListener {
customDialog.setTitle("Vaciar carro").setDescription("Esta operación no se puede rectificar.").setOkButton("Vaciar"){
customDialog.setTitle("Vaciar carro")
.setDescription("Esta operación no se puede rectificar.").setOkButton("Vaciar") {
viewModel.clearShelvingList(user, password, shelvingFk, "clearShelvingList")
listItems.forEach {
it.stickers = "0"
@ -246,6 +319,17 @@ class UbicadorFragment(
}
private fun setTooltips() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
binding.editImg.tooltipText="Permite cambiar la matrícula al carro"
binding.deleteImg.tooltipText="Borra todos los items del carro"
binding.editPrioridad.tooltipText="Cambia la prioridad de los items del carro. Cuanto más alta antes cogerán los sacadores."
binding.parkingImg.tooltipText="Permite aparcar el carro"
binding.automaticImg.tooltipText="Permite añadir items al carro de manera continuada. No uno a uno"
}
}
override fun observeViewModel() {
with(viewModel) {
loadShelvingList.observe(viewLifecycleOwner, Observer { event ->
@ -256,29 +340,42 @@ class UbicadorFragment(
it.list.forEach { item ->
try {
contEtiquetas += item.stickers.toInt()
}catch (e: Exception) {}
} catch (e: Exception) {
}
parking = item.code.uppercase()
listItems.add(item)
}
etiquetas = contEtiquetas.toString()
binding.mainToolbar.toolbarTitle.text = shelvingFk.uppercase() + " P: "+parking+ " E: "+etiquetas
binding.mainToolbar.toolbarTitle.text =
shelvingFk.uppercase() + " P: " + parking + " E: " + etiquetas
if (it.list.size > 0)
binding.editPrioridad.setText(it.list[0].priority)
binding.splashProgress.visibility = View.GONE
//sergio: para mostrar CustomDialogUbicator, ubicador con grouping
adapter = UbicadorAdapter(listItems,onPasillerosItemClickListener = pasillerosItemClickListener!!,
adapter = UbicadorAdapter(listItems,
onPasillerosItemClickListener = pasillerosItemClickListener!!,
onVisibleClickListener = object : OnVisibleClickListener {
override fun onVisibleClickListener(item: ItemUbicadorVO) {
// if (item.grouping.isNullOrEmpty()){item.grouping=""}
showAddItem(item.item,item.packing,item.stickers,item.visible,true,item,
grouping=if (item.grouping.isNullOrEmpty()) { "" } else item.grouping)
showAddItem(
item.item,
item.packing,
item.stickers,
item.visible,
true,
item,
grouping = if (item.grouping.isNullOrEmpty()) {
""
} else item.grouping
)
}
},onMoreClickListener = object: OnMoreClickListener{
},
onMoreClickListener = object : OnMoreClickListener {
override fun onMoreClickListener(item: ItemUbicadorVO) {
showMoreOptions(item)
}
@ -286,7 +383,8 @@ class UbicadorFragment(
})
binding.locationRecyclerview.adapter = adapter
binding.locationRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, true)
binding.locationRecyclerview.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, true)
}
})
@ -294,7 +392,8 @@ class UbicadorFragment(
response.observe(viewLifecycleOwner, Observer {
if (it.isError) {
mperror!!.start()
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
}
@ -303,7 +402,8 @@ class UbicadorFragment(
responsepriority.observe(viewLifecycleOwner, Observer {
if (it.isError) {
mperror!!.start()
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
} else {
@ -321,15 +421,33 @@ class UbicadorFragment(
}
}
private fun showAddItem(itemFk:String,packing: String,etiquetas: String,visible: String, delete:Boolean,itemUbicador:ItemUbicadorVO,grouping:String){
private fun showAddItem(
itemFk: String,
packing: String,
etiquetas: String,
visible: String,
delete: Boolean,
itemUbicador: ItemUbicadorVO,
grouping: String
) {
var title = "Nuevo Item"
if (delete) title = "Editar item " + itemFk
customDialogUbicador.setTitle(title).setItemValue(itemFk).setPackingValue(packing).setGroupingValue(grouping).setEtiquetaValue(etiquetas).setVisibleValue(visible).setOkButton("Guardar"){
customDialogUbicador.setTitle(title).setItemValue(itemFk).setPackingValue(packing)
.setGroupingValue(grouping).setEtiquetaValue(etiquetas).setVisibleValue(visible)
.setOkButton("Guardar") {
var packingUpdate = false
if (packing != customDialogUbicador.getPackingValue() || etiquetas != customDialogUbicador.getEtiquetaValue()) {
packingUpdate = true
}
saveNewItem(customDialogUbicador.getItemValue(),customDialogUbicador.getEtiquetaValue(),customDialogUbicador.getPackingValue(),customDialogUbicador.getVisibleValue(),if (delete)packingUpdate else null,itemUbicador.id,customDialogUbicador.getGroupingValue())
saveNewItem(
customDialogUbicador.getItemValue(),
customDialogUbicador.getEtiquetaValue(),
customDialogUbicador.getPackingValue(),
customDialogUbicador.getVisibleValue(),
if (delete) packingUpdate else null,
itemUbicador.id,
customDialogUbicador.getGroupingValue()
)
}.setKoButton("Cerrar") {
customDialogUbicador.dismiss()
}.show()
@ -343,7 +461,15 @@ class UbicadorFragment(
if (packing != customDialogUbicador.getPackingValue() || etiquetas != customDialogUbicador.getEtiquetaValue()) {
packingUpdate = true
}
saveNewItem(customDialogUbicador.getItemValue(),customDialogUbicador.getEtiquetaValue(),customDialogUbicador.getPackingValue(),customDialogUbicador.getVisibleValue(),if (delete)packingUpdate else null,itemUbicador.id,customDialogUbicador.getGroupingValue())
saveNewItem(
customDialogUbicador.getItemValue(),
customDialogUbicador.getEtiquetaValue(),
customDialogUbicador.getPackingValue(),
customDialogUbicador.getVisibleValue(),
if (delete) packingUpdate else null,
itemUbicador.id,
customDialogUbicador.getGroupingValue()
)
return@setOnEditorActionListener true
}
false
@ -355,7 +481,15 @@ class UbicadorFragment(
if (packing != customDialogUbicador.getPackingValue() || etiquetas != customDialogUbicador.getEtiquetaValue()) {
packingUpdate = true
}
saveNewItem(customDialogUbicador.getItemValue(),customDialogUbicador.getEtiquetaValue(),customDialogUbicador.getPackingValue(),customDialogUbicador.getVisibleValue(),if (delete)packingUpdate else null,itemUbicador.id,customDialogUbicador.getGroupingValue())
saveNewItem(
customDialogUbicador.getItemValue(),
customDialogUbicador.getEtiquetaValue(),
customDialogUbicador.getPackingValue(),
customDialogUbicador.getVisibleValue(),
if (delete) packingUpdate else null,
itemUbicador.id,
customDialogUbicador.getGroupingValue()
)
return@setOnEditorActionListener true
}
false
@ -363,34 +497,104 @@ class UbicadorFragment(
}
private fun saveNewItem(itemFk:String,etiquetas:String,packing:String,visible:String,updatePacking:Boolean? = null,itemShelvingFk:String,groupingPack:String){
private fun saveNewItem(
itemFk: String,
etiquetas: String,
packing: String,
visible: String,
updatePacking: Boolean? = null,
itemShelvingFk: String,
groupingPack: String
) {
if (!packing.isNullOrEmpty()) {
if (updatePacking == null) {
if (!itemFk.isNullOrEmpty() && !visible.isNullOrEmpty()) {
viewModel.itemShelvingMake(user,password,shelvingFk,itemFk,deep.toString(),visible,packing,warehouseFk,"1","itemShelvingMake",groupingPack)
changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible,packing = packing))
customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("").setEtiquetaValue("").setVisibleValue("")
viewModel.itemShelvingMake(
user,
password,
shelvingFk,
itemFk,
deep.toString(),
visible,
packing,
warehouseFk,
"1",
"itemShelvingMake",
groupingPack
)
changeOfflineValue(
ItemUbicadorVO(
item = itemFk,
visible = visible,
packing = packing
)
)
customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("")
.setEtiquetaValue("").setVisibleValue("")
customDialogUbicador.getEditItem().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem())
customDialogUbicador.dismiss()
} else if (!itemFk.isNullOrEmpty() && !etiquetas.isNullOrEmpty()) {
val visible_calc = (etiquetas.toInt() * packing.toInt()).toString()
viewModel.itemShelvingMake(user,password,shelvingFk,itemFk,deep.toString(),visible_calc,packing,warehouseFk,"1","itemShelvingMake",groupingPack)
changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible_calc,packing = packing,stickers = etiquetas))
customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("").setEtiquetaValue("").setVisibleValue("")
viewModel.itemShelvingMake(
user,
password,
shelvingFk,
itemFk,
deep.toString(),
visible_calc,
packing,
warehouseFk,
"1",
"itemShelvingMake",
groupingPack
)
changeOfflineValue(
ItemUbicadorVO(
item = itemFk,
visible = visible_calc,
packing = packing,
stickers = etiquetas
)
)
customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("")
.setEtiquetaValue("").setVisibleValue("")
customDialogUbicador.getEditItem().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem())
customDialogUbicador.dismiss()
} else {
"Rellena campos obligatorios".toast((activity as MainActivity), Toast.LENGTH_LONG)
"Rellena campos obligatorios".toast(
(activity as MainActivity),
Toast.LENGTH_LONG
)
}
} else {
if (!itemFk.isNullOrEmpty() && !visible.isNullOrEmpty() && !updatePacking) {
viewModel.itemShelvingMakeEdit(user,password,shelvingFk,itemFk,deep.toString(),visible,packing,warehouseFk,"1",itemShelvingFk,"itemShelvingMakeEdit",groupingPack)
changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible,packing = packing))
customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("").setEtiquetaValue("").setVisibleValue("")
viewModel.itemShelvingMakeEdit(
user,
password,
shelvingFk,
itemFk,
deep.toString(),
visible,
packing,
warehouseFk,
"1",
itemShelvingFk,
"itemShelvingMakeEdit",
groupingPack
)
changeOfflineValue(
ItemUbicadorVO(
item = itemFk,
visible = visible,
packing = packing
)
)
customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("")
.setEtiquetaValue("").setVisibleValue("")
customDialogUbicador.getEditItem().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem())
customDialogUbicador.dismiss()
@ -399,16 +603,41 @@ class UbicadorFragment(
var visible_calc = "0"
try {
visible_calc = (etiquetas.toInt() * packing.toInt()).toString()
}catch (e:Exception){}
viewModel.itemShelvingMakeEdit(user,password,shelvingFk,itemFk,deep.toString(),visible_calc,packing,warehouseFk,"1",itemShelvingFk,"itemShelvingMakeEdit",groupingPack)
changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible_calc,packing = packing,stickers = etiquetas))
customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("").setEtiquetaValue("").setVisibleValue("")
} catch (e: Exception) {
}
viewModel.itemShelvingMakeEdit(
user,
password,
shelvingFk,
itemFk,
deep.toString(),
visible_calc,
packing,
warehouseFk,
"1",
itemShelvingFk,
"itemShelvingMakeEdit",
groupingPack
)
changeOfflineValue(
ItemUbicadorVO(
item = itemFk,
visible = visible_calc,
packing = packing,
stickers = etiquetas
)
)
customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("")
.setEtiquetaValue("").setVisibleValue("")
customDialogUbicador.getEditItem().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem())
customDialogUbicador.dismiss()
} else {
"Rellena campos obligatorios".toast((activity as MainActivity), Toast.LENGTH_LONG)
"Rellena campos obligatorios".toast(
(activity as MainActivity),
Toast.LENGTH_LONG
)
}
}
@ -447,10 +676,19 @@ class UbicadorFragment(
}
private fun showMoreOptions(item: ItemUbicadorVO) {
customDialogTwoButtons.setTitle(item.item).setDescription("Selecciona una acción").setOkButton("Transferir"){
customDialogInput.setTitle("Nueva matrícula").setDescription("Introduce el destino para item: "+item.item).setValue("").setOkButton("Transferir"){
customDialogTwoButtons.setTitle(item.item).setDescription("Selecciona una acción")
.setOkButton("Transferir") {
customDialogInput.setTitle("Nueva matrícula")
.setDescription("Introduce el destino para item: " + item.item).setValue("")
.setOkButton("Transferir") {
if (customDialogInput.getValue().isNotEmpty()) {
viewModel.itemShelvingTransfer(user,password,item.id,customDialogInput.getValue(),"itemShelvingTransfer")
viewModel.itemShelvingTransfer(
user,
password,
item.id,
customDialogInput.getValue(),
"itemShelvingTransfer"
)
listItems.remove(item)
adapter!!.notifyDataSetChanged()
customDialogInput.dismiss()
@ -459,7 +697,6 @@ class UbicadorFragment(
}
}.setKoButton("Cancelar") {
customDialogInput.dismiss()
}.show()
@ -467,7 +704,13 @@ class UbicadorFragment(
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
viewModel.itemShelvingTransfer(user,password,item.id,customDialogInput.getValue(),"itemShelvingTransfer")
viewModel.itemShelvingTransfer(
user,
password,
item.id,
customDialogInput.getValue(),
"itemShelvingTransfer"
)
listItems.remove(item)
adapter!!.notifyDataSetChanged()
customDialogInput.dismiss()
@ -477,7 +720,9 @@ class UbicadorFragment(
}
customDialogTwoButtons.dismiss()
}.setOkButtonTwo("Eliminar") {
customDialog.setTitle("Confirmar").setDescription("Confirmas eliminar el artículo: "+item.item+"?").setOkButton("Eliminar"){
customDialog.setTitle("Confirmar")
.setDescription("Confirmas eliminar el artículo: " + item.item + "?")
.setOkButton("Eliminar") {
listItems.remove(item)
adapter!!.notifyDataSetChanged()
viewModel.itemShelvingDelete(user, password, item.id, "itemShelvingDelete")

View File

@ -8,6 +8,7 @@ import es.verdnatura.domain.GetUbicadorUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
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.ubicador.model.ItemUbicadorListVO
@ -45,7 +46,7 @@ class UbicadorViewModel(context: Context) : BaseViewModel() {
Callback<List<ItemUbicadorVO>> {
override fun onFailure(call: Call<List<ItemUbicadorVO>>, t: Throwable) {
val listError:ArrayList<ItemUbicadorVO> = ArrayList()
listError.add(ItemUbicadorVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
listError.add(ItemUbicadorVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_shelvingList.value = ItemUbicadorListVO(listError)
}
@ -57,7 +58,7 @@ class UbicadorViewModel(context: Context) : BaseViewModel() {
_shelvingList.value = response.body()?.let { ItemUbicadorListVO(it) }
}else{
val listError:ArrayList<ItemUbicadorVO> = ArrayList()
listError.add(ItemUbicadorVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
listError.add(ItemUbicadorVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_shelvingList.value = ItemUbicadorListVO(listError)
}
}
@ -68,19 +69,19 @@ class UbicadorViewModel(context: Context) : BaseViewModel() {
fun shelvingPriorityUpdate(usuario:String,password:String,priority:String,shelving:String,callFunction:String){
getUbicadorUserCase.shelvingPriorityUpdate(usuario,password,priority,shelving).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_responsepriority.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_responsepriority.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (!response.isSuccessful){
_responsepriority.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_responsepriority.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_responsepriority.value = ResponseItemVO(isError = false,response = "Prioridad modificada")
}
/*if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}*/
@ -94,12 +95,12 @@ class UbicadorViewModel(context: Context) : BaseViewModel() {
fun itemShelvingMake(usuario:String,password:String,shelving:String,item:String,deep:String,quantity:String,packing:String,warehouse:String,level:String,callFunction:String,grouping: String){
getUbicadorUserCase.itemShelvingMake(usuario,password,shelving,item,deep,quantity,packing,warehouse,level,grouping).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_responseMake.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -112,12 +113,12 @@ class UbicadorViewModel(context: Context) : BaseViewModel() {
fun itemShelvingMakeEdit(usuario:String,password:String,shelving:String,item:String,deep:String,quantity:String,packing:String,warehouse:String,level:String,itemShelvingFk:String,callFunction:String,grouping:String){
getUbicadorUserCase.itemShelvingMakeEdit(usuario,password,shelving,item,deep,quantity,packing,warehouse,level,itemShelvingFk,grouping).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_responseMake.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -130,11 +131,11 @@ class UbicadorViewModel(context: Context) : BaseViewModel() {
fun shelvingPark(usuario:String,password:String,shelving:String,parking:String,callFunction:String){
getUbicadorUserCase.shelvingPark(usuario,password,shelving,parking).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -145,11 +146,11 @@ class UbicadorViewModel(context: Context) : BaseViewModel() {
fun shelvingChange(usuario:String,password:String,origen:String,destino:String,callFunction:String){
getUbicadorUserCase.shelvingChange(usuario,password,origen,destino).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -160,11 +161,11 @@ class UbicadorViewModel(context: Context) : BaseViewModel() {
fun clearShelvingList(usuario:String,password:String,shelvingFk:String,callFunction:String){
getUbicadorUserCase.clearShelvingList(usuario,password,shelvingFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -175,11 +176,11 @@ class UbicadorViewModel(context: Context) : BaseViewModel() {
fun itemShelvingTransfer(usuario:String,password:String,itemFk:String,shelvingFk:String,callFunction:String){
getUbicadorUserCase.itemShelvingTransfer(usuario,password,itemFk,shelvingFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@ -190,11 +191,11 @@ class UbicadorViewModel(context: Context) : BaseViewModel() {
fun itemShelvingDelete(usuario:String,password:String,itemFk:String,callFunction:String){
getUbicadorUserCase.itemShelvingDelete(usuario,password,itemFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}

View File

@ -0,0 +1,8 @@
<!-- drawable/phone_outline.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#fff" android:pathData="M20,15.5C18.8,15.5 17.5,15.3 16.4,14.9C16.3,14.9 16.2,14.9 16.1,14.9C15.8,14.9 15.6,15 15.4,15.2L13.2,17.4C10.4,15.9 8,13.6 6.6,10.8L8.8,8.6C9.1,8.3 9.2,7.9 9,7.6C8.7,6.5 8.5,5.2 8.5,4C8.5,3.5 8,3 7.5,3H4C3.5,3 3,3.5 3,4C3,13.4 10.6,21 20,21C20.5,21 21,20.5 21,20V16.5C21,16 20.5,15.5 20,15.5M5,5H6.5C6.6,5.9 6.8,6.8 7,7.6L5.8,8.8C5.4,7.6 5.1,6.3 5,5M19,19C17.7,18.9 16.4,18.6 15.2,18.2L16.4,17C17.2,17.2 18.1,17.4 19,17.4V19Z" />
</vector>

View File

@ -22,6 +22,7 @@
<color name="verdnatura_dark_sky_blue">#4ab4e6</color>
<color name="verdnatura_dark_mint">#50be87</color>
<color name="verdnatura_dark_mint_light">#80be87</color>
<color name="verdnatura_dark_mint_light_precontrolled">#b8daba</color>
<color name="verdnatura_light_teal">#b8ecd6</color>
<color name="verdnatura_white">#ffffff</color>
<color name="verdnatura_black_8_alpha_6">#991A1A1A</color>