CollectionFragment modificar y borrar comentarios

This commit is contained in:
Sergio De la torre 2022-11-03 09:46:14 +01:00
parent 8f5a3788d6
commit 239641eb10
9 changed files with 115 additions and 501 deletions

View File

@ -82,10 +82,16 @@
</select>
</component>
<component name="ChangeListManager">
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="Version 9.4Beta Cmr, Control ubicación, volver atrás de Controlador, botón llamadas, volver pantalla anterior parking,">
<change afterPath="$PROJECT_DIR$/app/release/vn-pickingBeta.apk" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/app/build.gradle" afterDir="false" />
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="Modificado .gitignore">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/common/ResponseItemVO.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/common/ResponseItemVO.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionViewModel.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/values-es/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values-es/strings.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/values/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values/strings.xml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />

View File

@ -117,6 +117,22 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
)
}
fun ticket_isOutClosureZone(
usuario: String,
password: String,
ticketFk: String
): Call<Boolean> {
val params: ArrayList<String> = ArrayList()
params.add(ticketFk)
return restClient!!.ticket_isOutClosureZone(
"json",
"1",
usuario,
password,
"application/json",
params
)
}
fun collection_getUncheckedTicket(
usuario: String,
password: String,

View File

@ -409,6 +409,17 @@ interface VerdnaturaService {
):
Call<String>
@POST("almacennew/ticket_isOutClosureZone")//NO SALIX
fun ticket_isOutClosureZone(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String,
@Body params: List<String>
):
Call<Boolean>
@POST("almacennew/collection_getUncheckedTicket")//NO SALIX
fun collection_getUncheckedTicket(
@Header("aplicacion") aplicacion: String,

View File

@ -662,7 +662,7 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
)
)
/* saveWorkForm(
saveWorkForm(
WorkForms(
"TestLocalhost",
"http://10.1.4.42:9000",
@ -676,7 +676,7 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
"http://192.168.1.132:9000",
urlSalix = "https://test-salix.verdnatura.es/api/"
)
)*/
)
saveWorkForm(
WorkForms(

View File

@ -1,20 +1,18 @@
package es.verdnatura.presentation.common
import java.sql.Time
import java.util.*
class ResponseItemVO(
var response: String = "",
var isError: Boolean = false,
var errorMessage: String = "",
var codeError:Int=0
var codeError: Int = 0
)
class ResponseItemNumber(
var response: Int? = null,
var isError: Boolean = false,
var errorMessage: String = "",
var codeError:Int=0
var codeError: Int = 0
)
class ResponseItemMachineControl(

View File

@ -1,6 +1,5 @@
package es.verdnatura.presentation.view.feature.collection.fragment
import android.content.Context
import android.content.Intent
import android.graphics.drawable.Drawable
@ -9,7 +8,6 @@ import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.os.Parcelable
import android.util.Log.d
import android.view.View
import android.view.View.GONE
import android.view.View.VISIBLE
@ -89,20 +87,13 @@ class CollectionFragment(
private var saleTrackingCall = -1
private var lastScanned: String = ""
private var buttonPushedGetCollection = false
//private var myKM: KeyguardManager? = null
private var positionUnmarked = -1
private var state = 0
private var mIsListening = false
private var placementPicked: PlacementVO? = null
private var lastPlacementPicked: PlacementVO? = null
private var originalItemScan: String = ""
private var workerFkFromTicket = ""
private var itemShelvingTracking_mark: String = ""
private var recylerViewState: Parcelable? = null
@ -119,10 +110,8 @@ class CollectionFragment(
override fun getLayoutId(): Int = R.layout.fragment_collection
override fun onCreate(savedInstanceState: Bundle?) {
mperror = MediaPlayer.create((activity as MainActivity), R.raw.error)
mpok = MediaPlayer.create((activity as MainActivity), R.raw.ok)
if (type.equals(CONTROLADOR)) {
//sergio: comprueba si viene de la pantalla de controlador
viewModel.ticket_checkFullyControlled(
@ -131,16 +120,6 @@ class CollectionFragment(
collection.collectionFk
)
//Tarea 4280
/* var customDialogWarning = CustomDialog(requireContext())
customDialogWarning.setTitle("Aviso urgente")
customDialogWarning.setDescription("Urge el ticket que está revisando, la hora de la zona web del ticket ya se ha cerrado")
.setOkButton("ENTERADO") {
customDialogWarning.dismiss()
requireActivity().onBackPressed()
}.show()*/
workerFkFromTicket = collection.tickets.get(0).sales.get(0).workerFk
}
@ -153,7 +132,6 @@ class CollectionFragment(
type
)
}
super.onCreate(savedInstanceState)
}
@ -171,11 +149,9 @@ class CollectionFragment(
binding.splashProgress.visibility = VISIBLE
setEvents()
setToolBar()
if (collection.tickets.isNotEmpty()) {
createCollectionList()
}
super.init()
}
@ -195,40 +171,28 @@ class CollectionFragment(
if (!collection.collectionFk.isNullOrEmpty()) {
binding.mainToolbar.toolbarTitle.text = collection.collectionFk
}
val listIcons: ArrayList<ImageView> = ArrayList()
val iconPrint = ImageView(context)
iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
val iconAdd = ImageView(context)
iconAdd.setImageResource(R.drawable.ic_playlist_add_black_24dp)
val iconViewCollection = ImageView(context)
iconViewCollection.setImageResource(R.drawable.ic_collection)
val iconWorker = ImageView(context)
iconWorker.setImageResource(R.drawable.ic_worker)
val iconPhone = ImageView(context)
iconPhone.setImageResource(R.drawable.phone_call)
val iconParking = ImageView(context)
iconParking.setImageResource(R.drawable.ic_local_parking_black_24dp)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconPrint.tooltipText = getTooltip(R.drawable.ic_print_black_24dp)
iconAdd.tooltipText = getTooltip(R.drawable.ic_playlist_add_black_24dp)
iconViewCollection.tooltipText = getTooltip(R.drawable.ic_collection)
iconPhone.tooltipText = getTooltip(R.drawable.phone_call)
iconParking.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp)
}
listIcons.add(iconPrint)
if (type == CONTROLADOR) {
listIcons.add(iconViewCollection)
binding.previaButton.visibility = VISIBLE
@ -244,7 +208,6 @@ class CollectionFragment(
listIcons.remove(iconPrint)
}
binding.mainToolbar.toolbarIcons.adapter =
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
@ -254,7 +217,6 @@ class CollectionFragment(
iconPrint.drawable -> print()
iconAdd.drawable -> addItem()
iconWorker.drawable -> showUser()
//iconPhone.drawable -> getExtensionFromUser()
iconParking.drawable -> pasillerosItemClickListener?.onPasillerosItemClickListener(
PasillerosItemVO(
title = getString(R.string.Parking)
@ -268,10 +230,9 @@ class CollectionFragment(
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
private fun showPrevia() {
customDialogList.setTitle("Escanea ticket de previa")
customDialogList.setTitle(getString(R.string.scanPreviousTicket))
.setOkButton(getString(R.string.end)) {
ma.hideKeyboard(customDialogList.getEditText())
@ -292,7 +253,6 @@ class CollectionFragment(
var saleGroupScanned = customDialogList.getValue()
sales.forEachIndexed { pos, s ->
if (!s.saleGroupFk.isNullOrEmpty() && s.saleGroupFk == saleGroupScanned) {
markLine(pos, type)
}
}
@ -305,16 +265,12 @@ class CollectionFragment(
}
false
}
hideKeyboard()
}
private fun getCollection() {
binding.splashProgress.visibility = VISIBLE
if (!buttonPushedGetCollection) {
viewModel.collection_get(
getData(USER),
@ -323,7 +279,6 @@ class CollectionFragment(
getData(SECTORFK),
type
)
buttonPushedGetCollection = true
} else {
viewModel.collectionTicketGet(
@ -339,25 +294,6 @@ class CollectionFragment(
lastScanned = collection.collectionFk
}
/* private fun getExtensionFromUser() {
binding.splashProgress.visibility = VISIBLE
/* var working_in_test = true // sergio: en proves app
if (working_in_test) {*/
goMistakeBack = false
viewModel.sip_getExtensionSalix(getData(TOKEN), workerFkFromTicket)
/* } else {
viewModel.sip_getExtension(
getData(USER),
getData(PASSWORD), workerFkFromTicket, "sip_getExtension"
)
}*/
}*/
private fun scanRequest() {
binding.scanInput.requestFocus()
hideKeyboards()
@ -637,7 +573,7 @@ class CollectionFragment(
customDialogList.setValueTwo("")
if (it.response.isEmpty()) {
showErrorMessage("Código artículo no existe. Por favor remite foto del artículo al dpto informática para comprobar si el código buyFk ha sido borrado")
showErrorMessage(getString(R.string.codeNotExist))
viewModel.debug_add(
getData(USER),
getData(PASSWORD),
@ -671,11 +607,24 @@ class CollectionFragment(
missingTrashSuccesful()
}
} //sergio:esto ya estaba
/* binding.splashProgress.visibility = View.VISIBLE
viewModel.collectionTicketGet(user,password,collection.collectionFk,getData(SECTORFK))*/
})
}
})
//Tarea 4280
/* responseTicketClosure.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = GONE
if (!goBack) {
if (it.response.toBoolean()) {
var customDialogWarning = CustomDialog(requireContext())
customDialogWarning.setTitle(getString(R.string.urgentWarning))
customDialogWarning.setDescription(getString(R.string.ticketWarning))
.setOkButton(getString(R.string.aware)) {
customDialogWarning.dismiss()
}.show()
}
}
})*/
responseIncQuantity.observe(viewLifecycleOwner, Observer {
@ -938,12 +887,6 @@ class CollectionFragment(
} else {
/* viewModel.saleTrackingDel(
getData(USER),
getData(PASSWORD),
saleFk = sales[positionUnmarked].saleFk
)*/
goBack = false
}
})
@ -951,9 +894,7 @@ class CollectionFragment(
responseSalixMessage.observe(viewLifecycleOwner, Observer {
if (it.isError) {
if (!goBack) {
ma.messageWithSound(
getString(R.string.rocketKO) + it.errorMessage,
@ -1005,7 +946,6 @@ class CollectionFragment(
}
private fun getSalePerson(ticketFk: String): String {
var salePerson = ""
for (it in sales) {
if (it.ticketFk.equals(ticketFk)) {
@ -1054,7 +994,7 @@ class CollectionFragment(
salesList.add(saleVO)
if (tickets.firstOrNull { it == saleVO.ticketFk }.isNullOrEmpty())
tickets.add(saleVO.ticketFk)
}//Refactor #4030//
}
else if (type == PRECHECKER) {
if (saleVO.saleGroupFk != "") {
salesList.add(saleVO)
@ -1073,22 +1013,11 @@ class CollectionFragment(
// d("VERDNATURA::", "El id es " + s.saleFk + " tiene saleOrder" + s.saleOrder)
}*/
if (type == CONTROLADOR) {
sales = salesList.sortedWith(compareBy({ it.picked }))
}
//pruebas sergio
// sales = salesList.sortedWith(compareBy({it.placements.get(0).created}))
//sales = salesList.sortedWith(compareBy({it.placements.get(0).placement}))
// SalesSorter()
/* for (s in sales) {
Log.d(
"VERDNATURA::",
"La sale es ${s.saleFk} El item es ${s.itemFk} y su picked ${s.picked} y saleorder ${s.saleOrder}"
)
}*/
saleAdapter =
SaleAdapter(sales, pasillerosItemClickListener!!, object : OnQuantityClickListener {
@ -1165,18 +1094,14 @@ class CollectionFragment(
}
//CAU ISMAELCT
if (type == SACADOR) {
for (indice in sales.indices){
//sales.forEachIndexed outer@{ pos, s ->
for (indice in sales.indices) {
if (sales[indice].isPrepared == "0") {
// d("VERDNATURA::", "sale encontrada pos: " + sales[indice].saleFk + "-" + sales[indice].itemFk)
setListPosition(position = indice, isFromBack = true)
setListPosition(position = indice, isFromBack = true)
break
}
}
}
exit@
printObservations(observations)
}
@ -1214,10 +1139,7 @@ class CollectionFragment(
if (type == SACADOR) {
for (saleVO in sales) {
//sergio: pita si encuentra ticket o el saleGroupFk
//Log.i("VERDNATURA:","SE busca en sales ${saleVO.ticketFk}")
//canviar el titcket per salegroup i enviar a pako saleTracking_add (saleGroupFk) i refrescar pantalla.
//d("El salegroup es " + saleVO.saleGroupFk)
//sergio: pinta si encuentra ticket o el saleGroupFk
if (saleVO.saleGroupFk == txtscan) {
// if (saleVO.ticketFk == txtscan ) {
isOk = true
@ -1286,9 +1208,6 @@ class CollectionFragment(
)
}
Timber.i("La coleccion es %s", tickets[0])
/* if (mpok != null) mpok!!.start()
"Ticket aparcado".toast(requireContext())*/
} else {
if (mperror != null) mperror!!.start()
}
@ -1296,8 +1215,6 @@ class CollectionFragment(
}
} else if (type == CONTROLADOR || type == PRECHECKER) {
// checkSaleGroup()
for (saleVO in sales) {
//0-Salegroup
@ -1338,18 +1255,8 @@ class CollectionFragment(
getData(PASSWORD),
collectionFk = tickets[0]
)
// Log.d("VERDNATURA::", "LA COLECTION ES ${tickets[0]}")
/* viewModel.parking(
getData(USER),
getData(PASSWORD),
ticketFk = tickets[0],
parking = txtscan
)*/
}
/* if (mpok != null) mpok!!.start()
getString(R.string.Ticketaparcado).toast(requireContext())*/
} else {
binding.splashProgress.visibility =
VISIBLE
@ -1373,26 +1280,13 @@ class CollectionFragment(
)
}
// } else {
// binding.splashProgress.visibility = View.GONE
//}
////Log.i("VERDNATURA:","La collection es ${txtscan}")
}
}
}
}
/*private fun checkSaleGroup(txtscan: String) {
for (i in sales.indices) {
if (sales[i].saleGroupFk == txtscan) {
markLine(i, type)
}
}
}*/
private fun findSale(txtscan: String, position: Int) {
var isOk = false
if (type == SACADOR) {
@ -1441,8 +1335,6 @@ class CollectionFragment(
parking = txtscan
)
}
/* if (mpok != null) mpok!!.start()
"Ticket aparcado".toast(requireContext())*/
} else {
if (mperror != null) mperror!!.start()
@ -1675,7 +1567,6 @@ class CollectionFragment(
binding.splashProgress.visibility =
VISIBLE
viewModel.getIdFromCodeSalix(
token = getData(TOKEN),
code = customDialogList.getValueTwo(),
@ -2401,7 +2292,6 @@ class CollectionFragment(
} catch (e: Exception) {
}
//var working_in_test = true
viewModel.transferSalesSalix(
getData(TOKEN),
@ -2410,24 +2300,6 @@ class CollectionFragment(
quantity = totalQuantity.toString()
)
/* sales[position].quantity = quantity
if (quantity == "0")
markLine(position, type)
saleAdapter!!.notifyDataSetChanged()
//enviar mensaje a salix
val ticket =
"[" + sales[position].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].ticketFk + "/summary)"
val message =
"Se ha enviado a Split el articulo " + sales[position].itemFk + " del ticket " + ticket
viewModel.sendChekingPresence(
token = getData(TOKEN),
workerId = sales[position].salePersonFk,
message = message, "sendChekingPresence"
)*/
}
private fun TrashMissingReject(
@ -2454,125 +2326,9 @@ class CollectionFragment(
type = typeCollectionTrashMissingReject,
originalQuantity = quantity.toString()
)
/* sales[position].quantity = quantity
saleAdapter!!.notifyDataSetChanged()
if (quantity == "0")
markLine(position, type)
*/
}
/* private fun trash(position: Int, quantity: String) {
var totalQuantity: Int = 0
try {
totalQuantity = sales[position].quantity.toInt() - quantity.toInt()
} catch (e: Exception) {
}
viewModel.collectionMissingTrash(
usuario = user,
password = password,
saleFk = sales[position].saleFk,
quantity = totalQuantity.toString(),
warehouseFk = warehouseFk,
type = "FALSE",
originalQuantity = quantity,
callFunction = "collectionMissingTrash"
)
sales[position].quantity = quantity
saleAdapter!!.notifyDataSetChanged()
if (quantity == "0")
markLine(position, type)
//enviar mensaje a salix
val ticket =
"[" + sales[position].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].ticketFk + "/summary)"
val message =
"Se ha enviado a Faltas la cantidad de " + totalQuantity + getString(R.string.fromItem) + sales[position].itemFk + " ticket " + ticket
viewModel.sendChekingPresence(
token = token,
workerId = sales[position].salePersonFk,
message = message, "sendChekingPresence"
)
}
private fun missing(position: Int, quantity: String) {
var totalQuantity: Int = 0
try {
totalQuantity = sales[position].quantity.toInt() - quantity.toInt()
} catch (e: Exception) {
}
viewModel.collectionMissingTrash(
usuario = user,
password = password,
saleFk = sales[position].saleFk,
quantity = totalQuantity.toString(),
warehouseFk = warehouseFk,
type = "TRUE",
originalQuantity = quantity,
callFunction = "collectionMissingTrash",
)
//sales[position].originalQuantity = quantity
sales[position].quantity = quantity
//sales[position].startQuantity = quantity
if (quantity == "0")
markLine(position, type)
saleAdapter!!.notifyDataSetChanged()
//enviar mensaje a salix
val ticket =
"[" + sales[position].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].ticketFk + "/summary)"
val message =
"Se ha enviado a Basura " + totalQuantity + getString(R.string.fromItem) + sales[position].itemFk + " ticket " + ticket
viewModel.sendChekingPresence(
token = token,
workerId = sales[position].salePersonFk,
message = message,
"sendChekingPresence"
)
}
private fun reject(position: Int, quantity: String) {
positionReject = position
quantityReject = quantity
var totalQuantity: Int = 0
try {
totalQuantity = sales[position].quantity.toInt() - quantity.toInt()
} catch (e: Exception) {
}
viewModel.collectionMissingTrash(
usuario = user,
password = password,
saleFk = sales[position].saleFk,
quantity = totalQuantity.toString(),
warehouseFk = warehouseFk,
type = "reject",
originalQuantity = quantity
)
//sales[position].originalQuantity = quantity
sales[position].quantity = quantity
//sales[position].startQuantity = quantity
saleAdapter!!.notifyDataSetChanged()
if (quantity == "0")
markLine(position, type)
//enviar mensaje a salix
/* val ticket =
"[" + sales[position].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].ticketFk + "/summary)"
val message =
"Se ha modificado la cantidad original " + sales[position].originalQuantity + " del artículo " + sales[position].itemFk + " a nueva cantidad: " + sales[position].quantity + " del ticket " + ticket
viewModel.sendChekingPresence(
token = token,
workerId = sales[position].salePersonFk,
message = message, "sendChekingPresence"
)*/
}*/
private fun missingTrashSuccesful() {
@ -2632,7 +2388,6 @@ class CollectionFragment(
private fun incresaseSuccesful() {
try {
//val quantityPicked = (quantity.toInt() - sales[position].quantitytoInt()).toString()
// sergio: se añade linea para que se actualice la originalQuantity
//sales[positionIncreaseQuantity].originalQuantity = quantityIncrease
@ -2654,10 +2409,8 @@ class CollectionFragment(
sales[positionIncreaseQuantity].originalQuantity = quantityIncrease
}
private fun sendSalixMessageNew(message: String, workerId: String) {
viewModel.sendChekingPresence(
@ -2672,24 +2425,11 @@ class CollectionFragment(
positionIncreaseQuantity = position
quantityIncrease = quantity
/* var working_in_test = true // sergio: en proves app
if (!working_in_test) {
viewModel.collectionIncreaseQuantity(
getData(USER),
getData(PASSWORD),
saleFk = sales[position].saleFk,
quantity = quantity, "collection_increaseQuantity"
)
} else {*/
viewModel.collectionIncreaseQuantitySalix(
getData(TOKEN),
saleFk = sales[position].saleFk,
quantity = quantity.toString()
)
/* }*/
}
@ -2727,32 +2467,9 @@ class CollectionFragment(
}
}
/* private fun changeInitTicketState() {
if (type == CONTROLADOR) {
tickets.forEach {
viewModel.collectionUpdateState(
getData(USER),
getData(PASSWORD),
collectionFk = it,
state = ON_CHECKING, "collection_updateState"
)
}
} else if (type == SACADOR) {
tickets.forEach {
viewModel.collectionUpdateState(
getData(USER),
getData(PASSWORD),
collectionFk = it,
state = ON_PREPARATION, "collection_updateState"
)
}
}
}*/
//OTROS
private fun showScanner(index: Int, sale: SaleVO) {
//Timber.d("VERDNATURA-Entrant en el show scanner al punxar sobre la sale")
customDialogInput.setTitle("" + sale.itemFk)
.setDescription(getString(R.string.scanWagonForItem))
.setOkButton(getString(R.string.accept)) {
@ -2843,187 +2560,6 @@ class CollectionFragment(
return false
}
}
//VOZ
/* override fun onResults(results: Bundle) {
super.onResults(results)
//Log.i("Speech", "onResults")
val matches = results
.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION)
if (matches != null) {
//Log.i("RESPUESTA", matches[0])
mIsListening = false
mSpeechRecognizer!!.cancel()
getText(matches[0])
}
}*/
/* private fun getText(text: String) {
val pos = checkText(text)
when (pos) {
NEW_COLLECTION -> {
}
CANCEL -> {
}
LISTO -> {
state += 1
//speakOrder()
}
VOLVER -> {
}
REPITE -> {
// speakOrder()
}
OTRO -> {
// speak("Orden no registrada")
}
FALTA -> {
// speak("Orden no registrada")
}
}
}*/
/*private fun speakOrder() {
if (type == SACADOR) {
if (state == 0) {
//speak("Colección cargada.")
} else {
var index = 0
for (sale in sales) {
if (sale.isPrepared == "0" && sale.isPreviousPrepared == "0" && sale.isControlled == "0") {
if (state == 1) {
//cantar pasillo
if (sale.placements.size > 0) {
var placementIndex = 0
for (placement in sale.placements) {
var visible = placement.visible
visible = visible.replace("(", "")
visible = visible.replace(")", "")
var quantityVisible = 0
try {
quantityVisible = visible.toInt()
} catch (e: Exception) {
}
if (quantityVisible > 0) {
val pasillo = placement.placement.subSequence(
0,
sale.placements[0].placement.indexOf("-")
).toString()
val sector = placement.placement.subSequence(
sale.placements[0].placement.indexOf("-") + 1,
sale.placements[0].placement.length
).toString()
var letras: ArrayList<Char> = ArrayList()
val carro = placement.shelving
var carroSeparate: StringBuilder = StringBuilder("")
for (l in carro) {
carroSeparate.append(l)
carroSeparate.append(" ")
}
placementPicked = placement
storedShelvingPosition = placementIndex
if (lastPlacementPicked == null || lastPlacementPicked!!.placement != placement.placement) {
lastPlacementPicked = placement
try {
// speak("Pasillo " + pasillo.toInt() + ", Sector " + sector.toInt() + ", " + carroSeparate.toString())
} catch (e: Exception) {
// speak("Pasillo " + pasillo + " Sector " + sector + " Carro " + carro)
}
} else if (lastPlacementPicked != null && lastPlacementPicked!!.shelving != placement.shelving) {
// speak(" Carro " + carro)
} else {
state = 2
speakOrder()
}
break
}
placementIndex += 1
}
} else {
// speak("El item " + sale.itemFk + " no se encuentra disponible. Se necesita actuación manual.")
}
} else if (state == 2) {
//cantar articulo
try {
val item = sale.itemFk
val cantidad =
sale.quantity.toInt() - sale.pickedQuantity.toInt()
val listtext = sale.longName.split(" ")
var nombre: String
if (listtext.isNotEmpty()) {
nombre = listtext.get(0) + " " + sale.color
} else {
nombre = sale.longName + " " + sale.color
}
//speak("Item " + item.toInt() + " " + nombre + " , Cantidad: " + cantidad)
} catch (e: Exception) {
//speak("Se necesita actuación manual")
}
} else if (state == 3) {
//marcar linea
var visible = placementPicked!!.visible
visible = visible.replace("(", "")
visible = visible.replace(")", "")
var quantityVisible = 0
try {
quantityVisible = visible.toInt()
} catch (e: Exception) {
}
var needPicked = 0
try {
needPicked = sale.quantity.toInt() - sale.pickedQuantity.toInt()
} catch (e: Exception) {
}
storedPosition = index
if (quantityVisible < needPicked) {
onQuantityOfShelvingSelected(
itemShelvingFk = placementPicked!!.shelving,
quantity = quantityVisible.toString()
)
} else {
onQuantityOfShelvingSelected(
itemShelvingFk = placementPicked!!.shelving,
quantity = needPicked.toString()
)
}
state = 0
//speak("Acción registrada. Diga listo para continuar")
// speak("Registrada")
}
break
}
index += 1
}
if (index >= sales.size) {
//speak("Colección completada.")
}
}
}
}*/
/* override fun onDestroy() {
//cancelSpeech()
super.onDestroy()
}*/
}

View File

@ -101,6 +101,10 @@ class CollectionViewModel(context: Context) : BaseViewModel() {
val responsecheckfully: LiveData<ResponseItemVO>
get() = _responsecheckfully
private val _responseTicketClosure by lazy { MutableLiveData<ResponseItemVO>() }
val responseTicketClosure: LiveData<ResponseItemVO>
get() = _responseTicketClosure
private val _responseCollectionUnchecked by lazy { MutableLiveData<ResponseItemVO>() }
val responseCollectionUnchecked: LiveData<ResponseItemVO>
get() = _responseCollectionUnchecked
@ -1200,6 +1204,39 @@ class CollectionViewModel(context: Context) : BaseViewModel() {
})
}*/
fun ticket_isOutClosureZone(
usuario: String,
password: String,
ticketFk: String
) {
getSacadorControladorUserCase.ticket_isOutClosureZone(
usuario,
password,
ticketFk
).enqueue(object :
Callback<Boolean> {
override fun onFailure(call: Call<Boolean>, t: Throwable) {
_responseTicketClosure.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onResponse(
call: Call<Boolean>,
response: Response<Boolean>
) {
if (response.isSuccessful) {
_responseTicketClosure.value = ResponseItemVO(
isError = false,
response = response.body()!!.toString(),
errorMessage = ""
)
}
}
})
}
fun ticket_checkFullyControlled(
usuario: String,
password: String,

View File

@ -514,5 +514,10 @@
<string name="nextEntrySummary">Siguiente paso: resumen entrada</string>
<string name="activateModoChecking">Activado modo revisión</string>
<string name="allowCheckingMode">Permite activar modo revisión. Escane primero una matrícula</string>
<string name="codeNotExist">Código artículo no existe. Por favor remite foto del artículo al dpto informática para comprobar si el código buyFk ha sido borrado</string>
<string name="ticketWarning">Urge el ticket que está revisando, la hora de la zona web del ticket ya se ha cerrado</string>
<string name="urgentWarning">Aviso urgente</string>
<string name="aware">ENTERADO</string>
<string name="scanPreviousTicket">Escanea ticket de previa</string>
</resources>

View File

@ -512,6 +512,11 @@
<string name="nextEntrySummary">Next step: entry summary</string>
<string name="activateModoChecking">Activated checking mode</string>
<string name="allowCheckingMode">Allow checking mode. Scan firstly the plate and after activate the mode</string>
<string name="codeNotExist">Item code not exists..Please send the label to Computing department</string>
<string name="ticketWarning">Ticket that you are checking is urgent , closure ticket zone web is closed</string>
<string name="urgentWarning">Aviso urgente</string>
<string name="aware">AWARE</string>
<string name="scanPreviousTicket">Scan previous ticket</string>
</resources>