refs #6458 ticketCheckingOrChecked
This commit is contained in:
parent
0583403b20
commit
9589279fa2
|
@ -2,6 +2,7 @@ package es.verdnatura.domain
|
||||||
|
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import es.verdnatura.presentation.common.ItemBarCodeSalix
|
import es.verdnatura.presentation.common.ItemBarCodeSalix
|
||||||
|
import es.verdnatura.presentation.common.TicketState
|
||||||
import es.verdnatura.presentation.common.packingSiteSalix
|
import es.verdnatura.presentation.common.packingSiteSalix
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.Printers
|
import es.verdnatura.presentation.view.feature.ajustes.model.Printers
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||||
|
@ -445,7 +446,13 @@ interface SalixService {
|
||||||
fun ticketIsOutClosureZone(
|
fun ticketIsOutClosureZone(
|
||||||
@Query("params") params: Any,
|
@Query("params") params: Any,
|
||||||
@Query("schema") schema: String = "vn"
|
@Query("schema") schema: String = "vn"
|
||||||
): Call<Any>
|
): Call<Any?>
|
||||||
|
|
||||||
|
@GET("TicketStates")
|
||||||
|
fun ticketState(
|
||||||
|
@Query("filter") filter: Any,
|
||||||
|
@Query("schema") schema: String = "vn"
|
||||||
|
): Call<List<TicketState>>
|
||||||
|
|
||||||
@POST("Applications/workerMachinery_isRegistered/execute-func")
|
@POST("Applications/workerMachinery_isRegistered/execute-func")
|
||||||
fun workerMachineryIsRegistered(
|
fun workerMachineryIsRegistered(
|
||||||
|
|
|
@ -4,6 +4,7 @@ class ItemBarCodeSalix(
|
||||||
var itemFk: Int,
|
var itemFk: Int,
|
||||||
var code: String
|
var code: String
|
||||||
)
|
)
|
||||||
|
|
||||||
data class SaleTrackingReplaceSalix(
|
data class SaleTrackingReplaceSalix(
|
||||||
var saleFk: Int,
|
var saleFk: Int,
|
||||||
var originalQuantity: Int,
|
var originalQuantity: Int,
|
||||||
|
@ -12,6 +13,7 @@ data class SaleTrackingReplaceSalix(
|
||||||
var buyFk: Long,
|
var buyFk: Long,
|
||||||
var isScanned: Boolean,
|
var isScanned: Boolean,
|
||||||
)
|
)
|
||||||
|
|
||||||
data class SaleTrackingSalix(
|
data class SaleTrackingSalix(
|
||||||
var saleFk: Int,
|
var saleFk: Int,
|
||||||
var originalQuantity: Int,
|
var originalQuantity: Int,
|
||||||
|
@ -62,3 +64,14 @@ data class CollectionItemSalix(
|
||||||
var warehouseFk: Int
|
var warehouseFk: Int
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
data class TicketState(
|
||||||
|
val ticketFk: Int = 0,
|
||||||
|
val code: String = "",
|
||||||
|
val user: UserSalix = UserSalix()
|
||||||
|
) {
|
||||||
|
data class UserSalix(
|
||||||
|
val id: Int = 0,
|
||||||
|
val username: String = ""
|
||||||
|
)
|
||||||
|
}
|
|
@ -140,6 +140,8 @@ class CollectionFragment(
|
||||||
collection.collectionFk
|
collection.collectionFk
|
||||||
|
|
||||||
)
|
)
|
||||||
|
//tarea 6458
|
||||||
|
//viewModel.ticketState(collection.collectionFk)
|
||||||
workerFkFromTicket = collection.tickets.get(0).sales.get(0).workerFk
|
workerFkFromTicket = collection.tickets.get(0).sales.get(0).workerFk
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,22 +646,27 @@ class CollectionFragment(
|
||||||
goBack2 = false
|
goBack2 = false
|
||||||
|
|
||||||
})
|
})
|
||||||
|
responseTicketState.observe(viewLifecycleOwner) {
|
||||||
|
binding.splashProgress.visibility = GONE
|
||||||
|
if (!goBack) {
|
||||||
|
if ((it.code == "ON_CHECKING" || it.code == "CHECKED") && it.user.id != mobileApplication.userId) {
|
||||||
|
var customDialogWarningChecking = CustomDialog(requireContext())
|
||||||
|
customDialogWarningChecking.setTitle(getString(R.string.info))
|
||||||
|
customDialogWarningChecking.setDescription(
|
||||||
|
if (it.code == "ON_CHECKING") {
|
||||||
|
getString(R.string.checkingByUser, it.user.username)
|
||||||
|
} else {
|
||||||
|
getString(R.string.checkedByUser, it.user.username)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.setOkButton(getString(R.string.aware)) {
|
||||||
|
customDialogWarningChecking.dismiss()
|
||||||
|
}.show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* responseMissingTrash.observe(viewLifecycleOwner, Observer {
|
}
|
||||||
|
|
||||||
if (!goBack) {
|
|
||||||
if (it.isError) {
|
|
||||||
ma.messageWithSound(it.errorMessage, isError = true, true)
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
missingTrashSuccesful()
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
})*/
|
|
||||||
//Tarea 4280
|
|
||||||
responseTicketClosure.observe(viewLifecycleOwner, Observer {
|
responseTicketClosure.observe(viewLifecycleOwner, Observer {
|
||||||
binding.splashProgress.visibility = GONE
|
binding.splashProgress.visibility = GONE
|
||||||
if (!goBack) {
|
if (!goBack) {
|
||||||
|
@ -1255,11 +1262,12 @@ class CollectionFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type.equals(CONTROLADOR)) {
|
if (type.equals(CONTROLADOR)) {
|
||||||
//Tarea #4280 cambiar a ticket_isOutClosureZone
|
|
||||||
viewModel.ticketIsOutClosureZone(
|
viewModel.ticketIsOutClosureZone(
|
||||||
txtscan.toInt()
|
txtscan.toInt()
|
||||||
|
|
||||||
)
|
)
|
||||||
|
//Tarea 6458
|
||||||
|
//viewModel.ticketState(txtscan.toInt())
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2147,8 +2155,6 @@ class CollectionFragment(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//FALTAS / BASURA / SPLIT
|
//FALTAS / BASURA / SPLIT
|
||||||
|
|
||||||
private fun showQuantityDialog(position: Int) {
|
private fun showQuantityDialog(position: Int) {
|
||||||
|
|
|
@ -13,6 +13,7 @@ import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.common.Event
|
import es.verdnatura.presentation.common.Event
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
|
import es.verdnatura.presentation.common.TicketState
|
||||||
import es.verdnatura.presentation.view.feature.collection.ItemVO
|
import es.verdnatura.presentation.view.feature.collection.ItemVO
|
||||||
import es.verdnatura.presentation.view.feature.collection.SalesModifiedList
|
import es.verdnatura.presentation.view.feature.collection.SalesModifiedList
|
||||||
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
||||||
|
@ -110,9 +111,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
val responseItemShelvingUpdate: LiveData<ResponseItemVO>
|
val responseItemShelvingUpdate: LiveData<ResponseItemVO>
|
||||||
get() = _responseItemShelvingUpdate
|
get() = _responseItemShelvingUpdate
|
||||||
|
|
||||||
/* private val _responseSaleMove by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _responseTicketState by lazy { MutableLiveData<TicketState>() }
|
||||||
val responseSaleMove: LiveData<ResponseItemVO>
|
val responseTicketState: LiveData<TicketState> = _responseTicketState
|
||||||
get() = _responseSaleMove*/
|
|
||||||
|
|
||||||
private val _responseUsedShelves by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _responseUsedShelves by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
val responseUsedShelves: LiveData<ResponseItemVO>
|
val responseUsedShelves: LiveData<ResponseItemVO>
|
||||||
|
@ -922,11 +922,11 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
salix.ticketIsOutClosureZone(
|
salix.ticketIsOutClosureZone(
|
||||||
arrayListOf(ticketFk)
|
arrayListOf(ticketFk)
|
||||||
).enqueue(object :
|
).enqueue(object :
|
||||||
SalixCallback<Any>(context) {
|
SalixCallback<Any?>(context) {
|
||||||
override fun onSuccess(response: Response<Any>) {
|
override fun onSuccess(response: Response<Any?>) {
|
||||||
_responseTicketClosure.value = ResponseItemVO(
|
_responseTicketClosure.value = ResponseItemVO(
|
||||||
isError = false,
|
isError = false,
|
||||||
response = response.body()!!.toString(),
|
response = response.body()?.toString() ?: "false",
|
||||||
errorMessage = ""
|
errorMessage = ""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -940,28 +940,22 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ticket_isOutClosureZoneNew(
|
fun ticketState(
|
||||||
ticketFk: Int
|
ticketFk: Int
|
||||||
) {
|
) {
|
||||||
salix.ticketIsOutClosureZone(
|
salix.ticketState(
|
||||||
params = arrayListOf(ticketFk)
|
"""{"where": {"ticketFk": "$ticketFk"},"include":[{"relation":"user","scope":{"fields":["username"]}}]}"""
|
||||||
|
|
||||||
).enqueue(object :
|
).enqueue(object :
|
||||||
SalixCallback<Any>(context) {
|
SalixCallback<List<TicketState>>(context) {
|
||||||
override fun onError(t: Throwable) {
|
override fun onSuccess(response: Response<List<TicketState>>) {
|
||||||
_responseTicketClosure.value = ResponseItemVO(
|
_responseTicketState.value = if (response.body()!!.isEmpty()) {
|
||||||
isError = true,
|
TicketState()
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
} else {
|
||||||
)
|
response.body()!![0]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSuccess(response: Response<Any>) {
|
|
||||||
_responseTicketClosure.value = ResponseItemVO(
|
|
||||||
isError = false,
|
|
||||||
response = response.body()!!.toString(),
|
|
||||||
errorMessage = ""
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,10 @@ import androidx.lifecycle.Observer
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentGeneralBlackBinding
|
import es.verdnatura.databinding.FragmentGeneralBlackBinding
|
||||||
import es.verdnatura.domain.ConstAndValues
|
import es.verdnatura.domain.ConstAndValues
|
||||||
import es.verdnatura.domain.ConstAndValues.SECTORFK
|
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.OnCollectionSelectedListener
|
import es.verdnatura.presentation.common.OnCollectionSelectedListener
|
||||||
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
|
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionViewModel
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||||
|
|
||||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||||
|
@ -19,6 +20,7 @@ class ControladorFragment :
|
||||||
|
|
||||||
private var goBack: Boolean = false
|
private var goBack: Boolean = false
|
||||||
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
|
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
|
||||||
|
private var collectionViewModel: CollectionViewModel? = null
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_general_black
|
override fun getLayoutId(): Int = R.layout.fragment_general_black
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -34,7 +36,6 @@ class ControladorFragment :
|
||||||
|
|
||||||
binding.splashProgress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
binding.scanInput.visibility = VISIBLE
|
binding.scanInput.visibility = VISIBLE
|
||||||
|
|
||||||
binding.mainToolbar.toolbarTitle.text = getString(R.string.controlticket)
|
binding.mainToolbar.toolbarTitle.text = getString(R.string.controlticket)
|
||||||
setEvents()
|
setEvents()
|
||||||
ma.hideBottomNavigation(VISIBLE)
|
ma.hideBottomNavigation(VISIBLE)
|
||||||
|
@ -47,6 +48,7 @@ class ControladorFragment :
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setEvents() {
|
private fun setEvents() {
|
||||||
|
|
||||||
binding.mainToolbar.backButton.setOnClickListener {
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
requireActivity().onBackPressed()
|
requireActivity().onBackPressed()
|
||||||
}
|
}
|
||||||
|
@ -57,21 +59,51 @@ class ControladorFragment :
|
||||||
goBack = false
|
goBack = false
|
||||||
if (!binding.scanInput.text.isNullOrEmpty()) {
|
if (!binding.scanInput.text.isNullOrEmpty()) {
|
||||||
binding.splashProgress.visibility = VISIBLE
|
binding.splashProgress.visibility = VISIBLE
|
||||||
|
|
||||||
//sergio: para ver si ha marcado dos veces el mismo ticket. El laser falla
|
|
||||||
binding.scanInput.setText(textScanned_filterDouble(binding.scanInput.text!!.toString()))
|
binding.scanInput.setText(textScanned_filterDouble(binding.scanInput.text!!.toString()))
|
||||||
|
//Tarea 6458
|
||||||
viewModel.collectionTicketGet(
|
collectionViewModel = CollectionViewModel(mobileApplication)
|
||||||
sectorFk = mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
|
collectionViewModel!!.ticketState(binding.scanInput.text.toString().toInt())
|
||||||
collectionFk = binding.scanInput.text.toString().toInt(),
|
collectionViewModel!!.responseTicketState.observe(viewLifecycleOwner, Observer { it ->
|
||||||
print = "0",
|
binding.splashProgress.visibility = View.GONE
|
||||||
type = ConstAndValues.CONTROLADOR
|
if ((it.code == "ON_CHECKING" || it.code == "CHECKED") && it.user.id != mobileApplication.userId) {
|
||||||
)
|
var customDialogWarning = CustomDialog(requireContext())
|
||||||
|
customDialogWarning.setTitle(getString(R.string.info))
|
||||||
|
customDialogWarning.setDescription(
|
||||||
|
if (it.code == "ON_CHECKING") {
|
||||||
|
getString(R.string.checkingByUser, it.user.username)
|
||||||
|
} else {
|
||||||
|
getString(R.string.checkedByUser, it.user.username)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.setOkButton(getString(R.string.aware)) {
|
||||||
|
customDialogWarning.dismiss()
|
||||||
|
binding.splashProgress.visibility= VISIBLE
|
||||||
|
viewModel.collectionTicketGet(
|
||||||
|
sectorFk = mobileApplication.dataStoreApp.readDataStoreKey(
|
||||||
|
ConstAndValues.SECTORFK
|
||||||
|
),
|
||||||
|
collectionFk = binding.scanInput.text.toString().toInt(),
|
||||||
|
print = "0",
|
||||||
|
type = ConstAndValues.CONTROLADOR
|
||||||
|
)
|
||||||
|
}.show()
|
||||||
|
customDialogWarning.currentFocus
|
||||||
|
} else {
|
||||||
|
viewModel.collectionTicketGet(
|
||||||
|
sectorFk = mobileApplication.dataStoreApp.readDataStoreKey(
|
||||||
|
ConstAndValues.SECTORFK
|
||||||
|
),
|
||||||
|
collectionFk = binding.scanInput.text.toString().toInt(),
|
||||||
|
print = "0",
|
||||||
|
type = ConstAndValues.CONTROLADOR
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
binding.scanInput.setText("")
|
|
||||||
ma.hideKeyboard(binding.scanInput)
|
ma.hideKeyboard(binding.scanInput)
|
||||||
return@setOnEditorActionListener true
|
return@setOnEditorActionListener false
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
@ -81,6 +113,7 @@ class ControladorFragment :
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
collectionTicketList.observe(viewLifecycleOwner, Observer {
|
collectionTicketList.observe(viewLifecycleOwner, Observer {
|
||||||
binding.splashProgress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
|
binding.scanInput.setText("")
|
||||||
if (it.isError) {
|
if (it.isError) {
|
||||||
ma.messageWithSound(it.errorMessage, isError = true, isPlayed = false)
|
ma.messageWithSound(it.errorMessage, isError = true, isPlayed = false)
|
||||||
} else {
|
} else {
|
||||||
|
@ -92,6 +125,7 @@ class ControladorFragment :
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun navigateToCollectionList(collection: CollectionVO) {
|
private fun navigateToCollectionList(collection: CollectionVO) {
|
||||||
|
|
|
@ -693,6 +693,8 @@
|
||||||
<string name="add">Añadir...</string>
|
<string name="add">Añadir...</string>
|
||||||
<string name="surname">Apellidos</string>
|
<string name="surname">Apellidos</string>
|
||||||
<string name="confirmReserv">Confirmada reserva</string>
|
<string name="confirmReserv">Confirmada reserva</string>
|
||||||
|
<string name="checkingByUser">Está siendo revisado por %1$s</string>
|
||||||
|
<string name="checkedByUser">Ha sido revisado por %1$s</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -693,6 +693,8 @@
|
||||||
<string name="add">Añadir...</string>
|
<string name="add">Añadir...</string>
|
||||||
<string name="surname">Nom de famille</string>
|
<string name="surname">Nom de famille</string>
|
||||||
<string name="confirmReserv">Confirmada reserva</string>
|
<string name="confirmReserv">Confirmada reserva</string>
|
||||||
|
<string name="checkingByUser">Está siendo revisado por %1$s</string>
|
||||||
|
<string name="checkedByUser">Ha sido revisado por %1$s</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -693,6 +693,8 @@
|
||||||
<string name="add">Añadir...</string>
|
<string name="add">Añadir...</string>
|
||||||
<string name="surname">Sobrenome</string>
|
<string name="surname">Sobrenome</string>
|
||||||
<string name="confirmReserv">Confirmada reserva</string>
|
<string name="confirmReserv">Confirmada reserva</string>
|
||||||
|
<string name="checkingByUser">Está siendo revisado por %1$s</string>
|
||||||
|
<string name="checkedByUser">Ha sido revisado por %1$s</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -692,5 +692,7 @@
|
||||||
<string name="add">Añadir...</string>
|
<string name="add">Añadir...</string>
|
||||||
<string name="surname">Surname</string>
|
<string name="surname">Surname</string>
|
||||||
<string name="confirmReserv">Confirmada reserva</string>
|
<string name="confirmReserv">Confirmada reserva</string>
|
||||||
|
<string name="checkingByUser">Ticket on checking by %1$s</string>
|
||||||
|
<string name="checkedByUser">ticket checked by %1$s</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue