This commit is contained in:
Sergio De la torre 2023-11-06 16:48:31 +01:00
parent f8272a4df2
commit 9ee06e52b0
2 changed files with 87 additions and 59 deletions

View File

@ -208,10 +208,10 @@ class UbicadorFragment(
iconReset.drawable -> { iconReset.drawable -> {
customDialog.setTitle(getString(R.string.checkItemShelvingDescrip)) customDialog.setTitle(getString(R.string.checkItemShelvingDescrip))
.setDescription(getString(R.string.checkItemShelving)) .setDescription(getString(R.string.checkItemShelving))
.setOkButton(getString(R.string.cancel)) { .setOkButton(getString(R.string.ok)) {
customDialog.dismiss() // viewModel.itemShelvingDelete()
} }
.setKoButton(getString(R.string.ok)) { .setKoButton(getString(R.string.cancel)) {
customDialog.dismiss() customDialog.dismiss()
} }
@ -312,26 +312,32 @@ class UbicadorFragment(
} }
binding.parkingImg.setOnClickListener { binding.parkingImg.setOnClickListener {
customDialogInput.setTitle(getString(R.string.parkingShelving)).setValue("") if (!shelvingFk.isNullOrBlank()) {
.setOkButton( customDialogInput.setTitle(getString(R.string.parkingShelving)).setValue("")
getString( .setOkButton(
R.string.parking getString(
) R.string.parking
) { )
viewModel.shelvingPark( ) {
shelvingFk, viewModel.shelvingPark(
customDialogInput.getValue() shelvingFk,
) customDialogInput.getValue()
parking = customDialogInput.getValue() )
binding.mainToolbar.toolbarTitle.text = parking = customDialogInput.getValue()
shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString( binding.mainToolbar.toolbarTitle.text =
R.string.label shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString(
) + etiquetas R.string.label
customDialogInput.dismiss() ) + etiquetas
}.setKoButton(getString(R.string.cancel)) { customDialogInput.dismiss()
customDialogInput.dismiss() }.setKoButton(getString(R.string.cancel)) {
}.show() customDialogInput.dismiss()
}.show()
} else {
getString(R.string.errorShelving).toast(
requireContext()
)
}
customDialogInput.getEditText().requestFocus() customDialogInput.getEditText().requestFocus()
ma.hideKeyboard(customDialogInput.getEditText()) ma.hideKeyboard(customDialogInput.getEditText())
@ -357,27 +363,39 @@ class UbicadorFragment(
} }
binding.editImg.setOnClickListener { binding.editImg.setOnClickListener {
customDialogInput.setTitle(getString(R.string.changeShelving)).setValue("") if (!shelvingFk.isNullOrBlank()
.setOkButton(getString(R.string.save)) { ) {
viewModel.shelvingChangeSalix( customDialogInput.setTitle(getString(R.string.changeShelving)).setValue("")
shelvingFk,customDialogInput.getValue() .setOkButton(getString(R.string.save)) {
) if (!customDialogInput.getValue().isNullOrBlank()) {
shelvingFk = customDialogInput.getValue() viewModel.shelvingChangeSalix(
binding.mainToolbar.toolbarTitle.text = shelvingFk, customDialogInput.getValue()
shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString( )
R.string.label shelvingFk = customDialogInput.getValue()
) + etiquetas binding.mainToolbar.toolbarTitle.text =
// if (mpok != null) mpok!!.start() shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString(
customDialogInput.dismiss() R.string.label
}.setKoButton(getString(R.string.cancel)) { ) + etiquetas
customDialogInput.dismiss() } else {
}.show() getString(R.string.errorShelving).toast(
requireContext()
)
}
customDialogInput.dismiss()
}.setKoButton(getString(R.string.cancel)) {
customDialogInput.dismiss()
}.show()
} else {
getString(R.string.errorShelving).toast(
requireContext()
)
}
customDialogInput.getEditText().requestFocus() customDialogInput.getEditText().requestFocus()
ma.hideKeyboard(customDialogInput.getEditText()) ma.hideKeyboard(customDialogInput.getEditText())
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event -> customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
viewModel.shelvingChangeSalix( viewModel.shelvingChangeSalix(
shelvingFk, shelvingFk,
customDialogInput.getValue() customDialogInput.getValue()
@ -387,7 +405,7 @@ class UbicadorFragment(
shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString( shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString(
R.string.label R.string.label
) + etiquetas ) + etiquetas
// if (mpok != null) mpok!!.start()
customDialogInput.dismiss() customDialogInput.dismiss()
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
@ -397,27 +415,35 @@ class UbicadorFragment(
} }
binding.deleteImg.setOnClickListener { binding.deleteImg.setOnClickListener {
customDialog.setTitle(getString(R.string.empty)) if (!shelvingFk.isNullOrBlank()) {
.setDescription(getString(R.string.operationNoReturn)) customDialog.setTitle(getString(R.string.empty))
.setOkButton(getString(R.string.empty)) { .setDescription(getString(R.string.operationNoReturn))
viewModel.clearShelvingList( .setOkButton(getString(R.string.empty)) {
shelvingFk
) viewModel.clearShelvingList(
listItems.forEach { shelvingFk
it.stickers = "0" )
it.visible = "0" listItems.forEach {
it.stickers = "0"
it.visible = "0"
}
if (adapter != null) {
adapter!!.notifyDataSetChanged()
}
customDialog.dismiss()
} }
if (adapter != null) {
adapter!!.notifyDataSetChanged() customDialog.setKoButton(getString(R.string.cancel)) {
}
customDialog.dismiss()
}.setKoButton(getString(R.string.cancel)) {
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()
} else {
getString(R.string.errorShelving).toast(
requireContext()
)
}
} }
} }
private fun checkUbications(itemScanned: Int) { private fun checkUbications(itemScanned: Int) {
@ -637,7 +663,7 @@ class UbicadorFragment(
ma.messageWithSound(it.errorMessage, it.isError, true) ma.messageWithSound(it.errorMessage, it.isError, true)
} else { } else {
checkUbications(it.response.toDouble().roundToInt()) checkUbications(it.response.toDouble().roundToInt())
} }
} }
} }
@ -686,7 +712,9 @@ class UbicadorFragment(
if (customDialogInput.getValue().toInt() > 0) { if (customDialogInput.getValue().toInt() > 0) {
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
var quantity = var quantity =
if (item.visible.toInt() - customDialogInput.getValue().toInt() > 0) { if (item.visible.toInt() - customDialogInput.getValue()
.toInt() > 0
) {
item.visible.toInt() - customDialogInput.getValue().toInt() item.visible.toInt() - customDialogInput.getValue().toInt()
} else { } else {
0 0

View File

@ -268,7 +268,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
vShelvingFk: String vShelvingFk: String
) { ) {
salix.itemShelvingsUpdate(id= """{"id":$vShelf}""", params= hashMapOf("shelvingFk" to vShelvingFk)) salix.itemShelvingsUpdate(where = """{"id":$vShelf}""", params= hashMapOf("shelvingFk" to vShelvingFk))
.enqueue(object : SilexCallback<Any>(context) { .enqueue(object : SilexCallback<Any>(context) {
override fun onError(t: Throwable) { override fun onError(t: Throwable) {
_response.value = ResponseItemVO( _response.value = ResponseItemVO(
@ -377,7 +377,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
) { ) {
salix.itemShelvingsUpdate( salix.itemShelvingsUpdate(
id = JsonObject().apply { addProperty("shelvingFk", shelvingFk) }, where = JsonObject().apply { addProperty("shelvingFk", shelvingFk) },
hashMapOf("visible" to 0) hashMapOf("visible" to 0)
) )
.enqueue(object : SalixCallback<Any>(context) { .enqueue(object : SalixCallback<Any>(context) {
@ -402,7 +402,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
) { ) {
salix.itemShelvingsUpdate( salix.itemShelvingsUpdate(
id = JsonObject().apply { addProperty("shelvingFk", shelvingFkIn) }, where = JsonObject().apply { addProperty("shelvingFk", shelvingFkIn) },
hashMapOf("shelvingFk" to shelvingFkOut) hashMapOf("shelvingFk" to shelvingFkOut)
) )
.enqueue(object : SalixCallback<Any>(context) { .enqueue(object : SalixCallback<Any>(context) {