refs #5802 setState
This commit is contained in:
parent
b6c116aee9
commit
879f957348
|
@ -113,6 +113,7 @@ class CollectionFragment(
|
||||||
private var itemShelvingTracking_mark: Int = 0
|
private var itemShelvingTracking_mark: Int = 0
|
||||||
private var recylerViewState: Parcelable? = null
|
private var recylerViewState: Parcelable? = null
|
||||||
private var isScanned: Boolean? = null
|
private var isScanned: Boolean? = null
|
||||||
|
private var canChangeState = true
|
||||||
|
|
||||||
private lateinit var myGroupList: List<SaleVO>
|
private lateinit var myGroupList: List<SaleVO>
|
||||||
|
|
||||||
|
@ -261,6 +262,7 @@ class CollectionFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateScreen() {
|
private fun updateScreen() {
|
||||||
|
canChangeState = false
|
||||||
binding.splashProgress.visibility = VISIBLE
|
binding.splashProgress.visibility = VISIBLE
|
||||||
viewModel.collectionTicketGet(
|
viewModel.collectionTicketGet(
|
||||||
collection.collectionFk,
|
collection.collectionFk,
|
||||||
|
@ -418,7 +420,7 @@ class CollectionFragment(
|
||||||
|
|
||||||
//LISTA =========
|
//LISTA =========
|
||||||
binding.collectionSwipe.setOnRefreshListener {
|
binding.collectionSwipe.setOnRefreshListener {
|
||||||
|
canChangeState = false
|
||||||
isMarking = false
|
isMarking = false
|
||||||
binding.collectionSwipe.isRefreshing = false
|
binding.collectionSwipe.isRefreshing = false
|
||||||
// if (type != PRECHECKER) {
|
// if (type != PRECHECKER) {
|
||||||
|
@ -427,7 +429,7 @@ class CollectionFragment(
|
||||||
collection.collectionFk,
|
collection.collectionFk,
|
||||||
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
|
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
|
||||||
print = "0",
|
print = "0",
|
||||||
type
|
""
|
||||||
)
|
)
|
||||||
buttonPushedGetCollection = false
|
buttonPushedGetCollection = false
|
||||||
binding.collectionSwipe.isRefreshing = false
|
binding.collectionSwipe.isRefreshing = false
|
||||||
|
@ -842,6 +844,8 @@ class CollectionFragment(
|
||||||
|
|
||||||
loadResponseItemShelvingUpdate.observe(viewLifecycleOwner) { event ->
|
loadResponseItemShelvingUpdate.observe(viewLifecycleOwner) { event ->
|
||||||
event.getContentIfNotHandled().notNull {
|
event.getContentIfNotHandled().notNull {
|
||||||
|
|
||||||
|
canChangeState = !it.isError
|
||||||
if (it.isError) {
|
if (it.isError) {
|
||||||
ma.messageWithSound(it.errorMessage, it.isError, false)
|
ma.messageWithSound(it.errorMessage, it.isError, false)
|
||||||
|
|
||||||
|
@ -1342,6 +1346,7 @@ class CollectionFragment(
|
||||||
|
|
||||||
//Tarea #4371
|
//Tarea #4371
|
||||||
private fun markLine(position: Int, newType: String) {
|
private fun markLine(position: Int, newType: String) {
|
||||||
|
canChangeState = true
|
||||||
state = 0
|
state = 0
|
||||||
//////Log.i("VERDNATURA:","Marcamos linea y enviamos saleTracking")
|
//////Log.i("VERDNATURA:","Marcamos linea y enviamos saleTracking")
|
||||||
if (type == SACADOR) {
|
if (type == SACADOR) {
|
||||||
|
@ -1506,6 +1511,7 @@ class CollectionFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun unMarkLine(position: Int, newType: String) {
|
private fun unMarkLine(position: Int, newType: String) {
|
||||||
|
|
||||||
state = 0
|
state = 0
|
||||||
if (sales[position].isPrepared == "1") {
|
if (sales[position].isPrepared == "1") {
|
||||||
customDialog.setTitle(getString(R.string.unmarkLine))
|
customDialog.setTitle(getString(R.string.unmarkLine))
|
||||||
|
@ -2089,7 +2095,7 @@ class CollectionFragment(
|
||||||
ticketCollection_setUsedShelves()
|
ticketCollection_setUsedShelves()
|
||||||
goBack = false*/
|
goBack = false*/
|
||||||
|
|
||||||
changeTicketState()
|
if (canChangeState) changeTicketState()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,6 +110,7 @@ class CollectionFragmentPicker(
|
||||||
private var isScanned: Boolean? = null
|
private var isScanned: Boolean? = null
|
||||||
|
|
||||||
private lateinit var myGroupList: List<SaleVO>
|
private lateinit var myGroupList: List<SaleVO>
|
||||||
|
private var canChangeState = true
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(collection: CollectionVO, type: String) =
|
fun newInstance(collection: CollectionVO, type: String) =
|
||||||
|
@ -256,6 +257,7 @@ class CollectionFragmentPicker(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateScreen() {
|
private fun updateScreen() {
|
||||||
|
canChangeState = false
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
viewModel.collectionTicketGet(
|
viewModel.collectionTicketGet(
|
||||||
collection.collectionFk,
|
collection.collectionFk,
|
||||||
|
@ -413,7 +415,7 @@ class CollectionFragmentPicker(
|
||||||
|
|
||||||
//LISTA =========
|
//LISTA =========
|
||||||
binding.collectionSwipe.setOnRefreshListener {
|
binding.collectionSwipe.setOnRefreshListener {
|
||||||
|
canChangeState = false
|
||||||
isMarking = false
|
isMarking = false
|
||||||
binding.collectionSwipe.isRefreshing = false
|
binding.collectionSwipe.isRefreshing = false
|
||||||
// if (type != PRECHECKER) {
|
// if (type != PRECHECKER) {
|
||||||
|
@ -511,7 +513,9 @@ class CollectionFragmentPicker(
|
||||||
it.isError, true
|
it.isError, true
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(PRINTERNAME)).toast(
|
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
||||||
|
PRINTERNAME
|
||||||
|
)).toast(
|
||||||
requireContext()
|
requireContext()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -808,7 +812,7 @@ class CollectionFragmentPicker(
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
canChangeState = true
|
||||||
viewModel.collectionTicketGet(
|
viewModel.collectionTicketGet(
|
||||||
collection.collectionFk,
|
collection.collectionFk,
|
||||||
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
|
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
|
||||||
|
@ -903,7 +907,6 @@ class CollectionFragmentPicker(
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// pintar línea
|
// pintar línea
|
||||||
|
|
||||||
saleAdapter!!.notifyDataSetChanged()
|
saleAdapter!!.notifyDataSetChanged()
|
||||||
|
|
||||||
ReviewQuantityForRefreshingAndSorting(
|
ReviewQuantityForRefreshingAndSorting(
|
||||||
|
@ -1079,9 +1082,11 @@ class CollectionFragmentPicker(
|
||||||
var entryPoint = Gson().toJson(
|
var entryPoint = Gson().toJson(
|
||||||
mutableMapOf(
|
mutableMapOf(
|
||||||
"entryPoint" to sale.ticketFk,
|
"entryPoint" to sale.ticketFk,
|
||||||
"web" to "${mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
"web" to "${
|
||||||
|
mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
||||||
ConstAndValues.BASEURLSALIX
|
ConstAndValues.BASEURLSALIX
|
||||||
)}/#!/ticket/${sale.ticketFk}/sale"
|
)
|
||||||
|
}/#!/ticket/${sale.ticketFk}/sale"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
ma.onPasillerosItemClickListener(
|
ma.onPasillerosItemClickListener(
|
||||||
|
@ -1391,6 +1396,7 @@ class CollectionFragmentPicker(
|
||||||
//setListPosition(position, false)
|
//setListPosition(position, false)
|
||||||
|
|
||||||
if (type == SACADOR) {
|
if (type == SACADOR) {
|
||||||
|
canChangeState = true
|
||||||
saleTracking_mark(position, newType)
|
saleTracking_mark(position, newType)
|
||||||
//nuevo
|
//nuevo
|
||||||
var mySale = sales[position].saleFk
|
var mySale = sales[position].saleFk
|
||||||
|
@ -1571,13 +1577,6 @@ class CollectionFragmentPicker(
|
||||||
)
|
)
|
||||||
positionUnmarked = position
|
positionUnmarked = position
|
||||||
|
|
||||||
/* viewModel.saleTrackingDel(
|
|
||||||
getData(USER),
|
|
||||||
getData(PASSWORD),
|
|
||||||
saleFk = sales[position].saleFk,
|
|
||||||
"saleTracking_del"
|
|
||||||
)*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
setTotalLines()
|
setTotalLines()
|
||||||
scanRequest()
|
scanRequest()
|
||||||
|
@ -2089,60 +2088,6 @@ class CollectionFragmentPicker(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* private fun showDisponibility() {
|
|
||||||
|
|
||||||
customDialogInput.setTitle(getString(R.string.Verdisponible))
|
|
||||||
.setDescription(getString(R.string.Escaneaetiqueta))
|
|
||||||
.setOkButton(getString(R.string.Buscar)) {
|
|
||||||
try {
|
|
||||||
if (binding.splashProgress != null) {
|
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (e: Exception) {
|
|
||||||
}
|
|
||||||
|
|
||||||
hideKeyboards()
|
|
||||||
viewModel.itemGetAvailable(
|
|
||||||
usuario = user,
|
|
||||||
password = password,
|
|
||||||
itemFk = customDialogInput.getValue(),
|
|
||||||
warehouseFk = warehouseFk,
|
|
||||||
"item_GetVisibleAvailable"
|
|
||||||
)
|
|
||||||
scanRequest()
|
|
||||||
customDialogInput.dismiss()
|
|
||||||
|
|
||||||
}.setKoButton(getString(R.string.cancel)) {
|
|
||||||
if (binding.splashProgress != null) {
|
|
||||||
binding.splashProgress.visibility = View.GONE
|
|
||||||
}
|
|
||||||
hideKeyboards()
|
|
||||||
scanRequest()
|
|
||||||
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()) {
|
|
||||||
if (binding.splashProgress != null) binding.splashProgress.visibility = View.VISIBLE
|
|
||||||
viewModel.itemGetAvailable(
|
|
||||||
usuario = user,
|
|
||||||
password = password,
|
|
||||||
itemFk = customDialogInput.getValue(),
|
|
||||||
warehouseFk = warehouseFk
|
|
||||||
,"item_GetVisibleAvailable")
|
|
||||||
}
|
|
||||||
customDialogInput.setValue("")
|
|
||||||
scanRequest()
|
|
||||||
customDialogInput.dismiss()
|
|
||||||
hideKeyboards()
|
|
||||||
return@setOnEditorActionListener true
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
private fun toastDisponibility(item: ItemVO) {
|
private fun toastDisponibility(item: ItemVO) {
|
||||||
if (item.available.isNullOrEmpty()) {
|
if (item.available.isNullOrEmpty()) {
|
||||||
item.available = "0"
|
item.available = "0"
|
||||||
|
@ -2197,14 +2142,14 @@ class CollectionFragmentPicker(
|
||||||
ticketCollection_setUsedShelves()
|
ticketCollection_setUsedShelves()
|
||||||
goBack = false
|
goBack = false
|
||||||
|
|
||||||
changeTicketState()
|
if (canChangeState) changeTicketState()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun ticketCollection_setUsedShelves() {
|
private fun ticketCollection_setUsedShelves() {
|
||||||
|
|
||||||
if (type.equals("CHECKER") && (isMarking && ( mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
if (type.equals("CHECKER") && (isMarking && (mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
||||||
SECTORDESCRIP
|
SECTORDESCRIP
|
||||||
).uppercase() != getString(
|
).uppercase() != getString(
|
||||||
R.string.sectorALGEMESI
|
R.string.sectorALGEMESI
|
||||||
|
@ -2454,7 +2399,9 @@ class CollectionFragmentPicker(
|
||||||
collectionFk = collection.collectionFk,
|
collectionFk = collection.collectionFk,
|
||||||
labelCount = (which + 1)
|
labelCount = (which + 1)
|
||||||
)
|
)
|
||||||
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(PRINTERNAME)).toast(requireContext())
|
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
||||||
|
PRINTERNAME
|
||||||
|
)).toast(requireContext())
|
||||||
|
|
||||||
}
|
}
|
||||||
val dialog = builder.create()
|
val dialog = builder.create()
|
||||||
|
|
|
@ -28,15 +28,12 @@ import retrofit2.Response
|
||||||
|
|
||||||
class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
// val emptyMessage = context.getString(R.string.collectionNoTickets)
|
|
||||||
|
|
||||||
private val contextApp = context
|
private val contextApp = context
|
||||||
|
|
||||||
/* private val getSacadorControladorUserCase: GetSacadorControladorUserCase =
|
private val _responseState by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
GetSacadorControladorUserCase(context)
|
val responseState: LiveData<ResponseItemVO>
|
||||||
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context)
|
get() = _responseState
|
||||||
private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase(context)
|
|
||||||
*/
|
|
||||||
private val _collectionTicketList by lazy { MutableLiveData<CollectionVO>() }
|
private val _collectionTicketList by lazy { MutableLiveData<CollectionVO>() }
|
||||||
val collectionTicketList: LiveData<CollectionVO>
|
val collectionTicketList: LiveData<CollectionVO>
|
||||||
get() = _collectionTicketList
|
get() = _collectionTicketList
|
||||||
|
@ -169,7 +166,6 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
val mistakeList: LiveData<MistakeTypeListVO>
|
val mistakeList: LiveData<MistakeTypeListVO>
|
||||||
get() = _mistakeList
|
get() = _mistakeList
|
||||||
|
|
||||||
|
|
||||||
private val _item by lazy { MutableLiveData<ItemVO>() }
|
private val _item by lazy { MutableLiveData<ItemVO>() }
|
||||||
val item: LiveData<ItemVO>
|
val item: LiveData<ItemVO>
|
||||||
get() = _item
|
get() = _item
|
||||||
|
@ -874,7 +870,6 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun saleMistakeAdd(
|
fun saleMistakeAdd(
|
||||||
saleFk: Int,
|
saleFk: Int,
|
||||||
typeFk: Int
|
typeFk: Int
|
||||||
|
@ -1035,4 +1030,32 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun collection_setState(
|
||||||
|
collectionFk: Int,
|
||||||
|
state: String
|
||||||
|
) {
|
||||||
|
salix.collectionSetState(
|
||||||
|
params = arrayListOf(
|
||||||
|
collectionFk,
|
||||||
|
state
|
||||||
|
).formatWithQuotes()
|
||||||
|
)
|
||||||
|
.enqueue(object : SalixCallback<Any?>(context) {
|
||||||
|
override fun onError(t: Throwable) {
|
||||||
|
|
||||||
|
_responseState.value = ResponseItemVO(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
|
)
|
||||||
|
super.onError(t)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onSuccess(response: Response<Any?>) {
|
||||||
|
_responseState.value =
|
||||||
|
ResponseItemVO(isError = false, response = "")
|
||||||
|
super.onSuccess(response)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue