feat: refs#7823 selectPrinterFreely
This commit is contained in:
parent
5153bf62a2
commit
983043382d
|
@ -304,11 +304,7 @@ class AjustesFragment :
|
||||||
getString(R.string.closeSession) -> ma.onMyBackPressed()
|
getString(R.string.closeSession) -> ma.onMyBackPressed()
|
||||||
getString(R.string.printerLabel) -> {
|
getString(R.string.printerLabel) -> {
|
||||||
messagePrinter = getString(R.string.SelectPrinter)
|
messagePrinter = getString(R.string.SelectPrinter)
|
||||||
viewModel.printerGet(
|
viewModel.printerGet()
|
||||||
mobileApplication.dataStoreApp.readDataStoreKey(
|
|
||||||
SECTORFK
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.vehicleControl) -> ma.onPasillerosItemClickListener(
|
getString(R.string.vehicleControl) -> ma.onPasillerosItemClickListener(
|
||||||
|
@ -352,7 +348,7 @@ class AjustesFragment :
|
||||||
event.getContentIfNotHandled().notNull {
|
event.getContentIfNotHandled().notNull {
|
||||||
messagePrinter =
|
messagePrinter =
|
||||||
getString(R.string.SelectPrinter) + "\n" + getString(R.string.printerRemoved)
|
getString(R.string.SelectPrinter) + "\n" + getString(R.string.printerRemoved)
|
||||||
viewModel.printerGet(mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK))
|
viewModel.printerGet()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,23 +436,23 @@ class AjustesFragment :
|
||||||
}
|
}
|
||||||
|
|
||||||
val array = arrayOfNulls<String>(listPrinters.size)
|
val array = arrayOfNulls<String>(listPrinters.size)
|
||||||
showDialogForAll(listPrinters.toArray(array), messagePrinter ?: "")
|
// showDialogForAll(listPrinters.toArray(array), messagePrinter ?: "")
|
||||||
//Tarea7823
|
//Tarea7823
|
||||||
/* val listColorsElements = printersList.mapIndexed { _, printer ->
|
val listColorsElements = printersList.mapIndexed { _, printer ->
|
||||||
if (printer.sector?.id == mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
if (printer.sector?.id == mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
||||||
SECTORFK
|
SECTORFK
|
||||||
)
|
)
|
||||||
) printer.id else null
|
) printer.id else null
|
||||||
}.filterNotNull()
|
}.filterNotNull()
|
||||||
|
|
||||||
setSearchable(printersList.map {
|
setSearchable(printersList.map {
|
||||||
NameWithId(
|
NameWithId(
|
||||||
id = it.id,
|
id = it.id,
|
||||||
name = it.name
|
name = it.name
|
||||||
)
|
)
|
||||||
} as MutableList<NameWithId>,
|
} as MutableList<NameWithId>,
|
||||||
type = "printer",
|
type = "printer",
|
||||||
listColorsElements = listColorsElements)*/
|
listColorsElements = listColorsElements)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
viewModel.settingsItem[2].selected = getString(R.string.noprinter)
|
viewModel.settingsItem[2].selected = getString(R.string.noprinter)
|
||||||
|
|
|
@ -156,14 +156,11 @@ class AjustesViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun printerGet(sectorFk: Int) {
|
fun printerGet() {
|
||||||
|
//Tarea 7823*/
|
||||||
salix.getprinters(
|
salix.getprinters(
|
||||||
"""{"fields":["id","name","sectorFk"],"where":{"sectorFk":$sectorFk,"isLabeler":{"neq":false}},"include": [ { "relation": "sector", "scope": { "fields": ["backupPrinterFk"]}}]}"""
|
"""{"fields":["id","name","sectorFk"],"where":{"isLabeler":{"neq":false}},"include": [ { "relation": "sector", "scope": { "fields": ["backupPrinterFk"]}}]}"""
|
||||||
).enqueue(object : SalixCallback<MutableList<Printers>>(context) {
|
).enqueue(object : SalixCallback<MutableList<Printers>>(context) {
|
||||||
//Tarea 7823
|
|
||||||
/* salix.getprinters(
|
|
||||||
"""{"fields":["id","name","sectorFk"],"where":{"isLabeler":{"neq":false}},"include": [ { "relation": "sector", "scope": { "fields": ["backupPrinterFk"]}}]}"""
|
|
||||||
).enqueue(object : SalixCallback<MutableList<Printers>>(context) {*/
|
|
||||||
override fun onSuccess(response: Response<MutableList<Printers>>) {
|
override fun onSuccess(response: Response<MutableList<Printers>>) {
|
||||||
_printerList.value = response.body()?.let { PrintersList(it) }
|
_printerList.value = response.body()?.let { PrintersList(it) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ import es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
class ItemCardFragment(
|
class ItemCardFragment(
|
||||||
|
@ -140,15 +141,21 @@ class ItemCardFragment(
|
||||||
},
|
},
|
||||||
onPrintChange = { text ->
|
onPrintChange = { text ->
|
||||||
if (itemScanIsQr(text)) {
|
if (itemScanIsQr(text)) {
|
||||||
|
val labeler = itemScanValue(
|
||||||
|
text,
|
||||||
|
arrayOf("printer"),
|
||||||
|
"id"
|
||||||
|
).toString().toInt()
|
||||||
viewModel.operatorUpdate(
|
viewModel.operatorUpdate(
|
||||||
workerFk = mobileApplication.userId!!,
|
workerFk = mobileApplication.userId!!,
|
||||||
labelerFK = itemScanValue(
|
labelerFK = labeler
|
||||||
text,
|
|
||||||
arrayOf("printer"),
|
|
||||||
"id"
|
|
||||||
).toString().toLong()
|
|
||||||
)
|
)
|
||||||
|
runBlocking {
|
||||||
|
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||||
|
PRINTERFK,
|
||||||
|
labeler
|
||||||
|
)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ma.messageWithSound(
|
ma.messageWithSound(
|
||||||
getString(R.string.qrPrinterNotvalid),
|
getString(R.string.qrPrinterNotvalid),
|
||||||
|
@ -364,6 +371,17 @@ class ItemCardFragment(
|
||||||
buyToPrint = it
|
buyToPrint = it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadChangePrinterResponse.observe(viewLifecycleOwner) { event ->
|
||||||
|
event.getContentIfNotHandled().notNull {
|
||||||
|
runBlocking {
|
||||||
|
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||||
|
PRINTERFK,
|
||||||
|
it
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,10 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
val buyUltimateResponse: LiveData<Long> = _buyUltimateResponse
|
val buyUltimateResponse: LiveData<Long> = _buyUltimateResponse
|
||||||
val loadBuyUltimateResponse: LiveData<Event<Long>> = _buyUltimateResponse.map { Event(it) }
|
val loadBuyUltimateResponse: LiveData<Event<Long>> = _buyUltimateResponse.map { Event(it) }
|
||||||
|
|
||||||
|
private val _changePrinterResponse by lazy { MutableLiveData<Int>() }
|
||||||
|
val changePrinterResponse: LiveData<Int> = _changePrinterResponse
|
||||||
|
val loadChangePrinterResponse: LiveData<Event<Int>> = _changePrinterResponse.map { Event(it) }
|
||||||
|
|
||||||
fun getItemCard(
|
fun getItemCard(
|
||||||
itemFk: Number,
|
itemFk: Number,
|
||||||
warehouseFk: Int,
|
warehouseFk: Int,
|
||||||
|
@ -75,6 +79,10 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
operatorUseCase.updateOperator(workerFk = workerFk, hashMapOf("labelerFk" to labelerFK))
|
operatorUseCase.updateOperator(workerFk = workerFk, hashMapOf("labelerFk" to labelerFK))
|
||||||
.enqueue(object : SalixCallback<Unit>(context) {
|
.enqueue(object : SalixCallback<Unit>(context) {
|
||||||
|
override fun onSuccess(response: Response<Unit>) {
|
||||||
|
super.onSuccess(response)
|
||||||
|
_changePrinterResponse.value = labelerFK.toInt()
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue