feat reservas refs #6810

This commit is contained in:
Sergio De la torre 2024-06-27 07:02:46 +02:00
parent eb787e04cc
commit f48aea9414
5 changed files with 39 additions and 19 deletions

View File

@ -24,6 +24,7 @@ import es.verdnatura.domain.ConstAndValues.NUMBEROFWAGONS
import es.verdnatura.domain.ConstAndValues.PRINTERFK import es.verdnatura.domain.ConstAndValues.PRINTERFK
import es.verdnatura.domain.ConstAndValues.PRINTERFKDEFAULT import es.verdnatura.domain.ConstAndValues.PRINTERFKDEFAULT
import es.verdnatura.domain.ConstAndValues.PRINTERNAME import es.verdnatura.domain.ConstAndValues.PRINTERNAME
import es.verdnatura.domain.ConstAndValues.RESERVATIONMODE
import es.verdnatura.domain.ConstAndValues.SECTORDESCRIP import es.verdnatura.domain.ConstAndValues.SECTORDESCRIP
import es.verdnatura.domain.ConstAndValues.SECTORFK import es.verdnatura.domain.ConstAndValues.SECTORFK
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
@ -97,6 +98,9 @@ class DataStoreLocal(var mobileApplication: MobileApplication) {
editDataStoreKey( editDataStoreKey(
NUMBEROFWAGONS, operator.numberOfWagons NUMBEROFWAGONS, operator.numberOfWagons
) )
editDataStoreKey(
RESERVATIONMODE, operator.isOnReservationMode
)
} }

View File

@ -64,6 +64,7 @@ object ConstAndValues {
const val INVENTORYPARKINGTO = "INVENTORYPARKINGTO" const val INVENTORYPARKINGTO = "INVENTORYPARKINGTO"
const val INVENTORYPARKINGFROM = "INVENTORYPARKINGFROM" const val INVENTORYPARKINGFROM = "INVENTORYPARKINGFROM"
const val LIMITRECORDSSHELVINGLOG = 25 const val LIMITRECORDSSHELVINGLOG = 25
const val RESERVATIONMODE = "operatorReservationMode"
} }

View File

@ -300,7 +300,7 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) {
workerId: Int workerId: Int
) { ) {
val filter = val filter =
"""{"fields":["itemPackingTypeFk","numberOfWagons","sectorFk","trainFk","labelerFk"],"include":[{"relation":"sector","scope":{"fields":["description","warehouseFk"]}},{"relation":"printer","scope":{"fields":["name"]}},{"relation":"train","scope":{"fields":["name"]}}]}""" """{"fields":["itemPackingTypeFk","numberOfWagons","sectorFk","trainFk","labelerFk","isOnReservationMode"],"include":[{"relation":"sector","scope":{"fields":["description","warehouseFk"]}},{"relation":"printer","scope":{"fields":["name"]}},{"relation":"train","scope":{"fields":["name"]}}]}"""
salix.operator_getData(id = workerId, filter) salix.operator_getData(id = workerId, filter)
.enqueue(object : SalixCallback<OperatorSalix>(context) { .enqueue(object : SalixCallback<OperatorSalix>(context) {
override fun onError(t: Throwable) { override fun onError(t: Throwable) {

View File

@ -9,6 +9,7 @@ class LoginSalixVO(
var isError: Boolean = false, var isError: Boolean = false,
var errorMessage: String = "" var errorMessage: String = ""
) )
data class LoginApp( data class LoginApp(
val user: String, val user: String,
val password: String, val password: String,
@ -18,6 +19,7 @@ data class LoginApp(
val nameApp: String val nameApp: String
) )
data class LoginAppData( data class LoginAppData(
val id: Int, val id: Int,
val token: String, val token: String,
@ -74,15 +76,17 @@ class OperatorSalix(
val numberOfWagons: Int = 0, val numberOfWagons: Int = 0,
var itemPackingTypeFk: String? = null, var itemPackingTypeFk: String? = null,
val isError: Boolean = false, val isError: Boolean = false,
var errorMessage: String = "" var errorMessage: String = "",
val isOnReservationMode: Boolean = false
) )
data class Sector( data class Sector(
val id: Int=0, val id: Int = 0,
val description: String="", val description: String = "",
val warehouseFk: Int=0, val warehouseFk: Int = 0,
val backupPrinterFk: Int? val backupPrinterFk: Int?
) )
data class Printer(val id: Int, val name: String) data class Printer(val id: Int, val name: String)
data class Train(val id: Int, val name: String) data class Train(val id: Int, val name: String)
@ -129,4 +133,9 @@ class workerId(
val Id: Int? = null, val Id: Int? = null,
var isError: Boolean = false, var isError: Boolean = false,
var errorMessage: String = "" var errorMessage: String = ""
)
data class NameWorker(
val firstName : String,
val lastName :String
) )

View File

@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import es.verdnatura.MobileApplication import es.verdnatura.MobileApplication
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.domain.ConstAndValues.RESERVATIONMODE
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
@ -14,6 +15,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
val pasillerositem: List<PasillerosItemVO> val pasillerositem: List<PasillerosItemVO>
get() = _pasillerositem get() = _pasillerositem
val userId = (contextApp as MobileApplication).userId val userId = (contextApp as MobileApplication).userId
val isOnReservationMode = (contextApp as MobileApplication).dataStoreApp.readDataStoreKey<Boolean>(RESERVATIONMODE)
fun inititializeDefaultData() { fun inititializeDefaultData() {
@ -537,31 +539,35 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
fun inititializeDefaultPrevia() { fun inititializeDefaultPrevia() {
_pasillerositem.add( if (isOnReservationMode || userId == 19591){
PasillerosItemVO( // if (userId == 19591 || userId == 18404 || userId == 9) {
7, _pasillerositem.add(
R.drawable.ic_previous_presacador, PasillerosItemVO(
contextApp.getString(R.string.titlePrePicker), 7,
R.string.titlePrePicker, R.drawable.ic_previous_presacador,
contextApp.getString( contextApp.getString(R.string.titlePrePickerTest),
R.string.titlePickerDescrip R.string.titlePrePickerTest,
contextApp.getString(
R.string.titlePickerDescrip
)
)
) )
) // }
) }else{
if (userId == 19591 || userId == 18404) {
_pasillerositem.add( _pasillerositem.add(
PasillerosItemVO( PasillerosItemVO(
7, 7,
R.drawable.ic_previous_presacador, R.drawable.ic_previous_presacador,
contextApp.getString(R.string.titlePrePickerTest), contextApp.getString(R.string.titlePrePicker),
R.string.titlePrePickerTest, R.string.titlePrePicker,
contextApp.getString( contextApp.getString(
R.string.titlePickerDescrip R.string.titlePickerDescrip
) )
) )
) )
} }
_pasillerositem.add( _pasillerositem.add(
PasillerosItemVO( PasillerosItemVO(
7, 7,