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

View File

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

View File

@ -300,7 +300,7 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) {
workerId: Int
) {
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)
.enqueue(object : SalixCallback<OperatorSalix>(context) {
override fun onError(t: Throwable) {

View File

@ -9,6 +9,7 @@ class LoginSalixVO(
var isError: Boolean = false,
var errorMessage: String = ""
)
data class LoginApp(
val user: String,
val password: String,
@ -18,6 +19,7 @@ data class LoginApp(
val nameApp: String
)
data class LoginAppData(
val id: Int,
val token: String,
@ -74,15 +76,17 @@ class OperatorSalix(
val numberOfWagons: Int = 0,
var itemPackingTypeFk: String? = null,
val isError: Boolean = false,
var errorMessage: String = ""
var errorMessage: String = "",
val isOnReservationMode: Boolean = false
)
data class Sector(
val id: Int=0,
val description: String="",
val warehouseFk: Int=0,
val id: Int = 0,
val description: String = "",
val warehouseFk: Int = 0,
val backupPrinterFk: Int?
)
data class Printer(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,
var isError: Boolean = false,
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 es.verdnatura.MobileApplication
import es.verdnatura.R
import es.verdnatura.domain.ConstAndValues.RESERVATIONMODE
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
@ -14,6 +15,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
val pasillerositem: List<PasillerosItemVO>
get() = _pasillerositem
val userId = (contextApp as MobileApplication).userId
val isOnReservationMode = (contextApp as MobileApplication).dataStoreApp.readDataStoreKey<Boolean>(RESERVATIONMODE)
fun inititializeDefaultData() {
@ -537,31 +539,35 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
fun inititializeDefaultPrevia() {
_pasillerositem.add(
PasillerosItemVO(
7,
R.drawable.ic_previous_presacador,
contextApp.getString(R.string.titlePrePicker),
R.string.titlePrePicker,
contextApp.getString(
R.string.titlePickerDescrip
if (isOnReservationMode || userId == 19591){
// if (userId == 19591 || userId == 18404 || userId == 9) {
_pasillerositem.add(
PasillerosItemVO(
7,
R.drawable.ic_previous_presacador,
contextApp.getString(R.string.titlePrePickerTest),
R.string.titlePrePickerTest,
contextApp.getString(
R.string.titlePickerDescrip
)
)
)
)
)
if (userId == 19591 || userId == 18404) {
// }
}else{
_pasillerositem.add(
PasillerosItemVO(
7,
R.drawable.ic_previous_presacador,
contextApp.getString(R.string.titlePrePickerTest),
R.string.titlePrePickerTest,
contextApp.getString(R.string.titlePrePicker),
R.string.titlePrePicker,
contextApp.getString(
R.string.titlePickerDescrip
)
)
)
}
_pasillerositem.add(
PasillerosItemVO(
7,