Versión 6.1.3 más textos cambiados y quitadas llamadas a collection_updateState
This commit is contained in:
parent
d63c74c055
commit
9e0d6d3eb1
|
@ -14,9 +14,9 @@ android {
|
|||
applicationId "es.verdnatura"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
versionCode 60
|
||||
versionCode 64
|
||||
// versionName "5.4.4"
|
||||
versionName "6.1.3"
|
||||
versionName "6.1.6" //control vehiculo , visualizar y filtrar historico
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -10,8 +10,8 @@
|
|||
{
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"versionCode": 60,
|
||||
"versionName": "6.1.3",
|
||||
"versionCode": 64,
|
||||
"versionName": "6.1.6",
|
||||
"outputFile": "app-release.apk"
|
||||
}
|
||||
]
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,10 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="es.verdnatura">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.PREVENT_POWER_KEY" />
|
||||
<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"/>
|
||||
|
||||
|
||||
<application
|
||||
android:name=".MobileApplication"
|
||||
|
|
|
@ -18,11 +18,15 @@ import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionSc
|
|||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionTruckListViewModel
|
||||
import es.verdnatura.presentation.view.feature.parking.fragment.ParkingViewModel
|
||||
import es.verdnatura.presentation.view.feature.pasillero.fragment.PasilleroViewModel
|
||||
import es.verdnatura.presentation.view.feature.precontrol.PreControladorViewModel
|
||||
import es.verdnatura.presentation.view.feature.presacador.fragment.PreSacadorViewModel
|
||||
import es.verdnatura.presentation.view.feature.reposicion.fragment.ReposicionViewModel
|
||||
import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorViewModel
|
||||
import es.verdnatura.presentation.view.feature.shelvingparking.fragment.ShelvingParkingViewModel
|
||||
import es.verdnatura.presentation.view.feature.ubicador.fragment.AutomaticAddItemViewModel
|
||||
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoViewModel
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoViewModel
|
||||
import es.verdnatura.presentation.view.feature.smarttag.sacador.AssociateTagsViewModel
|
||||
import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorViewModel
|
||||
import org.koin.android.ext.koin.androidContext
|
||||
import org.koin.androidx.viewmodel.dsl.viewModel
|
||||
|
@ -59,6 +63,10 @@ val viewModelModule = module{
|
|||
BuscarItemAllViewModel(androidContext())
|
||||
}
|
||||
|
||||
viewModel{
|
||||
PreControladorViewModel(androidContext())
|
||||
}
|
||||
|
||||
// Pasilleros / Inventario
|
||||
viewModel {
|
||||
InventaryViewModel(androidContext())
|
||||
|
@ -137,4 +145,15 @@ val viewModelModule = module{
|
|||
viewModel {
|
||||
QaualityViewModel(androidContext())
|
||||
}
|
||||
|
||||
viewModel {
|
||||
ControlVehiculoViewModel(androidContext())
|
||||
}
|
||||
|
||||
viewModel{
|
||||
HistoricoVehiculoViewModel(androidContext())
|
||||
}
|
||||
viewModel{
|
||||
AssociateTagsViewModel(androidContext())
|
||||
}
|
||||
}
|
|
@ -1,13 +1,15 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
object ConstAndValues {
|
||||
const val SACADOR = "PREPARED"
|
||||
const val CONTROLADOR = "CHECKED"
|
||||
const val SACADOR = "PREPARED" //ITEMPICKER
|
||||
const val CONTROLADOR = "CHECKED"//CHECKER
|
||||
const val OK = "OK"
|
||||
const val PREPARED = "PREPARED"
|
||||
const val ON_PREPARATION = "ON_PREPARATION"
|
||||
const val CHECKED = "CHECKED"
|
||||
const val PRESACADOR = "PRESACADOR"
|
||||
const val PRESACADOR = "PRESACADOR" //PREITEMPICKER
|
||||
const val ON_CHECKING = "ON_CHECKING"
|
||||
const val PRECHECKER = "PRECHECKER"//PRECHECKER
|
||||
const val MAINACTIVITY = "MAIN"
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
|
||||
fun Any.toast(context: Context?, duration: Int = Toast.LENGTH_SHORT): Toast {
|
||||
|
@ -9,4 +10,4 @@ fun Any.toast(context: Context?, duration: Int = Toast.LENGTH_SHORT): Toast {
|
|||
|
||||
fun <T : Any> T?.notNull(f: (it: T) -> Unit) {
|
||||
if (this != null) f(this)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,10 +8,11 @@ import retrofit2.Call
|
|||
|
||||
class GetLoginUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun login(usuario:String,password:String) : Call<String>{
|
||||
fun login(usuario:String,password:String,imei:String) : Call<String>{
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
params.add(usuario)
|
||||
params.add(password)
|
||||
//params.add(imei)
|
||||
return restClient!!.login("json","1",usuario,password,"application/json",params)
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ class GetPaletizadoresUserCase(context: Context) : RestClient(context) {
|
|||
val params:ArrayList<String> = ArrayList()
|
||||
params.add(vHour)
|
||||
params.add(vDescription)
|
||||
// ////Log.i("VERDNATURA"," La hora es $vHour y descrip $vDescription")
|
||||
// //////Log.i("VERDNATURA:"," La hora es $vHour y descrip $vDescription")
|
||||
return restClient!!.expeditionTruckAdd("json","1",usuario,password,"application/json",params)
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import retrofit2.Call
|
||||
|
||||
class GetPreControladorUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
|
||||
fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String,print:String,type:String) : Call<CollectionVO> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
params.add(collectionFk)
|
||||
params.add(sectorFk)
|
||||
params.add(print)
|
||||
params.add(type)
|
||||
return restClient!!.collection_getTickets("json","1",usuario,password,"application/json",params)
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -10,14 +10,16 @@ import retrofit2.Call
|
|||
|
||||
class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String,print:String) : Call<CollectionVO> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String,print:String,type:String) : Call<CollectionVO> {
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
params.add(collectionFk)
|
||||
params.add(sectorFk)
|
||||
params.add(print)
|
||||
params.add(type)
|
||||
return restClient!!.collectionTicketGet("json","1",usuario,password,"application/json",params)
|
||||
}
|
||||
|
||||
|
||||
fun collectionNew(usuario:String,password:String,sectorFk:String,carros:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
params.add(sectorFk)
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoVO
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
|
||||
import retrofit2.Call
|
||||
|
||||
class GetVehicleControlTimeUserCase (context: Context) : RestClient(context) {
|
||||
|
||||
fun vehicleWarehouseTimeControl_insert(usuario:String,password:String,plateNumber:String,workerFk:String,direction:String) : Call<Boolean> {
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
params.add(plateNumber)
|
||||
params.add(workerFk)
|
||||
params.add(direction)
|
||||
return restClient!!.vehicleWarehouseTimeControl_insert("json","1",usuario,password,"application/json",params)
|
||||
}
|
||||
|
||||
|
||||
fun vehicleWarehouseTimeControl_checkRegister(usuario:String,password:String,userFk:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
params.add(userFk)
|
||||
return restClient!!.vehicleWarehouseTimeControl_checkRegister("json","1",usuario,password,"application/json",params)
|
||||
}
|
||||
|
||||
fun vehicleWarehouseTimeControl_getHistorical(usuario:String,password:String,PlateNumber:String,nameWorker:String) : Call<List<ItemHistoricoVehiculo>> {
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
params.add(PlateNumber)
|
||||
params.add(nameWorker)
|
||||
return restClient!!.vehicleWarehouseTimeControl_getHistorical("json","1",usuario,password,"application/json",params)
|
||||
}
|
||||
|
||||
}
|
|
@ -12,6 +12,7 @@ import es.verdnatura.presentation.view.feature.calidad.model.ItemBuyerVO
|
|||
import es.verdnatura.presentation.view.feature.collection.ItemVO
|
||||
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
|
||||
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoVO
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
|
||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
||||
import es.verdnatura.presentation.view.feature.login.model.versionApp
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.*
|
||||
|
@ -129,6 +130,17 @@ interface VerdnaturaService {
|
|||
@Header("Content-Type") content_type: String,
|
||||
@Body params: List<String>):
|
||||
Call<CollectionVO>
|
||||
//sergio: de momento se separa para ir viendo como funciona. El precontrol llamara a collectionTicketGet con otro parametro.
|
||||
@POST("almacennew/collection_getTickets")
|
||||
fun collection_getTickets(@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<CollectionVO>
|
||||
|
||||
|
||||
|
||||
@POST("almacennew/saleTrackingReplace")
|
||||
fun saleTrackingReplace(@Header("aplicacion") aplicacion: String,
|
||||
|
@ -440,6 +452,33 @@ interface VerdnaturaService {
|
|||
Call<List<ItemShelvingParkingVO>>
|
||||
|
||||
|
||||
//CONTROL DE VEHICULOS
|
||||
@POST("almacennew/vehicleWarehouseTimeControl_insert")
|
||||
fun vehicleWarehouseTimeControl_insert(@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<Boolean>
|
||||
|
||||
@POST("almacennew/vehicleWarehouseTimeControl_checkRegister")
|
||||
fun vehicleWarehouseTimeControl_checkRegister(@Header("aplicacion") aplicacion: String,
|
||||
@Header("version") version: String,
|
||||
@Header("user") user: String,
|
||||
@Header("pass") pass: String,
|
||||
@Header("Content-Type") content_type: String,
|
||||
@Body params: List<String>):
|
||||
Call<String>
|
||||
|
||||
@POST("almacennew/vehicleWarehouseTimeControl_getHistorical")
|
||||
fun vehicleWarehouseTimeControl_getHistorical(@Header("aplicacion") aplicacion: String,
|
||||
@Header("version") version: String,
|
||||
@Header("user") user: String,
|
||||
@Header("pass") pass: String,
|
||||
@Header("Content-Type") content_type: String,
|
||||
@Body params: List<String>):
|
||||
Call<List<ItemHistoricoVehiculo>>
|
||||
|
||||
//UBICADOR ========================================================================>
|
||||
@POST("almacennew/itemShelvingList")
|
||||
|
|
|
@ -38,4 +38,7 @@ abstract class BaseActivity<T : ViewDataBinding> : AppCompatActivity() {
|
|||
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
imm.hideSoftInputFromWindow(view.windowToken, 0)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -27,6 +27,7 @@ import es.verdnatura.domain.toast
|
|||
import es.verdnatura.presentation.common.mediaCurrentVolume
|
||||
import es.verdnatura.presentation.common.mediaMaxVolume
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
|
@ -97,6 +98,7 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
init()
|
||||
}
|
||||
|
||||
|
||||
@LayoutRes
|
||||
abstract fun getLayoutId(): Int
|
||||
open fun init() {}
|
||||
|
@ -322,7 +324,19 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
return 100
|
||||
}
|
||||
|
||||
private fun requestRecordAudioPermission() {
|
||||
/* private fun requestReadPhoneStatePermission(){
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
val requiredPermission: String = Manifest.permission.READ_PHONE_STATE
|
||||
val res = context!!.checkCallingOrSelfPermission(requiredPermission)
|
||||
if (res == PackageManager.PERMISSION_DENIED) {
|
||||
requestPermissions(arrayOf(requiredPermission), 102)
|
||||
}
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
private fun requestRecordAudioPermission() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
val requiredPermission: String = Manifest.permission.RECORD_AUDIO
|
||||
val res = context!!.checkCallingOrSelfPermission(requiredPermission)
|
||||
|
@ -353,6 +367,12 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
editor.apply()
|
||||
}
|
||||
|
||||
fun getIMEI() :String {
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||
val imei = prefs.getString("IMEI","0")
|
||||
return imei.toString()
|
||||
}
|
||||
|
||||
|
||||
/*open fun wordToNumber(input: String?): Int {
|
||||
var input = input
|
||||
|
|
|
@ -102,4 +102,8 @@ interface OnBuyerSelectedListener {
|
|||
|
||||
interface OnStarSelectedListener {
|
||||
fun onStarSelected(vId:String, vStars:String)
|
||||
}
|
||||
|
||||
interface onVehicleSelected{
|
||||
fun onVehicleClick(userFk: String)
|
||||
}
|
|
@ -7,6 +7,7 @@ import android.graphics.Bitmap
|
|||
import android.graphics.drawable.Drawable
|
||||
import android.media.AudioManager
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewTreeObserver
|
||||
|
@ -20,6 +21,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.request.target.CustomTarget
|
||||
import com.bumptech.glide.request.transition.Transition
|
||||
import es.verdnatura.BuildConfig
|
||||
import java.util.*
|
||||
|
||||
|
||||
|
@ -153,12 +155,10 @@ fun AudioManager.setMediaVolume(volumeIndex:Int) {
|
|||
)
|
||||
}
|
||||
|
||||
|
||||
// Extension property to get media maximum volume index
|
||||
val AudioManager.mediaMaxVolume:Int
|
||||
get() = this.getStreamMaxVolume(AudioManager.STREAM_MUSIC)
|
||||
|
||||
|
||||
// Extension property to get media/music current volume index
|
||||
val AudioManager.mediaCurrentVolume:Int
|
||||
get() = this.getStreamVolume(AudioManager.STREAM_MUSIC)
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
package es.verdnatura.presentation.view.feature.ajustes.fragment
|
||||
|
||||
import android.app.AlarmManager
|
||||
import android.app.AlertDialog
|
||||
import android.app.PendingIntent
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import android.os.Bundle
|
||||
import android.preference.PreferenceManager
|
||||
import android.util.Log
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import androidx.lifecycle.Observer
|
||||
|
@ -16,7 +12,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentAjustesBinding
|
||||
import es.verdnatura.domain.notNull
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.OnAjustesItemClickListener
|
||||
import es.verdnatura.presentation.common.hideKeyboard
|
||||
|
@ -24,8 +19,6 @@ 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
|
||||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||
import es.verdnatura.presentation.view.feature.login.activity.LoginActivity
|
||||
import es.verdnatura.presentation.view.feature.login.fragment.LoginFragment
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.fragment_ajustes.*
|
||||
import kotlinx.android.synthetic.main.fragment_ajustes.splash_progress
|
||||
|
@ -98,7 +91,7 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
|
|||
} else if (item.id == 1){
|
||||
activity!!.onBackPressed()
|
||||
}else if (item.id == 2){
|
||||
// ////Log.i("VERDNATURA","Carros pulsados")
|
||||
// //////Log.i("VERDNATURA:","Carros pulsados")
|
||||
val listCarros : ArrayList<String> = ArrayList()
|
||||
listCarros.add("1")
|
||||
listCarros.add("2")
|
||||
|
@ -131,7 +124,7 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
|
|||
event.getContentIfNotHandled().notNull {
|
||||
splash_progress.visibility = View.INVISIBLE
|
||||
if (it.list != null && it.list.size > 0 && it.list.get(0).isError){
|
||||
customDialog.setTitle("Error").setDescription(it.list.get(0).errorMessage).setOkButton(getString(R.string.Cerrar)){
|
||||
customDialog.setTitle("Error").setDescription(it.list.get(0).errorMessage).setOkButton(getString(R.string.Close)){
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
}else{
|
||||
|
@ -146,7 +139,7 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
|
|||
showDialogSector(listSectores.toArray(array))
|
||||
|
||||
}else{
|
||||
customDialog.setTitle("Sectores").setDescription(getString(R.string.Noexistessectores)).setOkButton(getString(R.string.Cerrar)){
|
||||
customDialog.setTitle("Sectores").setDescription(getString(R.string.Noexistessectores)).setOkButton(getString(R.string.Close)){
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
}
|
||||
|
|
|
@ -86,7 +86,6 @@ class ItemCardFragment(
|
|||
customDialogInput = CustomDialogInput(requireContext())
|
||||
customDialogList = CustomDialogList(requireContext())
|
||||
customDialogTwo = CustomDialogTwoButtons(requireContext())
|
||||
//sergio: se le pasa el item desde otros fragments
|
||||
if (!itemFk.isNullOrEmpty()){
|
||||
getItemCard(itemFk)
|
||||
}
|
||||
|
@ -112,7 +111,10 @@ class ItemCardFragment(
|
|||
if (itemFk.isNullOrEmpty()){
|
||||
"Escanea un item".toast(activity!!)
|
||||
}else{
|
||||
(activity as MainActivity).onPasillerosItemClickListener( PasillerosItemVO(title = "Historico"),itemFk)
|
||||
// //Log.i("VERDNATURA:","el item es ${itemInfoG!!.id}")
|
||||
//(activity as MainActivity).onPasillerosItemClickListener( PasillerosItemVO(title = "Historico"),itemFk)
|
||||
(activity as MainActivity).onPasillerosItemClickListener( PasillerosItemVO(title = "Historico"),itemInfoG!!.id)
|
||||
////Log.i("VERDNATURA:","El item es ${itemInfoG!!.id}")
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -186,8 +188,8 @@ class ItemCardFragment(
|
|||
|
||||
itemspackinglist.observe(viewLifecycleOwner, Observer {
|
||||
splash_progress.visibility = View.GONE
|
||||
// Log.i("VERDNATURA","el code es $it.code")
|
||||
// Log.i("VERDNATURA","la descrip es $it.description")
|
||||
// //Log.i("VERDNATURA:","el code es $it.code")
|
||||
// //Log.i("VERDNATURA:","la descrip es $it.description")
|
||||
createItemTypeTypeList(it.list)
|
||||
})
|
||||
|
||||
|
@ -210,7 +212,7 @@ class ItemCardFragment(
|
|||
if (!item.isError){
|
||||
try {
|
||||
itemsPackingType.add(ItemPackingType(item.code,item.description));
|
||||
// Log.i("VERDNATURA","Nombre encajado ${item.code} : ${item.description}")
|
||||
// //Log.i("VERDNATURA:","Nombre encajado ${item.code} : ${item.description}")
|
||||
}catch (e:Exception){}
|
||||
}
|
||||
}}
|
||||
|
|
|
@ -179,7 +179,7 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
|
|||
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada updatePackingType")
|
||||
}else{
|
||||
//if (response.body()=="Finish"){
|
||||
// Log.i("VERDNATURA","Fisnih encontrado")}
|
||||
// //Log.i("VERDNATURA:","Fisnih encontrado")}
|
||||
_response.value = ResponseItemVO(isError = false,response = response.body()!!.toString())
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ class BuscarItemAllFragment(
|
|||
}
|
||||
|
||||
edit_itemFk.setOnKeyListener { v, keyCode, event ->
|
||||
Log.i("VERDNATURA","text")
|
||||
//Log.i("VERDNATURA:","text")
|
||||
return@setOnKeyListener false}
|
||||
/*if (filter_itemFk.text.toString().isNullOrEmpty()){
|
||||
if (listInvetory.size != listInvetoryAux.size){
|
||||
|
|
|
@ -129,6 +129,12 @@ class SaleAdapter (
|
|||
contentLayout.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_black))
|
||||
}
|
||||
|
||||
//sergio: para de momento que pinten las lineas sin actualizar ni nada
|
||||
if (sale.isControlled == "2"){
|
||||
itemArticleRowSemaforoCon.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_white))
|
||||
contentLayout.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_dark_mint_light))
|
||||
}
|
||||
|
||||
|
||||
//ASIGNAMOS VALOR A LA VSITA
|
||||
this.sale = sale
|
||||
|
|
|
@ -22,6 +22,7 @@ import es.verdnatura.domain.ConstAndValues.CONTROLADOR
|
|||
import es.verdnatura.domain.ConstAndValues.OK
|
||||
import es.verdnatura.domain.ConstAndValues.ON_CHECKING
|
||||
import es.verdnatura.domain.ConstAndValues.ON_PREPARATION
|
||||
import es.verdnatura.domain.ConstAndValues.PRECHECKER
|
||||
import es.verdnatura.domain.ConstAndValues.PREPARED
|
||||
import es.verdnatura.domain.ConstAndValues.SACADOR
|
||||
import es.verdnatura.domain.toast
|
||||
|
@ -101,7 +102,6 @@ class CollectionFragment(
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
||||
|
||||
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||
user = prefs.getString(USER,"").toString()
|
||||
password = prefs.getString(PASSWORD,"").toString()
|
||||
|
@ -112,13 +112,11 @@ class CollectionFragment(
|
|||
mperror = MediaPlayer.create((activity as MainActivity),R.raw.error)
|
||||
mpok = MediaPlayer.create((activity as MainActivity),R.raw.ok)
|
||||
if (collection.tickets.isEmpty()){
|
||||
viewModel.collectionTicketGet(user,password,collection.collectionFk,sectorFk)
|
||||
Log.i("VERDNATURA","La collection es ${collection.collectionFk}")
|
||||
viewModel.collectionTicketGet(user,password,collection.collectionFk,sectorFk,type)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
|
@ -135,12 +133,17 @@ class CollectionFragment(
|
|||
activity!!.main_bottom_navigation.visibility = View.GONE
|
||||
if (splash_progress != null) splash_progress.visibility = View.VISIBLE
|
||||
toolbar_title.text = "collectionTicket_get"
|
||||
setToolBar()
|
||||
|
||||
// //Log.i("VERDNATURA:","el type es $type")
|
||||
|
||||
|
||||
setEvents()
|
||||
|
||||
Log.i("VERDNATURA","el type es $type")
|
||||
if (type=="PRECONTROLADOR"){
|
||||
}
|
||||
if (type!=PRECHECKER) { setToolBar() }
|
||||
else{
|
||||
toolbar_subtitle.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
|
||||
if (type == SACADOR && voz != "NO"){
|
||||
setSpeak()
|
||||
|
@ -149,6 +152,7 @@ class CollectionFragment(
|
|||
if (collection.tickets.isNotEmpty()){
|
||||
createCollectionList()
|
||||
}
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
|
@ -201,7 +205,7 @@ class CollectionFragment(
|
|||
scan_input.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {//ID=0 ACTION_NEXT ID=5 ACTION_UNESPECEFIED)
|
||||
if (!scan_input.text.toString().isNullOrEmpty()){
|
||||
////Log.i("VERDNATURA","Pita o no pita si encuentra. Diferencia si es matricula o no")
|
||||
//////Log.i("VERDNATURA:","Pita o no pita si encuentra. Diferencia si es matricula o no")
|
||||
findSale(scan_input.text.toString())
|
||||
}
|
||||
scan_input.setText("")
|
||||
|
@ -216,8 +220,9 @@ class CollectionFragment(
|
|||
//LISTA =========
|
||||
collection_swipe.setOnRefreshListener {
|
||||
if (splash_progress != null) splash_progress.visibility = View.VISIBLE
|
||||
viewModel.collectionTicketGet(user,password,collection.collectionFk,sectorFk)
|
||||
Log.i("VERDNATURA","La collection es ${collection.collectionFk}")
|
||||
viewModel.collectionTicketGet(user,password,collection.collectionFk,sectorFk,type)
|
||||
// //Log.i("VERDNATURA:","La collection es ${collection.collectionFk}")
|
||||
// //Log.i("VERDNATURA:","La collection es ${type}")
|
||||
collection_swipe.isRefreshing = false
|
||||
}
|
||||
}
|
||||
|
@ -258,7 +263,7 @@ class CollectionFragment(
|
|||
|
||||
item.observe(viewLifecycleOwner, Observer {
|
||||
if (splash_progress != null) splash_progress.visibility = View.GONE
|
||||
if (!goBack) toastDisponibility(it)
|
||||
if (!goBack) toastDisponibility(it)
|
||||
goBack = false
|
||||
})
|
||||
|
||||
|
@ -272,8 +277,8 @@ class CollectionFragment(
|
|||
}.show()
|
||||
}else{
|
||||
if (splash_progress != null) splash_progress.visibility = View.VISIBLE
|
||||
viewModel.collectionTicketGet(user,password,collection.collectionFk,sectorFk)
|
||||
Log.i("VERDNATURA","La collection es ${collection.collectionFk}")
|
||||
viewModel.collectionTicketGet(user,password,collection.collectionFk,sectorFk,type)
|
||||
// //Log.i("VERDNATURA:","La collection es ${collection.collectionFk}")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -308,8 +313,8 @@ class CollectionFragment(
|
|||
})
|
||||
|
||||
responseIncQuantity.observe(viewLifecycleOwner, Observer {
|
||||
/* splash_progress.visibility = View.VISIBLE
|
||||
viewModel.collectionTicketGet(user,password,collection.collectionFk,sectorFk)*/
|
||||
/* splash_progress.visibility = View.VISIBLE
|
||||
viewModel.collectionTicketGet(user,password,collection.collectionFk,sectorFk)*/
|
||||
})
|
||||
|
||||
mistakeList.observe(viewLifecycleOwner, Observer {
|
||||
|
@ -325,11 +330,13 @@ class CollectionFragment(
|
|||
private fun createCollectionList(){
|
||||
state = 0
|
||||
if (type == SACADOR && voz != "NO"){
|
||||
// initialize()
|
||||
// initialize()
|
||||
speak("Colección cargada, diga listo para empezar.")
|
||||
}
|
||||
|
||||
toolbar_title.text = collection.collectionFk
|
||||
toolbar_title.text=collection.collectionFk
|
||||
|
||||
|
||||
if (splash_progress != null) splash_progress.visibility = View.GONE
|
||||
var salesList:ArrayList<SaleVO> = ArrayList()
|
||||
tickets = ArrayList()
|
||||
|
@ -340,8 +347,8 @@ class CollectionFragment(
|
|||
salesList.add(saleVO)
|
||||
if (tickets.firstOrNull { it == saleVO.ticketFk}.isNullOrEmpty())
|
||||
tickets.add(saleVO.ticketFk)
|
||||
}else if (type == CONTROLADOR){
|
||||
//sergio el type CHECKED =CONTROLADOR
|
||||
}else if (type == CONTROLADOR || type == PRECHECKER){
|
||||
//sergio el type CHECKED =CONTROLADOR
|
||||
salesList.add(saleVO)
|
||||
if (tickets.firstOrNull { it == saleVO.ticketFk}.isNullOrEmpty())
|
||||
tickets.add(saleVO.ticketFk)
|
||||
|
@ -353,47 +360,54 @@ class CollectionFragment(
|
|||
|
||||
sales = salesList.sortedWith(compareBy({ it.saleOrder }))
|
||||
saleAdapter = SaleAdapter(sales,pasillerosItemClickListener!!,object: OnQuantityClickListener{
|
||||
|
||||
override fun onQuantityClick(sale: SaleVO) {
|
||||
|
||||
sales.forEachIndexed { index, saleVO ->
|
||||
if (saleVO.saleFk == sale.saleFk){
|
||||
showQuantityDialog(index)
|
||||
if (saleVO.saleFk == sale.saleFk) {
|
||||
if (type!="PRECHECKER"){
|
||||
showQuantityDialog(index)}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},object : OnSaleClickListener{
|
||||
override fun onSaleClick(sale: SaleVO) {
|
||||
|
||||
sales.forEachIndexed { index, saleVO ->
|
||||
if (saleVO.saleFk == sale.saleFk){
|
||||
if (type == CONTROLADOR) {
|
||||
markLine(index,type)
|
||||
////Log.i("VERDNATURA","marcamos linea")
|
||||
} else if (type == SACADOR){
|
||||
if (sale.isPrepared == "0"){
|
||||
showScanner(index,sale)
|
||||
}else{
|
||||
|
||||
if (type == CONTROLADOR || type==PRECHECKER) {// sergio:cuidado , esta es de lo último para marcar colores
|
||||
markLine(index, type)
|
||||
//////Log.i("VERDNATURA:","marcamos linea")
|
||||
} else if (type == SACADOR) {
|
||||
if (sale.isPrepared == "0") {
|
||||
showScanner(index, sale)
|
||||
} else {
|
||||
unMarkLine(index, OK)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
},object: OnMistakeClickListener{
|
||||
override fun onMistakeClickListener(sale: SaleVO) {
|
||||
if (splash_progress != null) splash_progress.visibility = View.VISIBLE
|
||||
mistakeSale = sale
|
||||
viewModel.mistakeType(usuario = user, password = password)
|
||||
if (type!="PRECHECKER"){
|
||||
if (splash_progress != null) splash_progress.visibility = View.VISIBLE
|
||||
mistakeSale = sale
|
||||
viewModel.mistakeType(usuario = user, password = password)}
|
||||
}
|
||||
})
|
||||
|
||||
lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
fragment_sacador_collections.adapter = saleAdapter
|
||||
fragment_sacador_collections.layoutManager = lm
|
||||
setTotalLines()
|
||||
|
||||
if (storedPosition != 0)
|
||||
setListPosition(storedPosition,true)
|
||||
else if (storedBackPosition != 0)
|
||||
|
@ -436,7 +450,7 @@ class CollectionFragment(
|
|||
if (type == SACADOR){
|
||||
for (saleVO in sales) {
|
||||
//sergio: pita si encuentra ticket
|
||||
////Log.i("VERDNATURA","SE busca en sales ${saleVO.ticketFk}")
|
||||
//////Log.i("VERDNATURA:","SE busca en sales ${saleVO.ticketFk}")
|
||||
|
||||
if (saleVO.ticketFk==txtscan){
|
||||
isOk=true
|
||||
|
@ -448,12 +462,12 @@ class CollectionFragment(
|
|||
|
||||
if(saleVO.isPrepared != "1" && saleVO.isPreviousPrepared != "1"){
|
||||
//1- Por itemFk
|
||||
/* if (txtscan == saleVO.itemFk){
|
||||
mpok!!.start()
|
||||
isOk = true
|
||||
markLine(index,type)
|
||||
break
|
||||
}*/
|
||||
/* if (txtscan == saleVO.itemFk){
|
||||
mpok!!.start()
|
||||
isOk = true
|
||||
markLine(index,type)
|
||||
break
|
||||
}*/
|
||||
//2- Por carro
|
||||
if (saleVO.placements != null){
|
||||
var shelvingIndex = 0
|
||||
|
@ -462,7 +476,7 @@ class CollectionFragment(
|
|||
if (placementVO.shelving != null && placementVO.visible != null && txtscan.toUpperCase() == placementVO.shelving.toUpperCase() && placementVO.visible != "(0)"){
|
||||
if (mpok != null) mpok!!.start()
|
||||
isOk = true
|
||||
////Log.i("VERDNATURA","encontrado producto")
|
||||
//////Log.i("VERDNATURA:","encontrado producto")
|
||||
showShelving(index,shelvingIndex)
|
||||
isBreak = true
|
||||
break
|
||||
|
@ -498,12 +512,12 @@ class CollectionFragment(
|
|||
if (mpok != null) mpok!!.start()
|
||||
"Ticket aparcado".toast(requireContext())
|
||||
}else{
|
||||
if (mperror != null) mperror!!.start()
|
||||
if (mperror != null) mperror!!.start()
|
||||
}
|
||||
|
||||
}
|
||||
}else if(type == CONTROLADOR){
|
||||
////Log.i("VERDNATURA","El tipo es controlador")
|
||||
}else if(type == CONTROLADOR || type== PRECHECKER){
|
||||
//////Log.i("VERDNATURA:","El tipo es controlador")
|
||||
for (saleVO in sales) {
|
||||
if(saleVO.isControlled == "0"){
|
||||
//1- Por itemFk
|
||||
|
@ -543,8 +557,8 @@ class CollectionFragment(
|
|||
if (splash_progress != null) splash_progress.visibility = View.VISIBLE
|
||||
storedPosition = 0
|
||||
storedBackPosition = 0
|
||||
viewModel.collectionTicketGet(user,password,txtscan,sectorFk)
|
||||
Log.i("VERDNATURA","La collection es ${txtscan}")
|
||||
viewModel.collectionTicketGet(user,password,txtscan,sectorFk,type)
|
||||
////Log.i("VERDNATURA:","La collection es ${txtscan}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -612,7 +626,7 @@ class CollectionFragment(
|
|||
|
||||
private fun markLine(position:Int,newType: String){
|
||||
state = 0
|
||||
////Log.i("VERDNATURA","Marcamos linea y enviamos saleTracking")
|
||||
//////Log.i("VERDNATURA:","Marcamos linea y enviamos saleTracking")
|
||||
if (type == SACADOR){
|
||||
sales[position].isPrepared = if (sales[position].isPrepared == "1") "0" else "1"
|
||||
if (sales[position].isPrepared == "1"){
|
||||
|
@ -621,10 +635,17 @@ class CollectionFragment(
|
|||
}else if (type == CONTROLADOR)
|
||||
sales[position].isControlled = if (sales[position].isControlled == "1") "0" else "1"
|
||||
|
||||
saleAdapter!!.notifyDataSetChanged()
|
||||
if (type == PRECHECKER) {
|
||||
sales[position].isControlled = if (sales[position].isControlled == "2") "0" else "2" //sergio: para diferenciar precontrol en previa
|
||||
}
|
||||
|
||||
saleAdapter!!.notifyDataSetChanged()
|
||||
setListPosition(position,false)
|
||||
saleTrackingReplace(position,newType)
|
||||
|
||||
if (type!=PRECHECKER ){
|
||||
saleTrackingReplace(position,newType)
|
||||
}
|
||||
|
||||
setTotalLines()
|
||||
}
|
||||
|
||||
|
@ -648,19 +669,20 @@ class CollectionFragment(
|
|||
}
|
||||
|
||||
private fun saleTrackingReplace(position: Int,type: String){
|
||||
////Log.i("VERDNATURA","POSICION $position y el tipo $type")
|
||||
////Log.i("VERDNATURA","El buyfk que no es real es $originalItemScan")
|
||||
//////Log.i("VERDNATURA:","POSICION $position y el tipo $type")
|
||||
//////Log.i("VERDNATURA:","El buyfk que no es real es $originalItemScan")
|
||||
viewModel.saleTrackingReplace(
|
||||
usuario = user,
|
||||
password = password,
|
||||
saleFk = sales[position].saleFk,
|
||||
vIsChecked = if (type == SACADOR) sales[position].isPrepared else if(type == CONTROLADOR) sales[position].isControlled else "1",
|
||||
vOriginalQuantity = sales[position].pickedQuantity,
|
||||
vStateFk = type.toString(),
|
||||
vStateFk = type,//type.toString(),
|
||||
vBuyFk = originalItemScan
|
||||
)
|
||||
//Log.i("VERDNATURA","POSICION $position y el tipo $type")
|
||||
//Log.i("VERDNATURA","El buyfk que no es real es $originalItemScan")
|
||||
//Log.i("VERDNATURA:","POSICION $position y el vStateFk $type")
|
||||
//Log.i("VERDNATURA:","vIscheked es ${if(type == CONTROLADOR) sales[position].isControlled else "1"}")
|
||||
//Log.i("VERDNATURA:","El buyfk que no es real es $originalItemScan")
|
||||
|
||||
|
||||
}
|
||||
|
@ -673,11 +695,11 @@ class CollectionFragment(
|
|||
sales[position].pickedQuantity = "0"
|
||||
saleAdapter!!.notifyDataSetChanged()
|
||||
setListPosition(position,false)
|
||||
viewModel.saleTrackingDel(
|
||||
if (type!=PRECHECKER){ viewModel.saleTrackingDel(
|
||||
usuario = user,
|
||||
password = password,
|
||||
saleFk = sales[position].saleFk
|
||||
)
|
||||
)}
|
||||
setTotalLines()
|
||||
scanRequest()
|
||||
customDialog.dismiss()
|
||||
|
@ -701,7 +723,7 @@ class CollectionFragment(
|
|||
try{
|
||||
quantityGet = (sales[position].quantity.toInt() - sales[position].pickedQuantity.toInt()).toString()
|
||||
}catch (e:Exception){}
|
||||
////Log.i("VERDNATURA","Aparece para enviar")
|
||||
//////Log.i("VERDNATURA:","Aparece para enviar")
|
||||
viewModel.itemPlacementSupplyAiming(
|
||||
usuario = user,
|
||||
password = password,
|
||||
|
@ -712,7 +734,7 @@ class CollectionFragment(
|
|||
}
|
||||
|
||||
private fun printShelvingResult(placementSupplyListVO: PlacementSupplyListVO){
|
||||
////Log.i("VERDNATURA","Print CustomDialog")
|
||||
//////Log.i("VERDNATURA:","Print CustomDialog")
|
||||
var shelving = ""
|
||||
var item = ""
|
||||
var longName = ""
|
||||
|
@ -737,21 +759,21 @@ class CollectionFragment(
|
|||
placementSupplyListVO.list.forEach {
|
||||
if (it.stock != "0")
|
||||
listPlacementSupply.add(BarcodeVO(code = it.proposal))
|
||||
////Log.i("VERDNATURA","Array de placementsupply")
|
||||
//////Log.i("VERDNATURA:","Array de placementsupply")
|
||||
}
|
||||
try {
|
||||
////Log.i("VERDNATURA","Pulso COGER-1")
|
||||
customDialogList.setTitle("$shelving($item) $total dee $longName").setOkButton("Coger") {
|
||||
////Log.i("VERDNATURA","Pulso COGER-2")
|
||||
//////Log.i("VERDNATURA:","Pulso COGER-1")
|
||||
customDialogList.setTitle("$shelving($item) $total de $longName").setOkButton("Coger") {
|
||||
//////Log.i("VERDNATURA:","Pulso COGER-2")
|
||||
if (customDialogList.getValueTwo().isNotEmpty()) {
|
||||
if (isNumber(customDialogList.getValue()) && isNumber(total) && customDialogList.getValue().toInt() > total.toInt()) {
|
||||
"La cantidad supera a la disponible".toast(requireContext())
|
||||
} else if (isNumber(customDialogList.getValue())) {
|
||||
originalItemScan = customDialogList.getValueTwo()
|
||||
// Log.i("VERDATURA","Le pasamos el siguiente item $originalItemScan que es el escaneado")
|
||||
// Log.i("VERDATURA","Le pasamos el siguiente item $originalItemScan que es el escaneado")
|
||||
if (checkItemScan(customDialogList.getValueTwo())) {
|
||||
onQuantityOfShelvingSelected(itemShelvingFk)
|
||||
////Log.i("VERDNATURA","Cantidad seleccionada")
|
||||
//////Log.i("VERDNATURA:","Cantidad seleccionada")
|
||||
mpok?.start()
|
||||
customDialogList.dismiss()
|
||||
} else {
|
||||
|
@ -782,18 +804,18 @@ class CollectionFragment(
|
|||
}.setHintValue("Cantidad que coges:").setValue(total).setHintValueTwo("Escanea item")
|
||||
.setValueTwo("").show()
|
||||
}catch (e:Exception){
|
||||
////Log.i("VERDNATURA","${e.message.toString()}")
|
||||
//////Log.i("VERDNATURA:","${e.message.toString()}")
|
||||
}
|
||||
try{
|
||||
customDialogList.getEditTextTwo().post(Runnable {
|
||||
customDialogList.getEditTextTwo().requestFocusFromTouch()
|
||||
if (activity != null) {
|
||||
val lManager: InputMethodManager =
|
||||
activity!!.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
lManager.hideSoftInputFromWindow(customDialogList.getEditTextTwo().windowToken, InputMethodManager.SHOW_FORCED)
|
||||
}
|
||||
customDialogList.getEditTextTwo().post(Runnable {
|
||||
customDialogList.getEditTextTwo().requestFocusFromTouch()
|
||||
if (activity != null) {
|
||||
val lManager: InputMethodManager =
|
||||
activity!!.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
lManager.hideSoftInputFromWindow(customDialogList.getEditTextTwo().windowToken, InputMethodManager.SHOW_FORCED)
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
}catch (e:Exception){}
|
||||
try {
|
||||
customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event ->
|
||||
|
@ -858,15 +880,15 @@ class CollectionFragment(
|
|||
|
||||
}
|
||||
private fun checkItemScan(valueToCheck:String):Boolean{
|
||||
////Log.i("VERDNATURA","Entramos a comprobar el CheckItemScan $valueToCheck")
|
||||
//////Log.i("VERDNATURA:","Entramos a comprobar el CheckItemScan $valueToCheck")
|
||||
if (storedPosition >= 0 && sales.size > storedPosition) {
|
||||
val saleToCheck = sales[storedPosition]
|
||||
//////Log.i("VERDNATURA","Entramos a comprobar si lo escaneado es el item $saleToCheck.itemFk escaneado:$valueToCheck")
|
||||
////////Log.i("VERDNATURA:","Entramos a comprobar si lo escaneado es el item $saleToCheck.itemFk escaneado:$valueToCheck")
|
||||
if (saleToCheck.itemFk == valueToCheck)
|
||||
return true
|
||||
else {
|
||||
saleToCheck.Barcodes.forEach { barcode ->
|
||||
////Log.i("VERDNATURA","Mirando barcode ${barcode.toString()}")
|
||||
//////Log.i("VERDNATURA:","Mirando barcode ${barcode.toString()}")
|
||||
if (barcode == valueToCheck)
|
||||
return true
|
||||
}
|
||||
|
@ -1094,8 +1116,8 @@ class CollectionFragment(
|
|||
}else if (it.quantity == "0"){
|
||||
totalMark += 1
|
||||
}
|
||||
}else if (type == CONTROLADOR){
|
||||
if (it.isControlled == "1")
|
||||
}else if (type == CONTROLADOR || type == PRECHECKER){
|
||||
if (it.isControlled == "1" || it.isControlled =="2")
|
||||
totalMark += 1
|
||||
}
|
||||
}
|
||||
|
@ -1111,7 +1133,7 @@ class CollectionFragment(
|
|||
|
||||
//FALTAS / BASURA / SPLIT
|
||||
private fun showQuantityDialog(position:Int) {
|
||||
// Log.i("VERDNATURA","Aparece CustomDialog")
|
||||
// //Log.i("VERDNATURA:","Aparece CustomDialog")
|
||||
customDialogThreeButtons.setDescription(getString(R.string.txtnuevacantidad)).setValue("")
|
||||
.setOkButton(getString(R.string.Faltas)){
|
||||
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()){
|
||||
|
@ -1202,7 +1224,7 @@ class CollectionFragment(
|
|||
quantity = totalQuantity.toString(),
|
||||
warehouseFk = warehouseFk,
|
||||
type = "FALSE",
|
||||
originalQuantity = quantity
|
||||
originalQuantity = quantity
|
||||
)
|
||||
//sales[position].originalQuantity = quantity
|
||||
sales[position].quantity = quantity
|
||||
|
@ -1282,13 +1304,13 @@ class CollectionFragment(
|
|||
saleFk = sales[position].saleFk,
|
||||
quantity = quantity
|
||||
)
|
||||
try {
|
||||
//val quantityPicked = (quantity.toInt() - sales[position].quantity.toInt()).toString()
|
||||
//sales[position].originalQuantity = quantity
|
||||
sales[position].quantity = quantity
|
||||
/*if (type == CONTROLADOR){
|
||||
showShelving(position,0,quantityPicked)
|
||||
}*/
|
||||
try {
|
||||
//val quantityPicked = (quantity.toInt() - sales[position].quantity.toInt()).toString()
|
||||
//sales[position].originalQuantity = quantity
|
||||
sales[position].quantity = quantity
|
||||
/*if (type == CONTROLADOR){
|
||||
showShelving(position,0,quantityPicked)
|
||||
}*/
|
||||
}catch (e:Exception){}
|
||||
saleAdapter?.notifyDataSetChanged()
|
||||
|
||||
|
@ -1387,7 +1409,7 @@ class CollectionFragment(
|
|||
if (splash_progress != null) splash_progress.visibility = View.GONE
|
||||
listPlacementSupply = ArrayList()
|
||||
list.forEach {
|
||||
listPlacementSupply.add(BarcodeVO(code = it.description))
|
||||
listPlacementSupply.add(BarcodeVO(code = it.description))
|
||||
}
|
||||
|
||||
|
||||
|
@ -1595,25 +1617,3 @@ class CollectionFragment(
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -59,8 +59,8 @@ class CollectionViewModel(context: Context) : BaseViewModel() {
|
|||
get() = _item
|
||||
|
||||
|
||||
fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String){
|
||||
getSacadorControladorUserCase.collectionTicketGet(usuario,password,collectionFk,sectorFk,"0").enqueue(object :
|
||||
fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String,type:String){
|
||||
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 = t.message!!)
|
||||
|
|
|
@ -4,7 +4,9 @@ import android.content.Context
|
|||
import android.content.SharedPreferences
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.lifecycle.Observer
|
||||
import es.verdnatura.R
|
||||
|
@ -28,6 +30,7 @@ class ControladorFragment : BaseFragment<FragmentControladorBinding,ControladorV
|
|||
private var onCollectionSelectedListener : OnCollectionSelectedListener? = null
|
||||
override fun getLayoutId(): Int = R.layout.fragment_controlador
|
||||
private lateinit var customDialog: CustomDialog
|
||||
private var type = ""
|
||||
|
||||
companion object {
|
||||
fun newInstance() = ControladorFragment()
|
||||
|
@ -40,7 +43,6 @@ class ControladorFragment : BaseFragment<FragmentControladorBinding,ControladorV
|
|||
|
||||
override fun init() {
|
||||
|
||||
|
||||
splash_progress.visibility = View.GONE
|
||||
customDialog = CustomDialog(requireContext())
|
||||
toolbar_title.text = getString(R.string.getcollection)
|
||||
|
@ -53,12 +55,14 @@ class ControladorFragment : BaseFragment<FragmentControladorBinding,ControladorV
|
|||
super.onPause()
|
||||
}
|
||||
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||
user = prefs.getString(USER,"").toString()
|
||||
password = prefs.getString(PASSWORD,"").toString()
|
||||
sectorFk = prefs.getInt(SECTORFK,1).toString()
|
||||
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
|
||||
type=ConstAndValues.CONTROLADOR
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
|
@ -67,15 +71,17 @@ class ControladorFragment : BaseFragment<FragmentControladorBinding,ControladorV
|
|||
scan_input.requestFocus()
|
||||
scan_input.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
goBack=false
|
||||
if (!scan_input.text.isNullOrEmpty()) {
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
viewModel.collectionTicketGet(
|
||||
usuario = user,
|
||||
password = password,
|
||||
sectorFk = sectorFk,
|
||||
collectionFk = scan_input.text.toString()
|
||||
collectionFk = scan_input.text.toString(),
|
||||
type = type
|
||||
)
|
||||
Log.i("VERDNATURA","La collection es ${scan_input.text.toString()}")
|
||||
////Log.i("VERDNATURA:","La collection es ${scan_input.text.toString()}")
|
||||
}
|
||||
scan_input.setText("")
|
||||
(activity as MainActivity).hideKeyboard(scan_input)
|
||||
|
@ -94,6 +100,7 @@ class ControladorFragment : BaseFragment<FragmentControladorBinding,ControladorV
|
|||
customDialog.dismiss()
|
||||
}.show()
|
||||
}else{
|
||||
////Log.i("VERDNATURA:"," goback es $goBack y ${it.collectionFk}")
|
||||
if (!goBack)navigateToCollectionList(it)
|
||||
goBack = false
|
||||
}
|
||||
|
@ -103,8 +110,11 @@ class ControladorFragment : BaseFragment<FragmentControladorBinding,ControladorV
|
|||
}
|
||||
|
||||
private fun navigateToCollectionList(collection: CollectionVO){
|
||||
////Log.i("VERDNATURA:","vamos a oncolecctionSelected ${collection.isError}")
|
||||
onCollectionSelectedListener?.onCollectionSelected(collection, ConstAndValues.CONTROLADOR)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@ class ControladorViewModel(context: Context) : BaseViewModel() {
|
|||
get() = _collectionTicketList
|
||||
|
||||
|
||||
fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String){
|
||||
getSacadorControladorUserCase.collectionTicketGet(usuario,password,collectionFk,sectorFk,"0").enqueue(object :
|
||||
fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String,type:String){
|
||||
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 = t.message!!)
|
||||
|
|
|
@ -0,0 +1,383 @@
|
|||
package es.verdnatura.presentation.view.feature.controlvehiculo.fragment
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.media.MediaPlayer
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.util.TypedValue
|
||||
import android.view.View
|
||||
import android.view.View.*
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentVehiclecontrolBinding
|
||||
import es.verdnatura.domain.ConstAndValues
|
||||
import es.verdnatura.domain.ConstAndValues.MAINACTIVITY
|
||||
import es.verdnatura.domain.ConstAndValues.SACADOR
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
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.CustomDialogList
|
||||
import es.verdnatura.presentation.view.component.CustomDialogThreeButtons
|
||||
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
|
||||
import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorFragment
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import kotlinx.android.synthetic.main.component_custom_three_dialog.*
|
||||
import kotlinx.android.synthetic.main.fragment_collection.*
|
||||
import kotlinx.android.synthetic.main.fragment_controlador.*
|
||||
import kotlinx.android.synthetic.main.fragment_controlador.scan_input
|
||||
import kotlinx.android.synthetic.main.fragment_controlador.splash_progress
|
||||
import kotlinx.android.synthetic.main.fragment_login.*
|
||||
import kotlinx.android.synthetic.main.fragment_sacador.*
|
||||
import kotlinx.android.synthetic.main.toolbar.*
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
class ControlVehiculoFragment(
|
||||
var tagName: String = ""
|
||||
) :BaseFragment<FragmentVehiclecontrolBinding, ControlVehiculoViewModel>(
|
||||
ControlVehiculoViewModel::class) {
|
||||
|
||||
|
||||
private var user = ""
|
||||
private var userFk = ""
|
||||
private var password = ""
|
||||
private var sectorFk = ""
|
||||
private var warehouseFk = ""
|
||||
private var goBack: Boolean = false
|
||||
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
|
||||
override fun getLayoutId(): Int = R.layout.fragment_vehiclecontrol
|
||||
private lateinit var customDialog: CustomDialog
|
||||
//private var type = ""
|
||||
|
||||
private lateinit var customDialogList: CustomDialogList
|
||||
private lateinit var customDialogInput: CustomDialogInput
|
||||
private lateinit var customDialogThreeButtons: CustomDialogThreeButtons
|
||||
|
||||
|
||||
companion object {
|
||||
fun newInstance(tagName: String) = ControlVehiculoFragment(tagName)
|
||||
}
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
super.onAttach(context)
|
||||
if (context is OnCollectionSelectedListener) onCollectionSelectedListener = context
|
||||
}
|
||||
|
||||
|
||||
override fun init() {
|
||||
|
||||
customDialog = CustomDialog(requireContext())
|
||||
customDialogList = CustomDialogList(requireContext())
|
||||
customDialogInput = CustomDialogInput(requireContext())
|
||||
customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
|
||||
goBack=false
|
||||
|
||||
splash_progress.visibility = GONE
|
||||
|
||||
if (!tagName.equals(SacadorFragment.TAG)) {
|
||||
checkControlTimeVehicle()
|
||||
}
|
||||
|
||||
setEvents()
|
||||
setToolBar("ALL")
|
||||
super.init()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
goBack = true
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
private fun setToolBar(direction:String) {
|
||||
|
||||
toolbar_title.text = getString(R.string.vehiclecontrol)
|
||||
toolbar_title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13F)
|
||||
|
||||
val listIcons: ArrayList<Drawable> = 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())
|
||||
|
||||
listIcons.add(iconVehicleIn)
|
||||
listIcons.add(iconVehicleOut)
|
||||
listIcons.add(iconHistory)
|
||||
|
||||
|
||||
toolbar_icons.adapter = ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
|
||||
override fun onOptionsItemSelected(item: Drawable) {
|
||||
|
||||
if (item == iconHistory) {
|
||||
showScanner("Escanea matrícula para ver histórico", "HISTORY")
|
||||
}
|
||||
|
||||
if (item == iconVehicleIn) {
|
||||
showScanner("Escanea matrícula del vehículo", "IN")
|
||||
}
|
||||
if (item == iconVehicleOut) {
|
||||
showScanner("Escanea matrícula para dejar vehículo", "OUT")
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
toolbar_icons.layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||
}
|
||||
|
||||
|
||||
private fun showScanner(description: String, action: String) {
|
||||
|
||||
customDialogInput.setTitle(getString(R.string.vehiclecontrol)).setDescription(description)
|
||||
.setOkButton("Aceptar") {
|
||||
if (!customDialogInput.getValue().isNullOrEmpty()) {
|
||||
// "$description ${customDialogInput.getValue()} OK".toast(requireContext())
|
||||
insertControlTimeVehicle(customDialogInput.getValue(), action)
|
||||
}
|
||||
customDialogInput.setValue("")
|
||||
scanRequest()
|
||||
customDialogInput.dismiss()
|
||||
hideKeyboards()
|
||||
}
|
||||
|
||||
.setKoButton("Cancelar") {
|
||||
customDialogInput.dismiss()
|
||||
}.setValue("").show()
|
||||
|
||||
customDialogInput.getEditText().requestFocus()
|
||||
|
||||
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
|
||||
if (!customDialogInput.getValue().isNullOrEmpty()) {
|
||||
// //Log.i("VERDNATURA:", "El valor es ${customDialogInput.getValue()}")
|
||||
// "$description ${customDialogInput.getValue()} OK".toast(requireContext())
|
||||
insertControlTimeVehicle(customDialogInput.getValue(), action)
|
||||
}
|
||||
customDialogInput.setValue("")
|
||||
scanRequest()
|
||||
customDialogInput.dismiss()
|
||||
hideKeyboards()
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private fun checkControlTimeVehicle(){
|
||||
|
||||
if (!goBack){ splash_progress.visibility = VISIBLE
|
||||
//Log.i("VERDNATURA:","Entramos en la llamada checkRegister")
|
||||
viewModel.vehicleWarehouseTimeControl_checkRegister(user, password, userFk)}
|
||||
|
||||
}
|
||||
private fun insertControlTimeVehicle(plateNumber: String, direction: String) {
|
||||
|
||||
if (direction.equals("HISTORY")){
|
||||
(activity as MainActivity).onPasillerosItemClickListener( PasillerosItemVO(title = "Historico Vehículo"),plateNumber)
|
||||
}else{
|
||||
splash_progress.visibility = VISIBLE
|
||||
// //Log.i("VERDNATURA:","Entramos al insert")
|
||||
viewModel.vehicleWarehouseTimeControl_insert(user, password, plateNumber, userFk, direction)
|
||||
// //Log.i("VERDNATURA:", "user $user pass $password matricula $plateNumber, id $userFk, action $direction")
|
||||
}
|
||||
}
|
||||
|
||||
private fun scanRequest() {
|
||||
if (scan_input != null) {
|
||||
scan_input.requestFocus()
|
||||
}
|
||||
hideKeyboards()
|
||||
}
|
||||
|
||||
private fun hideKeyboards() {
|
||||
try {
|
||||
requireActivity().hideKeyboard()
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER, 0)
|
||||
user = prefs.getString(USER, "").toString()
|
||||
password = prefs.getString(PASSWORD, "").toString()
|
||||
sectorFk = prefs.getInt(SECTORFK, 1).toString()
|
||||
warehouseFk = prefs.getInt(WAREHOUSEFK, 1).toString()
|
||||
userFk = prefs.getString(USERFK, "0").toString()
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
private fun setEvents() {
|
||||
|
||||
backButton.setOnClickListener {
|
||||
activity!!.onBackPressed()
|
||||
}
|
||||
|
||||
scan_input.requestFocus()
|
||||
scan_input.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
if (!scan_input.text.isNullOrEmpty()) {
|
||||
////Log.i("VERDNATURA:", "Obtenido focus: ${scan_input.text.toString()}")
|
||||
showOptionsVehicleControl(scan_input.text.toString())
|
||||
}
|
||||
scan_input.setText("")
|
||||
(activity as MainActivity).hideKeyboard(scan_input)
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
private fun showOptionsVehicleControl(plate: String) {
|
||||
|
||||
customDialogThreeButtons.custom_dialog_value.visibility = GONE
|
||||
|
||||
customDialogThreeButtons.setDescription("¿Qué desea hacer con el vehículo de matrícula $plate")
|
||||
.setValue(plate)
|
||||
.setOkButtonTwo("COGER") {
|
||||
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
|
||||
"Vuelva a escanear".toast(requireContext())
|
||||
} else {
|
||||
splash_progress.visibility = VISIBLE
|
||||
customDialogThreeButtons.dismiss()
|
||||
insertControlTimeVehicle(customDialogThreeButtons.getValue(), "IN")
|
||||
}
|
||||
}.setOkButtonThree("DEJAR") {
|
||||
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
|
||||
"Vuelva a escanear".toast(requireContext())
|
||||
} else {
|
||||
splash_progress.visibility = VISIBLE
|
||||
customDialogThreeButtons.dismiss()
|
||||
insertControlTimeVehicle(customDialogThreeButtons.getValue(), "OUT")
|
||||
}
|
||||
|
||||
}.setOkButtonFour("HISTÓRICO") {
|
||||
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
|
||||
"Vuelva a escanear".toast(requireContext())
|
||||
} else {
|
||||
customDialogThreeButtons.dismiss()
|
||||
insertControlTimeVehicle(customDialogThreeButtons.getValue(), "HISTORY")
|
||||
|
||||
}
|
||||
|
||||
}.setKoButton("Cancelar") {
|
||||
scanRequest()
|
||||
customDialogThreeButtons.dismiss()
|
||||
}.show()
|
||||
}
|
||||
|
||||
|
||||
override fun observeViewModel() {
|
||||
|
||||
|
||||
with(viewModel) {
|
||||
splash_progress.visibility = GONE
|
||||
responseinsert.observe(viewLifecycleOwner, Observer {
|
||||
Log.i(
|
||||
"VERDNATURA",
|
||||
"Respuesta call vehicle_insert en el viewmodel es : ${it.response}"
|
||||
)
|
||||
|
||||
|
||||
if (it.isError) {
|
||||
|
||||
customDialog.setTitle("Error").setDescription(it.errorMessage)
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
} else {
|
||||
if (it.response == null || it.response == "false") {
|
||||
|
||||
customDialog.setTitle("Error")
|
||||
.setDescription("Revisar llamada del registro de vehículos")
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
|
||||
} else {
|
||||
if (it.response == "true") {
|
||||
"Acción registrada correctamente".toast(context)
|
||||
/* customDialog.setTitle("Llamada correcta")
|
||||
.setDescription("Acción registrada satisfactoriamente")
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()*/
|
||||
//(activity as MainActivity).openFragmentPickers()
|
||||
//(activity as MainActivity).onPasillerosItemClickListener( PasillerosItemVO(title = "Sacadores"),"CONTROL")
|
||||
checkControlTimeVehicle()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
splash_progress.visibility = GONE
|
||||
})
|
||||
|
||||
responsecontrol.observe(viewLifecycleOwner, Observer {
|
||||
splash_progress.visibility=GONE;
|
||||
if (it.isError) {
|
||||
customDialog.setTitle("Error").setDescription(it.errorMessage)
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
} else {
|
||||
if (it.response == null) {
|
||||
customDialog.setTitle("Error")
|
||||
.setDescription("Revisar llamada de control de vehículos")
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
} else {
|
||||
if (it.response == "REGISTERED") {
|
||||
// setToolBar("IN")
|
||||
/* customDialog.setTitle("Control de vehículos")
|
||||
.setDescription("SI Tienes coche asignado")
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()*/
|
||||
if (!tagName.equals(SacadorFragment.TAG)){
|
||||
(activity as MainActivity).openFragmentPickers()
|
||||
}
|
||||
|
||||
|
||||
|
||||
}else{
|
||||
if (it.response == "UNREGISTERED") {
|
||||
//Log.i("VERDNATURA:","${it.response}")
|
||||
customDialog.setTitle("Control de vehículos")
|
||||
.setDescription("Escanea la matrícula del vehículo a utillizar o elige ir sin vehículo")
|
||||
.setOkButton("Escanear vehículo") {
|
||||
customDialog.dismiss()
|
||||
showScanner("Escanea matrícula del vehículo", "IN")
|
||||
}
|
||||
.setKoButton("Sin vehículo"){
|
||||
customDialog.dismiss()
|
||||
insertControlTimeVehicle("", "")
|
||||
}.show()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package es.verdnatura.presentation.view.feature.controlvehiculo.fragment
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.GetVehicleControlTimeUserCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
|
||||
|
||||
private val getVehicleControlTimeUserCase: GetVehicleControlTimeUserCase = GetVehicleControlTimeUserCase(context)
|
||||
|
||||
private val _responseinsert by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseinsert: LiveData<ResponseItemVO>
|
||||
get() = _responseinsert
|
||||
|
||||
private val _responsecontrol by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responsecontrol: LiveData<ResponseItemVO>
|
||||
get() = _responsecontrol
|
||||
|
||||
|
||||
|
||||
|
||||
fun vehicleWarehouseTimeControl_insert(usuario:String,password:String,PlateNumber:String,workerFk:String,Direction:String){
|
||||
getVehicleControlTimeUserCase.vehicleWarehouseTimeControl_insert(usuario,password,PlateNumber,workerFk,Direction).enqueue(object : Callback<Boolean>{
|
||||
override fun onFailure(call: Call<Boolean>, t: Throwable) {
|
||||
_responseinsert.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada de registro de vehículo")
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Boolean>, response: Response<Boolean>) {
|
||||
if (response.body() == null || response.body().toString() == "false"){
|
||||
_responseinsert.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada. Escanea matrícula de nuevo")
|
||||
}else{
|
||||
//_response.value = ResponseItemVO(isError = false,response = response.body()!!)
|
||||
_responseinsert.value = ResponseItemVO(isError = false,response = response.body()!!.toString())
|
||||
//Log.i("VERDNATURA:","Respuesta call vehicle_insert ${response.body()}")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun vehicleWarehouseTimeControl_checkRegister(usuario:String,password:String,userFk:String){
|
||||
getVehicleControlTimeUserCase.vehicleWarehouseTimeControl_checkRegister(usuario,password,userFk).enqueue(object : Callback<String>{
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
_responsecontrol.value = ResponseItemVO(isError = true,errorMessage = "Error al comprobar el control vehículo")
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
if (response.body() == null){
|
||||
_responsecontrol.value = ResponseItemVO(isError = true,errorMessage = "Error al comprobar control vehículo")
|
||||
}else{
|
||||
_responsecontrol.value = ResponseItemVO(isError = false,response = response.body()!!)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
package es.verdnatura.presentation.view.feature.historico.fragment
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
|
@ -8,12 +10,18 @@ import es.verdnatura.R
|
|||
import es.verdnatura.databinding.FragmentHistoricoBinding
|
||||
import es.verdnatura.domain.notNull
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.component.CustomDialogInput
|
||||
import es.verdnatura.presentation.view.feature.historico.adapter.HistoricoAdapter
|
||||
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoListVO
|
||||
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoVO
|
||||
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.fragment_buscar_item.*
|
||||
import kotlinx.android.synthetic.main.fragment_historico.*
|
||||
import kotlinx.android.synthetic.main.fragment_historico.splash_progress
|
||||
import kotlinx.android.synthetic.main.fragment_inventary.*
|
||||
import kotlinx.android.synthetic.main.toolbar.*
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
@ -30,15 +38,15 @@ class HistoricoFragment(
|
|||
private var adapter : HistoricoAdapter? = null
|
||||
private lateinit var customDialogInput: CustomDialogInput
|
||||
private lateinit var customDialog: CustomDialog
|
||||
|
||||
private var listHistoric:ArrayList<ItemHistoricoVO> = ArrayList()
|
||||
private var listHistoryAux:ArrayList<ItemHistoricoVO> = ArrayList()
|
||||
private var filter:String=""
|
||||
|
||||
companion object {
|
||||
fun newInstance(entryPoint:String) = HistoricoFragment(entryPoint)
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.fragment_historico
|
||||
|
||||
|
||||
override fun init() {
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||
user = prefs.getString(USER,"").toString()
|
||||
|
@ -48,27 +56,103 @@ class HistoricoFragment(
|
|||
customDialogInput = CustomDialogInput(requireContext())
|
||||
customDialog = CustomDialog(requireContext())
|
||||
activity!!.main_bottom_navigation.visibility = View.GONE
|
||||
filter="all"
|
||||
viewModel.itemDiary(user,password,itemFk,warehouseFk)
|
||||
toolbar_title.text = getString(R.string.itemdiary)
|
||||
setToolBar()
|
||||
setEvents()
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
private fun setToolBar(){
|
||||
val listIcons:ArrayList<Drawable> = ArrayList()
|
||||
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,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())
|
||||
|
||||
|
||||
listIcons.add(iconGargabe)
|
||||
listIcons.add(iconFault)
|
||||
listIcons.add(iconReload)
|
||||
|
||||
toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
|
||||
override fun onOptionsItemSelected(item: Drawable) {
|
||||
if (item == iconReload){
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
filter="all"
|
||||
viewModel.itemDiary(user,password,itemFk,warehouseFk)
|
||||
|
||||
}
|
||||
if (item == iconGargabe){
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
viewModel.itemDiary(user,password,itemFk,warehouseFk)
|
||||
filter="basura"
|
||||
//showFilterItems("basura")
|
||||
|
||||
}
|
||||
if (item == iconFault){
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
viewModel.itemDiary(user,password,itemFk,warehouseFk)
|
||||
filter="falta"
|
||||
// showFilterItems("falta")
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||
|
||||
}
|
||||
|
||||
|
||||
private fun setEvents(){
|
||||
backButton.setOnClickListener {
|
||||
activity!!.onBackPressed()
|
||||
}
|
||||
|
||||
filter_nameordateitem.setOnKeyListener { v, keyCode, event ->
|
||||
// //Log.i("VERDNATURA:","El key a filtrar ${filter_nameordateitem.text.toString()}")
|
||||
if (filter_nameordateitem.text.toString().isNullOrEmpty()){
|
||||
if (listHistoric.size != listHistoryAux.size){
|
||||
listHistoric.removeAll(listHistoryAux)
|
||||
listHistoryAux.forEach {
|
||||
listHistoric.add(it)
|
||||
}
|
||||
adapter!!.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
}else{
|
||||
listHistoric.removeAll(listHistoryAux)
|
||||
listHistoryAux.forEach {
|
||||
if (it.name!=null && (it.name.contains(filter_nameordateitem.text.toString(),true))){
|
||||
//Log.i("VERDNATURA:","si contiene ${filter_nameordateitem.text.toString()}")
|
||||
listHistoric.add(it)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
adapter!!.notifyDataSetChanged()
|
||||
return@setOnKeyListener false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun observeViewModel() {
|
||||
with(viewModel){
|
||||
loadHistoricoList.observe(viewLifecycleOwner, Observer { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
|
||||
splash_progress.visibility = View.GONE
|
||||
adapter = HistoricoAdapter(it.list)
|
||||
listToAdapter(it.list,filter)
|
||||
// //Log.i("VERDNATURA:","el total original es ${it.list.size}")
|
||||
/* adapter = HistoricoAdapter(it.list)
|
||||
historico_recyclerview.adapter = adapter
|
||||
historico_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
historico_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)*/
|
||||
navigateToToday(it)
|
||||
|
||||
}
|
||||
|
@ -76,6 +160,33 @@ class HistoricoFragment(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private fun listToAdapter(lista:List<ItemHistoricoVO>,filter:String){
|
||||
|
||||
listHistoric.clear()
|
||||
listHistoryAux.clear()
|
||||
lista.forEach {
|
||||
|
||||
if (filter.equals("all")){
|
||||
listHistoric.add(it)
|
||||
listHistoryAux.add(it)
|
||||
}else{
|
||||
if ((it.name!=null) && (it.name.contains(filter,true))){
|
||||
listHistoric.add(it)
|
||||
listHistoryAux.add(it)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
adapter = HistoricoAdapter(listHistoric)
|
||||
historico_recyclerview.adapter = adapter
|
||||
historico_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
// //Log.i("VERDNATURA:","el total de aux es ${listHistoryAux.size}")
|
||||
////Log.i("VERDNATURA:","el total de histor es ${listHistoric.size}")
|
||||
|
||||
}
|
||||
|
||||
private fun navigateToToday(it:ItemHistoricoListVO){
|
||||
var positionToday = 0
|
||||
val sdf = SimpleDateFormat("yyyy-MM-dd")
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package es.verdnatura.presentation.view.feature.historicovehiculo.adapter
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.ItemHistoricovehiculoRowBinding
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
|
||||
|
||||
class HistoricoVehiculoAdapter (
|
||||
private val items: List<ItemHistoricoVehiculo>
|
||||
): RecyclerView.Adapter<HistoricoVehiculoAdapter.ItemHolder> () {
|
||||
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
|
||||
return ItemHolder(
|
||||
ItemHistoricovehiculoRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
|
||||
)
|
||||
}
|
||||
|
||||
override fun getItemCount() =items.size
|
||||
|
||||
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
|
||||
holder.bind(items[position])
|
||||
}
|
||||
|
||||
inner class ItemHolder(
|
||||
val binding: ItemHistoricovehiculoRowBinding
|
||||
) : RecyclerView.ViewHolder(binding.root){
|
||||
private val res = binding.root.context.resources
|
||||
fun bind(item: ItemHistoricoVehiculo) {
|
||||
binding.apply {
|
||||
this.item = item
|
||||
val sdf = SimpleDateFormat("yyyy-MM-dd")
|
||||
val currentDate = sdf.format(Date())
|
||||
if (currentDate == item.timed){
|
||||
historicoDate.setBackgroundColor(res.getColor(R.color.verdnatura_pumpkin_orange))
|
||||
}else{
|
||||
historicoDate.setBackgroundColor(res.getColor(R.color.verdnatura_black_5))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
package es.verdnatura.presentation.view.feature.historicovehiculo.fragment
|
||||
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentHistoricovehiculoBinding
|
||||
import es.verdnatura.domain.notNull
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.component.CustomDialogInput
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.adapter.HistoricoVehiculoAdapter
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculoList
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.fragment_historicovehiculo.*
|
||||
import kotlinx.android.synthetic.main.fragment_historicovehiculo.splash_progress
|
||||
import kotlinx.android.synthetic.main.toolbar.*
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
|
||||
class HistoricoVehiculoFragment (
|
||||
var numberPlate:String = ""
|
||||
) : BaseFragment<FragmentHistoricovehiculoBinding, HistoricoVehiculoViewModel>(
|
||||
HistoricoVehiculoViewModel::class) {
|
||||
|
||||
private var user = ""
|
||||
private var userFk = ""
|
||||
private var password = ""
|
||||
private var sectorFk = ""
|
||||
private var warehouseFk = ""
|
||||
private var adapter : HistoricoVehiculoAdapter? = null
|
||||
private lateinit var customDialogInput: CustomDialogInput
|
||||
private lateinit var customDialog: CustomDialog
|
||||
|
||||
|
||||
companion object {
|
||||
fun newInstance(entryPoint:String) = HistoricoVehiculoFragment(entryPoint)
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.fragment_historicovehiculo
|
||||
|
||||
|
||||
override fun init() {
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||
user = prefs.getString(USER,"").toString()
|
||||
userFk=prefs.getString(USERFK,"").toString()
|
||||
password = prefs.getString(PASSWORD,"").toString()
|
||||
sectorFk = prefs.getInt(SECTORFK,1).toString()
|
||||
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
|
||||
customDialogInput = CustomDialogInput(requireContext())
|
||||
customDialog = CustomDialog(requireContext())
|
||||
activity!!.main_bottom_navigation.visibility = View.GONE
|
||||
|
||||
|
||||
////Log.i("VERDNATURA:","la matricula es $numberPlate")
|
||||
//sergio: revisar entrypoint
|
||||
viewModel.vehicleWarehouseTimeControl_getHistorical(user,password,numberPlate,userFk)
|
||||
toolbar_title.text = getString(R.string.vehiclediary)
|
||||
setEvents()
|
||||
super.init()
|
||||
}
|
||||
|
||||
|
||||
private fun setEvents(){
|
||||
backButton.setOnClickListener {
|
||||
activity!!.onBackPressed()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
override fun observeViewModel() {
|
||||
with(viewModel){
|
||||
loadHistoricoVehiculoList.observe(viewLifecycleOwner, Observer{ event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
splash_progress.visibility = View.GONE
|
||||
adapter = HistoricoVehiculoAdapter(it.list)
|
||||
historicovehiculo_recyclerview.adapter = adapter
|
||||
historicovehiculo_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
navigateToToday(it)
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun navigateToToday(it: ItemHistoricoVehiculoList){
|
||||
var positionToday = 0
|
||||
val sdf = SimpleDateFormat("yyyy-MM-dd")
|
||||
val currentDate = sdf.format(Date())
|
||||
|
||||
for (item in it.list){
|
||||
if (currentDate == item.timed){
|
||||
break
|
||||
}
|
||||
positionToday += 1
|
||||
}
|
||||
|
||||
historicovehiculo_recyclerview.scrollToPosition(positionToday)
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package es.verdnatura.presentation.view.feature.historicovehiculo.fragment
|
||||
|
||||
import android.content.Context
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import es.verdnatura.domain.GetItemCardUserCase
|
||||
import es.verdnatura.domain.GetVehicleControlTimeUserCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.common.Event
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculoList
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class HistoricoVehiculoViewModel (context: Context) : BaseViewModel() {
|
||||
private val GetVehicleControlTimeUserCase: GetVehicleControlTimeUserCase = GetVehicleControlTimeUserCase(context)
|
||||
|
||||
|
||||
private val _historicovehiculoList by lazy { MutableLiveData<ItemHistoricoVehiculoList>() }
|
||||
val historicovehiculoList: LiveData<ItemHistoricoVehiculoList>
|
||||
get() = _historicovehiculoList
|
||||
|
||||
|
||||
val loadHistoricoVehiculoList = Transformations.map(_historicovehiculoList) { Event(it) }
|
||||
|
||||
|
||||
fun vehicleWarehouseTimeControl_getHistorical(usuario:String,password:String,plateNumber:String,nameWorker:String){
|
||||
GetVehicleControlTimeUserCase.vehicleWarehouseTimeControl_getHistorical(usuario,password,plateNumber,nameWorker).enqueue(object :
|
||||
Callback<List<ItemHistoricoVehiculo>> {
|
||||
override fun onFailure(call: Call<List<ItemHistoricoVehiculo>>, t: Throwable) {
|
||||
val listError:ArrayList<ItemHistoricoVehiculo> = ArrayList()
|
||||
listError.add(ItemHistoricoVehiculo(isError = true,errorMessage = t.message!!))
|
||||
_historicovehiculoList.value = ItemHistoricoVehiculoList(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<ItemHistoricoVehiculo>>,
|
||||
response: Response<List<ItemHistoricoVehiculo>>
|
||||
) {
|
||||
if (response.body() != null){
|
||||
_historicovehiculoList.value = response.body()?.let { ItemHistoricoVehiculoList(it) }
|
||||
}else{
|
||||
val listError:ArrayList<ItemHistoricoVehiculo> = ArrayList()
|
||||
listError.add(ItemHistoricoVehiculo(isError = true,errorMessage = "Error en la llamada de historico vehículo"))
|
||||
_historicovehiculoList.value = ItemHistoricoVehiculoList(listError)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package es.verdnatura.presentation.view.feature.historicovehiculo.model
|
||||
|
||||
|
||||
|
||||
class ItemHistoricoVehiculo (
|
||||
var timed:String = "",
|
||||
var workerFk:String = "",
|
||||
var direction:String = "",
|
||||
var isError:Boolean = false,
|
||||
var errorMessage:String = ""
|
||||
)
|
||||
|
||||
class ItemHistoricoVehiculoList(
|
||||
var list:List<ItemHistoricoVehiculo> = listOf()
|
||||
)
|
|
@ -86,15 +86,15 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
|
|||
filter_buyer.setText(prefs!!.getString(BUYER,""))
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
buyerId=prefs!!.getString(BUYERID,"").toString()
|
||||
//Log.i("VERDNATURA","el sector es $warehouseFk")
|
||||
//Log.i("VERDNATURA","el sbuyerid es $buyerId")
|
||||
////Log.i("VERDNATURA:","el sector es $warehouseFk")
|
||||
////Log.i("VERDNATURA:","el sbuyerid es $buyerId")
|
||||
viewModel.getInventory(user,password,buyerId,warehouseFk)
|
||||
filter_buyer.setOnClickListener{
|
||||
//SimpleSearchDialogCompat(context,getString(R.string.compradores),getString(R.string.escribirparteNombre),null,initData(),
|
||||
SimpleSearchDialogCompat(context,getString(R.string.compradores),getString(R.string.escribirparteNombre),null,items,
|
||||
SearchResultListener { baseSearchDialogCompat, nombre, position ->
|
||||
////Log.i("VERDNATURA","nombre "+nombre.title)
|
||||
////Log.i("VERDNATURA","el id es "+nombre.getBuyerId())
|
||||
//////Log.i("VERDNATURA:","nombre "+nombre.title)
|
||||
//////Log.i("VERDNATURA:","el id es "+nombre.getBuyerId())
|
||||
filter_buyer.setText((nombre.title))
|
||||
saveBuyer(nombre.getBuyerNickname())
|
||||
saveBuyerId(nombre.getBuyerId())
|
||||
|
@ -225,10 +225,10 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
|
|||
override fun onInvetoryNichoClickListener(item: ItemInventaryVO) {
|
||||
|
||||
//sergio: cambiad customdialogInput pòr customdialog 6.1.4
|
||||
//Log.i("VERDNATURA","A tirar tanto")
|
||||
////Log.i("VERDNATURA:","A tirar tanto")
|
||||
customDialog.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){
|
||||
//customDialogInput.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){
|
||||
//Log.i("VERDNATURA","A tirar tanto viewmodel dentro")
|
||||
////Log.i("VERDNATURA:","A tirar tanto viewmodel dentro")
|
||||
viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,"0","0")
|
||||
// viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0")
|
||||
changeOfflineValue(item)
|
||||
|
@ -244,7 +244,7 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
|
|||
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
if (!customDialogInput.getValue().isNullOrEmpty()){
|
||||
//Log.i("VERDNATURA","A tirar tanto viewmodel fuera")
|
||||
////Log.i("VERDNATURA:","A tirar tanto viewmodel fuera")
|
||||
viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0")
|
||||
changeOfflineValue(item)
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
|
|||
if (!buyer.isError){
|
||||
try {
|
||||
items.add(SearchBuyerModel(buyer.nickname,buyer.userFk));
|
||||
//Log.i("VERDNATURA","Nombre comprador ${buyer.nickname} : ${buyer.userFk}")
|
||||
////Log.i("VERDNATURA:","Nombre comprador ${buyer.nickname} : ${buyer.userFk}")
|
||||
}catch (e:Exception){}
|
||||
}
|
||||
}}
|
||||
|
|
|
@ -1,20 +1,29 @@
|
|||
package es.verdnatura.presentation.view.feature.login.activity
|
||||
|
||||
import android.content.Intent
|
||||
import android.app.admin.DeviceAdminReceiver
|
||||
import android.content.Context
|
||||
import android.net.wifi.WifiManager
|
||||
import android.os.Build
|
||||
import android.provider.Settings
|
||||
import android.util.Log
|
||||
import androidx.annotation.RequiresApi
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.ActivityLoginBinding
|
||||
import es.verdnatura.presentation.base.BaseActivity
|
||||
import es.verdnatura.presentation.common.TAG
|
||||
import es.verdnatura.presentation.common.addFragment
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.feature.login.fragment.LoginFragment
|
||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||
|
||||
|
||||
class LoginActivity : BaseActivity<ActivityLoginBinding>() {
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.activity_login
|
||||
private lateinit var customDialog: CustomDialog
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
override fun init() {
|
||||
/* val crashButton = Button(this)
|
||||
/* val crashButton = Button(this)
|
||||
crashButton.text = "Crash!"
|
||||
crashButton.setOnClickListener {
|
||||
throw RuntimeException("Test Crash") // Force a crash
|
||||
|
@ -23,13 +32,141 @@ class LoginActivity : BaseActivity<ActivityLoginBinding>() {
|
|||
addContentView(crashButton, ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT))*/
|
||||
/*
|
||||
val admin = DeviceAdminReceiver()
|
||||
val devicepolicymanager = admin.getManager(applicationContext)
|
||||
val name1 = admin.getWho(applicationContext)
|
||||
//Log.i("VERDNATURA:", "mac ${name1.className}")
|
||||
if (devicepolicymanager.isAdminActive(name1)) {
|
||||
val mac_address = devicepolicymanager.getWifiMacAddress(name1)
|
||||
//Log.i("VERDNATURA:", "mac $mac_address")
|
||||
}
|
||||
|
||||
|
||||
val id: String = Settings.Secure.getString(contentResolver, Settings.Secure.ANDROID_ID)
|
||||
// var c= Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);
|
||||
var myIMEI: String? = null
|
||||
try {
|
||||
|
||||
val tm = applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager
|
||||
|
||||
|
||||
myIMEI = tm.connectionInfo.toString()
|
||||
|
||||
}catch (ex:Exception) {
|
||||
//Log.i("VERDNATURA:", "el wifi_id $id ")
|
||||
|
||||
}
|
||||
|
||||
///////
|
||||
var a = Settings.Secure.getString(getContentResolver(), "bluetooth_name")
|
||||
//Log.i("VERDNATURA:", "el nombre es $a")
|
||||
try {
|
||||
var b = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
android.os.Build.getSerial()
|
||||
} else {
|
||||
|
||||
|
||||
}
|
||||
//Log.i("VERDNATURA:", "el numSerie es $b")
|
||||
|
||||
} catch (e: Exception) {
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
addFragment(LoginFragment.newInstance(),R.id.main_frame_layout,LoginFragment.TAG)
|
||||
}
|
||||
}
|
||||
// val id: String = Settings.Secure.getString(contentResolver, Settings.Secure.ANDROID_ID)
|
||||
// var c= Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);
|
||||
// //Log.i("VERDNATURA:","el android_id $c")
|
||||
/*SERGIO: PARA CUANDO SE AVERIGUE EL TEMA DE ANDROID_ID:
|
||||
|
||||
requestReadPhoneStatePermission() */
|
||||
|
||||
/* private fun requestReadPhoneStatePermission(){
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
val requiredPermission: String = Manifest.permission.READ_PHONE_STATE
|
||||
val res = this!!.checkCallingOrSelfPermission(requiredPermission)
|
||||
if (res == PackageManager.PERMISSION_DENIED) {
|
||||
requestPermissions(arrayOf(requiredPermission), 102)
|
||||
}else{
|
||||
addFragment(LoginFragment.newInstance(),R.id.main_frame_layout,LoginFragment.TAG)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun onRequestPermissionsResult(
|
||||
requestCode: Int,
|
||||
permissions: Array<out String>,
|
||||
grantResults: IntArray
|
||||
) {
|
||||
if (requestCode==102 && (grantResults[0]==PackageManager.PERMISSION_GRANTED)){
|
||||
get_IMEI()
|
||||
addFragment(LoginFragment.newInstance(),R.id.main_frame_layout,LoginFragment.TAG)
|
||||
}
|
||||
|
||||
if (requestCode==102 && (grantResults[0]==PackageManager.PERMISSION_DENIED)){
|
||||
customDialog = CustomDialog(this)
|
||||
customDialog.setTitle(getString(R.string.Error)).setDescription(getString(R.string.mensajeadvertenciaIMEI))
|
||||
.setOkButton(getString(R.string.Close)) {
|
||||
|
||||
customDialog.dismiss()
|
||||
finish()
|
||||
}.show()
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun get_IMEI()
|
||||
{
|
||||
|
||||
var myIMEI: String? = null
|
||||
try
|
||||
{
|
||||
|
||||
val tm = getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
myIMEI=tm.getImei()
|
||||
} else{
|
||||
myIMEI=tm.getDeviceId()
|
||||
}
|
||||
|
||||
if (myIMEI != null)
|
||||
{
|
||||
saveIMEI(myIMEI)
|
||||
//Log.i("VERDNATURA:","Guardamos $myIMEI")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
catch (ex:Exception) {
|
||||
//Log.i("VERDNATURA:", "Error ${ex.message.toString()}")
|
||||
customDialog = CustomDialog(this)
|
||||
customDialog.setTitle(getString(R.string.Error))
|
||||
.setDescription(getString(R.string.mensajenoimei))
|
||||
.setOkButton(getString(R.string.Close)) {
|
||||
customDialog.dismiss()
|
||||
addFragment(LoginFragment.newInstance(),R.id.main_frame_layout,LoginFragment.TAG)
|
||||
}.show()
|
||||
|
||||
}
|
||||
|
||||
|
||||
addFragment(LoginFragment.newInstance(),R.id.main_frame_layout,LoginFragment.TAG)
|
||||
//sergio: para no hacer login se inicia MainActivity directamente
|
||||
/* val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)*/
|
||||
}
|
||||
|
||||
fun saveIMEI(myIMEI:String) {
|
||||
val prefs: SharedPreferences = this!!.getSharedPreferences("es.verdnatura.user.prefs", 0)
|
||||
val editor = prefs.edit()
|
||||
editor.putString("IMEI", myIMEI)
|
||||
editor.apply()
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
|
|
|
@ -4,14 +4,21 @@ package es.verdnatura.presentation.view.feature.login.fragment
|
|||
import android.app.AlarmManager
|
||||
import android.app.PendingIntent
|
||||
import android.content.Context
|
||||
import android.content.Context.TELEPHONY_SERVICE
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import android.content.pm.PackageInfo
|
||||
import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.preference.PreferenceManager
|
||||
import android.telephony.TelephonyManager
|
||||
import android.util.Log
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.content.ContextCompat.checkSelfPermission
|
||||
import androidx.core.content.ContextCompat.getSystemService
|
||||
import androidx.lifecycle.Observer
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentLoginBinding
|
||||
|
@ -40,9 +47,14 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
|
||||
customDialog = CustomDialog(requireContext())
|
||||
checkUser()
|
||||
|
||||
|
||||
|
||||
button_login.setOnClickListener(View.OnClickListener {
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
viewModel.login(edittext_username.text.toString(), edittext_password.text.toString())
|
||||
// //Log.i("VERDNATURA:","el imei pasado al login es ${getIMEI()}")
|
||||
viewModel.login(edittext_username.text.toString(), edittext_password.text.toString(),getIMEI())
|
||||
|
||||
})
|
||||
|
||||
textview_remember_password.setOnClickListener {
|
||||
|
@ -68,9 +80,9 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
})
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private fun checkUser(){
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER, 0)
|
||||
if (prefs.getBoolean(RECORDAR, false)){
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
package es.verdnatura.presentation.view.feature.login.fragment
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.google.gson.Gson
|
||||
import es.verdnatura.domain.GetLoginUserCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.view.feature.login.model.LoginItemVO
|
||||
import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO
|
||||
import es.verdnatura.presentation.view.feature.login.model.errorMessage
|
||||
import es.verdnatura.presentation.view.feature.login.model.versionApp
|
||||
import org.json.JSONObject
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
@ -35,13 +39,19 @@ class LoginViewModel(context: Context) : BaseViewModel() {
|
|||
val versionappitem : LiveData<versionApp>
|
||||
get() = _versionappitem
|
||||
|
||||
fun login(user:String,password:String){
|
||||
getLoginUserCase.login(user,password).enqueue(object : Callback<String>{
|
||||
fun login(user:String,password:String,imei:String){
|
||||
getLoginUserCase.login(user,password,imei).enqueue(object : Callback<String>{
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
|
||||
var loginItemVO:LoginItemVO?
|
||||
if (response.raw().code() == 555){
|
||||
loginItemVO = LoginItemVO(id = "0",isError = true, errorMessage = "Usuario o contraseña incorrectos")
|
||||
var message=response.raw().message().toString()
|
||||
|
||||
if (message.contains("autorizado")){
|
||||
loginItemVO = LoginItemVO(id = "0",isError = true, errorMessage = "Usuario no autorizado para este dispositivo")
|
||||
}else{ loginItemVO = LoginItemVO(id = "0",isError = true, errorMessage = "Usuario o contraseña incorrectos")}
|
||||
|
||||
|
||||
}else if (!response.body().isNullOrEmpty()){
|
||||
loginItemVO = response.body()?.let { LoginItemVO(id = it) }
|
||||
}else{
|
||||
|
@ -103,7 +113,7 @@ class LoginViewModel(context: Context) : BaseViewModel() {
|
|||
|
||||
if (response.body() != null){
|
||||
versionApp= response.body()?.version?.let { versionApp(nameApp,it,isError = false,errorMessage = "") }
|
||||
// Log.i("VERDNATURA","Recogemos ${versionApp?.version}")
|
||||
// //Log.i("VERDNATURA:","Recogemos ${versionApp?.version}")
|
||||
}else{
|
||||
versionApp = versionApp(user,password,isError = true,errorMessage = "Error al conectar.")
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package es.verdnatura.presentation.view.feature.login.model
|
||||
|
||||
class errorMessage (
|
||||
val message: String = ""
|
||||
){
|
||||
override fun toString(): String {
|
||||
return "${this.message}"
|
||||
}
|
||||
}
|
|
@ -8,19 +8,21 @@ import androidx.fragment.app.Fragment
|
|||
import androidx.fragment.app.FragmentManager
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.ActivityMainBinding
|
||||
import es.verdnatura.domain.ConstAndValues.MAINACTIVITY
|
||||
import es.verdnatura.presentation.base.BaseActivity
|
||||
import es.verdnatura.presentation.common.*
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesFragment
|
||||
import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardFragment
|
||||
import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemAllFragment
|
||||
import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemFragment
|
||||
import es.verdnatura.presentation.view.feature.calidad.fragment.BuyersFragment
|
||||
import es.verdnatura.presentation.view.feature.calidad.fragment.QaualityFragment
|
||||
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragment
|
||||
import es.verdnatura.presentation.view.feature.controlador.fragment.ControladorFragment
|
||||
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoFragment
|
||||
import es.verdnatura.presentation.view.feature.faltas.fragment.FaltasFragment
|
||||
import es.verdnatura.presentation.view.feature.historico.fragment.HistoricoFragment
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoFragment
|
||||
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryFragment
|
||||
import es.verdnatura.presentation.view.feature.main.model.ItemMenuVO
|
||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPalletDetailFragment
|
||||
|
@ -53,6 +55,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
|||
private lateinit var customDialog: CustomDialog
|
||||
var firstItem : ItemMenuVO? = null
|
||||
var fm = supportFragmentManager
|
||||
var TAG="MainActivity"
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.activity_main
|
||||
|
||||
|
@ -62,6 +65,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
|||
setBottomMenu()
|
||||
if(haveSector()) addFragment(PasilleroFragment.newInstance(),R.id.main_frame_layout, PasilleroFragment.TAG,false)
|
||||
else addFragment(AjustesFragment.newInstance(),R.id.main_frame_layout, AjustesFragment.TAG,false)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -139,7 +143,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
|||
}
|
||||
getString(R.string.Sacadores) -> {
|
||||
fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
addFragment(SacadorFragment.newInstance(),R.id.main_frame_layout, SacadorFragment.TAG,false)
|
||||
// addFragment(SacadorFragment.newInstance(),R.id.main_frame_layout, SacadorFragment.TAG,false)
|
||||
addFragment(ControlVehiculoFragment.newInstance(MAINACTIVITY),R.id.main_frame_layout, MAINACTIVITY.TAG,false)
|
||||
true
|
||||
}
|
||||
getString(R.string.Controladores) -> {
|
||||
|
@ -172,13 +177,12 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
|||
|
||||
private fun delete_Fragments() {
|
||||
fm.getFragments().forEach {
|
||||
// Log.i("VERDNATURA", "si esta ${it.tag.toString()}")
|
||||
////Log.i("VERDNATURA:", "si esta ${it.tag.toString()}")
|
||||
var fragment:Fragment?=supportFragmentManager.findFragmentByTag(it.tag.toString())
|
||||
if (fragment!= null) supportFragmentManager
|
||||
.beginTransaction().remove(fragment)
|
||||
.commit()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onPasillerosItemClickListener(item: PasillerosItemVO, entryPoint: String) {
|
||||
|
@ -186,14 +190,15 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
|||
|
||||
when (item.title){
|
||||
|
||||
"Asociar Sacador SmartTags" -> {
|
||||
addFragmentOnTop(AssociateTagsFragment.newInstance(entryPoint))
|
||||
}
|
||||
"Pre Sacador" -> {
|
||||
addFragmentOnTop(PreSacadorFragment.newInstance())
|
||||
}
|
||||
|
||||
"Ver Ticket" -> {
|
||||
addFragmentOnTop(PreControladorFragment.newInstance())
|
||||
}
|
||||
|
||||
"Reposición" -> {
|
||||
addFragmentOnTop(ReposicionFragment.newInstance())
|
||||
}
|
||||
|
@ -212,6 +217,12 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
|||
"Historico" -> {
|
||||
addFragmentOnTop(HistoricoFragment.newInstance(entryPoint))
|
||||
}
|
||||
|
||||
"Historico Vehículo" -> {
|
||||
addFragmentOnTop(HistoricoVehiculoFragment.newInstance(entryPoint))
|
||||
// fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
// addFragment(HistoricoVehiculoFragment.newInstance(entryPoint),R.id.main_frame_layout, ControladorFragment.TAG,false)
|
||||
}
|
||||
"Inventario" -> {
|
||||
addFragmentOnTop(InventaryFragment.newInstance())
|
||||
}
|
||||
|
@ -230,6 +241,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
|||
"Calidad" -> {
|
||||
addFragmentOnTop(BuyersFragment.newInstance())
|
||||
}
|
||||
"Sacadores" -> {
|
||||
addFragmentOnTop(SacadorFragment.newInstance())
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Log.i("Item: ",item.title)
|
||||
}
|
||||
|
@ -246,7 +262,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
|||
}
|
||||
|
||||
|
||||
|
||||
override fun onBackPressed() {
|
||||
|
||||
try{
|
||||
|
@ -270,7 +285,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
|||
|
||||
override fun onTruckClickListener(item: ItemExpeditionTruckVO, entryPoint: String) {
|
||||
addFragmentOnTop(ExpeditionPalletFragment.newInstance(item))
|
||||
//Log.i("VERDNATURA","clickamos la expedicion y abrimos ExpeditionPalletFragment")
|
||||
////Log.i("VERDNATURA:","clickamos la expedicion y abrimos ExpeditionPalletFragment")
|
||||
|
||||
}
|
||||
|
||||
|
@ -289,10 +304,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
|||
}
|
||||
|
||||
|
||||
|
||||
override fun onCollectionSelected(collection: CollectionVO,type:String) {
|
||||
fm.popBackStack()
|
||||
// Log.i("VERDNATURA","el type es $type")
|
||||
// fm.popBackStack()
|
||||
addFragmentOnTop(CollectionFragment.newInstance(collection,type))
|
||||
|
||||
}
|
||||
|
@ -301,4 +314,19 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
|||
addFragmentOnTop(QaualityFragment.newInstance(userFk))
|
||||
}
|
||||
|
||||
fun onVehicleSelected(tag:String) {
|
||||
fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
addFragmentOnTop(ControlVehiculoFragment.newInstance(tag))
|
||||
}
|
||||
|
||||
fun openFragmentPickers(){
|
||||
//delete_Fragments()
|
||||
fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
addFragment(SacadorFragment.newInstance(),R.id.main_frame_layout, SacadorFragment.TAG,false)
|
||||
//addFragmentOnTop(SacadorFragment.newInstance())
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ class ExpeditionListAdapter (
|
|||
holder.bind(items[position])
|
||||
holder.binding.root.setOnClickListener {
|
||||
onTruckClickListener.onTruckClickListener(items[position],"")
|
||||
//Log.i("VERDNATURA","3-ontruckClickListener")
|
||||
////Log.i("VERDNATURA:","3-ontruckClickListener")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ class ExpeditionPalletDetailFragment(
|
|||
// sergio: en caso de que hay problemas habrá que cambiar aquí la llamada
|
||||
// MainActivity.addFragmentOnTop(ExpeditionPalletDetailFragment.newInstance(itemTruck,itemPallet))
|
||||
// que llame diractamente al fragment para que no se repita la ultima accion
|
||||
//Log.i("VERDNATURA", "pulsamos boton OK en detail fragment")
|
||||
////Log.i("VERDNATURA:", "pulsamos boton OK en detail fragment")
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -120,8 +120,6 @@ class ExpeditionPalletDetailFragment(
|
|||
splash_progress.visibility = View.VISIBLE
|
||||
|
||||
viewModel.expeditionPalletPrintSet(user,password,itemPallet!!.Pallet,sectorFk)
|
||||
|
||||
////Log.i("VERDNATURA","imprimiento etiqueta pallet $itemPallet.Pallet y sector $sectorFk")
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -89,7 +89,7 @@ class ExpeditionPalletFragment(
|
|||
setToolBar()
|
||||
setEvents()
|
||||
viewModel.expeditionPallet_List(user,password,itemExpeditionTruckVO!!.truckFk)
|
||||
//Log.i("VERDNATURA","4-listamos listado de pallets para la expedicion")
|
||||
////Log.i("VERDNATURA:","4-listamos listado de pallets para la expedicion")
|
||||
super.init()
|
||||
}
|
||||
|
||||
|
@ -152,20 +152,17 @@ class ExpeditionPalletFragment(
|
|||
customDialog.dismiss()
|
||||
}.show()
|
||||
}else{
|
||||
//Log.i("VERDNATURA"," Resultado llamada es ${it.response.toString()}")
|
||||
|
||||
|
||||
if (it.response=="0") {
|
||||
|
||||
//"Rutas iguales ${it.response}".toast(activity!!)
|
||||
//Log.i("VERDNATURA","Rutas iguales")
|
||||
////Log.i("VERDNATURA:","Rutas iguales")
|
||||
}
|
||||
if (it.response=="1"){
|
||||
mperror?.start()
|
||||
// "Resultado llamada $it.response".toast(activity!!)
|
||||
// customDialog.setTitle("Rutas distintas").setDescription(it.response).setOkButton("Cerrar"){
|
||||
// customDialog.dismiss()
|
||||
// }.show()
|
||||
////Log.i("VERDNATURA:","Rutas distintas")
|
||||
|
||||
}}
|
||||
})
|
||||
|
||||
|
@ -190,7 +187,7 @@ class ExpeditionPalletFragment(
|
|||
|
||||
private fun showScanExpeditions(it:ItemScanList){
|
||||
|
||||
//Log.i("VERDNATURA","VA A ESCANEAR EN PALLETFRAGMENT")
|
||||
//Log.i("VERDNATURA:","VA A ESCANEAR EN PALLETFRAGMENT")
|
||||
splash_progress.visibility = View.GONE
|
||||
|
||||
listExpeditions = ArrayList()
|
||||
|
@ -236,7 +233,7 @@ class ExpeditionPalletFragment(
|
|||
listExpeditions.add(0,BarcodeVO(code = customDialogList.getValue()))
|
||||
customDialogList.setDescription("Total: "+listExpeditions.size)
|
||||
viewModel.expeditionScanPut(user,password,it.list.get(0).palletFk,customDialogList.getValue())
|
||||
//Log.i("VERDNATURA"," palletizando ${it.list.get(0).palletFk} expedi: ${customDialogList.getValue()}")
|
||||
////Log.i("VERDNATURA:"," palletizando ${it.list.get(0).palletFk} expedi: ${customDialogList.getValue()}")
|
||||
viewModel.checkRouteExpeditionScanPut(user,password,it.list.get(0).palletFk,customDialogList.getValue());
|
||||
}else{
|
||||
if (mperror != null) mperror!!.start()
|
||||
|
|
|
@ -115,7 +115,7 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
|
|||
_responseCheckexpeditionScanPut.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada checkExpeditionScan_Put")
|
||||
}else{
|
||||
_responseCheckexpeditionScanPut.value = ResponseItemVO(isError = false,response = response.body()!!)
|
||||
//Log.i("VERDNATURA","Resultado checkExpeditionScan ${_responseCheckexpeditionScanPut.value}")
|
||||
////Log.i("VERDNATURA:","Resultado checkExpeditionScan ${_responseCheckexpeditionScanPut.value}")
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package es.verdnatura.presentation.view.feature.paletizador.fragment
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.graphics.drawable.Drawable
|
||||
|
@ -110,7 +111,9 @@ class ExpeditionScanFragment (
|
|||
splash_progress.visibility = View.VISIBLE
|
||||
viewModel.expeditionScanList(user,password,itemPalletVO!!.Pallet)
|
||||
}else if(item == iconPlus){
|
||||
expeditionScanAdd()
|
||||
//Log.i("VERDNATURA:","ENTRAMOS A SCAN ADD")
|
||||
expeditionScanAdd ()
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -149,13 +152,13 @@ class ExpeditionScanFragment (
|
|||
customDialog.dismiss()
|
||||
}.show()
|
||||
}else{
|
||||
//Log.i("VERDNATURA"," Resultado llamada es ${it.response.toString()}")
|
||||
////Log.i("VERDNATURA:"," Resultado llamada es ${it.response.toString()}")
|
||||
|
||||
|
||||
if (it.response=="0") {
|
||||
|
||||
//"Rutas iguales ${it.response}".toast(activity!!)
|
||||
//Log.i("VERDNATURA","Rutas iguales")
|
||||
////Log.i("VERDNATURA:","Rutas iguales")
|
||||
}
|
||||
if (it.response=="1"){
|
||||
mperror?.start()
|
||||
|
@ -206,27 +209,27 @@ class ExpeditionScanFragment (
|
|||
private fun expeditionScanAdd(){
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
viewModel.expeditionScanAdd(usuario = user,password = password,vPalletFk = itemPalletVO!!.Pallet,vTruckFk = itemExpeditionTruckVO!!.truckFk)
|
||||
//Log.i("VERDNATURA","entramos a escanear ticket del pallet")
|
||||
//Log.i("VERDNATURA:","entramos a escanear ticket del pallet")
|
||||
|
||||
}
|
||||
|
||||
private fun showScanExpeditions(it: ItemScanList){
|
||||
//Log.i("VERDNATURA","muestra expediciones")
|
||||
//Log.i("VERDNATURA:","muestra expediciones y a escanear")
|
||||
listExpeditions = ArrayList()
|
||||
splash_progress.visibility = View.GONE
|
||||
it.list.forEach {
|
||||
if(it.expeditionFk != "0")
|
||||
listExpeditions.add(BarcodeVO(code = it.expeditionFk))
|
||||
}
|
||||
//sergio:Comprueba si el numero es mayor>0
|
||||
//sergio:Comprueba si el numero es mayor>0
|
||||
customDialogList.setTitle("Pallet"+itemPalletVO!!.Pallet+" ("+toolbar_title.text+")").setOkButton("Comprobar"){
|
||||
//Log.i("VERDNATURA","Añadida etiqueta")
|
||||
//Log.i("VERDNATURA:","Añadida etiqueta")
|
||||
|
||||
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
|
||||
|
||||
|
||||
if (listExpeditions.size > 0){
|
||||
//Log.i("VERDNATURA","boton comprobar . si las expediciones >0 muetra DetailFragment")
|
||||
////Log.i("VERDNATURA:","boton comprobar . si las expediciones >0 muetra DetailFragment")
|
||||
onComprobarPalletViewClickListener!!.onComprobarPalletViewClickListener(itemExpeditionTruckVO!!,
|
||||
ItemPalletVO(Pallet = it.list.get(0).palletFk)
|
||||
)
|
||||
|
@ -255,8 +258,8 @@ class ExpeditionScanFragment (
|
|||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||
if (!customDialogList.getValue().isNullOrEmpty()) {
|
||||
|
||||
//Log.i("VERDNATURA", "scan put pallet ${it.list.get(0).palletFk}");
|
||||
//Log.i("VERDNATURA", "scan put list ${customDialogList.getValue()}");
|
||||
////Log.i("VERDNATURA:", "scan put pallet ${it.list.get(0).palletFk}");
|
||||
////Log.i("VERDNATURA:", "scan put list ${customDialogList.getValue()}");
|
||||
|
||||
listExpeditions.add(BarcodeVO(code = customDialogList.getValue()))
|
||||
viewModel.expeditionScanPut(
|
||||
|
@ -265,15 +268,15 @@ class ExpeditionScanFragment (
|
|||
it.list.get(0).palletFk,
|
||||
customDialogList.getValue()
|
||||
)
|
||||
//Log.i("VERDNATURA", "scan put pallet ${it.list.get(0).palletFk}");
|
||||
//Log.i("VERDNATURA", "scan put list ${customDialogList.getValue()}");
|
||||
////Log.i("VERDNATURA:", "scan put pallet ${it.list.get(0).palletFk}");
|
||||
////Log.i("VERDNATURA:", "scan put list ${customDialogList.getValue()}");
|
||||
|
||||
// //Log.i("VERDNATURA","misma ruta ?")
|
||||
// ////Log.i("VERDNATURA:","misma ruta ?")
|
||||
//sergio:comprueba si es de la misma ruta. Check_route_expedition.
|
||||
checkRouteExpeditionScanPut(user, password,it.list.get(0).palletFk,customDialogList.getValue())
|
||||
|
||||
//Log.i("VERDNATURA", "scan put pallet ${it.list.get(0).palletFk}");
|
||||
//Log.i("VERDNATURA", "scan put list ${customDialogList.getValue()}");
|
||||
////Log.i("VERDNATURA:", "scan put pallet ${it.list.get(0).palletFk}");
|
||||
////Log.i("VERDNATURA:", "scan put list ${customDialogList.getValue()}");
|
||||
|
||||
expeditionAdapter!!.notifyDataSetChanged()
|
||||
|
||||
|
@ -300,27 +303,8 @@ class ExpeditionScanFragment (
|
|||
private fun checkRouteExpeditionScanPut(user: String, password: String, palletFk: String, expedition: String){
|
||||
|
||||
viewModel.checkRouteExpeditionScanPut(user,password,palletFk,expedition);
|
||||
// "Pallet $palletFk y expediti $expedition".toast(activity!!)
|
||||
// //Log.i("VERDNATURA", "ha entrado en checkexpedition");
|
||||
|
||||
|
||||
/* var addScanInput = false;
|
||||
|
||||
customDialogTwoButtons.setTitle("La etiqueta escaneada no pertenece a la misma ruta. \n¿Desea incluirla igualmente?")
|
||||
.setOkButton("Incluir") {
|
||||
addScanInput = true
|
||||
customDialogTwoButtons.dismiss()
|
||||
return@setOkButton
|
||||
|
||||
}
|
||||
.setKoButton("Eliminar") {
|
||||
addScanInput = false
|
||||
customDialogTwoButtons.dismiss()
|
||||
return@setKoButton
|
||||
|
||||
}.show()
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -117,7 +117,7 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel() {
|
|||
_responseCheckexpeditionScanPut.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada checkExpeditionScan_Put")
|
||||
}else{
|
||||
_responseCheckexpeditionScanPut.value = ResponseItemVO(isError = false,response = response.body()!!)
|
||||
// //Log.i("VERDNATURA","Resultado checkExpeditionScan ${_responseCheckexpeditionScanPut.value}")
|
||||
// ////Log.i("VERDNATURA:","Resultado checkExpeditionScan ${_responseCheckexpeditionScanPut.value}")
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -66,7 +66,7 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
|
|||
toolbar_title.text = "PScan: "+getCURDATE()
|
||||
backButton.visibility = View.GONE
|
||||
setToolBar()
|
||||
//Log.i("VERDNATURA","1-cargamos expediciones")
|
||||
////Log.i("VERDNATURA:","1-cargamos expediciones")
|
||||
viewModel.expeditionTruckList(user,password)
|
||||
super.init()
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
|
|||
adapter = ExpeditionListAdapter(it.list,onTruckClickListener!!)
|
||||
expedition_truck_recyclerview.adapter = adapter
|
||||
expedition_truck_recyclerview.layoutManager = lm
|
||||
//Log.i("VERDNATURA","2-Rellenamos adapter")
|
||||
////Log.i("VERDNATURA:","2-Rellenamos adapter")
|
||||
}
|
||||
|
||||
private fun addTruck(){
|
||||
|
|
|
@ -14,14 +14,22 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
|
|||
|
||||
fun inititializeDefaultData() {
|
||||
|
||||
/* _pasillerositem.add(
|
||||
PasillerosItemVO(20,
|
||||
R.drawable.ic_loyalty_black_24dp,
|
||||
"Asociar Sacador SmartTags",R.string.SmarttagAssociate)
|
||||
)*/
|
||||
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(7,
|
||||
R.drawable.ic_streetview_black_24dp,
|
||||
"Pre Sacador",R.string.PreSacador)
|
||||
)
|
||||
_pasillerositem.add(
|
||||
//sergio para que aparezca el nuevo menu
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(10,
|
||||
R.drawable.ic_streetview_black_24dp,
|
||||
R.drawable.ic_visibility_black_24dp,
|
||||
"Ver Ticket",R.string.verticket)
|
||||
)
|
||||
|
||||
|
|
|
@ -13,13 +13,12 @@ import es.verdnatura.domain.ConstAndValues
|
|||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.OnCollectionSelectedListener
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.feature.controlador.fragment.ControladorViewModel
|
||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import kotlinx.android.synthetic.main.fragment_controlador.*
|
||||
import kotlinx.android.synthetic.main.toolbar.*
|
||||
|
||||
class PreControladorFragment: BaseFragment<FragmentControladorBinding,ControladorViewModel>(ControladorViewModel::class) {
|
||||
class PreControladorFragment: BaseFragment<FragmentControladorBinding,PreControladorViewModel>(PreControladorViewModel::class) {
|
||||
|
||||
|
||||
private var user = ""
|
||||
|
@ -30,6 +29,7 @@ class PreControladorFragment: BaseFragment<FragmentControladorBinding,Controlado
|
|||
private var onCollectionSelectedListener : OnCollectionSelectedListener? = null
|
||||
override fun getLayoutId(): Int = R.layout.fragment_controlador
|
||||
private lateinit var customDialog: CustomDialog
|
||||
private var type = ""
|
||||
|
||||
companion object {
|
||||
fun newInstance() = PreControladorFragment()
|
||||
|
@ -40,12 +40,13 @@ class PreControladorFragment: BaseFragment<FragmentControladorBinding,Controlado
|
|||
if (context is OnCollectionSelectedListener) onCollectionSelectedListener = context
|
||||
}
|
||||
|
||||
override fun init() {
|
||||
//sergio:Es PRECONTROLADOR PORQUE REALIZA LO MISMO QUE CONTROLADOR PERO EN EL BACK NO ACTUALIZA ESTADO Y EL CONTROLADOR SI.
|
||||
|
||||
override fun init() {
|
||||
|
||||
splash_progress.visibility = View.GONE
|
||||
customDialog = CustomDialog(requireContext())
|
||||
toolbar_title.text = getString(R.string.getcollection)
|
||||
toolbar_title.text = getString(R.string.verticket)
|
||||
setEvents()
|
||||
super.init()
|
||||
}
|
||||
|
@ -61,23 +62,32 @@ class PreControladorFragment: BaseFragment<FragmentControladorBinding,Controlado
|
|||
password = prefs.getString(PASSWORD,"").toString()
|
||||
sectorFk = prefs.getInt(SECTORFK,1).toString()
|
||||
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
|
||||
type=ConstAndValues.PRECHECKER
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
private fun setEvents(){
|
||||
|
||||
backButton.setOnClickListener {
|
||||
activity!!.onBackPressed()
|
||||
}
|
||||
|
||||
scan_input.requestFocus()
|
||||
scan_input.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
goBack=false;
|
||||
if (!scan_input.text.isNullOrEmpty()) {
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
////Log.i("VERDNATURA:","lanzamos desde precontrol")
|
||||
// viewModel.collection_getTickets(
|
||||
viewModel.collectionTicketGet(
|
||||
usuario = user,
|
||||
password = password,
|
||||
sectorFk = sectorFk,
|
||||
collectionFk = scan_input.text.toString()
|
||||
collectionFk = scan_input.text.toString(),
|
||||
type = type
|
||||
)
|
||||
Log.i("VERDNATURA","La collection es ${scan_input.text.toString()}")
|
||||
// //Log.i("VERDNATURA:","La collection es ${scan_input.text.toString()}")
|
||||
}
|
||||
scan_input.setText("")
|
||||
(activity as MainActivity).hideKeyboard(scan_input)
|
||||
|
@ -105,11 +115,9 @@ class PreControladorFragment: BaseFragment<FragmentControladorBinding,Controlado
|
|||
}
|
||||
|
||||
private fun navigateToCollectionList(collection: CollectionVO){
|
||||
onCollectionSelectedListener?.onCollectionSelected(collection, ConstAndValues.CONTROLADOR)
|
||||
//onCollectionSelectedListener?.onCollectionSelected(collection, "PRECONTROLADOR")
|
||||
// onCollectionSelectedListener=null
|
||||
// onCollectionSelectedListener?.onCollectionSelected(collection, ConstAndValues.CONTROLADOR)
|
||||
onCollectionSelectedListener?.onCollectionSelected(collection, ConstAndValues.PRECHECKER)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ package es.verdnatura.presentation.view.feature.precontrol
|
|||
import android.content.Context
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.GetSacadorControladorUserCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.domain.GetPreControladorUserCase
|
||||
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import retrofit2.Call
|
||||
|
@ -14,14 +14,13 @@ import retrofit2.Response
|
|||
class PreControladorViewModel(context: Context) : BaseViewModel() {
|
||||
|
||||
private val _collectionTicketList by lazy { MutableLiveData<CollectionVO>() }
|
||||
private val getSacadorControladorUserCase: GetSacadorControladorUserCase = GetSacadorControladorUserCase(context)
|
||||
private val getPreControladorUserCase: GetPreControladorUserCase = GetPreControladorUserCase(context)
|
||||
|
||||
val collectionTicketList: LiveData<CollectionVO>
|
||||
get() = _collectionTicketList
|
||||
|
||||
|
||||
fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String){
|
||||
getSacadorControladorUserCase.collectionTicketGet(usuario,password,collectionFk,sectorFk,"0").enqueue(object :
|
||||
fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String,type:String){
|
||||
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 = t.message!!)
|
||||
|
@ -39,5 +38,29 @@ class PreControladorViewModel(context: Context) : BaseViewModel() {
|
|||
})
|
||||
}
|
||||
|
||||
/* sergio: para el caso que íbamos a diferenciar pero ahora se hará todo desde Collection_getTickets pasánsole parámetro
|
||||
|
||||
fun collection_getTickets(usuario:String,password:String,collectionFk:String,sectorFk:String){
|
||||
//getPreControladorUserCase.collection_getTickets(usuario,password,collectionFk,sectorFk,"0").enqueue(object :
|
||||
getPreControladorUserCase.collection_getTickets(usuario,password,collectionFk,sectorFk,"0").enqueue(object :
|
||||
Callback<CollectionVO> {
|
||||
override fun onFailure(call: Call<CollectionVO>, t: Throwable) {
|
||||
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = t.message!!)
|
||||
}
|
||||
override fun onResponse(
|
||||
call: Call<CollectionVO>,
|
||||
response: Response<CollectionVO>
|
||||
) {
|
||||
if (response.body() != null){
|
||||
_collectionTicketList.value = response.body()?.let { it.map() }
|
||||
}else{
|
||||
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = "No hay tickets para sacar")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
}
|
|
@ -371,9 +371,9 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
|
|||
|
||||
)
|
||||
|
||||
// //Log.i("VERDNATURA","El id movimiento es ${sales[position].idMovimiento}")
|
||||
// //Log.i("VERDNATURA","Checked is ${if (sales[position].picked == sales[position].quantity) "1" else "0"}")
|
||||
// //Log.i("VERDNATURA","Position is ${position}")
|
||||
// ////Log.i("VERDNATURA:","El id movimiento es ${sales[position].idMovimiento}")
|
||||
// ////Log.i("VERDNATURA:","Checked is ${if (sales[position].picked == sales[position].quantity) "1" else "0"}")
|
||||
// ////Log.i("VERDNATURA:","Position is ${position}")
|
||||
|
||||
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
|
|||
|
||||
|
||||
originalItemScan=customDialogList.getValueTwo()
|
||||
//Log.i("VERDNATURA","el item original es $originalItemScan")
|
||||
////Log.i("VERDNATURA:","el item original es $originalItemScan")
|
||||
|
||||
if (customDialogList.getValueTwo().isNotEmpty()){
|
||||
if (checkItemScan(customDialogList.getValueTwo())){
|
||||
|
@ -605,7 +605,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
|
|||
collectionFk = ticket,
|
||||
sectorFk = sectorFk
|
||||
)
|
||||
//Log.i("VERDNATURA","La collection es $ticket, sectorFk $sectorFk, user $user i pass $password")
|
||||
////Log.i("VERDNATURA:","La collection es $ticket, sectorFk $sectorFk, user $user i pass $password")
|
||||
"Imprimiendo...".toast(requireContext())
|
||||
}
|
||||
|
||||
|
@ -617,13 +617,13 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
|
|||
val iconPrint : Drawable = resources.getDrawable(R.drawable.ic_print_black_24dp,resources.newTheme())
|
||||
val iconParking : Drawable = resources.getDrawable(R.drawable.ic_local_parking_black_24dp,resources.newTheme())
|
||||
//sergio para hacer el presacador como sacador
|
||||
val iconAdd : Drawable = resources.getDrawable(R.drawable.ic_add_black_24dp,resources.newTheme())
|
||||
//val iconAdd : Drawable = resources.getDrawable(R.drawable.ic_add_black_24dp,resources.newTheme())
|
||||
|
||||
//val iconTransferir : Drawable = resources.getDrawable(R.drawable.ic_swap_horiz_black_24dp,resources.newTheme())
|
||||
|
||||
listIcons.add(iconPrint)
|
||||
listIcons.add(iconParking)
|
||||
listIcons.add(iconAdd)
|
||||
//listIcons.add(iconAdd)
|
||||
//listIcons.add(iconTransferir)
|
||||
|
||||
toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
|
||||
|
@ -657,7 +657,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
|
|||
parking = parking
|
||||
|
||||
)
|
||||
//Log.i("VERDNATURA","El usuario $user pass $password ticket $ticketFk y parking $parking")
|
||||
////Log.i("VERDNATURA:","El usuario $user pass $password ticket $ticketFk y parking $parking")
|
||||
if (mpok != null) mpok!!.start()
|
||||
"Ticket aparcado".toast(requireContext())
|
||||
}
|
||||
|
|
|
@ -530,7 +530,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
|
|||
}
|
||||
|
||||
private fun showScanner(index:Int, sale:PreSacadorItemVO){
|
||||
////Log.i("VERDNATURA","CUSTOMDIALOG para enviar")
|
||||
//////Log.i("VERDNATURA:","CUSTOMDIALOG para enviar")
|
||||
customDialogInput.setTitle(""+sale.itemFk).setDescription("Escanea el carro para el item seleccionado").setOkButton("Aceptar"){
|
||||
if (!customDialogInput.getValue().isNullOrEmpty()) {
|
||||
findSale(customDialogInput.getValue(),index)
|
||||
|
|
|
@ -27,7 +27,7 @@ class CollectionAdapter (
|
|||
holder.bind(items[position])
|
||||
holder.binding.root.setOnClickListener {
|
||||
onCollectionSelected.onCollectionSelected(items[position],SACADOR)
|
||||
////Log.i("VERDNATURA","2-Click item ${items[position].collectionFk}")
|
||||
//////Log.i("VERDNATURA:","2-Click item ${items[position].collectionFk}")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,10 @@ import es.verdnatura.domain.ConstAndValues.SACADOR
|
|||
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.view.component.CustomDialog
|
||||
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.adapter.CollectionAdapter
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import kotlinx.android.synthetic.main.fragment_sacador.*
|
||||
|
@ -60,22 +62,24 @@ class SacadorFragment : BaseFragment<FragmentSacadorBinding,SacadorViewModel>(Sa
|
|||
}
|
||||
|
||||
override fun init() {
|
||||
|
||||
////Log.i("VERDNATURA:","Entramos en Sacador")
|
||||
customDialog = CustomDialog(requireContext())
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
splash_progress_two.visibility = View.GONE
|
||||
//el texto de la toolbar
|
||||
toolbar_title.text =getString(R.string.getcollection)
|
||||
setToolBar()
|
||||
setEvents()
|
||||
viewModel.collectionGet(user,password)
|
||||
|
||||
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
goBack = true
|
||||
goBack2 = true
|
||||
goBack2 = true
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
|
@ -83,14 +87,23 @@ class SacadorFragment : BaseFragment<FragmentSacadorBinding,SacadorViewModel>(Sa
|
|||
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())
|
||||
|
||||
|
||||
listIcons.add(iconVehicleIn)
|
||||
listIcons.add(iconAdd)
|
||||
|
||||
toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
|
||||
override fun onOptionsItemSelected(item: Drawable) {
|
||||
if(item == iconAdd){
|
||||
////Log.i("VERDNATURA","pulsando el +")
|
||||
splash_progress_two.visibility = View.VISIBLE
|
||||
//////Log.i("VERDNATURA:","pulsando el +")
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
viewModel.collectionNew(user,password,sectorFk,carros)
|
||||
}
|
||||
|
||||
if (item == iconVehicleIn){
|
||||
(activity as MainActivity).onVehicleSelected(SacadorFragment.TAG)
|
||||
}
|
||||
}
|
||||
})
|
||||
toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||
|
@ -98,20 +111,19 @@ class SacadorFragment : BaseFragment<FragmentSacadorBinding,SacadorViewModel>(Sa
|
|||
|
||||
private fun setEvents(){
|
||||
sacador_swipe.setOnRefreshListener {
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
|
||||
viewModel.collectionGet(user,password)
|
||||
Log.i("VERDNATURA","CollectionGet desde SacadorFragment SETEVENTS del swipe")
|
||||
//sergio: para mostrar que si se refresca o no
|
||||
sacador_swipe.isRefreshing = false
|
||||
}
|
||||
}
|
||||
|
||||
override fun observeViewModel() {
|
||||
|
||||
with(viewModel){
|
||||
|
||||
collectionList.observe(viewLifecycleOwner, Observer {
|
||||
if (!goBack2)splash_progress.visibility = View.GONE
|
||||
createCollectionList(it.list)
|
||||
splash_progress.visibility = View.GONE
|
||||
goBack2 = false
|
||||
})
|
||||
/* collectionTicketList.observe(viewLifecycleOwner, Observer {
|
||||
|
@ -127,6 +139,7 @@ class SacadorFragment : BaseFragment<FragmentSacadorBinding,SacadorViewModel>(Sa
|
|||
})*/
|
||||
response.observe(viewLifecycleOwner, Observer {
|
||||
splash_progress_two.visibility = View.GONE
|
||||
splash_progress.visibility = View.GONE
|
||||
if (it.isError){
|
||||
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Aceptar"){
|
||||
customDialog.dismiss()
|
||||
|
@ -146,7 +159,7 @@ class SacadorFragment : BaseFragment<FragmentSacadorBinding,SacadorViewModel>(Sa
|
|||
}
|
||||
val lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
adapter = CollectionAdapter(collectionsList,onCollectionSelectedListener!!)
|
||||
////Log.i("VERDNATURA","3-New fragment")
|
||||
//////Log.i("VERDNATURA:","3-New fragment")
|
||||
fragment_sacador_collections.layoutManager = lm
|
||||
fragment_sacador_collections.adapter = adapter
|
||||
|
||||
|
|
|
@ -38,19 +38,22 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
|
|||
get() = _response
|
||||
|
||||
|
||||
|
||||
fun collectionTicketGet(
|
||||
usuario: String,
|
||||
password: String,
|
||||
collectionFk: String,
|
||||
sectorFk: String,
|
||||
print: String
|
||||
print: String,
|
||||
type:String
|
||||
){
|
||||
getSacadorControladorUserCase.collectionTicketGet(
|
||||
usuario,
|
||||
password,
|
||||
collectionFk,
|
||||
sectorFk,
|
||||
print
|
||||
print,
|
||||
type
|
||||
).enqueue(object :
|
||||
Callback<CollectionVO> {
|
||||
override fun onFailure(call: Call<CollectionVO>, t: Throwable) {
|
||||
|
@ -83,7 +86,7 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
|
|||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = true, errorMessage = "" + t.message!!)
|
||||
////Log.i("VERDNATURA",t.message.toString())
|
||||
//////Log.i("VERDNATURA:",t.message.toString())
|
||||
|
||||
}
|
||||
|
||||
|
@ -96,7 +99,7 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
|
|||
ResponseItemVO(isError = false, response = response.body()!!)
|
||||
} else {
|
||||
val error=response.message()
|
||||
////Log.i("VERDNATURA",""+ error)
|
||||
//////Log.i("VERDNATURA:",""+ error)
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
// errorMessage = "Error en la llamada collectionNew"
|
||||
|
@ -112,7 +115,7 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
|
|||
|
||||
|
||||
fun collectionGet(usuario: String, password: String){
|
||||
////Log.i("VERDNATURA","collectionGet para coger tickets")
|
||||
//////Log.i("VERDNATURA:","collectionGet para coger tickets")
|
||||
getSacadorControladorUserCase.collectionGet(usuario, password).enqueue(object :
|
||||
Callback<List<CollectionVO>> {
|
||||
override fun onFailure(call: Call<List<CollectionVO>>, t: Throwable) {
|
||||
|
|
|
@ -0,0 +1,367 @@
|
|||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.util.TypedValue
|
||||
import android.view.View.*
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentVehiclecontrolBinding
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
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.CustomDialogList
|
||||
import es.verdnatura.presentation.view.component.CustomDialogThreeButtons
|
||||
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
|
||||
import es.verdnatura.presentation.view.feature.smarttag.sacador.AssociateTagsViewModel
|
||||
import kotlinx.android.synthetic.main.component_custom_three_dialog.*
|
||||
import kotlinx.android.synthetic.main.fragment_collection.*
|
||||
import kotlinx.android.synthetic.main.fragment_controlador.*
|
||||
import kotlinx.android.synthetic.main.fragment_controlador.scan_input
|
||||
import kotlinx.android.synthetic.main.fragment_controlador.splash_progress
|
||||
import kotlinx.android.synthetic.main.fragment_login.*
|
||||
import kotlinx.android.synthetic.main.fragment_sacador.*
|
||||
import kotlinx.android.synthetic.main.toolbar.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
class AssociateTagsFragment(
|
||||
var tagName: String = ""
|
||||
) :BaseFragment<FragmentVehiclecontrolBinding, AssociateTagsViewModel>(
|
||||
AssociateTagsViewModel::class) {
|
||||
|
||||
|
||||
private var user = ""
|
||||
private var userFk = ""
|
||||
private var password = ""
|
||||
private var sectorFk = ""
|
||||
private var warehouseFk = ""
|
||||
private var goBack: Boolean = false
|
||||
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
|
||||
override fun getLayoutId(): Int = R.layout.fragment_vehiclecontrol
|
||||
private lateinit var customDialog: CustomDialog
|
||||
|
||||
private lateinit var customDialogList: CustomDialogList
|
||||
private lateinit var customDialogInput: CustomDialogInput
|
||||
private lateinit var customDialogThreeButtons: CustomDialogThreeButtons
|
||||
|
||||
|
||||
companion object {
|
||||
fun newInstance(tagName: String) = AssociateTagsFragment(tagName)
|
||||
}
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
super.onAttach(context)
|
||||
if (context is OnCollectionSelectedListener) onCollectionSelectedListener = context
|
||||
}
|
||||
|
||||
|
||||
override fun init() {
|
||||
Log.i("V::","init associate")
|
||||
customDialog = CustomDialog(requireContext())
|
||||
customDialogList = CustomDialogList(requireContext())
|
||||
customDialogInput = CustomDialogInput(requireContext())
|
||||
customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
|
||||
goBack=false
|
||||
|
||||
splash_progress.visibility = GONE
|
||||
|
||||
/* if (!tagName.equals(SacadorFragment.TAG)) {
|
||||
checkControlTimeVehicle()
|
||||
}*/
|
||||
|
||||
setEvents()
|
||||
setToolBar("ALL")
|
||||
super.init()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
goBack = true
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
private fun setToolBar(direction:String) {
|
||||
|
||||
toolbar_title.text = getString(R.string.vehiclecontrol)
|
||||
toolbar_title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13F)
|
||||
|
||||
val listIcons: ArrayList<Drawable> = 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())
|
||||
|
||||
//listIcons.add(iconVehicleIn)
|
||||
//listIcons.add(iconVehicleOut)
|
||||
//listIcons.add(iconHistory)
|
||||
|
||||
|
||||
toolbar_icons.adapter = ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
|
||||
override fun onOptionsItemSelected(item: Drawable) {
|
||||
|
||||
if (item == iconHistory) {
|
||||
showScanner("Escanea matrícula para ver histórico", "HISTORY")
|
||||
}
|
||||
|
||||
if (item == iconVehicleIn) {
|
||||
showScanner("Escanea matrícula del vehículo", "IN")
|
||||
}
|
||||
if (item == iconVehicleOut) {
|
||||
showScanner("Escanea matrícula para dejar vehículo", "OUT")
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
toolbar_icons.layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||
}
|
||||
|
||||
|
||||
private fun showScanner(description: String, action: String) {
|
||||
|
||||
customDialogInput.setTitle(getString(R.string.vehiclecontrol)).setDescription(description)
|
||||
.setOkButton("Aceptar") {
|
||||
if (!customDialogInput.getValue().isNullOrEmpty()) {
|
||||
// "$description ${customDialogInput.getValue()} OK".toast(requireContext())
|
||||
insertControlTimeVehicle(customDialogInput.getValue(), action)
|
||||
}
|
||||
customDialogInput.setValue("")
|
||||
scanRequest()
|
||||
customDialogInput.dismiss()
|
||||
hideKeyboards()
|
||||
}
|
||||
|
||||
.setKoButton("Cancelar") {
|
||||
customDialogInput.dismiss()
|
||||
}.setValue("").show()
|
||||
|
||||
customDialogInput.getEditText().requestFocus()
|
||||
|
||||
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
|
||||
if (!customDialogInput.getValue().isNullOrEmpty()) {
|
||||
// //Log.i("VERDNATURA:", "El valor es ${customDialogInput.getValue()}")
|
||||
// "$description ${customDialogInput.getValue()} OK".toast(requireContext())
|
||||
insertControlTimeVehicle(customDialogInput.getValue(), action)
|
||||
}
|
||||
customDialogInput.setValue("")
|
||||
scanRequest()
|
||||
customDialogInput.dismiss()
|
||||
hideKeyboards()
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private fun checkControlTimeVehicle(){
|
||||
|
||||
if (!goBack){ splash_progress.visibility = VISIBLE
|
||||
//Log.i("VERDNATURA:","Entramos en la llamada checkRegister")
|
||||
viewModel.vehicleWarehouseTimeControl_checkRegister(user, password, userFk)}
|
||||
|
||||
}
|
||||
private fun insertControlTimeVehicle(plateNumber: String, direction: String) {
|
||||
|
||||
if (direction.equals("HISTORY")){
|
||||
(activity as MainActivity).onPasillerosItemClickListener( PasillerosItemVO(title = "Historico Vehículo"),plateNumber)
|
||||
}else{
|
||||
splash_progress.visibility = VISIBLE
|
||||
// //Log.i("VERDNATURA:","Entramos al insert")
|
||||
viewModel.vehicleWarehouseTimeControl_insert(user, password, plateNumber, userFk, direction)
|
||||
// //Log.i("VERDNATURA:", "user $user pass $password matricula $plateNumber, id $userFk, action $direction")
|
||||
}
|
||||
}
|
||||
|
||||
private fun scanRequest() {
|
||||
if (scan_input != null) {
|
||||
scan_input.requestFocus()
|
||||
}
|
||||
hideKeyboards()
|
||||
}
|
||||
|
||||
private fun hideKeyboards() {
|
||||
try {
|
||||
requireActivity().hideKeyboard()
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER, 0)
|
||||
user = prefs.getString(USER, "").toString()
|
||||
password = prefs.getString(PASSWORD, "").toString()
|
||||
sectorFk = prefs.getInt(SECTORFK, 1).toString()
|
||||
warehouseFk = prefs.getInt(WAREHOUSEFK, 1).toString()
|
||||
userFk = prefs.getString(USERFK, "0").toString()
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
private fun setEvents() {
|
||||
|
||||
backButton.setOnClickListener {
|
||||
activity!!.onBackPressed()
|
||||
}
|
||||
|
||||
scan_input.requestFocus()
|
||||
scan_input.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
if (!scan_input.text.isNullOrEmpty()) {
|
||||
////Log.i("VERDNATURA:", "Obtenido focus: ${scan_input.text.toString()}")
|
||||
showOptionsVehicleControl(scan_input.text.toString())
|
||||
}
|
||||
scan_input.setText("")
|
||||
(activity as MainActivity).hideKeyboard(scan_input)
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
private fun showOptionsVehicleControl(plate: String) {
|
||||
|
||||
customDialogThreeButtons.custom_dialog_value.visibility = GONE
|
||||
|
||||
customDialogThreeButtons.setDescription("¿Qué desea hacer con el vehículo de matrícula $plate")
|
||||
.setValue(plate)
|
||||
.setOkButtonTwo("COGER") {
|
||||
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
|
||||
"Vuelva a escanear".toast(requireContext())
|
||||
} else {
|
||||
splash_progress.visibility = VISIBLE
|
||||
customDialogThreeButtons.dismiss()
|
||||
insertControlTimeVehicle(customDialogThreeButtons.getValue(), "IN")
|
||||
}
|
||||
}.setOkButtonThree("DEJAR") {
|
||||
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
|
||||
"Vuelva a escanear".toast(requireContext())
|
||||
} else {
|
||||
splash_progress.visibility = VISIBLE
|
||||
customDialogThreeButtons.dismiss()
|
||||
insertControlTimeVehicle(customDialogThreeButtons.getValue(), "OUT")
|
||||
}
|
||||
|
||||
}.setOkButtonFour("HISTÓRICO") {
|
||||
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
|
||||
"Vuelva a escanear".toast(requireContext())
|
||||
} else {
|
||||
customDialogThreeButtons.dismiss()
|
||||
insertControlTimeVehicle(customDialogThreeButtons.getValue(), "HISTORY")
|
||||
|
||||
}
|
||||
|
||||
}.setKoButton("Cancelar") {
|
||||
scanRequest()
|
||||
customDialogThreeButtons.dismiss()
|
||||
}.show()
|
||||
}
|
||||
|
||||
|
||||
override fun observeViewModel() {
|
||||
|
||||
|
||||
with(viewModel) {
|
||||
splash_progress.visibility = GONE
|
||||
responseinsert.observe(viewLifecycleOwner, Observer {
|
||||
Log.i(
|
||||
"VERDNATURA",
|
||||
"Respuesta call vehicle_insert en el viewmodel es : ${it.response}"
|
||||
)
|
||||
|
||||
|
||||
if (it.isError) {
|
||||
|
||||
customDialog.setTitle("Error").setDescription(it.errorMessage)
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
} else {
|
||||
if (it.response == null || it.response == "false") {
|
||||
|
||||
customDialog.setTitle("Error")
|
||||
.setDescription("Revisar llamada del registro de vehículos")
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
|
||||
} else {
|
||||
if (it.response == "true") {
|
||||
"Acción registrada correctamente".toast(context)
|
||||
/* customDialog.setTitle("Llamada correcta")
|
||||
.setDescription("Acción registrada satisfactoriamente")
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()*/
|
||||
//(activity as MainActivity).openFragmentPickers()
|
||||
//(activity as MainActivity).onPasillerosItemClickListener( PasillerosItemVO(title = "Sacadores"),"CONTROL")
|
||||
checkControlTimeVehicle()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
splash_progress.visibility = GONE
|
||||
})
|
||||
|
||||
responsecontrol.observe(viewLifecycleOwner, Observer {
|
||||
splash_progress.visibility=GONE;
|
||||
if (it.isError) {
|
||||
customDialog.setTitle("Error").setDescription(it.errorMessage)
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
} else {
|
||||
if (it.response == null) {
|
||||
customDialog.setTitle("Error")
|
||||
.setDescription("Revisar llamada de control de vehículos")
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
} else {
|
||||
if (it.response == "REGISTERED") {
|
||||
// setToolBar("IN")
|
||||
/* customDialog.setTitle("Control de vehículos")
|
||||
.setDescription("SI Tienes coche asignado")
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()*/
|
||||
|
||||
|
||||
}else{
|
||||
if (it.response == "UNREGISTERED") {
|
||||
//Log.i("VERDNATURA:","${it.response}")
|
||||
customDialog.setTitle("Control de vehículos")
|
||||
.setDescription("Escanea la matrícula del vehículo a utillizar o elige ir sin vehículo")
|
||||
.setOkButton("Escanear vehículo") {
|
||||
customDialog.dismiss()
|
||||
showScanner("Escanea matrícula del vehículo", "IN")
|
||||
}
|
||||
.setKoButton("Sin vehículo"){
|
||||
customDialog.dismiss()
|
||||
insertControlTimeVehicle("", "")
|
||||
}.show()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package es.verdnatura.presentation.view.feature.smarttag.sacador
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.GetVehicleControlTimeUserCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class AssociateTagsViewModel(context: Context) : BaseViewModel() {
|
||||
|
||||
private val getVehicleControlTimeUserCase: GetVehicleControlTimeUserCase = GetVehicleControlTimeUserCase(context)
|
||||
|
||||
private val _responseinsert by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseinsert: LiveData<ResponseItemVO>
|
||||
get() = _responseinsert
|
||||
|
||||
private val _responsecontrol by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responsecontrol: LiveData<ResponseItemVO>
|
||||
get() = _responsecontrol
|
||||
|
||||
|
||||
// A MODIFICAR TODAS LAS LLAMADAS
|
||||
|
||||
fun vehicleWarehouseTimeControl_insert(usuario:String,password:String,PlateNumber:String,workerFk:String,Direction:String){
|
||||
getVehicleControlTimeUserCase.vehicleWarehouseTimeControl_insert(usuario,password,PlateNumber,workerFk,Direction).enqueue(object : Callback<Boolean>{
|
||||
override fun onFailure(call: Call<Boolean>, t: Throwable) {
|
||||
_responseinsert.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada de registro de vehículo")
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Boolean>, response: Response<Boolean>) {
|
||||
if (response.body() == null || response.body().toString() == "false"){
|
||||
_responseinsert.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada. Escanea matrícula de nuevo")
|
||||
}else{
|
||||
//_response.value = ResponseItemVO(isError = false,response = response.body()!!)
|
||||
_responseinsert.value = ResponseItemVO(isError = false,response = response.body()!!.toString())
|
||||
//Log.i("VERDNATURA:","Respuesta call vehicle_insert ${response.body()}")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun vehicleWarehouseTimeControl_checkRegister(usuario:String,password:String,userFk:String){
|
||||
getVehicleControlTimeUserCase.vehicleWarehouseTimeControl_checkRegister(usuario,password,userFk).enqueue(object : Callback<String>{
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
_responsecontrol.value = ResponseItemVO(isError = true,errorMessage = "Error al comprobar el control vehículo")
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
if (response.body() == null){
|
||||
_responsecontrol.value = ResponseItemVO(isError = true,errorMessage = "Error al comprobar control vehículo")
|
||||
}else{
|
||||
_responsecontrol.value = ResponseItemVO(isError = false,response = response.body()!!)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<!-- drawable/alpha_b_circle_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="M15,10.5C15,11.3 14.3,12 13.5,12C14.3,12 15,12.7 15,13.5V15A2,2 0 0,1 13,17H9V7H13A2,2 0 0,1 15,9V10.5M13,15V13H11V15H13M13,11V9H11V11H13M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z" />
|
||||
</vector>
|
|
@ -0,0 +1,8 @@
|
|||
<!-- drawable/alpha_f_circle_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="M9,7H15V9H11V11H14V13H11V17H9V7M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z" />
|
||||
</vector>
|
|
@ -0,0 +1,8 @@
|
|||
<!-- drawable/car.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="#FFFFFF" android:pathData="M5,11L6.5,6.5H17.5L19,11M17.5,16A1.5,1.5 0 0,1 16,14.5A1.5,1.5 0 0,1 17.5,13A1.5,1.5 0 0,1 19,14.5A1.5,1.5 0 0,1 17.5,16M6.5,16A1.5,1.5 0 0,1 5,14.5A1.5,1.5 0 0,1 6.5,13A1.5,1.5 0 0,1 8,14.5A1.5,1.5 0 0,1 6.5,16M18.92,6C18.72,5.42 18.16,5 17.5,5H6.5C5.84,5 5.28,5.42 5.08,6L3,12V20A1,1 0 0,0 4,21H5A1,1 0 0,0 6,20V19H18V20A1,1 0 0,0 19,21H20A1,1 0 0,0 21,20V12L18.92,6Z" />
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<!-- drawable/car_off.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="#FFFFFF" android:pathData="M20.5,19.85L6.41,5.76L2.41,1.76L1.11,3L4.57,6.46L3,11V19A1,1 0 0,0 4,20H5A1,1 0 0,0 6,19V18H16.11L20.84,22.73L22.11,21.46L20.5,19.85M6.5,15A1.5,1.5 0 0,1 5,13.5A1.5,1.5 0 0,1 6.5,12A1.5,1.5 0 0,1 8,13.5A1.5,1.5 0 0,1 6.5,15M5,10L5.78,7.67L8.11,10H5M17.5,5.5L19,10H13.2L16.12,12.92C16.5,12.17 17.37,11.86 18.12,12.21C18.87,12.57 19.18,13.47 18.83,14.21C18.68,14.5 18.43,14.77 18.12,14.92L21,17.8V11L18.92,5C18.71,4.4 18.14,4 17.5,4H7.2L8.7,5.5H17.5Z" />
|
||||
|
||||
</vector>
|
|
@ -0,0 +1,8 @@
|
|||
<!-- drawable/delete.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="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z" />
|
||||
</vector>
|
|
@ -1,5 +1,8 @@
|
|||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
<vector
|
||||
android:height="24dp"
|
||||
android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FFFFFF" android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
|
||||
</vector>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<vector android:height="24dp" android:tint="#F7931E"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24"
|
||||
android:width="24dp"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M19,3L5,3c-1.1,0 -2,0.9 -2,2v7c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM19,9h-4c0,1.62 -1.38,3 -3,3s-3,-1.38 -3,-3L5,9L5,5h14v4zM15,16h6v3c0,1.1 -0.9,2 -2,2L5,21c-1.1,0 -2,-0.9 -2,-2v-3h6c0,1.66 1.34,3 3,3s3,-1.34 3,-3z"/>
|
||||
</vector>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<!-- drawable/walk.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="#FFFFFF" android:pathData="M14.12,10H19V8.2H15.38L13.38,4.87C13.08,4.37 12.54,4.03 11.92,4.03C11.74,4.03 11.58,4.06 11.42,4.11L6,5.8V11H7.8V7.33L9.91,6.67L6,22H7.8L10.67,13.89L13,17V22H14.8V15.59L12.31,11.05L13.04,8.18M14,3.8C15,3.8 15.8,3 15.8,2C15.8,1 15,0.2 14,0.2C13,0.2 12.2,1 12.2,2C12.2,3 13,3.8 14,3.8Z" />
|
||||
</vector>
|
|
@ -24,7 +24,39 @@
|
|||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:paddingTop="@dimen/toolbar_height">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/filter_nameordateitem"
|
||||
style="@style/InputLineTextSearch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:backgroundTint="@android:color/white"
|
||||
android:hint="@string/Filtro"
|
||||
android:inputType="text"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textColorHint="@android:color/darker_gray" />
|
||||
|
||||
|
||||
|
||||
<ImageView
|
||||
|
||||
android:id="@+id/item_image"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/ic_chevron_right_black_24dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -113,6 +145,7 @@
|
|||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:gravity="center">
|
||||
|
||||
|
||||
<com.airbnb.lottie.LottieAnimationView
|
||||
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoViewModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:paddingTop="@dimen/toolbar_height">
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="@dimen/layout_margin_min"
|
||||
android:layout_marginBottom="@dimen/layout_margin_1"
|
||||
android:paddingLeft="@dimen/layout_margin_min"
|
||||
android:paddingRight="@dimen/layout_margin_min">
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Fecha"
|
||||
android:textSize="@dimen/body2"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Worker"
|
||||
android:textSize="@dimen/body2"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/state"
|
||||
android:textSize="@dimen/body2"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"/>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/historicovehiculo_recyclerview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
tools:listitem="@layout/item_historicovehiculo_row"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
<include
|
||||
android:id="@+id/main_toolbar"
|
||||
layout="@layout/toolbar"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/splash_progress"
|
||||
android:visibility="visible"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/verdnatura_black_8_alpha_6"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:gravity="center">
|
||||
|
||||
<com.airbnb.lottie.LottieAnimationView
|
||||
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/verdnatura_logo_large_height"
|
||||
|
||||
app:lottie_autoPlay="true"
|
||||
app:lottie_loop="true"
|
||||
app:lottie_rawRes="@raw/orange_loading"
|
||||
app:lottie_speed="2" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
|
@ -0,0 +1,70 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoFragment" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/verdnatura_black">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/scan"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/main_toolbar">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/scan_input"
|
||||
style="@style/InputLineTextSearch"
|
||||
android:layout_width="match_parent"
|
||||
android:backgroundTint="@android:color/white"
|
||||
android:hint="@string/Escaneaetiqueta"
|
||||
android:inputType="text"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textColorHint="@android:color/darker_gray" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
<include
|
||||
android:id="@+id/main_toolbar"
|
||||
layout="@layout/toolbar"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/splash_progress"
|
||||
android:visibility="visible"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/verdnatura_black_8_alpha_6"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:gravity="center">
|
||||
|
||||
<com.airbnb.lottie.LottieAnimationView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/verdnatura_logo_large_height"
|
||||
app:lottie_autoPlay="true"
|
||||
app:lottie_loop="true"
|
||||
app:lottie_rawRes="@raw/orange_loading"
|
||||
app:lottie_speed="2" />
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
|
@ -0,0 +1,63 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tool="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="item"
|
||||
type="es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo" />
|
||||
</data>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:id="@+id/item_row_layout"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/verdnatura_black_5"
|
||||
android:paddingLeft="@dimen/layout_margin_min"
|
||||
android:paddingRight="@dimen/layout_margin_min"
|
||||
android:paddingTop="@dimen/pasilleros_margin_main_menu"
|
||||
android:paddingBottom="@dimen/pasilleros_margin_main_menu">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/historico_date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{item.timed}"
|
||||
android:textSize="@dimen/body2"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:gravity="center"
|
||||
android:layout_marginRight="@dimen/layout_margin_min"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{item.workerFk}"
|
||||
android:textSize="@dimen/body2"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{item.direction}"
|
||||
android:textSize="@dimen/body2"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"/>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/verdnatura_black_9"/>
|
||||
</LinearLayout>
|
||||
</layout>
|
|
@ -46,7 +46,7 @@
|
|||
<string name="Transferir">Transferir</string>
|
||||
<string name="Sinsector">Sin sector</string>
|
||||
<string name="Nodisponibleenestaversión">No disponible en esta versión</string>
|
||||
<string name="Cerrar">Cerrar</string>
|
||||
<string name="Close">Cerrar</string>
|
||||
<string name="Noexistessectores">No existes sectores.</string>
|
||||
<string name="Seleccionaunsector">Selecciona un sector</string>
|
||||
<string name="Pasilleros">Pasilleros</string>
|
||||
|
@ -109,7 +109,7 @@
|
|||
<string name="total">Total</string>
|
||||
<string name="mensajeseleccionencajado">Selecciona zona encajado :</string>
|
||||
<string name="buscararticulo">Buscar artículo</string>
|
||||
<string name="itemdiary">Balance del artículo</string>
|
||||
<string name="itemdiary">Balance</string>
|
||||
<string name="getcollection">Obtener colección</string>
|
||||
<string name="getticketpre">Obtener ticket previa</string>
|
||||
<string name="locator">Ubicador</string>
|
||||
|
@ -120,4 +120,12 @@
|
|||
<string name="shelvingParking_get">Parking estanterías</string>
|
||||
<string name="test">Buscar item search</string>
|
||||
<string name="verticket">Ver ticket</string>
|
||||
<string name="mensajeadvertenciaIMEI">Debes aceptar el permiso de llamadas telefónicas para utilizar el dispositivo</string>
|
||||
<string name="Error">Error</string>
|
||||
<string name="mensajenoimei">No se ha podido leer IMEI</string>
|
||||
<string name="vehiclecontrol">Control vehículos</string>
|
||||
<string name="Worker">Trabajador</string>
|
||||
<string name="state">Estado</string>
|
||||
<string name="vehiclediary">Histórico vehículo</string>
|
||||
<string name="SmarttagAssociate">Asociar SmartTag Sacador</string>
|
||||
</resources>
|
|
@ -20,6 +20,7 @@
|
|||
<color name="verdnatura_sunflower_yellow">#ffd400</color>
|
||||
<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_light_teal">#b8ecd6</color>
|
||||
<color name="verdnatura_white">#ffffff</color>
|
||||
<color name="verdnatura_black_8_alpha_6">#991A1A1A</color>
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
<string name="Transferir">To transfer</string>
|
||||
<string name="Sinsector">Without sector</string>
|
||||
<string name="Nodisponibleenestaversión">Not available in this version</string>
|
||||
<string name="Cerrar">Close</string>
|
||||
<string name="Close">Close</string>
|
||||
<string name="Noexistessectores">There are no sectors.</string>
|
||||
<string name="Seleccionaunsector">Select a sector</string>
|
||||
<string name="Pasilleros">Corridors</string>
|
||||
|
@ -119,5 +119,14 @@
|
|||
<string name="shelvingParking_get">Shelving parking</string>
|
||||
<string name="test">Search item test</string>
|
||||
<string name="verticket">Show ticket</string>
|
||||
<string name="mensajeadvertenciaIMEI">You must accept the phone call permission to use the device</string>
|
||||
<string name="Error">Error</string>
|
||||
<string name="mensajenoimei">Unable to read IMEI</string>
|
||||
<string name="vehiclecontrol">" Vehicles control"</string>
|
||||
<string name="Worker">Worker</string>
|
||||
<string name="state">State</string>
|
||||
<string name="vehiclediary">Historic vehicle</string>
|
||||
<string name="SmarttagAssociate">Associate SmartTag Punch</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -13,7 +13,6 @@ buildscript {
|
|||
piccasso = '2.71828'
|
||||
coil = '0.9.5'
|
||||
}
|
||||
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
|
|
Loading…
Reference in New Issue