refs #5890 feat: itemShelvingReserva
This commit is contained in:
parent
990f5b1f7e
commit
56882dcfc9
|
@ -43,15 +43,12 @@ import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.*
|
import es.verdnatura.presentation.view.feature.sacador.model.*
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
|
|
||||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||||
class CollectionFragmentPickerNew(
|
class CollectionFragmentPickerNew(
|
||||||
var collection: CollectionTicket,
|
var collection: CollectionTicket, var type: String = SACADOR
|
||||||
var type: String = SACADOR
|
|
||||||
) : BaseFragment<FragmentCollectionNewBinding, CollectionViewModel>(
|
) : BaseFragment<FragmentCollectionNewBinding, CollectionViewModel>(
|
||||||
CollectionViewModel::class
|
CollectionViewModel::class
|
||||||
) {
|
) {
|
||||||
|
|
||||||
private var sales: List<Sale> = listOf()
|
private var sales: List<Sale> = listOf()
|
||||||
private var salesParent: List<SaleVO> = listOf()
|
private var salesParent: List<SaleVO> = listOf()
|
||||||
private var saleAdapter: SaleAdapterNew? = null
|
private var saleAdapter: SaleAdapterNew? = null
|
||||||
|
@ -75,20 +72,18 @@ class CollectionFragmentPickerNew(
|
||||||
private var storedBackPosition: Int = 0
|
private var storedBackPosition: Int = 0
|
||||||
private var tickets: ArrayList<String> = ArrayList()
|
private var tickets: ArrayList<String> = ArrayList()
|
||||||
private var mistakeSale: SaleVO? = null
|
private var mistakeSale: SaleVO? = null
|
||||||
|
|
||||||
private var isMarking = false
|
private var isMarking = false
|
||||||
private lateinit var ticketScanTxt: String
|
private lateinit var ticketScanTxt: String
|
||||||
private var lastScanned: Int = 0
|
private var lastScanned: Int = 0
|
||||||
private var buttonPushedGetCollection = false
|
private var buttonPushedGetCollection = false
|
||||||
private var positionUnmarked = -1
|
private var positionUnmarked = -1
|
||||||
private var state = 0
|
private var state = 0
|
||||||
|
|
||||||
private var originalItemScan: Long = 0
|
private var originalItemScan: Long = 0
|
||||||
private var workerFkFromTicket: String? = null
|
private var workerFkFromTicket: String? = null
|
||||||
private var isScanned: Boolean? = null
|
private var isScanned: Boolean? = null
|
||||||
private var positionConfirm = 0
|
private var positionConfirm = 0
|
||||||
private var quantityConfirm = 0
|
private var quantityConfirm = 0
|
||||||
|
private var positionMarkPrevia = 0
|
||||||
private lateinit var myGroupList: List<Sale>
|
private lateinit var myGroupList: List<Sale>
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -107,10 +102,8 @@ class CollectionFragmentPickerNew(
|
||||||
|
|
||||||
mperror = MediaPlayer.create((activity as MainActivity), R.raw.error)
|
mperror = MediaPlayer.create((activity as MainActivity), R.raw.error)
|
||||||
mpok = MediaPlayer.create((activity as MainActivity), R.raw.ok)
|
mpok = MediaPlayer.create((activity as MainActivity), R.raw.ok)
|
||||||
|
|
||||||
viewModel.collectionTicketGetSalix(
|
viewModel.collectionTicketGetSalix(
|
||||||
collection.collectionFk,
|
collection.collectionFk, print = false
|
||||||
print = false
|
|
||||||
)
|
)
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
}
|
}
|
||||||
|
@ -120,7 +113,6 @@ class CollectionFragmentPickerNew(
|
||||||
scanRequest()
|
scanRequest()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
customDialogList = CustomDialogList(requireContext())
|
customDialogList = CustomDialogList(requireContext())
|
||||||
customDialogInput = CustomDialogInput(requireContext())
|
customDialogInput = CustomDialogInput(requireContext())
|
||||||
|
@ -142,7 +134,6 @@ class CollectionFragmentPickerNew(
|
||||||
goBack = true
|
goBack = true
|
||||||
goBack2 = true
|
goBack2 = true
|
||||||
goMistakeBack = true
|
goMistakeBack = true
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setToolBar() {
|
private fun setToolBar() {
|
||||||
|
@ -153,7 +144,6 @@ class CollectionFragmentPickerNew(
|
||||||
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString()
|
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
val listIcons: ArrayList<ImageView> = ArrayList()
|
val listIcons: ArrayList<ImageView> = ArrayList()
|
||||||
val iconPrint = ImageView(context)
|
val iconPrint = ImageView(context)
|
||||||
iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
|
iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
|
||||||
|
@ -184,7 +174,6 @@ class CollectionFragmentPickerNew(
|
||||||
listIcons.add(iconUpdate)
|
listIcons.add(iconUpdate)
|
||||||
listIcons.remove(iconWorker)
|
listIcons.remove(iconWorker)
|
||||||
|
|
||||||
|
|
||||||
binding.mainToolbar.toolbarIcons.adapter =
|
binding.mainToolbar.toolbarIcons.adapter =
|
||||||
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
||||||
override fun onOptionsItemSelected(item: Drawable) {
|
override fun onOptionsItemSelected(item: Drawable) {
|
||||||
|
@ -208,28 +197,21 @@ class CollectionFragmentPickerNew(
|
||||||
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun updateScreen() {
|
private fun updateScreen() {
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
|
||||||
viewModel.collectionTicketGetSalix(
|
viewModel.collectionTicketGetSalix(
|
||||||
collection.collectionFk,
|
collection.collectionFk, print = false
|
||||||
print = false
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun markPrevia(saleGroupScanned: String): Boolean {
|
private fun markPrevia(saleGroupScanned: String): Boolean {
|
||||||
println("Sacador Marcamos la previa ?")
|
|
||||||
println("Sacador saleGroup $saleGroupScanned ")
|
println("Sacador saleGroup $saleGroupScanned ")
|
||||||
try {
|
try {
|
||||||
for (indice in sales.indices) {
|
for (indice in sales.indices) {
|
||||||
println("Sacador saleGroup ${sales[indice].saleGroupFk}")
|
println("Sacador saleGroup ${sales[indice].saleGroupFk}")
|
||||||
if (sales[indice].saleGroupFk != null && sales[indice].saleGroupFk == saleGroupScanned.toInt()) {
|
if (sales[indice].saleGroupFk != null && sales[indice].saleGroupFk == saleGroupScanned.toInt()) {
|
||||||
println("Sacador saleGroup ${sales[indice].itemShelvingSaleFk}")
|
println("Sacador saleGroup ${sales[indice].itemShelvingSaleFk}")
|
||||||
|
viewModel.itemShelvingSaleSetSaleGroup(saleGroupScanned.toInt())
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
positionMarkPrevia = indice
|
||||||
viewModel.saleTrackingAddPreparedSaleGroup(saleGroupScanned.toInt())
|
|
||||||
|
|
||||||
return true
|
return true
|
||||||
mpok!!.start()
|
mpok!!.start()
|
||||||
|
|
||||||
|
@ -242,22 +224,15 @@ class CollectionFragmentPickerNew(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getCollection() {
|
private fun getCollection() {
|
||||||
|
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
if (!buttonPushedGetCollection) {
|
if (!buttonPushedGetCollection) {
|
||||||
viewModel.collection_get(
|
viewModel.collection_get(
|
||||||
collection.collectionFk,
|
collection.collectionFk, getDataInt(SECTORFK), print = "0", type
|
||||||
getDataInt(SECTORFK),
|
|
||||||
print = "0",
|
|
||||||
type
|
|
||||||
)
|
)
|
||||||
buttonPushedGetCollection = true
|
buttonPushedGetCollection = true
|
||||||
} else {
|
} else {
|
||||||
viewModel.collectionTicketGet(
|
viewModel.collectionTicketGet(
|
||||||
lastScanned,
|
lastScanned, getDataInt(SECTORFK), print = "0", type
|
||||||
getDataInt(SECTORFK),
|
|
||||||
print = "0",
|
|
||||||
type
|
|
||||||
|
|
||||||
)
|
)
|
||||||
buttonPushedGetCollection = false
|
buttonPushedGetCollection = false
|
||||||
|
@ -290,17 +265,11 @@ class CollectionFragmentPickerNew(
|
||||||
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
|
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {//ID=0 ACTION_NEXT ID=5 ACTION_UNESPECEFIED)
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {//ID=0 ACTION_NEXT ID=5 ACTION_UNESPECEFIED)
|
||||||
if (!binding.scanInput.text.toString().isNullOrEmpty()) {
|
if (!binding.scanInput.text.toString().isNullOrEmpty()) {
|
||||||
|
|
||||||
binding.scanInput.setText(textScanned_filterDouble(binding.scanInput.text!!.toString()))
|
binding.scanInput.setText(textScanned_filterDouble(binding.scanInput.text!!.toString()))
|
||||||
|
|
||||||
//de momento solo está el qr de artículo
|
|
||||||
isScanned =
|
isScanned =
|
||||||
event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
|
event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
|
||||||
|
|
||||||
if (itemScanIsQr(binding.scanInput.text.toString())) {
|
if (itemScanIsQr(binding.scanInput.text.toString())) {
|
||||||
|
|
||||||
val myQr = ItemScanned(JSONObject(binding.scanInput.text.toString()))
|
val myQr = ItemScanned(JSONObject(binding.scanInput.text.toString()))
|
||||||
|
|
||||||
when (myQr.table) {
|
when (myQr.table) {
|
||||||
"saleGroup" -> {
|
"saleGroup" -> {
|
||||||
if (type == CONTROLADOR) {
|
if (type == CONTROLADOR) {
|
||||||
|
@ -312,16 +281,13 @@ class CollectionFragmentPickerNew(
|
||||||
}
|
}
|
||||||
|
|
||||||
"buy" -> binding.scanInput.setText(myQr.more)
|
"buy" -> binding.scanInput.setText(myQr.more)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ma.hideKeyboard(binding.scanInput)
|
ma.hideKeyboard(binding.scanInput)
|
||||||
findSale(binding.scanInput.text.toString())
|
findSale(binding.scanInput.text.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
buttonPushedGetCollection = false
|
buttonPushedGetCollection = false
|
||||||
|
|
||||||
}
|
}
|
||||||
binding.scanInput.setText("")
|
binding.scanInput.setText("")
|
||||||
hideKeyboards()
|
hideKeyboards()
|
||||||
|
@ -334,15 +300,11 @@ class CollectionFragmentPickerNew(
|
||||||
|
|
||||||
//LISTA =========
|
//LISTA =========
|
||||||
binding.collectionSwipe.setOnRefreshListener {
|
binding.collectionSwipe.setOnRefreshListener {
|
||||||
|
|
||||||
isMarking = false
|
isMarking = false
|
||||||
binding.collectionSwipe.isRefreshing = false
|
binding.collectionSwipe.isRefreshing = false
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
viewModel.collectionTicketGet(
|
viewModel.collectionTicketGet(
|
||||||
collection.collectionFk,
|
collection.collectionFk, getDataInt(SECTORFK), print = "0", type
|
||||||
getDataInt(SECTORFK),
|
|
||||||
print = "0",
|
|
||||||
type
|
|
||||||
)
|
)
|
||||||
buttonPushedGetCollection = false
|
buttonPushedGetCollection = false
|
||||||
binding.collectionSwipe.isRefreshing = false
|
binding.collectionSwipe.isRefreshing = false
|
||||||
|
@ -357,67 +319,12 @@ class CollectionFragmentPickerNew(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
/* with(viewModelSalix) {
|
|
||||||
responseCallBack.observe(viewLifecycleOwner, Observer {
|
|
||||||
binding.splashProgress.visibility = View.GONE
|
|
||||||
|
|
||||||
if (!goBack && !it.isError) {
|
|
||||||
when (it.routine) {
|
|
||||||
"itemShelvingSale_setQuantity", "itemShelvingSale_unpicked","saleTracking_add" -> {
|
|
||||||
myGroupList[positionConfirm].isPicked = 1
|
|
||||||
myGroupList[positionConfirm].reservedQuantity = quantityConfirm
|
|
||||||
viewModel.collectionTicketGetSalix(
|
|
||||||
collection.collectionFk,
|
|
||||||
print = false
|
|
||||||
)
|
|
||||||
lm!!.scrollToPositionWithOffset(positionConfirm, 0)
|
|
||||||
//saleAdapter!!.notifyDataSetChanged()
|
|
||||||
ma.messageWithSound(
|
|
||||||
"Confirmada acción",
|
|
||||||
it.isError, !it.isError
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
"collection_addWithReservation" -> {
|
|
||||||
ma.messageWithSound(
|
|
||||||
"ítem y reserva añadida correctamente",
|
|
||||||
it.isError, !it.isError
|
|
||||||
)
|
|
||||||
viewModel.collectionTicketGet(
|
|
||||||
collection.collectionFk,
|
|
||||||
getDataInt(SECTORFK),
|
|
||||||
print = "0",
|
|
||||||
type
|
|
||||||
)
|
|
||||||
|
|
||||||
goBack = false
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!goBack) {
|
|
||||||
ma.messageWithSound(
|
|
||||||
"No se ha podido realizar la acción.",
|
|
||||||
it.isError, true
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*//* if (!goBack) {
|
|
||||||
ma.messageWithSound(
|
|
||||||
if (it.isError) it.errorMessage else getString(R.string.savedShelves),
|
|
||||||
it.isError, true
|
|
||||||
)
|
|
||||||
}*//*
|
|
||||||
|
|
||||||
})
|
|
||||||
}*/
|
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
binding.splashProgress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
collectionTicketList.observe(viewLifecycleOwner, Observer {
|
collectionTicketList.observe(viewLifecycleOwner, Observer {
|
||||||
|
|
||||||
if (!it.isError) {
|
if (!it.isError) {
|
||||||
if (it.tickets.isNotEmpty()) {
|
if (it.tickets.isNotEmpty()) {
|
||||||
//collection = it
|
//collection = it
|
||||||
|
@ -459,19 +366,6 @@ class CollectionFragmentPickerNew(
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
/* responseUsedShelves.observe(viewLifecycleOwner, Observer {
|
|
||||||
binding.splashProgress.visibility = View.GONE
|
|
||||||
|
|
||||||
if (!goBack) {
|
|
||||||
ma.messageWithSound(
|
|
||||||
if (it.isError) it.errorMessage else getString(R.string.savedShelves),
|
|
||||||
it.isError, true
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
})*/
|
|
||||||
|
|
||||||
|
|
||||||
responseParking.observe(viewLifecycleOwner, Observer {
|
responseParking.observe(viewLifecycleOwner, Observer {
|
||||||
binding.splashProgress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
|
|
||||||
|
@ -479,26 +373,17 @@ class CollectionFragmentPickerNew(
|
||||||
binding.splashProgress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
ma.messageWithSound(
|
ma.messageWithSound(
|
||||||
if (it.isError) it.errorMessage else getString(R.string.Aparcado),
|
if (it.isError) it.errorMessage else getString(R.string.Aparcado),
|
||||||
it.isError, true
|
it.isError,
|
||||||
|
true
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
responseCollectionAddItem.observe(viewLifecycleOwner, Observer {
|
responseCollectionAddItem.observe(viewLifecycleOwner, Observer {
|
||||||
binding.splashProgress.visibility = View.GONE
|
|
||||||
|
|
||||||
if (!goBack) {
|
if (!goBack) {
|
||||||
binding.splashProgress.visibility = View.GONE
|
|
||||||
ma.messageWithSound(
|
|
||||||
"ítem y reserva añadida correctamente",
|
|
||||||
it.isError, !it.isError
|
|
||||||
)
|
|
||||||
viewModel.collectionTicketGet(
|
viewModel.collectionTicketGet(
|
||||||
collection.collectionFk,
|
collection.collectionFk, getDataInt(SECTORFK), print = "0", type
|
||||||
getDataInt(SECTORFK),
|
|
||||||
print = "0",
|
|
||||||
type
|
|
||||||
)
|
)
|
||||||
|
|
||||||
goBack = false
|
goBack = false
|
||||||
|
@ -513,8 +398,7 @@ class CollectionFragmentPickerNew(
|
||||||
|
|
||||||
if (it.isError) {
|
if (it.isError) {
|
||||||
ma.messageWithSound(
|
ma.messageWithSound(
|
||||||
it.errorMessage,
|
it.errorMessage, it.isError, true
|
||||||
it.isError, true
|
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
(getString(R.string.Imprimiendo) + getData(PRINTERNAME)).toast(
|
(getString(R.string.Imprimiendo) + getData(PRINTERNAME)).toast(
|
||||||
|
@ -525,24 +409,21 @@ class CollectionFragmentPickerNew(
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
responseConfirmReservedItemShelvingSale.observe(viewLifecycleOwner, Observer {
|
responseConfirmReservedItemShelvingSale.observe(viewLifecycleOwner, Observer {
|
||||||
binding.splashProgress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
|
|
||||||
if (it.isError) {
|
if (it.isError) {
|
||||||
ma.messageWithSound(
|
ma.messageWithSound(
|
||||||
if (it.isError) it.errorMessage else "Confirmada reserva",
|
if (it.isError) it.errorMessage else getString(R.string.confirmReserv),
|
||||||
it.isError, it.isError
|
it.isError,
|
||||||
|
it.isError
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (!it.isError) {
|
if (!it.isError) {
|
||||||
sales[positionConfirm].isPicked = 1
|
sales[positionConfirm].isPicked = 1
|
||||||
saleAdapter!!.notifyDataSetChanged()
|
saleAdapter!!.notifyDataSetChanged()
|
||||||
|
|
||||||
viewModel.collectionTicketGetSalix(
|
viewModel.collectionTicketGetSalix(
|
||||||
collection.collectionFk,
|
collection.collectionFk, print = false
|
||||||
print = false
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -554,14 +435,12 @@ class CollectionFragmentPickerNew(
|
||||||
myGroupList[positionConfirm].isPicked = 1
|
myGroupList[positionConfirm].isPicked = 1
|
||||||
myGroupList[positionConfirm].reservedQuantity = quantityConfirm
|
myGroupList[positionConfirm].reservedQuantity = quantityConfirm
|
||||||
viewModel.collectionTicketGetSalix(
|
viewModel.collectionTicketGetSalix(
|
||||||
collection.collectionFk,
|
collection.collectionFk, print = false
|
||||||
print = false
|
|
||||||
)
|
)
|
||||||
lm!!.scrollToPositionWithOffset(positionConfirm, 0)
|
lm!!.scrollToPositionWithOffset(positionConfirm, 0)
|
||||||
//saleAdapter!!.notifyDataSetChanged()
|
//saleAdapter!!.notifyDataSetChanged()
|
||||||
ma.messageWithSound(
|
ma.messageWithSound(
|
||||||
"Confirmada acción",
|
"Confirmada acción", it.isError, !it.isError
|
||||||
it.isError, !it.isError
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
responseItemShelvingSaleUnPicked.observe(viewLifecycleOwner, Observer {
|
responseItemShelvingSaleUnPicked.observe(viewLifecycleOwner, Observer {
|
||||||
|
@ -569,17 +448,25 @@ class CollectionFragmentPickerNew(
|
||||||
myGroupList[positionUnmarked].isPicked = 1
|
myGroupList[positionUnmarked].isPicked = 1
|
||||||
myGroupList[positionUnmarked].reservedQuantity = quantityConfirm
|
myGroupList[positionUnmarked].reservedQuantity = quantityConfirm
|
||||||
viewModel.collectionTicketGetSalix(
|
viewModel.collectionTicketGetSalix(
|
||||||
collection.collectionFk,
|
collection.collectionFk, print = false
|
||||||
print = false
|
|
||||||
)
|
)
|
||||||
lm!!.scrollToPositionWithOffset(positionUnmarked, 0)
|
lm!!.scrollToPositionWithOffset(positionUnmarked, 0)
|
||||||
//saleAdapter!!.notifyDataSetChanged()
|
//saleAdapter!!.notifyDataSetChanged()
|
||||||
ma.messageWithSound(
|
ma.messageWithSound(
|
||||||
"Confirmada acción",
|
"Confirmada acción", it.isError, !it.isError
|
||||||
it.isError, !it.isError
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
responseItemShelvingSaleGroup.observe(viewLifecycleOwner, Observer {
|
||||||
|
|
||||||
|
viewModel.collectionTicketGetSalix(
|
||||||
|
collection.collectionFk, print = false
|
||||||
|
)
|
||||||
|
lm!!.scrollToPositionWithOffset(positionMarkPrevia, 0)
|
||||||
|
|
||||||
|
ma.messageWithSound(
|
||||||
|
"Previa recogida", it.isError, !it.isError
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
responseCode.observe(viewLifecycleOwner, Observer {
|
responseCode.observe(viewLifecycleOwner, Observer {
|
||||||
binding.splashProgress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
|
@ -617,28 +504,22 @@ class CollectionFragmentPickerNew(
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun callPicker(extensionNumber: String) {
|
private fun callPicker(extensionNumber: String) {
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val intent = Intent(Intent.ACTION_DIAL).apply {
|
val intent = Intent(Intent.ACTION_DIAL).apply {
|
||||||
data = Uri.parse("tel:$extensionNumber")
|
data = Uri.parse("tel:$extensionNumber")
|
||||||
}
|
}
|
||||||
|
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
// d("VERDNATURA::" + e.message)
|
// d("VERDNATURA::" + e.message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun createCollectionList() {
|
private fun createCollectionList() {
|
||||||
state = 0
|
state = 0
|
||||||
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString()
|
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString()
|
||||||
|
@ -650,8 +531,8 @@ class CollectionFragmentPickerNew(
|
||||||
var observations = ""
|
var observations = ""
|
||||||
collection.tickets.forEach { ticket ->
|
collection.tickets.forEach { ticket ->
|
||||||
|
|
||||||
if (!observations.isNullOrEmpty())
|
if (!observations.isNullOrEmpty()) observations =
|
||||||
observations = observations + " " + ticket.observations
|
observations + " " + ticket.observations
|
||||||
ticket.sales.forEach { sale ->
|
ticket.sales.forEach { sale ->
|
||||||
salesList.add(sale)
|
salesList.add(sale)
|
||||||
|
|
||||||
|
@ -663,9 +544,7 @@ class CollectionFragmentPickerNew(
|
||||||
//quitar comentarios FALTA AGRUPAR LAS PREVIAS
|
//quitar comentarios FALTA AGRUPAR LAS PREVIAS
|
||||||
myGroupList =
|
myGroupList =
|
||||||
groupSaleGroup(salesList).sortedWith(compareBy<Sale> { it.pickingOrder }.thenBy { it.itemFk })
|
groupSaleGroup(salesList).sortedWith(compareBy<Sale> { it.pickingOrder }.thenBy { it.itemFk })
|
||||||
saleAdapter =
|
saleAdapter = SaleAdapterNew(myGroupList,
|
||||||
SaleAdapterNew(
|
|
||||||
myGroupList,
|
|
||||||
pasillerosItemClickListener!!,
|
pasillerosItemClickListener!!,
|
||||||
object : OnQuantityClickSaleListener {
|
object : OnQuantityClickSaleListener {
|
||||||
|
|
||||||
|
@ -707,7 +586,6 @@ class CollectionFragmentPickerNew(
|
||||||
unMarkLine(index, sales[index])
|
unMarkLine(index, sales[index])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -721,8 +599,7 @@ class CollectionFragmentPickerNew(
|
||||||
object : OnPackingClickSaleListener {
|
object : OnPackingClickSaleListener {
|
||||||
override fun onPackingClick(sale: Sale) {
|
override fun onPackingClick(sale: Sale) {
|
||||||
// item_updatePackingShelve(sale.itemFk)
|
// item_updatePackingShelve(sale.itemFk)
|
||||||
if (!sale.code.isNullOrEmpty())
|
if (!sale.code.isNullOrEmpty()) ma.onPasillerosItemClickListener(
|
||||||
ma.onPasillerosItemClickListener(
|
|
||||||
PasillerosItemVO(
|
PasillerosItemVO(
|
||||||
title = getString(R.string.titleUbicator),
|
title = getString(R.string.titleUbicator),
|
||||||
), entryPoint = sale.code!!
|
), entryPoint = sale.code!!
|
||||||
|
@ -743,7 +620,8 @@ class CollectionFragmentPickerNew(
|
||||||
), entryPoint = entryPoint
|
), entryPoint = entryPoint
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}, type = type
|
},
|
||||||
|
type = type
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -779,8 +657,6 @@ class CollectionFragmentPickerNew(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//SEARCH AND MARK
|
|
||||||
|
|
||||||
private fun findSale(txtscan: String) {
|
private fun findSale(txtscan: String) {
|
||||||
|
|
||||||
var isOk = markPrevia(txtscan)
|
var isOk = markPrevia(txtscan)
|
||||||
|
@ -793,6 +669,7 @@ class CollectionFragmentPickerNew(
|
||||||
if (myGroupList[indice].isPicked != 1 && myGroupList[indice].code != null && myGroupList[indice].code!!.uppercase() == txtscan.uppercase()) {
|
if (myGroupList[indice].isPicked != 1 && myGroupList[indice].code != null && myGroupList[indice].code!!.uppercase() == txtscan.uppercase()) {
|
||||||
mpok!!.start()
|
mpok!!.start()
|
||||||
isOk = true
|
isOk = true
|
||||||
|
positionMarkPrevia = indice
|
||||||
printShelvingResult(indice)
|
printShelvingResult(indice)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -801,8 +678,7 @@ class CollectionFragmentPickerNew(
|
||||||
//Si no es previa ni está cogiendo nada se comprueba si es un parking
|
//Si no es previa ni está cogiendo nada se comprueba si es un parking
|
||||||
if (txtscan.contains("-")) {
|
if (txtscan.contains("-")) {
|
||||||
viewModel.setParking(
|
viewModel.setParking(
|
||||||
ticketFk = collection.collectionFk,
|
ticketFk = collection.collectionFk, parking = txtscan
|
||||||
parking = txtscan
|
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
mperror!!.start()
|
mperror!!.start()
|
||||||
|
@ -822,14 +698,12 @@ class CollectionFragmentPickerNew(
|
||||||
if (sale.code!!.uppercase() == txtscan.uppercase()) {
|
if (sale.code!!.uppercase() == txtscan.uppercase()) {
|
||||||
mpok!!.start()
|
mpok!!.start()
|
||||||
printShelvingResult(position)
|
printShelvingResult(position)
|
||||||
|
|
||||||
sale.isPicked = 1
|
sale.isPicked = 1
|
||||||
saleAdapter!!.notifyDataSetChanged()
|
saleAdapter!!.notifyDataSetChanged()
|
||||||
} else {
|
} else {
|
||||||
mperror!!.start()
|
mperror!!.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun markLine(position: Int, quantity: Int, isItemShelvingSaleEmpty: Boolean?) {
|
private fun markLine(position: Int, quantity: Int, isItemShelvingSaleEmpty: Boolean?) {
|
||||||
|
@ -840,9 +714,9 @@ class CollectionFragmentPickerNew(
|
||||||
quantityConfirm = quantity
|
quantityConfirm = quantity
|
||||||
isMarking = true
|
isMarking = true
|
||||||
|
|
||||||
viewModel.itemShelvingSaleSetQuantity(myGroupList[position].itemShelvingSaleFk,
|
viewModel.itemShelvingSaleSetQuantity(
|
||||||
quantity,
|
myGroupList[position].itemShelvingSaleFk, quantity, isItemShelvingSaleEmpty
|
||||||
isItemShelvingSaleEmpty)
|
)
|
||||||
|
|
||||||
//nuevo tema agrupacion sales
|
//nuevo tema agrupacion sales
|
||||||
//checkStateParent()
|
//checkStateParent()
|
||||||
|
@ -858,7 +732,6 @@ class CollectionFragmentPickerNew(
|
||||||
//setTotalLines()
|
//setTotalLines()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Tarea #4371
|
//Tarea #4371
|
||||||
|
|
||||||
private fun checkStateParent() {
|
private fun checkStateParent() {
|
||||||
|
@ -868,8 +741,7 @@ class CollectionFragmentPickerNew(
|
||||||
var isPreviousPrepared = s.sonSales.filter { it.semaphore == "1" }.size
|
var isPreviousPrepared = s.sonSales.filter { it.semaphore == "1" }.size
|
||||||
var isPrepared = s.sonSales.filter { it.semaphore == "2" }.size
|
var isPrepared = s.sonSales.filter { it.semaphore == "2" }.size
|
||||||
var isControlled = s.sonSales.filter { it.semaphore == "1" }.size
|
var isControlled = s.sonSales.filter { it.semaphore == "1" }.size
|
||||||
var isPreControlled = s.sonSales.filter { it.semaphore == "4" }.size
|
var isPreControlled = s.sonSales.filter { it.semaphore == "4" }.size/* if (totalLines == isPreviousPrepared) {
|
||||||
/* if (totalLines == isPreviousPrepared) {
|
|
||||||
s.isPreviousPrepared = "1"
|
s.isPreviousPrepared = "1"
|
||||||
} else {
|
} else {
|
||||||
s.isPreviousPrepared = "0"
|
s.isPreviousPrepared = "0"
|
||||||
|
@ -914,13 +786,11 @@ class CollectionFragmentPickerNew(
|
||||||
|
|
||||||
private fun unMarkLine(position: Int, sale: Sale) {
|
private fun unMarkLine(position: Int, sale: Sale) {
|
||||||
state = 0
|
state = 0
|
||||||
customDialog.setTitle(getString(R.string.unmarkLine))
|
customDialog.setTitle(getString(R.string.unmarkLine)).setDescription(
|
||||||
.setDescription(
|
|
||||||
getString(R.string.goUnmark) + sale.itemFk + getString(
|
getString(R.string.goUnmark) + sale.itemFk + getString(
|
||||||
R.string.sure
|
R.string.sure
|
||||||
)
|
)
|
||||||
)
|
).setOkButton(getString(R.string.unmark)) {
|
||||||
.setOkButton(getString(R.string.unmark)) {
|
|
||||||
sale.isPicked = 0
|
sale.isPicked = 0
|
||||||
saleAdapter!!.notifyDataSetChanged()
|
saleAdapter!!.notifyDataSetChanged()
|
||||||
var mySale = sale.saleFk
|
var mySale = sale.saleFk
|
||||||
|
@ -933,6 +803,7 @@ class CollectionFragmentPickerNew(
|
||||||
storedBackPosition = position
|
storedBackPosition = position
|
||||||
setListPosition(position, false)
|
setListPosition(position, false)
|
||||||
viewModel.itemShelvingSaleUnpicked(sales[position].itemShelvingSaleFk)
|
viewModel.itemShelvingSaleUnpicked(sales[position].itemShelvingSaleFk)
|
||||||
|
println("itemshelvingSale ${sales[position].itemShelvingSaleFk}")
|
||||||
positionUnmarked = position
|
positionUnmarked = position
|
||||||
setTotalLines()
|
setTotalLines()
|
||||||
scanRequest()
|
scanRequest()
|
||||||
|
@ -942,27 +813,22 @@ class CollectionFragmentPickerNew(
|
||||||
customDialog.dismiss()
|
customDialog.dismiss()
|
||||||
}.show()
|
}.show()
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//SHELVINGS
|
//SHELVINGS
|
||||||
|
|
||||||
private fun printShelvingResult(pos: Int) {
|
private fun printShelvingResult(pos: Int) {
|
||||||
|
|
||||||
storedPosition = pos
|
storedPosition = pos
|
||||||
customDialogList.getEditTextTwo().inputType = InputType.TYPE_CLASS_TEXT
|
customDialogList.getEditTextTwo().inputType = InputType.TYPE_CLASS_TEXT
|
||||||
customDialogList.getEditTextTwo().setRawInputType(InputType.TYPE_CLASS_NUMBER)
|
customDialogList.getEditTextTwo().setRawInputType(InputType.TYPE_CLASS_NUMBER)
|
||||||
|
|
||||||
customDialogList.getEditText().setRawInputType(InputType.TYPE_CLASS_NUMBER)
|
customDialogList.getEditText().setRawInputType(InputType.TYPE_CLASS_NUMBER)
|
||||||
customDialogList.getEditTextTwo().requestFocus()
|
customDialogList.getEditTextTwo().requestFocus()
|
||||||
|
|
||||||
var shelving = myGroupList[pos].code
|
var shelving = myGroupList[pos].code
|
||||||
var item = myGroupList[pos].itemFk
|
var item = myGroupList[pos].itemFk
|
||||||
var longName = myGroupList[pos].longName
|
var longName = myGroupList[pos].longName
|
||||||
var totalReserved = myGroupList[pos].reservedQuantity
|
var totalReserved = myGroupList[pos].reservedQuantity
|
||||||
var itemShelvingFk = myGroupList[pos].itemShelvingSaleFk
|
var itemShelvingFk = myGroupList[pos].itemShelvingSaleFk
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
customDialogList.setTitle("$shelving($item) $totalReserved de $longName").setOkButton(
|
customDialogList.setTitle("$shelving($item) $totalReserved de $longName").setOkButton(
|
||||||
getString(
|
getString(
|
||||||
|
@ -977,8 +843,7 @@ class CollectionFragmentPickerNew(
|
||||||
scanRequest()
|
scanRequest()
|
||||||
|
|
||||||
}.setHintValue(getString(R.string.quantitySelect)).setValue(totalReserved.toString())
|
}.setHintValue(getString(R.string.quantitySelect)).setValue(totalReserved.toString())
|
||||||
.setHintValueTwo(getString(R.string.scanItem))
|
.setHintValueTwo(getString(R.string.scanItem)).setValueTwo("").show()
|
||||||
.setValueTwo("").show()
|
|
||||||
|
|
||||||
customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event ->
|
customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||||
|
@ -1000,21 +865,15 @@ class CollectionFragmentPickerNew(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun customDialogTakeAction(
|
private fun customDialogTakeAction(
|
||||||
position: Int,
|
position: Int, itemShelvingFk: Int, totalReserved: Int, isItemScanned: Boolean?
|
||||||
itemShelvingFk: Int,
|
|
||||||
totalReserved: Int,
|
|
||||||
isItemScanned: Boolean?
|
|
||||||
) {
|
) {
|
||||||
isScanned = isItemScanned
|
isScanned = isItemScanned
|
||||||
if (customDialogList.getValueTwo().isNotEmpty()) {
|
if (customDialogList.getValueTwo().isNotEmpty()) {
|
||||||
|
|
||||||
customDialogList.setValueTwo(
|
customDialogList.setValueTwo(
|
||||||
itemScanValue(
|
itemScanValue(
|
||||||
customDialogList.getValueTwo(),
|
customDialogList.getValueTwo(), "buy", "more"
|
||||||
"buy",
|
|
||||||
"more"
|
|
||||||
).toString()
|
).toString()
|
||||||
)
|
)
|
||||||
var quantityToReserve = customDialogList.getValue().toInt()
|
var quantityToReserve = customDialogList.getValue().toInt()
|
||||||
|
@ -1034,8 +893,7 @@ class CollectionFragmentPickerNew(
|
||||||
if (checkItemScan(customDialogList.getValueTwo())) {
|
if (checkItemScan(customDialogList.getValueTwo())) {
|
||||||
|
|
||||||
onQuantityOfShelvingSelected(
|
onQuantityOfShelvingSelected(
|
||||||
itemShelvingFk,
|
itemShelvingFk, quantityToReserve
|
||||||
quantityToReserve
|
|
||||||
)
|
)
|
||||||
|
|
||||||
mpok?.start()
|
mpok?.start()
|
||||||
|
@ -1045,8 +903,7 @@ class CollectionFragmentPickerNew(
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
itemShelvingFkStored = itemShelvingFk
|
itemShelvingFkStored = itemShelvingFk
|
||||||
binding.splashProgress.visibility =
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
View.VISIBLE
|
|
||||||
viewModel.getIdFromCodeSalix(
|
viewModel.getIdFromCodeSalix(
|
||||||
code = customDialogList.getValueTwo(),
|
code = customDialogList.getValueTwo(),
|
||||||
)
|
)
|
||||||
|
@ -1059,42 +916,18 @@ class CollectionFragmentPickerNew(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun ReviewQuantityForRefreshingAndSorting(
|
|
||||||
quantityTotal: Int,
|
|
||||||
quantityPicked: Int
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (quantityPicked < quantityTotal) {
|
|
||||||
|
|
||||||
viewModel.collectionTicketGet(
|
|
||||||
collection.collectionFk,
|
|
||||||
getDataInt(SECTORFK),
|
|
||||||
print = "0",
|
|
||||||
type
|
|
||||||
)
|
|
||||||
|
|
||||||
} else {
|
|
||||||
setStoredPosition(false)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setStoredPosition(isFromBack: Boolean) {
|
private fun setStoredPosition(isFromBack: Boolean) {
|
||||||
setListPosition(storedPosition, isFromBack)
|
setListPosition(storedPosition, isFromBack)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun checkItemScan(valueToCheck: String): Boolean {
|
private fun checkItemScan(valueToCheck: String): Boolean {
|
||||||
if (storedPosition >= 0 && sales.size > storedPosition) {
|
if (storedPosition >= 0 && sales.size > storedPosition) {
|
||||||
val saleToCheck = sales[storedPosition]
|
val saleToCheck = sales[storedPosition]
|
||||||
|
|
||||||
if (saleToCheck.itemFk.toString() == valueToCheck)
|
if (saleToCheck.itemFk.toString() == valueToCheck) return true
|
||||||
return true
|
|
||||||
else {
|
else {
|
||||||
saleToCheck.Barcodes.forEach { barcode ->
|
saleToCheck.Barcodes.forEach { barcode ->
|
||||||
if (barcode == valueToCheck)
|
if (barcode == valueToCheck) return true
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1104,22 +937,18 @@ class CollectionFragmentPickerNew(
|
||||||
|
|
||||||
//Tarea #4371
|
//Tarea #4371
|
||||||
private fun onQuantityOfShelvingSelected(itemShelvingFk: Int, quantity: Int = 0) {
|
private fun onQuantityOfShelvingSelected(itemShelvingFk: Int, quantity: Int = 0) {
|
||||||
println("Sacador $itemShelvingFk-$quantity")
|
println("Sacador $itemShelvingFk-$quantity")/* if (myGroupList[storedPosition].reservedQuantity == 0) {
|
||||||
/* if (myGroupList[storedPosition].reservedQuantity == 0) {
|
|
||||||
showQuestionUbicationEmpty(storedPosition)
|
showQuestionUbicationEmpty(storedPosition)
|
||||||
} else {*/
|
} else {*/
|
||||||
markLine(storedPosition, quantity, null)
|
markLine(storedPosition, quantity, null)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showQuestionUbicationEmpty(position: Int, quantity: Int = 0) {
|
private fun showQuestionUbicationEmpty(position: Int, quantity: Int = 0) {
|
||||||
customDialogThreeButtonsQuantity
|
customDialogThreeButtonsQuantity.setTitle("Cambio de cantidad a $quantity")
|
||||||
.setTitle("Cambio de cantidad a $quantity")
|
|
||||||
.setDescription("¿Hay unidades del artículo ${sales[position].itemFk} en el carro escaneado?")
|
.setDescription("¿Hay unidades del artículo ${sales[position].itemFk} en el carro escaneado?")
|
||||||
.setValue("")
|
.setValue("").setCustomDialogValue(View.GONE)
|
||||||
.setCustomDialogValue(View.GONE)
|
|
||||||
customDialogThreeButtonsQuantity.setOkButtonAdd("SI") {
|
customDialogThreeButtonsQuantity.setOkButtonAdd("SI") {
|
||||||
scanRequest()
|
scanRequest()
|
||||||
customDialogThreeButtonsQuantity.dismiss()
|
customDialogThreeButtonsQuantity.dismiss()
|
||||||
|
@ -1131,8 +960,7 @@ class CollectionFragmentPickerNew(
|
||||||
scanRequest()
|
scanRequest()
|
||||||
customDialogThreeButtonsQuantity.dismiss()
|
customDialogThreeButtonsQuantity.dismiss()
|
||||||
markLine(position, quantity, true)
|
markLine(position, quantity, true)
|
||||||
}
|
}.setKoButton("CANCELAR") {
|
||||||
.setKoButton("CANCELAR") {
|
|
||||||
scanRequest()
|
scanRequest()
|
||||||
customDialogThreeButtonsQuantity.dismiss()
|
customDialogThreeButtonsQuantity.dismiss()
|
||||||
}.show()
|
}.show()
|
||||||
|
@ -1142,12 +970,10 @@ class CollectionFragmentPickerNew(
|
||||||
//OPTIONS
|
//OPTIONS
|
||||||
private fun print() {
|
private fun print() {
|
||||||
|
|
||||||
|
|
||||||
if (ma.havePrinter() && ma.haveSector()) {
|
if (ma.havePrinter() && ma.haveSector()) {
|
||||||
showDialogLabelCount()
|
showDialogLabelCount()
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
ma.messageWithSound(
|
ma.messageWithSound(
|
||||||
getString(R.string.printerFault),
|
getString(R.string.printerFault),
|
||||||
isError = true,
|
isError = true,
|
||||||
|
@ -1188,9 +1014,7 @@ class CollectionFragmentPickerNew(
|
||||||
try {
|
try {
|
||||||
customDialogList.setValue(
|
customDialogList.setValue(
|
||||||
itemScanValue(
|
itemScanValue(
|
||||||
customDialogList.getValue(),
|
customDialogList.getValue(), "buy", "more"
|
||||||
"buy",
|
|
||||||
"more"
|
|
||||||
).toString()
|
).toString()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1202,7 +1026,6 @@ class CollectionFragmentPickerNew(
|
||||||
|
|
||||||
return@setOnEditorActionListener true
|
return@setOnEditorActionListener true
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
|
|
||||||
|
@ -1232,7 +1055,6 @@ class CollectionFragmentPickerNew(
|
||||||
customDialogList.getRecyclerView().layoutManager =
|
customDialogList.getRecyclerView().layoutManager =
|
||||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun customDialogAddItem() {
|
private fun customDialogAddItem() {
|
||||||
|
@ -1240,25 +1062,23 @@ class CollectionFragmentPickerNew(
|
||||||
if (!customDialogList.getValueTwo().isNullOrEmpty()) {
|
if (!customDialogList.getValueTwo().isNullOrEmpty()) {
|
||||||
if (ticketSelected == 0) {
|
if (ticketSelected == 0) {
|
||||||
getString(R.string.Seleccionaunticketdelaista).toast(requireContext())
|
getString(R.string.Seleccionaunticketdelaista).toast(requireContext())
|
||||||
} else if (customDialogList.getValue()
|
} else if (customDialogList.getValue().isNullOrEmpty() || customDialogList.getValueTwo()
|
||||||
.isNullOrEmpty() || customDialogList.getValueTwo().isNullOrEmpty()
|
.isNullOrEmpty()
|
||||||
) {
|
) {
|
||||||
getString(R.string.Todosloscampossonobligatorios).toast(requireContext())
|
getString(R.string.Todosloscampossonobligatorios).toast(requireContext())
|
||||||
} else {
|
} else {
|
||||||
binding.splashProgress.visibility =
|
viewModel.collectionAddWithReservation(
|
||||||
View.VISIBLE
|
customDialogList.getValue().toInt(),
|
||||||
|
|
||||||
|
|
||||||
viewModel.collectionAddWithReservation(customDialogList.getValue().toInt(),
|
|
||||||
customDialogList.getValueTwo().toInt(),
|
customDialogList.getValueTwo().toInt(),
|
||||||
ticketSelected)
|
ticketSelected
|
||||||
|
)
|
||||||
|
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
hideKeyboards()
|
hideKeyboards()
|
||||||
scanRequest()
|
scanRequest()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
"El item no puede estar vacío".toast(requireContext())
|
getString(R.string.scanItem).toast(requireContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1281,8 +1101,7 @@ class CollectionFragmentPickerNew(
|
||||||
var totalMark = 0
|
var totalMark = 0
|
||||||
sales.forEach {
|
sales.forEach {
|
||||||
if (it.isPicked == 1) {
|
if (it.isPicked == 1) {
|
||||||
totalMark += 1
|
totalMark += 1/* } else if (it.reservedQuantity == 0) {
|
||||||
/* } else if (it.reservedQuantity == 0) {
|
|
||||||
totalMark += 1*/
|
totalMark += 1*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1305,24 +1124,20 @@ class CollectionFragmentPickerNew(
|
||||||
|
|
||||||
changeTicketState()
|
changeTicketState()
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//ESTADOS
|
//ESTADOS
|
||||||
private fun changeTicketState() {
|
private fun changeTicketState() {
|
||||||
|
|
||||||
tickets.forEach {
|
tickets.forEach {
|
||||||
viewModel.ticketStateTodaySetState(
|
viewModel.ticketStateTodaySetState(
|
||||||
ticketFk = it.toInt(),
|
ticketFk = it.toInt(), state = "PREPARED"
|
||||||
state = "PREPARED"
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//OTROS
|
//OTROS
|
||||||
private fun showScanner(index: Int, sale: Sale) {
|
private fun showScanner(index: Int, sale: Sale) {
|
||||||
customDialogInput.getEditText().inputType = InputType.TYPE_CLASS_TEXT
|
customDialogInput.getEditText().inputType = InputType.TYPE_CLASS_TEXT
|
||||||
|
@ -1361,8 +1176,7 @@ class CollectionFragmentPickerNew(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showErrorMessage(title: String = getString(R.string.errorMarkLine), text: String) {
|
private fun showErrorMessage(title: String = getString(R.string.errorMarkLine), text: String) {
|
||||||
customDialog.setTitle(title).setDescription(text)
|
customDialog.setTitle(title).setDescription(text).setKoButton(getString(R.string.close)) {
|
||||||
.setKoButton(getString(R.string.close)) {
|
|
||||||
customDialog.dismiss()
|
customDialog.dismiss()
|
||||||
}.show()
|
}.show()
|
||||||
}
|
}
|
||||||
|
@ -1381,8 +1195,7 @@ class CollectionFragmentPickerNew(
|
||||||
val labelCount = arrayOf("1", "2", "3", "4", "5", "6", "7", "8", "9", "10")
|
val labelCount = arrayOf("1", "2", "3", "4", "5", "6", "7", "8", "9", "10")
|
||||||
builder.setItems(labelCount) { dialog, which ->
|
builder.setItems(labelCount) { dialog, which ->
|
||||||
viewModel.collectionStickerPrint(
|
viewModel.collectionStickerPrint(
|
||||||
collectionFk = collection.collectionFk,
|
collectionFk = collection.collectionFk, labelCount = (which + 1)
|
||||||
labelCount = (which + 1)
|
|
||||||
)
|
)
|
||||||
(getString(R.string.Imprimiendo) + getData(PRINTERNAME)).toast(requireContext())
|
(getString(R.string.Imprimiendo) + getData(PRINTERNAME)).toast(requireContext())
|
||||||
|
|
||||||
|
@ -1391,13 +1204,11 @@ class CollectionFragmentPickerNew(
|
||||||
dialog.show()
|
dialog.show()
|
||||||
} else {
|
} else {
|
||||||
viewModel.collectionStickerPrint(
|
viewModel.collectionStickerPrint(
|
||||||
collectionFk = collection.collectionFk,
|
collectionFk = collection.collectionFk, null
|
||||||
null
|
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isNumber(num: String): Boolean {
|
fun isNumber(num: String): Boolean {
|
||||||
|
@ -1410,7 +1221,6 @@ class CollectionFragmentPickerNew(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun groupSaleGroup(salesList: ArrayList<Sale>): MutableList<Sale> {
|
private fun groupSaleGroup(salesList: ArrayList<Sale>): MutableList<Sale> {
|
||||||
var myMap = salesList.groupBy { it.saleGroupFk }
|
var myMap = salesList.groupBy { it.saleGroupFk }
|
||||||
var myList: MutableList<Sale> = mutableListOf()
|
var myList: MutableList<Sale> = mutableListOf()
|
||||||
|
@ -1449,8 +1259,7 @@ class CollectionFragmentPickerNew(
|
||||||
mySale.isParent = true
|
mySale.isParent = true
|
||||||
value as MutableList<Sale>
|
value as MutableList<Sale>
|
||||||
mySale.sonSales =
|
mySale.sonSales =
|
||||||
value.sortedWith(compareBy { it.isPicked }) as MutableList<Sale>
|
value.sortedWith(compareBy { it.isPicked }) as MutableList<Sale>/*mySale.line1 = "Previa :${mySale.saleGroupFk}"
|
||||||
/*mySale.line1 = "Previa :${mySale.saleGroupFk}"
|
|
||||||
mySale.line2 = "Líneas: ${value.size}"
|
mySale.line2 = "Líneas: ${value.size}"
|
||||||
mySale.line3 = value[0].code*/
|
mySale.line3 = value[0].code*/
|
||||||
// mySale.placements = listOf(PlacementVO(shelving = value[0].code!!))
|
// mySale.placements = listOf(PlacementVO(shelving = value[0].code!!))
|
||||||
|
@ -1462,7 +1271,6 @@ class CollectionFragmentPickerNew(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue