feat: refs #6861 reservas
This commit is contained in:
parent
e6fc241e92
commit
f94cee238e
|
@ -297,7 +297,6 @@ class CollectionFragmentPicker(
|
|||
SACADOR -> {
|
||||
//jose antonio
|
||||
myPosition = myGroupList.indexOfFirst { it.saleGroupFk == saleGroupScanned }
|
||||
println("previa $saleGroupScanned posicion $myPosition")
|
||||
viewModel.saleTrackingAddPreparedSaleGroup(
|
||||
saleGroupScanned.toInt()
|
||||
)
|
||||
|
|
|
@ -161,7 +161,7 @@ class CollectionFragmentPreChecker(
|
|||
collection.collectionFk,
|
||||
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
|
||||
print = "0",
|
||||
type
|
||||
"PREVIOUS_CONTROL"
|
||||
)
|
||||
}
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -383,7 +383,7 @@ class CollectionFragmentPreChecker(
|
|||
viewModel.getSales(
|
||||
binding.scanInput.text.toString().toInt(),
|
||||
print = "0",
|
||||
source = type
|
||||
source = "PREVIOUS_CONTROL"
|
||||
)
|
||||
|
||||
//findSale(binding.scanInput.text.toString())
|
||||
|
@ -419,7 +419,7 @@ class CollectionFragmentPreChecker(
|
|||
viewModel.getSales(
|
||||
binding.scanInput.toLong(),
|
||||
print = "0",
|
||||
source = type
|
||||
source = "PREVIOUS_CONTROL"
|
||||
)
|
||||
} catch (ex: Exception) {
|
||||
ma.messageWithSound(
|
||||
|
@ -1743,7 +1743,7 @@ class CollectionFragmentPreChecker(
|
|||
collection.collectionFk,
|
||||
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
|
||||
print = "0",
|
||||
type
|
||||
type = "PREVIOUS_CONTROL"
|
||||
)
|
||||
|
||||
} else {
|
||||
|
|
|
@ -188,6 +188,10 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
get() = _responseIncQuantity
|
||||
val loadIncQuantity: LiveData<Event<ResponseItemVO>> = _responseIncQuantity.map { Event(it) }
|
||||
|
||||
private val _responseStateId by lazy { MutableLiveData<Number>() }
|
||||
val responseStateId: LiveData<Number> = _responseStateId
|
||||
val loadResponseStateId: LiveData<Event<Number>> = _responseStateId.map { Event(it) }
|
||||
|
||||
private val _mistakeList by lazy { MutableLiveData<MistakeTypeListVO>() }
|
||||
val mistakeList: LiveData<MistakeTypeListVO>
|
||||
get() = _mistakeList
|
||||
|
@ -211,6 +215,16 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
val responseSaleAddPrevOK: LiveData<ResponseItemVO>
|
||||
get() = _responseSaleAddPrevOK
|
||||
|
||||
private val _responseSaleReserveAddPrevOK by lazy { MutableLiveData<Boolean>() }
|
||||
val responseSaleReserveAddPrevOK: LiveData<Boolean> = _responseSaleReserveAddPrevOK
|
||||
val loadResponseReserveAddPrevOK: LiveData<Event<Boolean>> =
|
||||
_responseSaleReserveAddPrevOK.map { Event(it) }
|
||||
|
||||
private val _setStateResponse by lazy { MutableLiveData<Boolean>() }
|
||||
val setStateResponse: LiveData<Boolean> = _setStateResponse
|
||||
val loadSetStateResponse: LiveData<Event<Boolean>> =
|
||||
_setStateResponse.map { Event(it) }
|
||||
|
||||
fun getSales(
|
||||
collectionFk: Number, print: String, source: String
|
||||
|
||||
|
@ -491,6 +505,35 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun getStateId(stateCode: String) {
|
||||
|
||||
salix.getStateId(
|
||||
filter = """{"where":{"code":"$stateCode"}, "fields":["id"]}""".trimMargin()
|
||||
).enqueue(object : SalixCallback<JsonObject>(context) {
|
||||
override fun onSuccess(response: Response<JsonObject>) {
|
||||
_responseStateId.value =
|
||||
response.body()?.get("id").toString().toInt()
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun setStateSaleGroup(
|
||||
saleGroups: List<Number>, stateCode: Int
|
||||
) {
|
||||
salix.collectionAddWithReservation(
|
||||
params = arrayListOf(
|
||||
saleGroups, stateCode
|
||||
)
|
||||
).enqueue(object : SalixCallback<Any>(context) {
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
// _responseCollectionAddItem.value = true
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun itemPlacementSupplyAiming(
|
||||
shelvingFk: String, quantity: Int, itemFk: Int
|
||||
) {
|
||||
|
@ -626,7 +669,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
|
||||
fun itemShelvingSaleSetSaleGroup(
|
||||
saleGroupFk: Int
|
||||
saleGroupFk: Int,
|
||||
) {
|
||||
salix.itemShelvingSaleSetSaleGroup(
|
||||
arrayListOf(
|
||||
|
@ -642,6 +685,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
|
||||
override fun onSuccess(response: Response<Unit>) {
|
||||
_responseItemShelvingSaleGroup.value = ResponseItemVO(isError = false)
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -767,6 +811,16 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun saleGroupUpdateState(saleGroup: Number, codeState: Number) {
|
||||
salix.saleGroupUpdate(
|
||||
id = saleGroup, hashMapOf("stateFk" to codeState)
|
||||
).enqueue(object : SalixCallback<Any>(context) {
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_setStateResponse.value = true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun collectionIncreaseQuantitySalix(
|
||||
saleFk: Int, quantity: String
|
||||
) {
|
||||
|
@ -797,7 +851,9 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
|
||||
salix.saleMistakeAdd(
|
||||
SaleMistakeSalix(
|
||||
userFk = (context as MobileApplication).userId!!, saleFk = saleFk, typeFk = typeFk
|
||||
userFk = (context as MobileApplication).userId!!,
|
||||
saleFk = saleFk,
|
||||
typeFk = typeFk
|
||||
)
|
||||
).enqueue(object : SalixCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
|
@ -988,22 +1044,11 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
) {
|
||||
salix.saleTrackingSectorCollectionAddPrevOK(arrayListOf(sectorCollectionFk))
|
||||
.enqueue(object : SalixCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseSaleAddPrevOK.value = ResponseItemVO(
|
||||
isError = true, errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this), t.message!!
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_responseSaleAddPrevOK.value = ResponseItemVO(
|
||||
isError = false, errorMessage = "" + getMessageFromAllResponse(
|
||||
nameofFunction(this), response.message()
|
||||
)
|
||||
)
|
||||
|
||||
_responseSaleReserveAddPrevOK.value = true
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,8 @@ data class Sale(
|
|||
var isPicked: Int = 0,
|
||||
var accumulatedQuantity: Int = 0,
|
||||
var totalItemShelving: Int = 0,
|
||||
var currentItemShelving: Int = 0
|
||||
var currentItemShelving: Int = 0,
|
||||
var stateCode: String? = ""
|
||||
|
||||
)
|
||||
|
||||
|
@ -112,8 +113,10 @@ class TicketSalix(
|
|||
var agencyName: String = "",
|
||||
var salesPersonFk: String = "",
|
||||
var sales: List<SaleVO> = listOf(),
|
||||
@SerializedName(value = "observations", alternate = ["observaciones"])
|
||||
var observations: String = "",
|
||||
@SerializedName(
|
||||
value = "observations",
|
||||
alternate = ["observaciones"]
|
||||
) var observations: String = "",
|
||||
|
||||
)
|
||||
|
||||
|
@ -177,8 +180,10 @@ class TicketVO(
|
|||
var agencyName: String = "",
|
||||
var salesPersonFk: String = "",
|
||||
var sales: List<SaleVO> = listOf(),
|
||||
@SerializedName(value = "observations", alternate = ["observaciones"])
|
||||
var observations: String = "",
|
||||
@SerializedName(
|
||||
value = "observations",
|
||||
alternate = ["observaciones"]
|
||||
) var observations: String = "",
|
||||
var isAdvanced: Int? = 0,
|
||||
var parkingCode: String? = ""
|
||||
|
||||
|
@ -279,8 +284,7 @@ class PlacementSupplyListVO(
|
|||
)
|
||||
|
||||
class MistakeTypeVO(
|
||||
var id: Int,
|
||||
var description: String
|
||||
var id: Int, var description: String
|
||||
)
|
||||
|
||||
class MistakeTypeListVO(
|
||||
|
@ -292,16 +296,11 @@ class TicketStateList(
|
|||
)
|
||||
|
||||
data class TicketStateSalix(
|
||||
val ticketFk: Int,
|
||||
val alertLevel: Int,
|
||||
val code: String,
|
||||
val stateFk: Int,
|
||||
val userFk: Int
|
||||
val ticketFk: Int, val alertLevel: Int, val code: String, val stateFk: Int, val userFk: Int
|
||||
) {
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
var created: String = ""
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
get() {
|
||||
@RequiresApi(Build.VERSION_CODES.O) get() {
|
||||
return field.isoToString()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue