feat qr #refs 7520

This commit is contained in:
Sergio De la torre 2024-06-18 12:14:04 +02:00
parent 413f9b767e
commit e940e9ec26
11 changed files with 1101 additions and 1236 deletions

View File

@ -45,7 +45,7 @@ class BuscarItemFragment(
if (binding.editItemFk.text.toString().isNotEmpty()) try {
getLocations(
itemScanValue(
binding.editItemFk.text.toString(), "buy", "more"
binding.editItemFk.text.toString(), arrayOf("buy"), "more"
)
)
} catch (ex: Exception) {

View File

@ -36,11 +36,9 @@ import es.verdnatura.domain.ConstAndValues.PRINTERNAME
import es.verdnatura.domain.ConstAndValues.SACADOR
import es.verdnatura.domain.ConstAndValues.SECTORDESCRIP
import es.verdnatura.domain.ConstAndValues.SECTORFK
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFK
import es.verdnatura.domain.notNull
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.DataMessageSalix
import es.verdnatura.presentation.common.ItemScanned
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
import es.verdnatura.presentation.common.OnMistakeClickListener
@ -80,7 +78,6 @@ class CollectionFragment(
var collection: CollectionVO = CollectionVO(0), var type: String = SACADOR
) : BaseFragment<FragmentCollectionBinding, CollectionViewModel>(CollectionViewModel::class) {
private lateinit var dataMessageSalix: DataMessageSalix
private var sales: List<SaleVO> = listOf()
private var salesParent: List<SaleVO> = listOf()
private var saleAdapter: SaleAdapter? = null
@ -936,17 +933,6 @@ class CollectionFragment(
}
private fun getSalePerson(ticketFk: Int): String {
var salePerson = ""
for (it in sales) {
if (it.ticketFk.equals(ticketFk)) {
salePerson = it.salePersonFk ?: ""
break
}
}
return salePerson
}
//CREATE LIST
private fun createCollectionList() {
@ -1640,7 +1626,7 @@ class CollectionFragment(
isScanned = false/*Tarea #5109*/
customDialogList.setValueTwo(
itemScanValue(
customDialogList.getValueTwo(), "buy", "more"
customDialogList.getValueTwo(), arrayOf("buy"), "more"
).toString()
)
@ -1719,7 +1705,7 @@ class CollectionFragment(
customDialogList.setValueTwo(
itemScanValue(
customDialogList.getValueTwo(), "buy", "more"
customDialogList.getValueTwo(), arrayOf("buy"), "more"
).toString()
)
@ -1938,22 +1924,10 @@ class CollectionFragment(
getString(R.string.Todosloscampossonobligatorios).toast(requireContext())
} else {
//sergio datos para mensaje salix
dataMessageSalix = DataMessageSalix(
ticket = ticketSelected,
item = customDialogList.getValue(),
quantity = customDialogList.getValueTwo(),
personSale = getSalePerson(ticketSelected)
)
viewModel.collectionAddItem(
itemFk = customDialogList.getValue().toInt(),
ticketFk = ticketSelected,
quantityFk = customDialogList.getValueTwo().toInt(),
warehouseFk = mobileApplication.dataStoreApp.readDataStoreKey(
WAREHOUSEFK
)
quantity = customDialogList.getValueTwo().toInt()
)
@ -1975,7 +1949,7 @@ class CollectionFragment(
try {
customDialogList.setValue(
itemScanValue(
customDialogList.getValue(), "buy", "more"
customDialogList.getValue(), arrayOf("buy"), "more"
).toString()
)
@ -2004,20 +1978,10 @@ class CollectionFragment(
getString(R.string.Todosloscampossonobligatorios).toast(requireContext())
} else {
dataMessageSalix = DataMessageSalix(
ticket = ticketSelected,
item = customDialogList.getValue(),
quantity = customDialogList.getValueTwo(),
personSale = getSalePerson(ticketSelected)
)
viewModel.collectionAddItem(
itemFk = customDialogList.getValue().toInt(),
ticketFk = ticketSelected,
quantityFk = customDialogList.getValueTwo().toInt(),
warehouseFk = mobileApplication.dataStoreApp.readDataStoreKey(
WAREHOUSEFK
)
quantity = customDialogList.getValueTwo().toInt(),
)
scanRequest()
customDialogList.dismiss()

View File

@ -32,11 +32,11 @@ import es.verdnatura.domain.ConstAndValues.PRINTERNAME
import es.verdnatura.domain.ConstAndValues.SACADOR
import es.verdnatura.domain.ConstAndValues.SECTORDESCRIP
import es.verdnatura.domain.ConstAndValues.SECTORFK
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFK
import es.verdnatura.domain.isParking
import es.verdnatura.domain.isShelving
import es.verdnatura.domain.notNull
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.DataMessageSalix
import es.verdnatura.presentation.common.ItemScanned
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
import es.verdnatura.presentation.common.OnMistakeClickListener
@ -75,7 +75,6 @@ class CollectionFragmentPicker(
var collection: CollectionVO = CollectionVO(0), var type: String = SACADOR
) : BaseFragment<FragmentCollectionBinding, CollectionViewModel>(CollectionViewModel::class) {
private lateinit var dataMessageSalix: DataMessageSalix
private var sales: List<SaleVO> = listOf()
private var salesParent: List<SaleVO> = listOf()
private var saleAdapter: SaleAdapter? = null
@ -323,11 +322,20 @@ class CollectionFragmentPicker(
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) {
if (!customDialogList.getValue().isEmpty()) {
ma.hideKeyboard(customDialogList.getEditText())
var saleGroupScanned = customDialogList.getValue()
try {
val saleGroupScanned = itemScanValue(
customDialogList.getValue(),
arrayOf("saleGroup"),
"id"
).toString()
isScanned =
event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
markPrevia(saleGroupScanned)
customDialogList.dismiss()
} catch (ex: Exception) {
ex.message!!.toast(requireContext())
}
}
customDialogList.setValue("")
ma.hideKeyboard(customDialogList.getEditText())
@ -905,17 +913,6 @@ class CollectionFragmentPicker(
}
private fun getSalePerson(ticketFk: Int): String {
var salePerson = ""
for (it in sales) {
if (it.ticketFk.equals(ticketFk)) {
salePerson = it.salePersonFk ?: ""
break
}
}
return salePerson
}
//CREATE LIST
private fun createCollectionList() {
@ -960,7 +957,8 @@ class CollectionFragmentPicker(
}
saleAdapter = SaleAdapter(myGroupList,
saleAdapter = SaleAdapter(
myGroupList,
pasillerosItemClickListener!!,
object : OnQuantityClickListener {
@ -1100,7 +1098,7 @@ class CollectionFragmentPicker(
try {
customDialogList.setValue(
itemScanValue(
customDialogList.getValue(), "ticket", "id"
customDialogList.getValue(), arrayOf("ticket"), "id"
).toString()
)
@ -1346,23 +1344,23 @@ class CollectionFragmentPicker(
}
if (!isOk) {
checkIsParking(txtscan)
if (txtscan.isParking()) {
ticketParking(txtscan)
} else {
if (mperror != null) mperror!!.start()
}
}
}
}
private fun checkIsParking(txtscan: String) {
if (txtscan.contains("-")) {
private fun ticketParking(txtscan: String) {
tickets.forEach {
viewModel.setParking(
ticketFk = it.toInt(), parking = txtscan
)
}
} else {
if (mperror != null) mperror!!.start()
}
}
//Tarea #4371
@ -1641,7 +1639,7 @@ class CollectionFragmentPicker(
isScanned = false/*Tarea #5109*/
customDialogList.setValueTwo(
itemScanValue(
customDialogList.getValueTwo(), "buy", "more"
customDialogList.getValueTwo(), arrayOf("buy"), "more"
).toString()
)
@ -1726,7 +1724,7 @@ class CollectionFragmentPicker(
customDialogList.setValueTwo(
itemScanValue(
customDialogList.getValueTwo(), "buy", "more"
customDialogList.getValueTwo(), arrayOf("buy"), "more"
).toString()
)
@ -1949,20 +1947,10 @@ class CollectionFragmentPicker(
getString(R.string.Todosloscampossonobligatorios).toast(requireContext())
} else {
//sergio datos para mensaje salix
dataMessageSalix = DataMessageSalix(
ticket = ticketSelected,
item = customDialogList.getValue(),
quantity = customDialogList.getValueTwo(),
personSale = getSalePerson(ticketSelected)
)
viewModel.collectionAddItem(
itemFk = customDialogList.getValue().toInt(),
ticketFk = ticketSelected,
quantityFk = customDialogList.getValueTwo().toInt(),
warehouseFk = mobileApplication.dataStoreApp.readDataStoreKey(WAREHOUSEFK)
quantity = customDialogList.getValueTwo().toInt()
)
@ -1984,7 +1972,7 @@ class CollectionFragmentPicker(
try {
customDialogList.setValue(
itemScanValue(
customDialogList.getValue(), "buy", "more"
customDialogList.getValue(), arrayOf("buy"), "more"
).toString()
)
@ -2013,20 +2001,10 @@ class CollectionFragmentPicker(
getString(R.string.Todosloscampossonobligatorios).toast(requireContext())
} else {
dataMessageSalix = DataMessageSalix(
ticket = ticketSelected,
item = customDialogList.getValue(),
quantity = customDialogList.getValueTwo(),
personSale = getSalePerson(ticketSelected)
)
viewModel.collectionAddItem(
itemFk = customDialogList.getValue().toInt(),
ticketFk = ticketSelected,
quantityFk = customDialogList.getValueTwo().toInt(),
warehouseFk = mobileApplication.dataStoreApp.readDataStoreKey(
WAREHOUSEFK
)
quantity = customDialogList.getValueTwo().toInt()
)
scanRequest()
customDialogList.dismiss()
@ -2293,17 +2271,31 @@ class CollectionFragmentPicker(
.setOkButton(getString(R.string.accept)) {
if (!customDialogInput.getValue().isNullOrEmpty()) {
//Tarea 5675
if (customDialogInput.getValue().isParking() || !customDialogInput.getValue()
.isShelving()
) {
ma.messageWithSound(
message = getString(R.string.shelvingError),
isError = true,
isPlayed = true,
isToasted = true
)
customDialogInput.setValue("")
} else {
findSale(customDialogInput.getValue(), index)
customDialogInput.setValue("")
scanRequest()
customDialogInput.dismiss()
hideKeyboards()
}
} else {
ma.messageWithSound(
getString(R.string.shelvingError), true, true, "Error", true
)
}
customDialogInput.setValue("")
scanRequest()
customDialogInput.dismiss()
hideKeyboards()
}.setKoButton(getString(R.string.cancel)) {
customDialogInput.dismiss()
}.setValue("").show()
@ -2312,12 +2304,25 @@ class CollectionFragmentPicker(
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
if (!customDialogInput.getValue().isNullOrEmpty()) {
//Tarea 5675
if (customDialogInput.getValue().isParking() || !customDialogInput.getValue()
.isShelving()
) {
ma.messageWithSound(
message = getString(R.string.shelvingError),
isError = true,
isPlayed = true,
isToasted = true
)
customDialogInput.setValue("")
} else {
findSale(customDialogInput.getValue(), index)
}
customDialogInput.setValue("")
scanRequest()
customDialogInput.dismiss()
hideKeyboards()
}
}
return@setOnEditorActionListener true
}
false

View File

@ -22,6 +22,7 @@ import es.verdnatura.domain.ConstAndValues.BASEURLSALIX
import es.verdnatura.domain.ConstAndValues.CONTROLADOR
import es.verdnatura.domain.ConstAndValues.PRINTERNAME
import es.verdnatura.domain.ConstAndValues.SACADOR
import es.verdnatura.domain.isParking
import es.verdnatura.domain.notNull
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
@ -757,7 +758,17 @@ class CollectionFragmentPickerNew(
R.string.take
)
) {
if (customDialogList.getValueTwo().isParking()) {
ma.messageWithSound(
message = getString(R.string.scanItem),
isError = true,
isPlayed = true,
isToasted = true
)
customDialogList.setValueTwo("")
} else {
customDialogTakeAction(pos, itemShelvingFk, totalReserved, false)
}
}.setKoButton(getString(R.string.close)) {
requireActivity().hideKeyboard(customDialogList.getEditTextTwo())
@ -796,7 +807,7 @@ class CollectionFragmentPickerNew(
customDialogList.setValueTwo(
itemScanValue(
customDialogList.getValueTwo(), "buy", "more"
customDialogList.getValueTwo(), arrayOf("buy"), "more"
).toString()
)
val quantityToReserve = customDialogList.getValue().toInt()
@ -945,7 +956,7 @@ class CollectionFragmentPickerNew(
try {
customDialogList.setValue(
itemScanValue(
customDialogList.getValue(), "buy", "more"
customDialogList.getValue(), arrayOf("buy"), "more"
).toString()
)

View File

@ -833,7 +833,7 @@ class CollectionFragmentPickerPreviousNew(
customDialogList.setValueTwo(
itemScanValue(
customDialogList.getValueTwo(), "buy", "more"
customDialogList.getValueTwo(), arrayOf("buy"), "more"
).toString()
)
val quantityToReserve = customDialogList.getValue().toInt()
@ -981,7 +981,7 @@ class CollectionFragmentPickerPreviousNew(
try {
customDialogList.setValue(
itemScanValue(
customDialogList.getValue(), "buy", "more"
customDialogList.getValue(), arrayOf("buy"), "more"
).toString()
)

View File

@ -35,11 +35,9 @@ import es.verdnatura.domain.ConstAndValues.PRINTERNAME
import es.verdnatura.domain.ConstAndValues.SACADOR
import es.verdnatura.domain.ConstAndValues.SECTORDESCRIP
import es.verdnatura.domain.ConstAndValues.SECTORFK
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFK
import es.verdnatura.domain.notNull
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.DataMessageSalix
import es.verdnatura.presentation.common.ItemScanned
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
import es.verdnatura.presentation.common.OnMistakeClickListener
@ -80,7 +78,6 @@ class CollectionFragmentPreChecker(
var type: String = SACADOR
) : BaseFragment<FragmentCollectionBinding, CollectionViewModel>(CollectionViewModel::class) {
private lateinit var dataMessageSalix: DataMessageSalix
private var sales: List<SaleVO> = listOf()
private var salesParent: List<SaleVO> = listOf()
private var saleAdapter: SaleAdapter? = null
@ -961,17 +958,6 @@ class CollectionFragmentPreChecker(
}
private fun getSalePerson(ticketFk: Int): String {
var salePerson = ""
for (it in sales) {
if (it.ticketFk.equals(ticketFk)) {
salePerson = it.salePersonFk ?: ""
break
}
}
return salePerson
}
//CREATE LIST
private fun createCollectionList() {
@ -1613,7 +1599,7 @@ class CollectionFragmentPreChecker(
customDialogList.setValueTwo(
itemScanValue(
customDialogList.getValueTwo(),
"buy",
arrayOf("buy"),
"more"
).toString()
)
@ -1689,7 +1675,7 @@ class CollectionFragmentPreChecker(
customDialogList.setValueTwo(
itemScanValue(
customDialogList.getValueTwo(),
"buy",
arrayOf("buy"),
"more"
).toString()
)
@ -1918,20 +1904,11 @@ class CollectionFragmentPreChecker(
getString(R.string.Todosloscampossonobligatorios).toast(requireContext())
} else {
//sergio datos para mensaje salix
dataMessageSalix = DataMessageSalix(
ticket = ticketSelected,
item = customDialogList.getValue(),
quantity = customDialogList.getValueTwo(),
personSale = getSalePerson(ticketSelected)
)
viewModel.collectionAddItem(
itemFk = customDialogList.getValue().toInt(),
ticketFk = ticketSelected,
quantityFk = customDialogList.getValueTwo().toInt(),
warehouseFk = mobileApplication.dataStoreApp.readDataStoreKey(WAREHOUSEFK)
quantity = customDialogList.getValueTwo().toInt()
)
@ -1954,7 +1931,7 @@ class CollectionFragmentPreChecker(
customDialogList.setValue(
itemScanValue(
customDialogList.getValue(),
"buy",
arrayOf("buy"),
"more"
).toString()
)
@ -1984,20 +1961,10 @@ class CollectionFragmentPreChecker(
getString(R.string.Todosloscampossonobligatorios).toast(requireContext())
} else {
dataMessageSalix = DataMessageSalix(
ticket = ticketSelected,
item = customDialogList.getValue(),
quantity = customDialogList.getValueTwo(),
personSale = getSalePerson(ticketSelected)
)
viewModel.collectionAddItem(
itemFk = customDialogList.getValue().toInt(),
ticketFk = ticketSelected,
quantityFk = customDialogList.getValueTwo().toInt(),
warehouseFk = mobileApplication.dataStoreApp.readDataStoreKey(
WAREHOUSEFK
)
quantity = customDialogList.getValueTwo().toInt(),
)
scanRequest()
customDialogList.dismiss()

View File

@ -13,7 +13,6 @@ import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.CollectionItemSalix
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemExistsItemShelvingSale
import es.verdnatura.presentation.common.ResponseItemVO
@ -194,7 +193,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val loadResponseDel: LiveData<Event<ResponseItemVO>> = _responseDel.map { Event(it) }
val loadResponseAddItem: LiveData<Event<ResponseItemVO>> = _responseCollectionAddItem.map { Event(it) }
val loadResponseAddItem: LiveData<Event<ResponseItemVO>> =
_responseCollectionAddItem.map { Event(it) }
val loadResponseSaleTrackingMark: LiveData<Event<ResponseItemVO>> =
_responseSaleTracking_mark.map { Event(it) }
@ -207,17 +207,12 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
get() = _responseSaleAddPrevOK
fun getSales(
collectionFk: Int,
print: String,
source: String
collectionFk: Int, print: String, source: String
) {
salix.getSalesFromTicketOrCollection(
collectionOrTicketFk = collectionFk,
print = print != "0",
source = source
).enqueue(object :
SalixCallback<CollectionVO>(context) {
collectionOrTicketFk = collectionFk, print = print != "0", source = source
).enqueue(object : SalixCallback<CollectionVO>(context) {
override fun onError(t: Throwable) {
_collectionTicketList.value = CollectionVO(
0,
@ -241,10 +236,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}
fun collectionTicketGet(
collectionFk: Int,
sectorFk: Int,
print: String,
type: String
collectionFk: Int, sectorFk: Int, print: String, type: String
) {
getSales(collectionFk, print, type)
@ -258,10 +250,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
) {
salix.getCollectionTickets(
collectionFk,
hashMapOf("print" to print)
).enqueue(object :
SalixCallback<CollectionTicket>(context) {
collectionFk, hashMapOf("print" to print)
).enqueue(object : SalixCallback<CollectionTicket>(context) {
override fun onError(t: Throwable) {
_collectionTicketSalix.value = CollectionTicket(
0,
@ -276,11 +266,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
_collectionTicketSalix.value = response.body()?.let { it.map(contextApp) }
} else {
_collectionTicketSalix.value = CollectionTicket(
0,
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
0, isError = true, errorMessage = getMessageFromAllResponse(
nameofFunction(this), response.message()
)
)
}
@ -289,16 +276,11 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}
fun collectionGetId(
ticketFk: Int,
sectorFk: Int,
print: String,
type: String
ticketFk: Int, sectorFk: Int, print: String, type: String
) {
salix.getCollectionId(
filter = """{"where":{"ticketFk":$ticketFk},"fields":"collectionFk"}"""
)
.enqueue(object :
SalixCallback<List<JsonObject>>(context) {
).enqueue(object : SalixCallback<List<JsonObject>>(context) {
override fun onError(t: Throwable) {
_collectionTicketList.value = CollectionVO(
0,
@ -318,8 +300,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
)
} else {
_collectionTicketList.value = CollectionVO(
0,
isError = false
0, isError = false
)
}
}
@ -327,16 +308,12 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}
fun itemShelvingSaleExists(
itemShelvingSaleFk: Number,
position: Int,
quantity: Int
itemShelvingSaleFk: Number, position: Int, quantity: Int
) {
salix.itemShelvingSaleExists(
itemShelvingSaleFk
)
.enqueue(object :
SalixCallback<JsonObject>(context) {
).enqueue(object : SalixCallback<JsonObject>(context) {
override fun onSuccess(response: Response<JsonObject>) {
_responseExistsItemShelvingSale.value = ResponseItemExistsItemShelvingSale(
@ -359,16 +336,14 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
SaleTrackingReplaceSalix(
saleFk, originalQuantity, code, isChecked != "0", buyFk, isScanned!!
)
)
/* silex.saleTrackingReplace(
)/* silex.saleTrackingReplace(
saleFk,
originalQuantity,
code,
isChecked != "0",
buyFk,
isScanned!!
)*/
.enqueue(object : SilexCallback<Any>(context) {
)*/.enqueue(object : SilexCallback<Any>(context) {
override fun onError(t: Throwable) {
_responseSaleReplace.value = ResponseItemVO(
isError = true,
@ -404,8 +379,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
quantity = quantity,
isScanned = isScanned!!
)
)
/* silex.saleTracking_mark(
)/* silex.saleTracking_mark(
saleFk,
originalQuantity,
code,
@ -413,8 +387,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
buyFk,
itemShelvingFk,
quantity,
isScanned)*/
.enqueue(object : SilexCallback<Any>(context) {
isScanned)*/.enqueue(object : SilexCallback<Any>(context) {
override fun onError(t: Throwable) {
_responseSaleTracking_mark.value = ResponseItemVO(
isError = true,
@ -425,10 +398,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
override fun onSuccess(response: Response<Any>) {
if (!response.isSuccessful) {
_responseSaleTracking_mark.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
isError = true, errorMessage = getMessageFromAllResponse(
nameofFunction(this), response.message()
)
)
} else {
@ -440,9 +411,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}
fun itemShelvingSaleSetQuantity(
itemShelvingSaleFk: Int,
quantity: Int,
isItemShelvingSaleEmpty: Boolean?
itemShelvingSaleFk: Int, quantity: Int, isItemShelvingSaleEmpty: Boolean?
) {
salix.itemShelvingSaleSetquantitySalix(
params = arrayListOf(itemShelvingSaleFk, quantity, isItemShelvingSaleEmpty)
@ -459,10 +428,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
override fun onSuccess(response: Response<Any>) {
if (!response.isSuccessful) {
_responseConfirmReservedItemShelvingSale.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
isError = true, errorMessage = getMessageFromAllResponse(
nameofFunction(this), response.message()
)
)
} else {
@ -474,17 +441,13 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}
fun collectionAddWithReservation(
item: Int,
quantity: Int,
ticketSelected: Int,
saleGroupFk :Int ?
item: Int, quantity: Int, ticketSelected: Int, saleGroupFk: Int?
) {
salix.collectionAddWithReservation(
params = arrayListOf(item, quantity, ticketSelected, saleGroupFk)
).enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
_responseCollectionAddItem.value =
ResponseItemVO(isError = false, response = "")
_responseCollectionAddItem.value = ResponseItemVO(isError = false, response = "")
}
/* override fun onError(t: Throwable) {
@ -498,8 +461,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}
fun confirmItemShelvingReservedUpdate(
itemShelvingSaleFk: Int,
isPicked: Boolean
itemShelvingSaleFk: Int, isPicked: Boolean
) {
salix.itemShelvingsReservedUpdate(
id = itemShelvingSaleFk, params = hashMapOf("isPicked" to isPicked)
@ -514,10 +476,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
override fun onSuccess(response: Response<Any>) {
if (!response.isSuccessful) {
_responseConfirmReservedUpdate.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
isError = true, errorMessage = getMessageFromAllResponse(
nameofFunction(this), response.message()
)
)
} else {
@ -529,18 +489,13 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}
fun itemPlacementSupplyAiming(
shelvingFk: String,
quantity: Int,
itemFk: Int
shelvingFk: String, quantity: Int, itemFk: Int
) {
salix.itemPlacementSupplyAiming(
arrayListOf(
shelvingFk,
quantity,
itemFk
shelvingFk, quantity, itemFk
).formatWithQuotes()
).enqueue(object :
SalixCallback<List<PlacementSupplyVO>>(context) {
).enqueue(object : SalixCallback<List<PlacementSupplyVO>>(context) {
override fun onSuccess(response: Response<List<PlacementSupplyVO>>) {
if (response.body() != null) {
_placementSuppleyList.value = response.body()?.let { PlacementSupplyListVO(it) }
@ -551,8 +506,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
itemShelvingFk = 0,
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
nameofFunction(this), response.message()
)
)
)
@ -576,13 +530,11 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}
fun collectionStickerPrint(
collectionFk: Int,
labelCount: Int?
collectionFk: Int, labelCount: Int?
) {
salix.collectionStickerPrint(
arrayListOf(
collectionFk,
labelCount
collectionFk, labelCount
)
).enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
@ -600,14 +552,11 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}
fun ticketCollection_setUsedShelves(
ticketFk: Int,
usedShelves: Int
ticketFk: Int, usedShelves: Int
) {
salix.ticketCollectionUpdate(
"""where={"ticketFk":$ticketFk}""",
hashMapOf("usedShelves" to usedShelves)
)
.enqueue(object : SalixCallback<Unit>(context) {
"""where={"ticketFk":$ticketFk}""", hashMapOf("usedShelves" to usedShelves)
).enqueue(object : SalixCallback<Unit>(context) {
override fun onError(t: Throwable) {
_responseUsedShelves.value = ResponseItemVO(
@ -687,26 +636,24 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}
fun collectionAddItem(
itemFk: Int,
quantityFk: Int,
ticketFk: Int,
warehouseFk: Int
itemFk: Int, quantity: Int, ticketFk: Int
) {
//Tarea 6276 OK
salix.addSaleByCode(
//Tarea 6889
salix.addSale(
id = ticketFk,
barcode = itemFk.toString(),
quantity = quantity
)
/* salix.addSaleByCode(
CollectionItemSalix(
itemFk.toString(),
quantityFk,
ticketFk,
warehouseFk
)
)
/*silex.collectionAddItem(
itemFk,
quantityFk,
ticketFk,
warehouseFk
)*/
.enqueue(object : SalixCallback<Any>(context) {
override fun onError(t: Throwable) {
@ -805,8 +752,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
//Tarea 6276
salix.saleTrackingDel(
SaleTrackingDelSalix(
saleFk = saleFk,
stateCodes = listOf("CHECKED", "OK", "PREPARED")
saleFk = saleFk, stateCodes = listOf("CHECKED", "OK", "PREPARED")
)
)
//silex.saleTrackingDel(saleFk)
@ -848,8 +794,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}
fun setParking(
ticketFk: Int,
parking: String
ticketFk: Int, parking: String
) {
salix.setParking(arrayListOf(ticketFk, parking).formatWithQuotes())
.enqueue(object : SalixCallback<Any>(context) {
@ -868,14 +813,12 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}
fun ticketStateTodaySetState(
ticketFk: Int,
state: String
ticketFk: Int, state: String
) {
salix.ticketStateTodaySetState(arrayListOf(ticketFk, state).formatWithQuotes())
.enqueue(object : SalixCallback<Unit>(context) {
override fun onSuccess(response: Response<Unit>) {
_response.value =
ResponseItemVO(isError = false, response = "")
_response.value = ResponseItemVO(isError = false, response = "")
}
override fun onError(t: Throwable) {
@ -888,8 +831,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}
fun getIdFromCodeSalix(code: String) {
salix.barcodes_toitem(code)
.enqueue(object : SalixCallback<String?>(context) {
salix.barcodes_toitem(code).enqueue(object : SalixCallback<String?>(context) {
override fun onError(t: Throwable) {
_responseCode.value = ResponseItemVO(
isError = true,
@ -899,10 +841,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
override fun onSuccess(response: Response<String?>) {
_responseCode.value =
ResponseItemVO(
isError = false,
response = if (response.body() == null) "" else {
_responseCode.value = ResponseItemVO(
isError = false, response = if (response.body() == null) "" else {
response!!.body().toString()
}
)
@ -912,8 +852,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}
fun collectionIncreaseQuantitySalix(
saleFk: Int,
quantity: String
saleFk: Int, quantity: String
) {
salix.collectionIncreaseQuantitySalix(
SalixSaleQuantity(saleId = saleFk, quantity = quantity.toInt())
@ -935,19 +874,14 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}
fun saleMistakeAdd(
saleFk: Int,
typeFk: Int
saleFk: Int, typeFk: Int
) {
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) {
).enqueue(object : SalixCallback<Any>(context) {
override fun onError(t: Throwable) {
_responseSaleMistakeAdd.value = ResponseItemVO(
isError = true,
@ -964,8 +898,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}
fun mistakeType() {
salix.getMistakeTypes()
.enqueue(object : SalixCallback<List<MistakeTypeVO>>(context) {
salix.getMistakeTypes().enqueue(object : SalixCallback<List<MistakeTypeVO>>(context) {
override fun onSuccess(response: Response<List<MistakeTypeVO>>) {
if (response.body() != null) {
_mistakeList.value = response.body()?.let { MistakeTypeListVO(it) }
@ -989,8 +922,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
) {
salix.ticketIsOutClosureZone(
arrayListOf(ticketFk)
).enqueue(object :
SalixCallback<Any?>(context) {
).enqueue(object : SalixCallback<Any?>(context) {
override fun onSuccess(response: Response<Any?>) {
_responseTicketClosure.value = ResponseItemVO(
isError = false,
@ -1014,8 +946,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
salix.ticketState(
"""{"where": {"ticketFk": "$ticketFk"},"include":[{"relation":"user","scope":{"fields":["username"]}}]}"""
).enqueue(object :
SalixCallback<List<TicketState>>(context) {
).enqueue(object : SalixCallback<List<TicketState>>(context) {
override fun onSuccess(response: Response<List<TicketState>>) {
_responseTicketState.value = if (response.body()!!.isEmpty()) {
TicketState()
@ -1030,8 +961,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
fun callBackSalix(function: String, params: ArrayList<Any>) {
salix.executeFunc(
routine = function, params = params
).enqueue(object :
SalixCallback<Any>(context) {
).enqueue(object : SalixCallback<Any>(context) {
override fun onError(t: Throwable) {
_responseTicketClosure.value = ResponseItemVO(
@ -1042,9 +972,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
override fun onSuccess(response: Response<Any>) {
_responseTicketClosure.value = ResponseItemVO(
isError = false,
response = response.body()!!.toString(),
errorMessage = ""
isError = false, response = response.body()!!.toString(), errorMessage = ""
)
}
@ -1057,8 +985,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
) {
salix.hasUncheckedTicket(collectionFk)
//silex.collection_getUncheckedTicket(collectionFk)
.enqueue(object :
SalixCallback<String>(context) {
.enqueue(object : SalixCallback<String>(context) {
override fun onError(t: Throwable) {
_responseCollectionUnchecked.value = ResponseItemVO(
isError = true,
@ -1070,17 +997,14 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
if (response.body() != null) {
_responseCollectionUnchecked.value = ResponseItemVO(
isError = false,
response = response.body()!!,
errorMessage = ""
isError = false, response = response.body()!!, errorMessage = ""
)
} else {
_responseCollectionUnchecked.value = ResponseItemVO(
isError = true,
response = response.body()!!.toString(),
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
nameofFunction(this), response.message()
)
)
}
@ -1089,16 +1013,13 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}
fun collection_setState(
collectionFk: Int,
state: String
collectionFk: Int, state: String
) {
salix.collectionSetState(
params = arrayListOf(
collectionFk,
state
collectionFk, state
).formatWithQuotes()
)
.enqueue(object : SalixCallback<Any?>(context) {
).enqueue(object : SalixCallback<Any?>(context) {
override fun onError(t: Throwable) {
_responseState.value = ResponseItemVO(
@ -1109,8 +1030,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}
override fun onSuccess(response: Response<Any?>) {
_responseState.value =
ResponseItemVO(isError = false, response = "")
_responseState.value = ResponseItemVO(isError = false, response = "")
super.onSuccess(response)
}
})

View File

@ -62,7 +62,7 @@ class ControladorFragment :
try {
binding.scanInput.setText(
itemScanValue(
binding.scanInput.text.toString(), "ticket", "id"
binding.scanInput.text.toString(), arrayOf("ticket","saleGroup"), "id"
).toString().toInt().toString(),
)
} catch (ex: Exception) {
@ -77,7 +77,7 @@ class ControladorFragment :
try {
collectionViewModel!!.ticketState(
itemScanValue(
binding.scanInput.text.toString(), "ticket", "id"
binding.scanInput.text.toString(), arrayOf("ticket","saleGroup"), "id"
).toString().toInt()
)
} catch (ex: Exception) {
@ -107,12 +107,11 @@ class ControladorFragment :
viewModel.getSales(
collectionFk = itemScanValue(
binding.scanInput.text.toString(), "ticket", "id"
binding.scanInput.text.toString(), arrayOf("ticket","saleGroup"), "id"
).toString().toInt(),
print = false,
source = ConstAndValues.ON_CHECKING
)
println("Qrtest4")
/* viewModel.getSales(
collectionFk = binding.scanInput.text.toString()
@ -129,12 +128,11 @@ class ControladorFragment :
} else {
viewModel.getSales(
collectionFk = itemScanValue(
binding.scanInput.text.toString(), "ticket", "id"
binding.scanInput.text.toString(), arrayOf("ticket","saleGRoup"), "id"
).toString().toInt(),
print = false,
source = ConstAndValues.ON_CHECKING
)
println("Qrtest3")
/* viewModel.getSales(
collectionFk = binding.scanInput.text.toString().toInt(),

View File

@ -19,7 +19,6 @@ 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
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
@ -30,6 +29,7 @@ import es.verdnatura.presentation.common.OnSaleClickListener
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
import es.verdnatura.presentation.common.addViewObserver
import es.verdnatura.presentation.common.hideKeyboard
import es.verdnatura.presentation.common.itemScanIsQr
import es.verdnatura.presentation.common.itemScanValue
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput
@ -133,47 +133,43 @@ class EndSacadorFragment(
if (!binding.scanInput.text.toString().isNullOrEmpty()) {
// originalScanned=binding.scanInput.text
if (itemScanIsQr(binding.scanInput.text.toString())) {
ticket = itemScanValue(
binding.scanInput.text.toString(),
arrayOf("saleGroup"),
"id"
) as Int
addSaleGroupToCollection(ticket)
} else {
if (binding.scanInput.text.contains("-")) {
//es parking
pasillerosItemClickListener?.onPasillerosItemClickListener(
PasillerosItemVO(
title = getString(R.string.Parking)
), ""
)
// parkingTicket(binding.scanInput.text.toString())
} else {
//if (binding.scanInput.text.length > 6){
// miramos si el primer digito es un numero de esta manera sabemos que no es una matrícula que sería el findsale
if (binding.scanInput.text.first().isDigit()) {
//es ticket
ticket = binding.scanInput.toInt()
try {
searchTicket(ticket)
} catch (ex: Exception) {
getString(R.string.errorInputTicketParking).toast(requireContext())
}
} else {
//es sale
findSale(binding.scanInput.text.toString())
}
}
}
binding.scanInput.setText("")
hideKeyboards()
return@setOnEditorActionListener true
}
true
}
}
hideKeyboards()
hideKeyboards()
//LISTA =========
binding.collectionSwipe.setOnRefreshListener {
//LISTA =========
binding.collectionSwipe.setOnRefreshListener {
if (::sales.isInitialized) {
sales.clear()
@ -181,11 +177,11 @@ class EndSacadorFragment(
}
searchSaleCollection()
binding.collectionSwipe.isRefreshing = false
}
}
}
}
@RequiresApi(Build.VERSION_CODES.O)
override fun observeViewModel() {
@RequiresApi(Build.VERSION_CODES.O)
override fun observeViewModel() {
with(viewModel) {
salesList.observe(viewLifecycleOwner, Observer {
createSaleList(it)
@ -317,7 +313,6 @@ class EndSacadorFragment(
})
responseSaleupdateIsChecked.observe(viewLifecycleOwner, Observer {
if (!goBack) {
if (it.isError) {
ma.messageWithSound(
@ -381,9 +376,9 @@ class EndSacadorFragment(
})
}
}
}
private fun responseSaleMoveSuccesful() {
private fun responseSaleMoveSuccesful() {
try {
sales[positionCollectionSplit].saldo = quantityCollectionSplit.toInt()
@ -396,9 +391,9 @@ class EndSacadorFragment(
markLine(positionCollectionSplit)
saleAdapter!!.notifyDataSetChanged()
}
}
private fun incresaseSuccesful() {
private fun incresaseSuccesful() {
try {
sales[positionIncreaseQuantity].saldo = quantityIncrease.toInt()
@ -410,19 +405,19 @@ class EndSacadorFragment(
searchSaleCollection()
}
}
//CREATE LIST
private fun searchSaleCollection() {
private fun searchSaleCollection() {
viewModel.sectorCollectionGetSale(
collection.collectionFk,
sectorFk = mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK)
)
}
}
private fun searchTicket(ticketFk: Int) {
private fun searchTicket(ticketFk: Int) {
ticket = ticketFk
@ -431,9 +426,20 @@ class EndSacadorFragment(
ticketFk,
collection.collectionFk
)
}
}
private fun createSaleList(salesList: List<PreSacadorItemVO>) {
private fun addSaleGroupToCollection(ticketFk: Int) {
ticket = ticketFk
if (ticketFk != 0)
viewModel.sectorCollectionSaleGroupAdd(
ticketFk,
collection.collectionFk
)
}
private fun createSaleList(salesList: List<PreSacadorItemVO>) {
if (salesList.isNullOrEmpty()) {
@ -509,9 +515,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) {
@ -519,9 +525,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 +546,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 +589,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 +622,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 +645,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 +669,10 @@ class EndSacadorFragment(
}.show()
}
}
}
//SHELVINGS
private fun showShelving(position: Int, shelvingPosition: Int) {
//SHELVINGS
private fun showShelving(position: Int, shelvingPosition: Int) {
storedShelvingPosition = shelvingPosition
storedPosition = position
var quantityGet = 0
@ -679,10 +685,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 = ""
@ -711,7 +717,7 @@ class EndSacadorFragment(
customDialogList.setValueTwo(
itemScanValue(
customDialogList.getValueTwo(),
"buy",
arrayOf("buy"),
"more"
).toString()
)
@ -766,7 +772,7 @@ class EndSacadorFragment(
customDialogList.setValueTwo(
itemScanValue(
customDialogList.getValueTwo(),
"buy",
arrayOf("buy"),
"id"
).toString()
)
@ -819,9 +825,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
@ -856,14 +862,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))
@ -881,9 +887,9 @@ class EndSacadorFragment(
false
}
}
}
private fun customDialogInputAction(index: Int) {
private fun customDialogInputAction(index: Int) {
if (!customDialogInput.getValue().isNullOrEmpty()) {
findSale(customDialogInput.getValue(), index)
customDialogInput.setValue("")
@ -891,10 +897,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()
@ -937,44 +943,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
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.itemSaleQuantity))
.setValue("")
@ -991,9 +997,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
@ -1002,6 +1008,6 @@ class EndSacadorFragment(
quantity = quantity
)
}
}
}

View File

@ -2,12 +2,10 @@ package es.verdnatura.presentation.view.feature.presacador.fragment
import android.content.Context
import android.graphics.drawable.Drawable
import android.os.Build
import android.text.InputType
import android.view.View
import android.view.inputmethod.EditorInfo
import android.widget.ImageView
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentSacadorBinding
@ -78,13 +76,9 @@ class InitPreSacadorFragment(
iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
iconAdd.setImageResource(R.drawable.ic_add_black_24dp)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconAdd.tooltipText = getTooltip(R.drawable.ic_add_black_24dp)
iconPrint.tooltipText = getTooltip(R.drawable.ic_print_black_24dp)
}
listIcons.add(iconAdd)
binding.mainToolbar.toolbarIcons.adapter =
@ -165,15 +159,15 @@ class InitPreSacadorFragment(
with(viewModel) {
collectionList.observe(viewLifecycleOwner, Observer {
collectionList.observe(viewLifecycleOwner) {
if (!goBack2) createCollectionList(it.list)
goBack2 = false
})
}
response.observe(viewLifecycleOwner, Observer {
response.observe(viewLifecycleOwner) {
if (goBack) addCollectionToList(it.response.toInt())
goBack = false
})
}
}
}

View File

@ -79,7 +79,7 @@ class AutomaticAddItemFragment(
0,
itemScanValue(
textScanned_filterDouble(binding.editMatricula.text.toString()),
"buy",
arrayOf("buy"),
"more"
).toString().toLong()