feat: boxPickingPrepared refs #7855
This commit is contained in:
parent
d077225e9e
commit
2c0f2cc72d
|
@ -6,6 +6,8 @@ import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentGeneralBlackBinding
|
import es.verdnatura.databinding.FragmentGeneralBlackBinding
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.OnCollectionSelectedListener
|
import es.verdnatura.presentation.common.OnCollectionSelectedListener
|
||||||
|
import es.verdnatura.presentation.common.hideKeyboard
|
||||||
|
import es.verdnatura.presentation.common.itemScanValue
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogInput
|
import es.verdnatura.presentation.view.component.CustomDialogInput
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionSalix
|
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionSalix
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.Expeditions
|
import es.verdnatura.presentation.view.feature.delivery.model.Expeditions
|
||||||
|
@ -40,13 +42,17 @@ class BoxPickingFragment(var title: String) :
|
||||||
binding.scanInput.hint = getString(R.string.scanLabelExpedition)
|
binding.scanInput.hint = getString(R.string.scanLabelExpedition)
|
||||||
binding.scanInput.requestFocus()
|
binding.scanInput.requestFocus()
|
||||||
binding.scanInput.setOnEditorActionListener { _, actionId, _ ->
|
binding.scanInput.setOnEditorActionListener { _, actionId, _ ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE) {
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||||
|
|
||||||
if (!binding.scanInput.text.isNullOrEmpty()) {
|
if (!binding.scanInput.text.isNullOrEmpty()) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
viewModel.findExpedition(
|
viewModel.findExpedition(
|
||||||
expedition = binding.scanInput.text.toString().toLong(),
|
expedition = itemScanValue(
|
||||||
|
binding.scanInput.text.toString(),
|
||||||
|
arrayOf("expedition"),
|
||||||
|
"id"
|
||||||
|
).toString().toLong(),
|
||||||
expeditionStateId = codeStateId
|
expeditionStateId = codeStateId
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -74,17 +80,9 @@ class BoxPickingFragment(var title: String) :
|
||||||
customDialogInput.setTitle(getString(R.string.scanItem))
|
customDialogInput.setTitle(getString(R.string.scanItem))
|
||||||
.setOkButton(getString(R.string.accept)) {
|
.setOkButton(getString(R.string.accept)) {
|
||||||
if (customDialogInput.getValue().isNotEmpty()) {
|
if (customDialogInput.getValue().isNotEmpty()) {
|
||||||
|
viewModel.isBoxPickingInPrintOut(
|
||||||
viewModel.expeditionStateAddSalix(
|
expeditionFk = expeditionFk,
|
||||||
expeditions = Expeditions(
|
customDialogInput.getValue()
|
||||||
arrayListOf(
|
|
||||||
ExpeditionSalix(
|
|
||||||
expeditionFk = expeditionFk,
|
|
||||||
stateCode = "CHECKED",
|
|
||||||
isScanned = 1
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -99,11 +97,14 @@ class BoxPickingFragment(var title: String) :
|
||||||
|
|
||||||
|
|
||||||
customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ ->
|
customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ ->
|
||||||
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 || actionId == 5) {
|
||||||
|
|
||||||
if (customDialogInput.getValue().isNotEmpty()) {
|
if (customDialogInput.getValue().isNotEmpty()) {
|
||||||
viewModel.findExpedition(
|
viewModel.isBoxPickingInPrintOut(
|
||||||
expedition = expeditionFk, expeditionStateId = expeditionFk
|
expeditionFk = expeditionFk,
|
||||||
|
itemScanValue(
|
||||||
|
customDialogInput.getValue(), arrayOf("buy"), "more"
|
||||||
|
).toString()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
customDialogInput.dismiss()
|
customDialogInput.dismiss()
|
||||||
|
@ -116,6 +117,7 @@ class BoxPickingFragment(var title: String) :
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
getString(R.string.errorInput)
|
getString(R.string.errorInput)
|
||||||
}
|
}
|
||||||
|
customDialogInput.getEditText().requestFocus()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
|
@ -123,7 +125,7 @@ class BoxPickingFragment(var title: String) :
|
||||||
responseExpeditionStateId.observe(viewLifecycleOwner) {
|
responseExpeditionStateId.observe(viewLifecycleOwner) {
|
||||||
codeStateId = it
|
codeStateId = it
|
||||||
}
|
}
|
||||||
responseFindExpeditionId.observe(viewLifecycleOwner) {
|
responseFindExpeditionId.observe(viewLifecycleOwner) { it ->
|
||||||
if (it != 0) {
|
if (it != 0) {
|
||||||
showScanBarcode(it.toLong())
|
showScanBarcode(it.toLong())
|
||||||
} else {
|
} else {
|
||||||
|
@ -133,42 +135,57 @@ class BoxPickingFragment(var title: String) :
|
||||||
), isError = true, isPlayed = true, isToasted = true
|
), isError = true, isPlayed = true, isToasted = true
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
responseStateAdd.observe(viewLifecycleOwner) {
|
}
|
||||||
if (it) {
|
responseStateAdd.observe(viewLifecycleOwner) {
|
||||||
customDialogInput.dismiss()
|
if (it) {
|
||||||
binding.scanInput.requestFocus()
|
ma.messageWithSound(message = "", isPlayed = true, isError = false)
|
||||||
}
|
customDialogInput.dismiss()
|
||||||
}
|
|
||||||
//Tarea 7751
|
|
||||||
isBoxPickingInPrintOut.observe(viewLifecycleOwner) {
|
|
||||||
if (it.isChecked) {
|
|
||||||
ma.messageWithSound(
|
|
||||||
message = getString(R.string.errorBoxPicking),
|
|
||||||
isError = true,
|
|
||||||
isPlayed = true,
|
|
||||||
isToasted = false
|
|
||||||
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
binding.scanInput.requestFocus()
|
binding.scanInput.requestFocus()
|
||||||
}
|
}
|
||||||
responseCode.observe(viewLifecycleOwner) {
|
|
||||||
|
|
||||||
ma.messageWithSound(
|
|
||||||
message = getString(R.string.errorInput),
|
|
||||||
isError = true,
|
|
||||||
isPlayed = true,
|
|
||||||
isToasted = null
|
|
||||||
|
|
||||||
)
|
|
||||||
binding.scanInput.requestFocus()
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
isBoxPickingInPrintOut.observe(viewLifecycleOwner) {
|
||||||
|
|
||||||
|
if (it.expeditionFk.toInt() == 0) {
|
||||||
|
ma.messageWithSound(
|
||||||
|
message = getString(R.string.errorBoxpicking),
|
||||||
|
isError = true,
|
||||||
|
isPlayed = true,
|
||||||
|
isToasted = false
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
viewModel.expeditionStateAddSalix(
|
||||||
|
expeditions = Expeditions(
|
||||||
|
arrayListOf(
|
||||||
|
ExpeditionSalix(
|
||||||
|
expeditionFk = it.expeditionFk.toInt(),
|
||||||
|
stateCode = "CHECKED",
|
||||||
|
isScanned = 1
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.scanInput.requestFocus()
|
||||||
|
hideKeyboard()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
responseCode.observe(viewLifecycleOwner) {
|
||||||
|
|
||||||
|
ma.messageWithSound(
|
||||||
|
message = getString(R.string.errorInput),
|
||||||
|
isError = true,
|
||||||
|
isPlayed = true,
|
||||||
|
isToasted = null
|
||||||
|
|
||||||
|
)
|
||||||
|
binding.scanInput.requestFocus()
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue