refs #5652 setItemVisible
This commit is contained in:
parent
aeabd7b353
commit
97d981fe89
|
@ -77,14 +77,12 @@ class ItemCardFragment(
|
|||
customDialogTwo = CustomDialogTwoButtons(requireContext())
|
||||
customDynamic = CustomDialogDynamicButtons(requireContext(), this)
|
||||
|
||||
|
||||
if (!itemFk.isNullOrEmpty()) {
|
||||
if (itemFk.isNotEmpty()) {
|
||||
getItemCard(itemFk)
|
||||
}
|
||||
setToolBar()
|
||||
super.init()
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun setToolBar() {
|
||||
|
@ -128,13 +126,12 @@ class ItemCardFragment(
|
|||
itemInfoG!!.id.toString()
|
||||
)
|
||||
|
||||
|
||||
}
|
||||
|
||||
iconSalix.drawable -> {
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
var itemId = itemInfoG!!.id
|
||||
var entryPoint = Gson().toJson(
|
||||
val itemId = itemInfoG!!.id
|
||||
val entryPoint = Gson().toJson(
|
||||
mutableMapOf(
|
||||
"entryPoint" to itemId,
|
||||
"web" to "${getData("base_urlSalix")}/#!/item/$itemId/summary"
|
||||
|
@ -166,8 +163,7 @@ class ItemCardFragment(
|
|||
|
||||
binding.editItemFk.setOnEditorActionListener { _, actionId, _ ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||
if (!binding.editItemFk.text.toString().isNullOrEmpty())
|
||||
//Tarea#5109
|
||||
if (binding.editItemFk.text.toString().isNotEmpty())
|
||||
try {
|
||||
getItemCard(
|
||||
itemScanValue(
|
||||
|
@ -180,7 +176,6 @@ class ItemCardFragment(
|
|||
ma.messageWithSound(ex.message.toString(), true, true)
|
||||
}
|
||||
|
||||
// getItemCard(binding.editItemFk.text.toString())
|
||||
binding.editItemFk.setText("")
|
||||
ma.hideKeyboard(binding.editItemFk)
|
||||
return@setOnEditorActionListener true
|
||||
|
@ -191,6 +186,9 @@ class ItemCardFragment(
|
|||
binding.mainToolbar.backButton.setOnClickListener {
|
||||
|
||||
requireActivity().onBackPressed()
|
||||
customDynamic.removeViewsDialog()
|
||||
customDynamic.cancel()
|
||||
|
||||
}
|
||||
|
||||
binding.itemcardImage.setOnClickListener {
|
||||
|
@ -259,7 +257,7 @@ class ItemCardFragment(
|
|||
addressLosesList.observe(viewLifecycleOwner, Observer {
|
||||
binding.splashProgress.visibility = GONE
|
||||
if (it.list.isEmpty()) {
|
||||
ma.messageWithSound(getString(R.string.empty), true, false)
|
||||
ma.messageWithSound(getString(R.string.NotAddress), true, false)
|
||||
} else {
|
||||
showDialogTrashFault(it.list)
|
||||
}
|
||||
|
@ -278,6 +276,7 @@ class ItemCardFragment(
|
|||
itemsPackingType.add(ItemPackingType(item.code, item.description))
|
||||
|
||||
} catch (e: Exception) {
|
||||
getString(R.string.errorInput).toast(requireContext())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -417,143 +416,52 @@ class ItemCardFragment(
|
|||
adapter = ItemCardAdapter(listItemsRow, object : OnItemCardRowClickListener {
|
||||
override fun onItemCardRowClickListener(item: ItemCardRowVO) {
|
||||
|
||||
if (item.action == "itemProposal") {
|
||||
when (item.action) {
|
||||
"itemProposal" -> {
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = getString(R.string.titleSearchSimilarItems)
|
||||
), itemInfoG!!.id.toString()
|
||||
)
|
||||
}
|
||||
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = getString(R.string.titleSearchSimilarItems)
|
||||
), itemInfoG!!.id.toString()
|
||||
)
|
||||
"toBarcode" -> {
|
||||
prepareBarcodeDialog()
|
||||
}
|
||||
|
||||
} else {
|
||||
if (item.action == "updateSector") {
|
||||
showDialogSelectItemTypePacking()
|
||||
} else {
|
||||
if (item.action != "toBarcode" && item.action != "buscarItem" && item.action != "itemStockUpdateAdd" && item.action != "itemStockUpdateRemove") {
|
||||
customDialogInput.setTitle(item.title!!)
|
||||
.setDescription(
|
||||
getString(R.string.currentVAlue) + if (item.value.isNullOrEmpty()) "" else {
|
||||
item.value
|
||||
}
|
||||
)
|
||||
.setOkButton(getString(R.string.save)) {
|
||||
ma.hideKeyboard(customDialogInput.getEditText())
|
||||
"buscarItem" -> {
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = getString(R.string.titleItemSearch)
|
||||
), itemInfoG!!.id.toString()
|
||||
)
|
||||
}
|
||||
|
||||
//Tarea 6182
|
||||
try {
|
||||
editItemCardRow(item, customDialogInput.getValue().toInt())
|
||||
} catch (ex: Exception) {
|
||||
if (item.action == "itemSaveStem" && customDialogInput.getValue()
|
||||
.isNullOrBlank()
|
||||
)
|
||||
viewModel.item_saveStems(
|
||||
itemFk = itemInfoG!!.id,
|
||||
value = null
|
||||
) else {
|
||||
getString(R.string.errorInput).toast(requireContext())
|
||||
}
|
||||
"itemStockUpdateRemove", "itemStockUpdateAdd" -> {
|
||||
customDialogInput.getEditText().setRawInputType(
|
||||
InputType.TYPE_CLASS_NUMBER
|
||||
)
|
||||
showCustomDialog(
|
||||
item, if (item.action == "itemStockUpdateRemove") {
|
||||
getString(R.string.quantityToUnregister)
|
||||
} else {
|
||||
getString(R.string.quantityToRegister)
|
||||
}
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
customDialogInput.dismiss()
|
||||
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
ma.hideKeyboard(customDialogInput.getEditText())
|
||||
customDialogInput.dismiss()
|
||||
}.setValue("").show()
|
||||
customDialogInput.getEditText().requestFocus()
|
||||
customDialogInput.getEditText()
|
||||
.setOnEditorActionListener { _, actionId, _ ->
|
||||
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
if (!customDialogInput.getValue().isNullOrEmpty())
|
||||
editItemCardRow(
|
||||
item,
|
||||
customDialogInput.getValue().toInt()
|
||||
)
|
||||
customDialogInput.setValue("")
|
||||
customDialogInput.dismiss()
|
||||
ma.hideKeyboard(customDialogInput.getEditText())
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
} else if (item.action == "toBarcode") {
|
||||
//BARCODE ROW
|
||||
prepareBarcodeDialog(item)
|
||||
} else if (item.action == "buscarItem") {
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = getString(R.string.titleItemSearch)
|
||||
), itemInfoG!!.id.toString()
|
||||
)
|
||||
} else if (item.action == "itemStockUpdateAdd") {
|
||||
customDialogInput.setTitle(item.title!!)
|
||||
.setDescription(getString(R.string.quantityToRegister))
|
||||
.setOkButton(getString(R.string.save)) {
|
||||
ma.hideKeyboard(customDialogInput.getEditText())
|
||||
editItemCardRow(item, customDialogInput.getValue().toInt())
|
||||
customDialogInput.dismiss()
|
||||
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
ma.hideKeyboard(customDialogInput.getEditText())
|
||||
customDialogInput.dismiss()
|
||||
}.setValue("").show()
|
||||
customDialogInput.getEditText().requestFocus()
|
||||
customDialogInput.getEditText()
|
||||
.setOnEditorActionListener { _, actionId, _ ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
if (!customDialogInput.getValue().isNullOrEmpty())
|
||||
editItemCardRow(
|
||||
item,
|
||||
customDialogInput.getValue().toInt()
|
||||
)
|
||||
customDialogInput.setValue("")
|
||||
customDialogInput.dismiss()
|
||||
ma.hideKeyboard(customDialogInput.getEditText())
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
} else if (item.action == "itemStockUpdateRemove") {
|
||||
customDialogInput.getEditText().setRawInputType(
|
||||
InputType.TYPE_CLASS_NUMBER
|
||||
)
|
||||
customDialogInput.setTitle(item.title!!)
|
||||
.setDescription(getString(R.string.quantityToUnregister))
|
||||
.setOkButton(getString(R.string.save)) {
|
||||
ma.hideKeyboard(customDialogInput.getEditText())
|
||||
editItemCardRow(item, customDialogInput.getValue().toInt())
|
||||
customDialogInput.dismiss()
|
||||
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
ma.hideKeyboard(customDialogInput.getEditText())
|
||||
customDialogInput.dismiss()
|
||||
}.setValue("").show()
|
||||
customDialogInput.getEditText().requestFocus()
|
||||
customDialogInput.getEditText()
|
||||
.setOnEditorActionListener { _, actionId, _ ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
if (!customDialogInput.getValue().isNullOrEmpty())
|
||||
editItemCardRow(
|
||||
item,
|
||||
customDialogInput.getValue().toInt()
|
||||
)
|
||||
customDialogInput.setValue("")
|
||||
customDialogInput.dismiss()
|
||||
ma.hideKeyboard(customDialogInput.getEditText())
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
showCustomDialog(
|
||||
item, getString(R.string.currentVAlue)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
//itemcard_recyclerview.adapter = adapter
|
||||
binding.itemcardRecyclerview.adapter = adapter
|
||||
//itemcard_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
binding.itemcardRecyclerview.layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
binding.scrollView.post {
|
||||
|
@ -564,243 +472,289 @@ class ItemCardFragment(
|
|||
binding.splashProgressTwo.visibility = GONE
|
||||
}
|
||||
|
||||
private fun editItemCardRow(item: ItemCardRowVO, value: Int) {
|
||||
private fun showCustomDialog(item: ItemCardRowVO, textDescrip: String) {
|
||||
|
||||
customDialogInput.setTitle(item.title!!)
|
||||
.setDescription(textDescrip)
|
||||
.setOkButton(getString(R.string.save)) {
|
||||
customDialogAdd(item)
|
||||
customDialogInput.dismiss()
|
||||
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
ma.hideKeyboard(customDialogInput.getEditText())
|
||||
customDialogInput.dismiss()
|
||||
}.setValue("").show()
|
||||
customDialogInput.getEditText().requestFocus()
|
||||
customDialogInput.getEditText()
|
||||
.setOnEditorActionListener { _, actionId, _ ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
customDialogAdd(item)
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
private fun customDialogAdd(item: ItemCardRowVO) {
|
||||
try {
|
||||
if (customDialogInput.getValue().isNotEmpty())
|
||||
editItemCardRow(
|
||||
item,
|
||||
customDialogInput.getValue().toInt()
|
||||
)
|
||||
customDialogInput.setValue("")
|
||||
customDialogInput.dismiss()
|
||||
ma.hideKeyboard(customDialogInput.getEditText())
|
||||
} catch (ex: Exception) {
|
||||
getString(R.string.errorInput).toast(requireContext())
|
||||
}
|
||||
}
|
||||
|
||||
private fun editItemCardRow(item: ItemCardRowVO, value: Int) {
|
||||
println("item $item.action")
|
||||
when (item.action) {
|
||||
"itemStockUpdateAdd" -> {
|
||||
showProgress()
|
||||
viewModel.itemTrash(
|
||||
viewModel.setVisibleDiscard(itemInfoG!!.id, warehouseFk!!, value * -1, null)
|
||||
/*viewModel.itemTrash(
|
||||
itemFk = itemInfoG!!.id,
|
||||
warehouseFk = warehouseFk!!,
|
||||
newValue = (value * -1),
|
||||
isTrash = false
|
||||
|
||||
)*/
|
||||
}
|
||||
|
||||
"itemStockUpdateRemove" -> prepareItemStockUpdate2(item, value)
|
||||
"updateGrouping" ->
|
||||
viewModel.updateGrouping(
|
||||
itemFk = itemInfoG!!.id,
|
||||
value = value,
|
||||
warehouseFk = warehouseFk!!
|
||||
)
|
||||
|
||||
"updatePacking" -> viewModel.updatePacking(
|
||||
itemFk = itemInfoG!!.id,
|
||||
value = value,
|
||||
warehouseFk = warehouseFk!!
|
||||
)
|
||||
|
||||
"itemSaveStem" -> viewModel.item_saveStems(
|
||||
itemFk = itemInfoG!!.id,
|
||||
value = value
|
||||
)
|
||||
|
||||
"item_saveReference" -> viewModel.item_saveReference(
|
||||
itemFk = itemInfoG!!.id,
|
||||
value = value
|
||||
)
|
||||
|
||||
|
||||
}
|
||||
"itemStockUpdateRemove" -> prepareItemStockUpdate2(item, value)
|
||||
"updateGrouping" ->
|
||||
viewModel.updateGrouping(
|
||||
itemFk = itemInfoG!!.id,
|
||||
value = value,
|
||||
warehouseFk = warehouseFk!!
|
||||
)
|
||||
|
||||
"updatePacking" -> viewModel.updatePacking(
|
||||
itemFk = itemInfoG!!.id,
|
||||
value = value,
|
||||
warehouseFk = warehouseFk!!
|
||||
)
|
||||
|
||||
"itemSaveStem" -> viewModel.item_saveStems(
|
||||
itemFk = itemInfoG!!.id,
|
||||
value = value
|
||||
)
|
||||
|
||||
"item_saveReference" -> viewModel.item_saveReference(
|
||||
itemFk = itemInfoG!!.id,
|
||||
value = value
|
||||
)
|
||||
|
||||
|
||||
if (item.action != "itemStockUpdate" && item.action != "itemStockUpdateRemove" && item.action != "itemStockUpdateAdd")
|
||||
// changeOfflineValue(item,value, listBarcodes)
|
||||
showProgress()
|
||||
}
|
||||
if (item.action != "itemStockUpdate" && item.action != "itemStockUpdateRemove" && item.action != "itemStockUpdateAdd")
|
||||
// changeOfflineValue(item,value, listBarcodes)
|
||||
showProgress()
|
||||
}
|
||||
|
||||
private fun prepareItemStockAdd(value: Int) {
|
||||
private fun prepareItemStockAdd(value: Int) {
|
||||
|
||||
showProgress()
|
||||
viewModel.itemTrash(
|
||||
itemFk = itemInfoG!!.id,
|
||||
warehouseFk = warehouseFk!!,
|
||||
newValue = (value * -1),
|
||||
isTrash = false
|
||||
showProgress()
|
||||
viewModel.itemTrash(
|
||||
itemFk = itemInfoG!!.id,
|
||||
warehouseFk = warehouseFk!!,
|
||||
newValue = (value * -1),
|
||||
isTrash = false
|
||||
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
//sergio: changeOffLineValue solo hace visible el progress
|
||||
|
||||
private fun showProgress() {
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
private fun prepareItemStockUpdate2(itemB: ItemCardRowVO, value: Int) {
|
||||
|
||||
//Tarea 5652 , quitar código cuando está asignada tarea
|
||||
var test = true
|
||||
if (test) {
|
||||
private fun showProgress() {
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
viewModel.getAddress()
|
||||
quantityToDiscard = value
|
||||
}
|
||||
|
||||
} else {
|
||||
try {
|
||||
value.toInt()
|
||||
private fun prepareItemStockUpdate2(itemB: ItemCardRowVO, value: Int) {
|
||||
|
||||
if (itemB.action == "itemStockUpdateRemove") {
|
||||
//Tarea 5652 , quitar código cuando está asignada tarea
|
||||
var test = true
|
||||
if (test) {
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
viewModel.getAddress()
|
||||
quantityToDiscard = value
|
||||
|
||||
customDialogTwo.setTitle(itemB.title!!)
|
||||
.setDescription(getString(R.string.deleteStock))
|
||||
.setOkButton(getString(R.string.fault)) {
|
||||
viewModel.itemTrash(
|
||||
itemFk = itemInfoG!!.id,
|
||||
warehouseFk = warehouseFk!!,
|
||||
newValue = value,
|
||||
isTrash = false
|
||||
} else {
|
||||
try {10
|
||||
value
|
||||
|
||||
)
|
||||
//changeOfflineValue(itemB,value, listBarcodes)
|
||||
showProgress()
|
||||
customDialogTwo.dismiss()
|
||||
if (itemB.action == "itemStockUpdateRemove") {
|
||||
|
||||
}.setOkButtonTwo(getString(R.string.trash)) {
|
||||
viewModel.itemTrash(
|
||||
itemFk = itemInfoG!!.id,
|
||||
warehouseFk = warehouseFk!!,
|
||||
newValue = value,
|
||||
isTrash = true
|
||||
customDialogTwo.setTitle(itemB.title!!)
|
||||
.setDescription(getString(R.string.deleteStock))
|
||||
.setOkButton(getString(R.string.fault)) {
|
||||
viewModel.itemTrash(
|
||||
itemFk = itemInfoG!!.id,
|
||||
warehouseFk = warehouseFk!!,
|
||||
newValue = value,
|
||||
isTrash = false
|
||||
|
||||
)
|
||||
)
|
||||
//changeOfflineValue(itemB,value, listBarcodes)
|
||||
showProgress()
|
||||
customDialogTwo.dismiss()
|
||||
|
||||
showProgress()
|
||||
customDialogTwo.dismiss()
|
||||
}.setOkButtonTwo(getString(R.string.trash)) {
|
||||
viewModel.itemTrash(
|
||||
itemFk = itemInfoG!!.id,
|
||||
warehouseFk = warehouseFk!!,
|
||||
newValue = value,
|
||||
isTrash = true
|
||||
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
)
|
||||
|
||||
customDialogTwo.dismiss()
|
||||
}.show()
|
||||
showProgress()
|
||||
customDialogTwo.dismiss()
|
||||
|
||||
} else {
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
|
||||
showProgress()
|
||||
viewModel.itemTrash(
|
||||
itemFk = itemInfoG!!.id,
|
||||
warehouseFk = warehouseFk!!,
|
||||
newValue = (value * -1),
|
||||
isTrash = false
|
||||
customDialogTwo.dismiss()
|
||||
}.show()
|
||||
|
||||
} else {
|
||||
|
||||
showProgress()
|
||||
viewModel.itemTrash(
|
||||
itemFk = itemInfoG!!.id,
|
||||
warehouseFk = warehouseFk!!,
|
||||
newValue = (value * -1),
|
||||
isTrash = false
|
||||
|
||||
)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
// binding.itemcardLayout.visibility = View.GONE
|
||||
ma.messageWithSound(getString(R.string.errorNotNumber), true, true)
|
||||
|
||||
)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
// binding.itemcardLayout.visibility = View.GONE
|
||||
ma.messageWithSound(getString(R.string.errorNotNumber), true, true)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showDialogTrashFault(listAddress: List<AddressLoses>) {
|
||||
private fun showDialogTrashFault(listAddress: List<AddressLoses>) {
|
||||
|
||||
customDynamic.setTitle("")
|
||||
customDynamic.setDescription(getString(R.string.deleteStock))
|
||||
customDynamic.createDynamicButtons(listAddress)
|
||||
customDynamic.show()
|
||||
}
|
||||
customDynamic.setTitle("")
|
||||
customDynamic.setDescription(getString(R.string.deleteStock))
|
||||
customDynamic.createDynamicButtons(listAddress)
|
||||
customDynamic.show()
|
||||
|
||||
private fun prepareBarcodeDialog(itemB: ItemCardRowVO) {
|
||||
}
|
||||
|
||||
customDialogList.setTitle(getString(R.string.barcodes))
|
||||
.setOkButton(getString(R.string.save)) {
|
||||
private fun prepareBarcodeDialog() {
|
||||
|
||||
customDialogList.setTitle(getString(R.string.barcodes))
|
||||
.setOkButton(getString(R.string.save)) {
|
||||
setUpdateBarcode()
|
||||
}.setKoButton(getString(R.string.close)) {
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
}.setValue("").show()
|
||||
|
||||
customDialogList.getEditText().setOnEditorActionListener { _, actionId, _ ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
setUpdateBarcode()
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
barcodeAdapter = BarcodeAdapter(listBarcodes, object : OnBarcodeRowClickListener {
|
||||
override fun onBarcodeRowClickListener(item: BarcodeVO) {
|
||||
updateBarcode(item.code!!, true)
|
||||
customDialogList.setValue("")
|
||||
customDialogList.dismiss()
|
||||
}
|
||||
})
|
||||
customDialogList.getRecyclerView().adapter = barcodeAdapter
|
||||
|
||||
customDialogList.getRecyclerView().layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
}
|
||||
|
||||
private fun setUpdateBarcode() {
|
||||
try {
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
if (!customDialogList.getValue().isEmpty())
|
||||
updateBarcode(customDialogList.getValue(), false)
|
||||
customDialogList.dismiss()
|
||||
|
||||
}.setKoButton(getString(R.string.close)) {
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
customDialogList.dismiss()
|
||||
}.setValue("").show()
|
||||
|
||||
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
customDialogList.getEditText().setOnEditorActionListener { _, actionId, _ ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
if (!customDialogList.getValue().isNullOrEmpty())
|
||||
if (customDialogList.getValue().isNotEmpty())
|
||||
updateBarcode(customDialogList.getValue(), false)
|
||||
customDialogList.setValue("")
|
||||
customDialogList.dismiss()
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
return@setOnEditorActionListener true
|
||||
|
||||
} catch (ex: Exception) {
|
||||
getString(R.string.errorInput).toast(requireContext())
|
||||
}
|
||||
false
|
||||
|
||||
}
|
||||
|
||||
barcodeAdapter = BarcodeAdapter(listBarcodes, object : OnBarcodeRowClickListener {
|
||||
override fun onBarcodeRowClickListener(item: BarcodeVO) {
|
||||
updateBarcode(item.code!!, true)
|
||||
customDialogList.setValue("")
|
||||
customDialogList.dismiss()
|
||||
}
|
||||
})
|
||||
customDialogList.getRecyclerView().adapter = barcodeAdapter
|
||||
private fun updateBarcode(code: String, delete: Boolean) {
|
||||
if (delete) {
|
||||
var i = 0
|
||||
var posDelete = 0
|
||||
listBarcodes.forEach {
|
||||
if (it.code == code)
|
||||
posDelete = i
|
||||
i += 1
|
||||
}
|
||||
listBarcodes.removeAt(posDelete)
|
||||
viewModel.barcodesEdit(
|
||||
itemFk = itemInfoG!!.id,
|
||||
value = code,
|
||||
delete = delete,
|
||||
)
|
||||
} else {
|
||||
listBarcodes.add(BarcodeVO(code))
|
||||
viewModel.barcodesEditSalix(
|
||||
itemFk = itemInfoG!!.id,
|
||||
barCodeValue = code
|
||||
)
|
||||
|
||||
customDialogList.getRecyclerView().layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
}
|
||||
|
||||
private fun updateBarcode(code: String, delete: Boolean) {
|
||||
if (delete) {
|
||||
var i = 0
|
||||
var posDelete = 0
|
||||
listBarcodes.forEach {
|
||||
if (it.code == code)
|
||||
posDelete = i
|
||||
i += 1
|
||||
}
|
||||
listBarcodes.removeAt(posDelete)
|
||||
viewModel.barcodesEdit(
|
||||
itemFk = itemInfoG!!.id,
|
||||
value = code,
|
||||
delete = delete,
|
||||
|
||||
barcodeAdapter!!.notifyDataSetChanged()
|
||||
showProgress()
|
||||
}
|
||||
|
||||
private fun showDialogSelectItemTypePacking() {
|
||||
|
||||
var array = arrayOfNulls<String>(itemsPackingType.size)
|
||||
for (indice in array.indices) {
|
||||
array[indice] =
|
||||
itemsPackingType[indice].code + " : " + itemsPackingType[indice].description
|
||||
}
|
||||
val builder = AlertDialog.Builder(this.context)
|
||||
builder.setTitle(getString(R.string.mensajeseleccionencajado))
|
||||
.setItems(
|
||||
array
|
||||
) { _, position ->
|
||||
|
||||
updateItemPackingType(itemsPackingType[position].code)
|
||||
|
||||
}
|
||||
|
||||
builder.create().show()
|
||||
}
|
||||
|
||||
private fun updateItemPackingType(itemPackingType: String) {
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
viewModel.updatePackingTypeSalix(
|
||||
itemInfoG!!.id,
|
||||
itemPackingType
|
||||
)
|
||||
} else {
|
||||
listBarcodes.add(BarcodeVO(code))
|
||||
viewModel.barcodesEditSalix(
|
||||
itemFk = itemInfoG!!.id,
|
||||
barCodeValue = code
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
barcodeAdapter!!.notifyDataSetChanged()
|
||||
showProgress()
|
||||
}
|
||||
override fun onClickDynamic(addressFK: Int) {
|
||||
|
||||
private fun showDialogSelectItemTypePacking() {
|
||||
|
||||
var array = arrayOfNulls<String>(itemsPackingType.size)
|
||||
for (indice in array.indices) {
|
||||
array[indice] =
|
||||
itemsPackingType[indice].code + " : " + itemsPackingType[indice].description
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
viewModel.setVisibleDiscard(itemInfoG!!.id, warehouseFk!!, quantityToDiscard, addressFK)
|
||||
customDynamic.dismiss()
|
||||
customDynamic.cancel()
|
||||
}
|
||||
val builder = AlertDialog.Builder(this.context)
|
||||
builder.setTitle(getString(R.string.mensajeseleccionencajado))
|
||||
.setItems(
|
||||
array
|
||||
) { _, position ->
|
||||
|
||||
updateItemPackingType(itemsPackingType[position].code)
|
||||
|
||||
}
|
||||
|
||||
builder.create().show()
|
||||
}
|
||||
|
||||
private fun updateItemPackingType(itemPackingType: String) {
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
viewModel.updatePackingTypeSalix(
|
||||
itemInfoG!!.id,
|
||||
itemPackingType
|
||||
)
|
||||
}
|
||||
|
||||
override fun onClickDynamic(addressFK: Int) {
|
||||
customDynamic.dismiss()
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
viewModel.setVisibleDiscard(itemInfoG!!.id, warehouseFk!!, quantityToDiscard, addressFK)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import es.verdnatura.domain.SilexCallback
|
|||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.common.ItemDiscardSalix
|
||||
import es.verdnatura.presentation.common.ItemDiscardSalixShortage
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import es.verdnatura.presentation.common.itemBarCodeSalix
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.AddressLoses
|
||||
|
@ -163,10 +163,12 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
|||
itemFk: Int,
|
||||
warehouseFk: Int,
|
||||
quantity: Int,
|
||||
addressFk: Int,
|
||||
addressFk: Int?,
|
||||
|
||||
) {
|
||||
salix.setVisibleDiscard(ItemDiscardSalix(itemFk, warehouseFk, quantity, addressFk))
|
||||
salix.setVisibleDiscard(
|
||||
ItemDiscardSalixShortage(itemFk, warehouseFk, quantity, addressFk)
|
||||
)
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value = ResponseItemVO(
|
||||
|
@ -377,34 +379,35 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
|||
|
||||
|
||||
fun getAddress() {
|
||||
salix.getAddressSalix().enqueue(object : SilexCallback<List<AddressLoses>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
salix.getAddressSalix("""{ "include": [ { "relation": "address", "scope": { "fields": { "nickname": true } } } ] }""")
|
||||
.enqueue(object : SilexCallback<List<AddressLoses>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
|
||||
val listError: ArrayList<AddressLoses> = ArrayList()
|
||||
listError.add(AddressLoses(isError = true, errorMessage = t.message!!))
|
||||
_addressLosesList.value = AddressLosesList(listError)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<List<AddressLoses>>) {
|
||||
|
||||
if (response.body() != null) {
|
||||
_addressLosesList.value = response.body()?.let { AddressLosesList(it) }
|
||||
} else {
|
||||
val listError: ArrayList<AddressLoses> = ArrayList()
|
||||
listError.add(
|
||||
AddressLoses(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
)
|
||||
listError.add(AddressLoses(isError = true, errorMessage = t.message!!))
|
||||
_addressLosesList.value = AddressLosesList(listError)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
override fun onSuccess(response: Response<List<AddressLoses>>) {
|
||||
|
||||
if (response.body() != null) {
|
||||
_addressLosesList.value = response.body()?.let { AddressLosesList(it) }
|
||||
} else {
|
||||
val listError: ArrayList<AddressLoses> = ArrayList()
|
||||
listError.add(
|
||||
AddressLoses(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
)
|
||||
_addressLosesList.value = AddressLosesList(listError)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -559,7 +559,6 @@
|
|||
<string name="serialNumberDescrip">Va a modificar el número de serie asociado a su dispositivo.</string>
|
||||
<string name="quantityTake">Indica la cantidad que coges</string>
|
||||
<string name="categoryChange">Cambiar a A2</string>
|
||||
<string name="titleChangeCategory">Cambiar a A2</string>
|
||||
<string name="ubication">Indica el carro donde está ubicado el item:</string>
|
||||
<string name="titleLoadTruck">Cargar furgoneta</string>
|
||||
<string name="titleUnLoadTruck">Descargar furgoneta</string>
|
||||
|
@ -685,6 +684,8 @@
|
|||
<string name="noteAddOk">Nota añadida correctamente</string>
|
||||
<string name="deleteChecked">Permite borrar las revisiones de la matrícula</string>
|
||||
<string name="errorFile">Problemas al intentar abrir/crear el fichero</string>
|
||||
<string name="errorScanExpedition">Error al escanear expedición</string>
|
||||
<string name="NotAddress">No hay consignatarios para dar de baja el ítem</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -559,7 +559,6 @@
|
|||
<string name="serialNumberDescrip">Va a modificar el número de serie asociado a su dispositivo.</string>
|
||||
<string name="quantityTake">Indica la cantidad que coges</string>
|
||||
<string name="categoryChange">Cambiar a A2</string>
|
||||
<string name="titleChangeCategory">Cambiar a A2</string>
|
||||
<string name="ubication">Indica el carro donde está ubicado el item:</string>
|
||||
<string name="titleLoadTruck">Charger fourgon</string>
|
||||
<string name="titleUnLoadTruck">Décharger fourgon</string>
|
||||
|
@ -685,6 +684,8 @@
|
|||
<string name="noteAddOk">Nota añadida correctamente</string>
|
||||
<string name="deleteChecked">Permite borrar las revisiones de la matrícula</string>
|
||||
<string name="errorFile">Problemas al intentar abrir/crear el fichero</string>
|
||||
<string name="errorScanExpedition">Error al escanear expedición</string>
|
||||
<string name="NotAddress">No hay consignatarios para dar de baja el ítem</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -559,7 +559,6 @@
|
|||
<string name="serialNumberDescrip">Va a modificar el número de serie asociado a su dispositivo.</string>
|
||||
<string name="quantityTake">Indica la cantidad que coges</string>
|
||||
<string name="categoryChange">Cambiar a A2</string>
|
||||
<string name="titleChangeCategory">Cambiar a A2</string>
|
||||
<string name="ubication">Indica el carro donde está ubicado el item:</string>
|
||||
<string name="titleLoadTruck">Cargar furgoneta</string>
|
||||
<string name="titleUnLoadTruck">Descargar furgoneta</string>
|
||||
|
@ -685,6 +684,8 @@
|
|||
<string name="noteAddOk">Nota añadida correctamente</string>
|
||||
<string name="deleteChecked">Permite borrar las revisiones de la matrícula</string>
|
||||
<string name="errorFile">Problemas al intentar abrir/crear el fichero</string>
|
||||
<string name="errorScanExpedition">Error al escanear expedición</string>
|
||||
<string name="NotAddress">No hay consignatarios para dar de baja el ítem</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -409,7 +409,6 @@
|
|||
<string name="titleUbicator">Ubicator</string>
|
||||
<string name="titlePackingHolland">Packing Holanda</string>
|
||||
<string name="titleSelfConsumption">Self-autoconsumption</string>
|
||||
<string name="titleChangeCategory">Change to A2</string>
|
||||
<string name="titleSelfDescription">Self-autoconsumption from your warehouse</string>
|
||||
<string name="titleReUbicator">Reubication</string>
|
||||
<string name="titleAuto">Add Automatically items to shelving</string>
|
||||
|
@ -684,5 +683,7 @@
|
|||
<string name="noteAddOk">Nota añadida correctamente</string>
|
||||
<string name="deleteChecked">Permite borrar las revisiones de la matrícula</string>
|
||||
<string name="errorFile">Problemas al intentar abrir/crear el fichero</string>
|
||||
<string name="errorScanExpedition">Error al escanear expedición</string>
|
||||
<string name="NotAddress">No hay consignatarios para dar de baja el ítem</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue