refs #6411 feat:update libraries

This commit is contained in:
Sergio De la torre 2024-02-27 12:00:33 +01:00
parent 7571e7f6ea
commit e85939e211
16 changed files with 827 additions and 785 deletions

View File

@ -3,7 +3,7 @@ package es.verdnatura.presentation.view.feature.buscaritem.fragment
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.map
import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.formatWithQuotes
import es.verdnatura.presentation.base.BaseViewModel
@ -16,7 +16,7 @@ class BuscarItemViewModel(val context: Context) : BaseViewModel(context) {
private val _locationList by lazy { MutableLiveData<LocationListVO>() }
val locationList: LiveData<LocationListVO>
get() = _locationList
val loadLocationList = Transformations.map(_locationList) { Event(it) }
val loadLocationList: LiveData<Event<LocationListVO>> = _locationList.map { Event(it) }
fun itemshelvingGetInfo(itemFk: Any) {
//salix falla fecha

View File

@ -3,7 +3,8 @@ package es.verdnatura.presentation.view.feature.collection.fragment
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.map
import com.google.gson.JsonObject
import es.verdnatura.MobileApplication
import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.SilexCallback
@ -12,6 +13,7 @@ import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemExistsItemShelvingSale
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.common.TicketState
import es.verdnatura.presentation.view.feature.collection.ItemVO
@ -39,10 +41,17 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val collectionTicketList: LiveData<CollectionVO>
get() = _collectionTicketList
private val _responseExistsItemShelvingSale by lazy { MutableLiveData<ResponseItemExistsItemShelvingSale>() }
val responseExistsItemShelvingSale: LiveData<ResponseItemExistsItemShelvingSale>
get() = _responseExistsItemShelvingSale
private val _collectionTicketSalix by lazy { MutableLiveData<CollectionTicket>() }
val collectionTicketSalix: LiveData<CollectionTicket>
get() = _collectionTicketSalix
val loadCollectionTicketSalix: LiveData<Event<CollectionTicket>> =
_collectionTicketSalix.map { Event(it) }
private val _collectionTicketListLocal by lazy { MutableLiveData<CollectionTicket>() }
val collectionTicketListLocal: LiveData<CollectionTicket>
get() = _collectionTicketListLocal
@ -170,10 +179,16 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val responseGetExtensionFromUserId: LiveData<ResponseItemVO>
get() = _responseGetExtensionFromUserId
val loadResponseDel = Transformations.map(_responseDel) { Event(it) }
val loadResponseSaleTrackingMark = Transformations.map(_responseSaleTracking_mark) { Event(it) }
val loadResponseItemShelvingUpdate =
Transformations.map(_responseItemShelvingUpdate) { Event(it) }
val loadResponseDel: LiveData<Event<ResponseItemVO>> = _responseDel.map { Event(it) }
val loadResponseSaleTrackingMark: LiveData<Event<ResponseItemVO>> =
_responseSaleTracking_mark.map { Event(it) }
val loadResponseItemShelvingUpdate: LiveData<Event<ResponseItemVO>> =
_responseItemShelvingUpdate.map { Event(it) }
fun collectionTicketGet(
collectionFk: Int,
@ -295,6 +310,26 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
})
}
fun itemShelvingSaleExists(
itemShelvingSaleFk: Number,
position: Int,
quantity: Int
) {
salix.itemShelvingSaleExists(
itemShelvingSaleFk
)
.enqueue(object :
SalixCallback<JsonObject>(context) {
override fun onSuccess(response: Response<JsonObject>) {
_responseExistsItemShelvingSale.value = ResponseItemExistsItemShelvingSale(
response.body()!!.entrySet().first().value.asBoolean, position, quantity
)
}
})
}
fun saleTrackingReplace(
saleFk: Int,
originalQuantity: Int,

View File

@ -3,7 +3,7 @@ package es.verdnatura.presentation.view.feature.delivery.viewmodels
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.map
import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.formatWithQuotes
import es.verdnatura.presentation.base.BaseViewModel
@ -76,7 +76,7 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
private val _expeditionList by lazy { MutableLiveData<ExpeditionList>() }
val expeditionList: LiveData<ExpeditionList> = _expeditionList
val loadRouteList = Transformations.map(_routeList) { Event(it) }
val loadRouteList: LiveData<Event<RouteList>> = _routeList.map { Event(it) }
private val _responseLoadList by lazy { MutableLiveData<ResponseItemVO>() }
val responseLoadList: LiveData<ResponseItemVO> = _responseLoadList

View File

@ -3,7 +3,7 @@ package es.verdnatura.presentation.view.feature.diadeventa.fragment
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.map
import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.formatWithQuotes
import es.verdnatura.presentation.base.BaseViewModel
@ -25,7 +25,7 @@ class DayOfSaleViewModel(val context: Context) : BaseViewModel(context) {
val itemShelvingSaleDateList: LiveData<ItemShelvingSaleDateList>
get() = _itemShelvingSaleDateList
val loadItemShelvingSaleDateList = Transformations.map(_itemShelvingSaleDateList) { Event(it) }
val loadItemShelvingSaleDateList: LiveData<Event<ItemShelvingSaleDateList>> = _itemShelvingSaleDateList.map { Event(it) }
fun itemShelvingGetSaleDate(vShelvingFK: String) {
//salix falla fecha

View File

@ -3,7 +3,7 @@ package es.verdnatura.presentation.view.feature.historicoarticulo.fragment
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.map
import es.verdnatura.domain.SalixCallback
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.common.Event
@ -17,7 +17,7 @@ class HistoricoArticuloViewModel(val context: Context) : BaseViewModel(context)
val historicoList: LiveData<ItemHistoricoListVO>
get() = _historicoList
val loadHistoricoList = Transformations.map(_historicoList) { Event(it) }
val loadHistoricoList: LiveData<Event<ItemHistoricoListVO>> = _historicoList.map { Event(it) }
fun itemGetBalance(itemFk: Int, vWarehouseFk: Int) {

View File

@ -5,6 +5,7 @@ import android.view.inputmethod.EditorInfo
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentItemshelvinglogBinding
import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.view.component.CustomDialog
@ -67,7 +68,9 @@ class ItemShelvingLogFragment(
override fun observeViewModel() {
with(viewModel) {
itemShelvingLogList.observe(viewLifecycleOwner) {
loadItemShelvingLogList.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull {
if (it.list.isEmpty()) {
customDialog.setTitle(getString(R.string.noResults))
@ -82,11 +85,16 @@ class ItemShelvingLogFragment(
)
binding.itemshelvinglogRecyclerview.adapter = adapter
binding.itemshelvinglogRecyclerview.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
LinearLayoutManager(
requireContext(),
LinearLayoutManager.VERTICAL,
false
)
setToolBar(getString(R.string.itemShelvingLog) + ":" + itemScan)
}
}
}
}
}
}

View File

@ -1,8 +1,9 @@
package es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.map
import es.verdnatura.domain.SalixCallback
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.common.Event
@ -13,7 +14,7 @@ import retrofit2.Response
class ShelvingLogViewModel(val context: Context) : BaseViewModel(context) {
private val _itemShelvingLogSalixList by lazy { MutableLiveData<ShelvingLogSalixList>() }
val loadShelvingLogSalixList = Transformations.map(_itemShelvingLogSalixList) { Event(it) }
val loadShelvingLogSalixList: LiveData<Event<ShelvingLogSalixList>> = _itemShelvingLogSalixList.map { Event(it) }
fun shelvings(vShelvingFK: String) {
salix.Shelvings("""{"where": {"code": "$vShelvingFK"}}""").enqueue(object :

View File

@ -1,8 +1,9 @@
package es.verdnatura.presentation.view.feature.historicovehiculo.fragment
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.map
import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.formatWithQuotes
import es.verdnatura.presentation.base.BaseViewModel
@ -14,7 +15,7 @@ import retrofit2.Response
class HistoricoVehiculoViewModel(var context: Context) : BaseViewModel(context) {
private val _historicovehiculoList by lazy { MutableLiveData<ItemHistoricoVehiculoList>() }
val loadHistoricoVehiculoList = Transformations.map(_historicovehiculoList) { Event(it) }
val loadHistoricoVehiculoList: LiveData<Event<ItemHistoricoVehiculoList>> = _historicovehiculoList.map { Event(it) }
fun machineWorkeGetHistorical(plateNumber: String, workerId:Int) {
//salix falla fecha

View File

@ -1,24 +0,0 @@
package es.verdnatura.presentation.view.feature.imageview.activity
import es.verdnatura.R
import es.verdnatura.databinding.ActivityImageviewBinding
import es.verdnatura.presentation.base.BaseActivity
import es.verdnatura.presentation.common.loadUrl
class ImageViewActivity : BaseActivity<ActivityImageviewBinding>(){
override fun getLayoutId(): Int = R.layout.activity_imageview
override fun init() {
binding.mainToolbar.toolbarTitle.text = intent.getStringExtra(getString(R.string.title))
binding.imgView.loadUrl(intent.getStringExtra(getString(R.string.url))!!)
binding.mainToolbar.backButton.setOnClickListener {
onBackPressed()
}
}
}

View File

@ -3,7 +3,7 @@ package es.verdnatura.presentation.view.feature.inventario.fragment
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.map
import com.google.gson.JsonObject
import es.verdnatura.MobileApplication
import es.verdnatura.domain.SalixCallback
@ -66,14 +66,12 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
private val _inventoryListParking by lazy { MutableLiveData<InventoryParkingList>() }
val inventoryListParking: LiveData<InventoryParkingList>
get() = _inventoryListParking
val loadInventaryParkingList = Transformations.map(_inventoryListParking) { Event(it) }
val loadInventaryParkingList: LiveData<Event<InventoryParkingList>> = _inventoryListParking.map { Event(it) }
private val _responseCode by lazy { MutableLiveData<ResponseItemVO>() }
val responseCode: LiveData<ResponseItemVO>
get() = _responseCode
val loadReponseCode = Transformations.map(_responseCode) { Event(it) }
val loadReponseCode: LiveData<Event<ResponseItemVO>> = _responseCode.map { Event(it) }
//sergio para obtener comprador
fun itemShelvingBuyerGet() {
@ -85,8 +83,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
})
}
val loadInventaryList = Transformations.map(_inventaryList) { Event(it) }
val loadInventaryList: LiveData<Event<InventaryListVO>> = _inventaryList.map { Event(it) }
fun getInventory(buyerFk: Int, warehouseFk: Int) {
salix.itemShelvingFilterBuyer(params = arrayListOf(buyerFk, warehouseFk))

View File

@ -3,7 +3,7 @@ package es.verdnatura.presentation.view.feature.login.fragment
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.map
import com.google.gson.Gson
import com.google.gson.JsonObject
import com.google.gson.reflect.TypeToken
@ -63,8 +63,7 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) {
private val _renewTokenResponse by lazy { MutableLiveData<RenewToken>() }
val renewTokenResponse: LiveData<RenewToken>
get() = _renewTokenResponse
val loadAccessConfigSalixList = Transformations.map(_accessConfigSalixList) { Event(it) }
val loadAccessConfigSalixList: LiveData<Event<accessConfigSalixList>> = _accessConfigSalixList.map { Event(it) }
fun loginSalix(user: String, password: String) {
salix.login(LoginSalixVO(user, password))

View File

@ -3,7 +3,7 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.map
import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.formatWithQuotes
import es.verdnatura.presentation.base.BaseViewModel
@ -18,7 +18,7 @@ import retrofit2.Response
class ExpeditionPalletDetailViewModel(var context: Context) : BaseViewModel(context) {
private val _expeditionPalletList by lazy { MutableLiveData<ItemPalletViewListVO>() }
val loadExpeditionPalletList = Transformations.map(_expeditionPalletList) { Event(it) }
val loadExpeditionPalletList: LiveData<Event<ItemPalletViewListVO>> = _expeditionPalletList.map { Event(it) }
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
val response: LiveData<ResponseItemVO>

View File

@ -3,7 +3,7 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.map
import es.verdnatura.domain.SalixCallback
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
@ -20,10 +20,11 @@ import retrofit2.Response
class ExpeditionPalletViewModel(val context: Context) : BaseViewModel(context) {
private val _expeditionPalletList by lazy { MutableLiveData<ItemPalletListVO>() }
val loadExpeditionPalletList = Transformations.map(_expeditionPalletList) { Event(it) }
val loadExpeditionPalletList: LiveData<Event<ItemPalletListVO>> =
_expeditionPalletList.map { Event(it) }
private val _scanList by lazy { MutableLiveData<ItemScanList>() }
val loadScanList = Transformations.map(_scanList) { Event(it) }
val loadScanList: LiveData<Event<ItemScanList>> = _scanList.map { Event(it) }
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
val response: LiveData<ResponseItemVO>
@ -89,7 +90,6 @@ class ExpeditionPalletViewModel(val context: Context) : BaseViewModel(context) {
}
})
}

View File

@ -3,7 +3,7 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.map
import es.verdnatura.domain.SalixCallback
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
@ -19,10 +19,10 @@ import retrofit2.Response
class ExpeditionScanViewModel(val context: Context) : BaseViewModel(context) {
private val _expeditionScanList by lazy { MutableLiveData<ItemExpeditionScanList>() }
val loadExpeditionScanList = Transformations.map(_expeditionScanList) { Event(it) }
val loadExpeditionScanList: LiveData<Event<ItemExpeditionScanList>> = _expeditionScanList.map { Event(it) }
private val _scanList by lazy { MutableLiveData<ItemScanList>() }
val loadScanList = Transformations.map(_scanList) { Event(it) }
val loadScanList: LiveData<Event<ItemScanList>> = _scanList.map { Event(it) }
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
val response: LiveData<ResponseItemVO>

View File

@ -3,8 +3,9 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment
import android.content.Context
import android.os.Build
import androidx.annotation.RequiresApi
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.map
import es.verdnatura.domain.SalixCallback
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.common.Event
@ -20,10 +21,10 @@ import java.time.LocalTime
class ExpeditionTruckListViewModel(val context: Context) : BaseViewModel(context) {
private val _expeditionTruckList by lazy { MutableLiveData<ItemExpeditionTruckList>() }
val loadExpeditionTruckList = Transformations.map(_expeditionTruckList) { Event(it) }
val loadExpeditionTruckList: LiveData<Event<ItemExpeditionTruckList>> = _expeditionTruckList.map { Event(it) }
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
val loadResponseExpeditionAdd = Transformations.map(_response) { Event(it) }
val loadResponseExpeditionAdd: LiveData<Event<ResponseItemVO>> = _response.map { Event(it) }
@RequiresApi(Build.VERSION_CODES.O)
fun expeditionTruckList() {

View File

@ -20,6 +20,7 @@ import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.R
import es.verdnatura.databinding.FragmentPreSacadorBinding
import es.verdnatura.domain.ConstAndValues.SECTORFK
import es.verdnatura.domain.notNull
import es.verdnatura.domain.toInt
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
@ -256,8 +257,8 @@ class EndSacadorFragment(
}
})
responseSaleGroupAdd.observe(viewLifecycleOwner, Observer {
loadResponseSaleGropAdd.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull {
binding.splashProgress.visibility = GONE
if (!goBack) {
@ -276,7 +277,30 @@ class EndSacadorFragment(
)
}
}
})
}
}
/* responseSaleGroupAdd.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = GONE
if (!goBack) {
if (it.isError) {
ma.messageWithSound(
getString(R.string.errorTicketAdd) + it.errorMessage,
isError = true,
true,
isToasted = true
)
} else {
viewModel.sectorCollection_getSale(
collection.collectionFk,
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK)
)
}
}
})*/
responseSaleAddPrevOK.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = GONE
@ -378,9 +402,9 @@ class EndSacadorFragment(
})
}
}
}
private fun responseSaleMoveSuccesful() {
private fun responseSaleMoveSuccesful() {
try {
sales[positionCollectionSplit].saldo = quantityCollectionSplit.toInt()
@ -393,9 +417,9 @@ class EndSacadorFragment(
markLine(positionCollectionSplit)
saleAdapter!!.notifyDataSetChanged()
}
}
private fun incresaseSuccesful() {
private fun incresaseSuccesful() {
try {
sales[positionIncreaseQuantity].saldo = quantityIncrease.toInt()
@ -407,19 +431,19 @@ class EndSacadorFragment(
searchSaleCollection()
}
}
//CREATE LIST
//CREATE LIST
private fun searchSaleCollection() {
private fun searchSaleCollection() {
binding.splashProgress.visibility = VISIBLE
viewModel.sectorCollection_getSale(
collection.collectionFk,
sectorFk = mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK)
)
}
}
private fun searchTicket(ticketFk: Int) {
private fun searchTicket(ticketFk: Int) {
ticket = ticketFk
@ -429,9 +453,9 @@ class EndSacadorFragment(
ticketFk,
collection.collectionFk
)
}
}
private fun createSaleList(salesList: List<PreSacadorItemVO>) {
private fun createSaleList(salesList: List<PreSacadorItemVO>) {
binding.splashProgress.visibility = GONE
if (salesList.isNullOrEmpty()) {
@ -507,9 +531,9 @@ class EndSacadorFragment(
setScrollListener(lm!!)
}
}
}
private fun setScrollListener(lm: LinearLayoutManager) {
private fun setScrollListener(lm: LinearLayoutManager) {
binding.fragmentSacadorCollections.addOnScrollListener(object :
RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
@ -517,9 +541,9 @@ class EndSacadorFragment(
super.onScrolled(recyclerView, dx, dy)
}
})
}
}
private fun setTotalLines() {
private fun setTotalLines() {
var totalMark = 0
sales.forEach {
if (it.saldo == it.picked)
@ -540,19 +564,19 @@ class EndSacadorFragment(
}
}
}
private fun setListPosition(position: Int) {
private fun setListPosition(position: Int) {
storedPosition = position
binding.fragmentSacadorCollections.addViewObserver {
lm!!.scrollToPositionWithOffset(position, 0)
}
}
}
//SEARCH AND MARK
private fun findSale(txtscan: String) {
//SEARCH AND MARK
private fun findSale(txtscan: String) {
var index = 0
var isBreak = false
var isOk = false
@ -583,9 +607,9 @@ class EndSacadorFragment(
(getString(R.string.itemScanetNotFound) + txtscan).toast(requireContext())
}
}
}
private fun findSale(txtscan: String, position: Int) {
private fun findSale(txtscan: String, position: Int) {
var index = 0
var isBreak = false
var isOk = false
@ -616,17 +640,17 @@ class EndSacadorFragment(
("getString(R.string.itemScanetNotFound)" + txtscan).toast(requireContext())
}
}
}
private fun markLine(position: Int) {
private fun markLine(position: Int) {
saleAdapter!!.notifyDataSetChanged()
setListPosition(position)
saleTrackingReplace(position)
setTotalLines()
}
}
private fun saleTrackingReplace(position: Int) {
private fun saleTrackingReplace(position: Int) {
if (sales[position].picked == sales[position].quantity || sales[position].picked == 0) {
@ -639,9 +663,9 @@ class EndSacadorFragment(
}
isScanned = null
}
}
private fun unMarkLine(position: Int) {
private fun unMarkLine(position: Int) {
if (sales[position].quantity == sales[position].picked) {
customDialog.setTitle(getString(R.string.unmarkLine))
@ -663,10 +687,10 @@ class EndSacadorFragment(
}.show()
}
}
}
//SHELVINGS
private fun showShelving(position: Int, shelvingPosition: Int) {
//SHELVINGS
private fun showShelving(position: Int, shelvingPosition: Int) {
storedShelvingPosition = shelvingPosition
storedPosition = position
binding.splashProgress.visibility = VISIBLE
@ -680,10 +704,10 @@ class EndSacadorFragment(
quantity = quantityGet,
shelvingFk = sales[position].carros[shelvingPosition].shelving
)
}
}
@RequiresApi(Build.VERSION_CODES.O)
private fun printShelvingResult(placementSupplyListVO: PlacementSupplyListVO) {
@RequiresApi(Build.VERSION_CODES.O)
private fun printShelvingResult(placementSupplyListVO: PlacementSupplyListVO) {
var shelving = ""
var item = ""
var longName = ""
@ -822,9 +846,9 @@ class EndSacadorFragment(
customDialogList.getRecyclerView().layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
}
}
private fun onQuantityOfShelvingSelected(itemShelvingFk: Int) {
private fun onQuantityOfShelvingSelected(itemShelvingFk: Int) {
//1 - MODIFICAR CANTIDAD DEL CARRO
try {
val shelvingVisible = sales[storedPosition].carros[storedShelvingPosition].stockTotal
@ -859,14 +883,14 @@ class EndSacadorFragment(
//3- MARCAR LINEA
markLine(storedPosition)
}
}
private fun checkItemScan(valueToCheck: String): Boolean {
private fun checkItemScan(valueToCheck: String): Boolean {
val saleToCheck = sales[storedPosition]
return saleToCheck.itemFk.toDouble() == valueToCheck.toDouble()
}
}
private fun showScanner(index: Int, sale: PreSacadorItemVO) {
private fun showScanner(index: Int, sale: PreSacadorItemVO) {
customDialogInput.setTitle("" + sale.itemFk)
.setDescription(getString(R.string.scanWagonForItem))
@ -884,9 +908,9 @@ class EndSacadorFragment(
false
}
}
}
private fun customDialogInputAction(index: Int) {
private fun customDialogInputAction(index: Int) {
if (!customDialogInput.getValue().isNullOrEmpty()) {
findSale(customDialogInput.getValue(), index)
customDialogInput.setValue("")
@ -894,10 +918,10 @@ class EndSacadorFragment(
customDialogInput.dismiss()
hideKeyboards()
}
}
}
//OTROS
private fun setToolBar() {
//OTROS
private fun setToolBar() {
binding.mainToolbar.toolbarSubtitle.visibility = VISIBLE
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString()
@ -940,44 +964,44 @@ class EndSacadorFragment(
})
binding.mainToolbar.toolbarIcons.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
}
private fun scanRequest() {
private fun scanRequest() {
binding.scanInput.requestFocus()
hideKeyboards()
}
}
private fun hideKeyboards() {
private fun hideKeyboards() {
requireActivity().hideKeyboard()
}
}
companion object {
companion object {
fun newInstance(collection: CollectionVO?, entrypoint: String) = EndSacadorFragment(
collection!!, entrypoint
)
}
}
override fun getLayoutId(): Int = R.layout.fragment_pre_sacador
override fun getLayoutId(): Int = R.layout.fragment_pre_sacador
override fun onPause() {
override fun onPause() {
goBack = true //SERGIO: se quita porque si no no entra la primera vez
goBack2 = true
super.onPause()
}
}
override fun onResume() {
override fun onResume() {
goBack = false
super.onResume()
}
}
private fun showErrorMessage(text: String) {
private fun showErrorMessage(text: String) {
customDialog.setTitle(getString(R.string.errorMarkLine)).setDescription(text)
.setKoButton(getString(R.string.close)) {
customDialog.dismiss()
}.show()
}
}
private fun showQuantityDialog(position: Int) {
private fun showQuantityDialog(position: Int) {
try {
customDialogThreeButtons.setDescription(getString(R.string.txtnuevacantidad))
.setValue("")
@ -1010,7 +1034,7 @@ class EndSacadorFragment(
getString(R.string.Split)
)
*/
*/
.setOkButtonAdd(getString(R.string.Agregar)) {
increaseQuantity(position, customDialogThreeButtons.getValue().toInt())
scanRequest()
@ -1030,9 +1054,9 @@ class EndSacadorFragment(
} catch (ex: Exception) {
getString(R.string.errorQuantity).toast(context)
}
}
}
private fun increaseQuantity(position: Int, quantity: Int) {
private fun increaseQuantity(position: Int, quantity: Int) {
positionIncreaseQuantity = position
quantityIncrease = quantity
@ -1041,6 +1065,6 @@ class EndSacadorFragment(
quantity = quantity
)
}
}
}