Version 9.2 Error encajado y en ver Ticket aparece ver la colección

This commit is contained in:
Sergio De la torre 2022-10-20 16:43:13 +02:00
parent 16def8477c
commit d371048d3b
25 changed files with 450 additions and 178 deletions

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\sergiodt\.android\avd\Pixel_3a_API_30_x86.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2022-10-18T14:11:38.332474100Z" />
</component>
</project>

View File

@ -13,8 +13,12 @@ android {
applicationId "es.verdnatura"
minSdkVersion 21 //21
targetSdkVersion 30
versionCode 136
versionName = "9.1"
versionCode 138
versionName = 9.2
//versionName = "9.3.1Beta" versioncode 138
//versionName = "9.3Beta" versionCode 137
//versionName = "9.2.2Beta" versioncode 136
// versionName = "9.1" versionCode 136
//versionName = "9.2.1Beta" versioncode 135
//versionName = "9.2Beta" versionCode 133
//versionName = "9" versionCode 133

View File

@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 135,
"versionName": "9.2.1Beta",
"versionCode": 138,
"versionName": "9.2",
"outputFile": "app-release.apk"
}
],

View File

@ -79,7 +79,7 @@ class GetLoginUserCase(context: Context) : RestClient(context)
fun sendChekingPresence(token:String,workerId:Int,message:String) : Call<Boolean>{
var working_in_test=false // Enviar a grupo test Android o a los usuarios
var working_in_test=true // Enviar a grupo test Android o a los usuarios
if (!working_in_test) {
return salixClient!!.sendChekingPresence(

View File

@ -41,7 +41,7 @@ class GetWokerMistakeUSerCase(context: Context) : RestClient(context) {
params
)
}
fun expeditionMistake_Add(
fun expeditionMistake_add(
usuario: String,
password: String,
vExpeditionFk: String,
@ -50,7 +50,7 @@ class GetWokerMistakeUSerCase(context: Context) : RestClient(context) {
val params: ArrayList<String> = ArrayList()
params.add(vExpeditionFk)
params.add(vTypeFk)
return restClient!!.expeditionMistake_Add(
return restClient!!.expeditionMistake_add(
"json",
"1",
usuario,

View File

@ -710,8 +710,8 @@ interface VerdnaturaService {
):
Call<Unit>
@POST("almacennew/expeditionMistake_Add")//REVISADA
fun expeditionMistake_Add(
@POST("almacennew/expeditionMistake_add")//REVISADA
fun expeditionMistake_add(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,

View File

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

@ -5,6 +5,5 @@ import org.json.JSONObject
data class itemScanned(var scanned: JSONObject) {
// var schema: String = scanned!!.get("schema").toString()
var table: String = scanned!!.get("table").toString()
var field: String = scanned!!.get("field").toString()
var value: String = scanned!!.get("value").toString()
var id: String = scanned!!.get("id").toString()
}

View File

@ -109,11 +109,11 @@ class CustomDialogInputTwoValues(context: Context) : Dialog(context, R.style.Dia
}
fun setInputText() {
binding.customDialogValue.inputType = InputType.TYPE_CLASS_NUMBER
// binding.customDialogValue.inputType = InputType.TYPE_CLASS_NUMBER
}
fun setInputTextTwo() {
binding.customDialogValueTwo.inputType = InputType.TYPE_CLASS_NUMBER
// binding.customDialogValueTwo.inputType = InputType.TYPE_CLASS_NUMBER
}
fun setInfoTex(text:String){
binding.textinputlayoutUsername.hint = text

View File

@ -74,9 +74,7 @@ class CustomDialogThreeButtons (context: Context) : Dialog(context, R.style.Dial
binding.customDialogButtonOkTwo.text = text
binding.customDialogButtonOkTwo.setOnClickListener { onButtonClicked() }
/* custom_dialog_button_ok_two.visibility = View.VISIBLE
custom_dialog_button_ok_two.text = text
custom_dialog_button_ok_two.setOnClickListener { onButtonClicked() }*/
return this
}
@ -86,9 +84,7 @@ class CustomDialogThreeButtons (context: Context) : Dialog(context, R.style.Dial
binding.customDialogButtonOkThree.text = text
binding.customDialogButtonOkThree.setOnClickListener { onButtonClicked() }
/* custom_dialog_button_ok_three.visibility = View.VISIBLE
custom_dialog_button_ok_three.text = text
custom_dialog_button_ok_three.setOnClickListener { onButtonClicked() }*/
return this
}
@ -97,9 +93,7 @@ class CustomDialogThreeButtons (context: Context) : Dialog(context, R.style.Dial
binding.customDialogButtonOkFour.text = text
binding.customDialogButtonOkFour.setOnClickListener { onButtonClicked() }
/* custom_dialog_button_ok_four.visibility = View.VISIBLE
custom_dialog_button_ok_four.text = text
custom_dialog_button_ok_four.setOnClickListener { onButtonClicked() }*/
return this
}
@ -109,9 +103,7 @@ class CustomDialogThreeButtons (context: Context) : Dialog(context, R.style.Dial
binding.customDialogButtonAdd.text = text
binding.customDialogButtonAdd.setOnClickListener { onButtonClicked() }
/* custom_dialog_button_add.visibility = View.VISIBLE
custom_dialog_button_add.text = text
custom_dialog_button_add.setOnClickListener { onButtonClicked() }*/
return this
}
@ -121,9 +113,7 @@ class CustomDialogThreeButtons (context: Context) : Dialog(context, R.style.Dial
binding.customDialogButtonKo.text = text
binding.customDialogButtonKo.setOnClickListener { onButtonClicked() }
/* custom_dialog_button_ko.visibility = View.VISIBLE
custom_dialog_button_ko.text = text
custom_dialog_button_ko.setOnClickListener { onButtonClicked() }*/
return this
}

View File

@ -35,6 +35,7 @@ class AjustesFragment :
private var ajustesAdapter: AjustesAdapter? = null
private var isWorkerAllowed: Boolean = false
private var itemPackingList: List<ItemPackingType> = listOf()
private var messagePrinter:String? = null
//añadido
private var wagonList: List<String> = listOf()
@ -125,8 +126,10 @@ class AjustesFragment :
showDialogCarros(array = listCarros.toArray(array))*/
} else if (item.id == 2) {
messagePrinter=getString(R.string.Selecccionaimpresoara)
viewModel.printer_get(getData(USER), getData(PASSWORD))
} else if (item.id == 3) {
val listTagsType: ArrayList<String> = ArrayList()
listTagsType.add(getString(R.string.stickers))
@ -216,6 +219,7 @@ class AjustesFragment :
)
binding.splashProgress.visibility = VISIBLE
messagePrinter=getString(R.string.Selecccionaimpresoara)+"\n"+getString(R.string.printerRemoved)
viewModel.printer_get(getData(USER), getData(PASSWORD))
// viewModel.worker_isF11Allowed(getData(USER), getData(PASSWORD))
@ -385,7 +389,9 @@ class AjustesFragment :
private fun showDialogPrinters(array: Array<String>) {
val builder = AlertDialog.Builder(this.context)
builder.setTitle(getString(R.string.Selecccionaimpresoara))
builder.setTitle(messagePrinter)
// builder.setMessage("La impresora que tenía se ha eliminado ")
builder.setItems(array) { _, which ->
val selected = array[which]
printersList.forEach {

View File

@ -8,7 +8,7 @@ import android.media.MediaPlayer
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.speech.SpeechRecognizer
import android.util.Log.d
import android.view.View
import android.view.View.GONE
import android.view.View.VISIBLE
@ -16,7 +16,6 @@ import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
import android.widget.ImageView
import android.widget.Toast
import androidx.core.net.toUri
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
@ -74,14 +73,14 @@ class CollectionFragment(
private var mistakeSale: SaleVO? = null
private var positionIncreaseQuantity = 0
private var positionReject = 0
private var quantityIncrease:Int=0
private var quantityIncrease: Int = 0
private var quantityReject = ""
private var typeCollectionMissing = ""
private var positionCollectionMissing = 0
private var quantityCollectionMissing:Int=0
private var quantityCollectionMissing: Int = 0
private var isMarking = false
private var positionCollectionSplit = 0
private var quantityCollectionSplit:Int=0
private var quantityCollectionSplit: Int = 0
private lateinit var ticketToParking: String
private lateinit var ticketScanTxt: String
@ -122,9 +121,7 @@ class CollectionFragment(
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(
getData(USER),
@ -132,11 +129,20 @@ 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
}
if (collection.tickets.isEmpty()) {
viewModel.collectionTicketGet(
getData(USER),
getData(PASSWORD),
@ -146,7 +152,6 @@ class CollectionFragment(
)
}
super.onCreate(savedInstanceState)
}
@ -197,6 +202,9 @@ class CollectionFragment(
val listIcons: ArrayList<ImageView> = ArrayList()
/* val iconPrevia = ImageView(context)
iconPrevia.setImageResource(R.drawable.ic_local_parking_orange_24dp)*/
val iconPrint = ImageView(context)
iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
@ -206,7 +214,6 @@ class CollectionFragment(
val iconViewCollection = ImageView(context)
iconViewCollection.setImageResource(R.drawable.ic_collection)
val iconWorker = ImageView(context)
iconWorker.setImageResource(R.drawable.ic_worker)
@ -216,6 +223,7 @@ class CollectionFragment(
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)
@ -223,23 +231,21 @@ class CollectionFragment(
iconViewCollection.tooltipText = getTooltip(R.drawable.ic_collection)
iconPhone.tooltipText = getTooltip(R.drawable.phone_call)
iconParking.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp)
}
if (type.equals("CHECKER")) {
// listIcons.add(iconPhone)
}
listIcons.add(iconPrint)
if (type == CONTROLADOR) {
listIcons.add(iconViewCollection)
binding.previaButton.visibility = VISIBLE
binding.previaButton.setOnClickListener {
showPrevia()
}
}
listIcons.add(iconAdd)
listIcons.add(iconWorker)
if (type.equals(PRECHECKER)) {
listIcons.add(iconParking)
listIcons.remove(iconPrint)
@ -255,7 +261,7 @@ class CollectionFragment(
iconPrint.drawable -> print()
iconAdd.drawable -> addItem()
iconWorker.drawable -> showUser()
//iconPhone.drawable -> getExtensionFromUser()
//iconPhone.drawable -> getExtensionFromUser()
iconParking.drawable -> pasillerosItemClickListener?.onPasillerosItemClickListener(
PasillerosItemVO(
title = getString(R.string.Parking)
@ -270,6 +276,48 @@ class CollectionFragment(
}
private fun showPrevia() {
customDialogList.setTitle("Escanea ticket de previa")
.setOkButton(getString(R.string.end)) {
ma.hideKeyboard(customDialogList.getEditText())
customDialogList.dismiss()
requireActivity().onBackPressed()
}.setValue("").show()
customDialogList.getEditText().requestFocus()
ma.hideKeyboard(customDialogList.getEditText())
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) {
if (!customDialogList.getValue().isEmpty()) {
ma.hideKeyboard(customDialogList.getEditText())
var saleGroupScanned = customDialogList.getValue()
sales.forEachIndexed { pos, s ->
if (!s.saleGroupFk.isNullOrEmpty() && s.saleGroupFk == saleGroupScanned) {
markLine(pos, type)
}
}
customDialogList.dismiss()
}
customDialogList.setValue("")
ma.hideKeyboard(customDialogList.getEditText())
return@setOnEditorActionListener true
}
false
}
hideKeyboard()
}
private fun getCollection() {
binding.splashProgress.visibility = VISIBLE
@ -298,24 +346,24 @@ class CollectionFragment(
lastScanned = collection.collectionFk
}
/* private fun getExtensionFromUser() {
/* private fun getExtensionFromUser() {
binding.splashProgress.visibility = VISIBLE
binding.splashProgress.visibility = VISIBLE
/* var working_in_test = true // sergio: en proves app
/* 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"
)
}*/
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()
@ -985,12 +1033,6 @@ class CollectionFragment(
val message =
getString(R.string.itemAdded) + item + getString(R.string.with) + quantity + getString(R.string.unityTicket) + ticket
/* d("VERDNATURA:","el comercial es " + salePerson)
d("VERDNATURA:","el item es " + item)
d("VERDNATURA:","el ticket es es " + ticketFk)
d("VERDNATURA:","la cantidad es " + quantity)*/
viewModel.sendChekingPresence(
token = getData(TOKEN),
workerId = salePerson,
@ -1032,6 +1074,9 @@ class CollectionFragment(
sales = salesList.sortedWith(compareBy({ it.saleOrder }))
for (s in sales) {
d("VERDNATURA::", "El id es " + s.saleFk + " tiene saleOrder" + s.saleOrder)
}
if (type == CONTROLADOR) {
@ -2248,9 +2293,14 @@ class CollectionFragment(
}
//FALTAS / BASURA / SPLIT
private fun showQuantityDialog(position: Int) {
customDialogThreeButtons.setDescription(getString(R.string.txtnuevacantidad)).setValue("")
.setOkButton(getString(R.string.titleFaults)) {
//Tarea4495
// if (type != SACADOR) {
customDialogThreeButtons.setOkButton(getString(R.string.titleFaults)) {
checkAndCall(
position,
customDialogThreeButtons.getValue(),
@ -2264,33 +2314,37 @@ class CollectionFragment(
customDialogThreeButtons.getValue(),
getString(R.string.BasuraRechazar)
)
}
// }
}.setOkButtonThree(getString(R.string.Reject)) {
checkAndCall(
position,
customDialogThreeButtons.getValue(),
getString(R.string.Reject)
)
customDialogThreeButtons.setOkButtonThree(getString(R.string.Reject)) {
checkAndCall(
position,
customDialogThreeButtons.getValue(),
getString(R.string.Reject)
)
}.setOkButtonFour(getString(R.string.Split)) {
checkAndCall(
position,
customDialogThreeButtons.getValue(),
getString(R.string.Split)
)
}.setOkButtonFour(getString(R.string.Split)) {
checkAndCall(
position,
customDialogThreeButtons.getValue(),
getString(R.string.Split)
)
}.setOkButtonAdd(getString(R.string.Agregar)) {
checkAndCall(
position,
customDialogThreeButtons.getValue(),
getString(R.string.Agregar)
)
}.setOkButtonAdd(getString(R.string.Agregar)) {
checkAndCall(
position,
customDialogThreeButtons.getValue(),
getString(R.string.Agregar)
)
}.setKoButton(getString(R.string.cancel)) {
scanRequest()
customDialogThreeButtons.dismiss()
}.show()
}.setKoButton(getString(R.string.cancel)) {
scanRequest()
customDialogThreeButtons.dismiss()
}.show()
}
private fun checkAndCall(position: Int, value: String, action: String) {
@ -2300,8 +2354,16 @@ class CollectionFragment(
when (action) {
getString(R.string.Agregar) -> increaseQuantity(position, value.toInt())
getString(R.string.BasuraRechazar) -> TrashMissingReject(position, value.toInt(), "TRUE")
getString(R.string.titleFaults) -> TrashMissingReject(position, value.toInt(), "FALSE")
getString(R.string.BasuraRechazar) -> TrashMissingReject(
position,
value.toInt(),
"TRUE"
)
getString(R.string.titleFaults) -> TrashMissingReject(
position,
value.toInt(),
"FALSE"
)
getString(R.string.Reject) -> TrashMissingReject(position, value.toInt(), "reject")
getString(R.string.Split) -> split(position, value.toInt())
@ -2769,46 +2831,46 @@ class CollectionFragment(
}
//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])
}
}*/
/* 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 -> {
/* private fun getText(text: String) {
val pos = checkText(text)
when (pos) {
NEW_COLLECTION -> {
}
CANCEL -> {
}
CANCEL -> {
}
LISTO -> {
state += 1
//speakOrder()
}
VOLVER -> {
}
LISTO -> {
state += 1
//speakOrder()
}
VOLVER -> {
}
REPITE -> {
// speakOrder()
}
OTRO -> {
// speak("Orden no registrada")
}
FALTA -> {
// speak("Orden no registrada")
}
}
}*/
}
REPITE -> {
// speakOrder()
}
OTRO -> {
// speak("Orden no registrada")
}
FALTA -> {
// speak("Orden no registrada")
}
}
}*/
/*private fun speakOrder() {
if (type == SACADOR) {
@ -2945,9 +3007,9 @@ class CollectionFragment(
}
}*/
/* override fun onDestroy() {
//cancelSpeech()
super.onDestroy()
}*/
/* override fun onDestroy() {
//cancelSpeech()
super.onDestroy()
}*/
}

View File

@ -37,6 +37,8 @@ class CollectionShowTicketFragment(
private lateinit var customDialog: CustomDialog
private var tickets: ArrayList<String> = ArrayList()
private var lastScanned: String = ""
private var buttonPushedGetCollection = false
companion object {
fun newInstance(collection: CollectionVO, type: String) =
@ -84,6 +86,9 @@ class CollectionShowTicketFragment(
binding.mainToolbar.toolbarSubtitle.visibility = VISIBLE
val listIcons: ArrayList<ImageView> = ArrayList()
val iconPrint = ImageView(context)
val iconViewCollection = ImageView(context)
iconViewCollection.setImageResource(R.drawable.ic_collection)
iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
@ -91,18 +96,47 @@ class CollectionShowTicketFragment(
}
listIcons.add(iconPrint)
listIcons.add(iconViewCollection)
binding.mainToolbar.toolbarIcons.adapter =
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
when (item){
iconPrint.drawable->print()}
iconPrint.drawable->print()
iconViewCollection.drawable->getCollection()
}
}
})
binding.mainToolbar.toolbarIcons.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
private fun getCollection() {
binding.splashProgress.visibility = VISIBLE
if (!buttonPushedGetCollection) {
viewModel.collection_get(
getData(USER),
getData(PASSWORD),
collection.collectionFk,
getData(SECTORFK),
type
)
buttonPushedGetCollection = true
} else {
viewModel.collectionTicketGet(
getData(USER),
getData(PASSWORD),
lastScanned,
getData(SECTORFK),
type
)
buttonPushedGetCollection = false
}
lastScanned = collection.collectionFk
}
private fun print() {

View File

@ -419,13 +419,13 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
}
})
}
fun expeditionMistake_Add(
fun expeditionMistake_add(
usuario: String,
password: String,
vExpeditionFk: String,
vTypeFk: String
) {
getWorkerMistakeUserCase.expeditionMistake_Add(usuario, password, vExpeditionFk, vTypeFk)
getWorkerMistakeUserCase.expeditionMistake_add(usuario, password, vExpeditionFk, vTypeFk)
.enqueue(object :
Callback<Unit> {
override fun onFailure(call: Call<Unit>, t: Throwable) {

View File

@ -367,10 +367,10 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
saveRemember(false)
}
saveUserAccesPref(
/*saveUserAccesPref(
binding.edittextUsername.text.toString(),
binding.edittextPassword.text.toString()
)
)*/
if (it.vIsAuthorized == "1" && it.vMessage.isNullOrEmpty()) {
@ -518,6 +518,10 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
}.show()
} else {
saveTokenPref(it.token)
saveUserAccesPref(
binding.edittextUsername.text.toString(),
binding.edittextPassword.text.toString()
)
//Tarea 4351 quitar el if y poner e device_checkLogin a continuación del response de operator_add
viewModel.operator_add(getData(USER), getData(PASSWORD))

View File

@ -1,6 +1,6 @@
package es.verdnatura.presentation.view.feature.paletizador.fragment
import android.util.Log
import android.util.Log.d
import android.view.View
import android.view.inputmethod.EditorInfo
import es.verdnatura.R
@ -20,6 +20,7 @@ class CmrExpeditionPalletFragment(
private lateinit var customDialogList: CustomDialogInputTwoValues
private var itemScaned: String = ""
private lateinit var dataScanned: itemScanned
private lateinit var dataScannedTwo: itemScanned
companion object {
fun newInstance(title: String) = CmrExpeditionPalletFragment(title)
@ -91,14 +92,13 @@ class CmrExpeditionPalletFragment(
}
private fun showExpeditionPalletScan() {
customDialogList.setInfoTex(getString(R.string.pallet))
customDialogList.setInfoTextTwo(getString(R.string.cmr))
customDialogList.setInputTextVisibility(View.GONE)
customDialogList.setTitle(getString(R.string.expeditionPalletScan))
customDialogList.setValue("")
customDialogList.setValueTwo("")
customDialogList.setInfoTex("")
customDialogList.setInfoTextTwo("")
customDialogList.setInfoTex(getString(R.string.expeditionPalletOrCMR))
customDialogList.setTitle(getString(R.string.expeditionPalletCMR))
.setOkButton(getString(R.string.end)) {
ma.hideKeyboard(customDialogList.getEditText())
customDialogList.dismiss()
binding.mainToolbar.backButton.performClick()
@ -115,8 +115,25 @@ class CmrExpeditionPalletFragment(
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) {
if (customDialogList.getValue().isNotEmpty()) {
customDialogList.setInputTextVisibility(View.VISIBLE)
customDialogList.setTitle(getString(R.string.cmrScan))
dataScanned = itemScan(customDialogList.getValue())
d("VERDNATURA::","tabla v1 es "+dataScanned.table)
when (itemScaned(customDialogList.getValue())) {
"cmr" -> {
customDialogList.setInfoTex(getString(R.string.cmr))
customDialogList.setInfoTextTwo(getString(R.string.pallet))
customDialogList.setValue(dataScanned.id)
}
"expeditionPallet" -> {
customDialogList.setInfoTex(getString(R.string.pallet))
customDialogList.setInfoTextTwo(getString(R.string.cmr))
//customDialogList.setInputTextVisibility(View.GONE)
customDialogList.setValue(dataScanned.id)
}
else ->
customDialogList.setValue("No ha escaneado ni pallet ni CMR")
}
customDialogList.setFocusTextTwo()
}
@ -131,21 +148,114 @@ class CmrExpeditionPalletFragment(
if (customDialogList.getValue().isNotEmpty() && customDialogList.getValueTwo()
.isNotEmpty()
) {
ma.hideKeyboard(customDialogList.getEditText())
dataScannedTwo = itemScan(customDialogList.getValueTwo())
d("VERDNATURA::","tabla v1 es "+dataScanned.table)
d("VERDNATURA::","tabla v2 es "+itemScaned(customDialogList.getValueTwo()))
if (itemScanedIsCMR(customDialogList.getValueTwo())) {
itemScaned = dataScanned.value
customDialogList.setValueTwo("")
cmrExpeditionPallet_add(
customDialogList.getValue(),
itemScaned
)
} else {
customDialogList.setValueTwo("")
ma.messageWithSound(getString(R.string.errorCmrNotScanned), true, true, isToasted = true)
// customDialogList.setValueTwo(itemScanedValue(customDialogList.getValueTwo()))
when (itemScaned(customDialogList.getValueTwo())){
"cmr" -> {
if (dataScanned.table == "cmr"){
ma.messageWithSound(
"Escanea pallet",
true,
true,
isToasted = true
)
customDialogList.setValueTwo("")
}
if (dataScanned.table == "expeditionPallet"){
cmrExpeditionPallet_add(
dataScanned.id,
dataScannedTwo.id)
}
customDialogList.setValueTwo(dataScannedTwo.id)
}
"expeditionPallet"->{
/* d("VERDNATURA::","tabla v1 es "+dataScanned.table)
d("VERDNATURA::","tabla v2 es "+itemScaned(customDialogList.getValueTwo()))*/
if (dataScanned.table == "cmr"){
cmrExpeditionPallet_add(
dataScannedTwo.id,
dataScanned.id)
customDialogList.setValueTwo(dataScannedTwo.id)
}
if (dataScanned.table == "expeditionPallet"){
ma.messageWithSound(
"Escanea CMR",
true,
true,
isToasted = true
)
customDialogList.setValueTwo("")
}
}
}
// ma.hideKeyboard(customDialogList.getEditText())
/* dataScannedTwo = itemScan(customDialogList.getValueTwo())
d("VERDNATURA::","el valor es " + dataScannedTwo.id + "y tabla " + dataScannedTwo.table)
*/
/* when (itemScaned(customDialogList.getValueTwo())) {
"cmr" -> {
customDialogList.setValueTwo(dataScanned.id)
*//* if (dataScanned.table == "cmr") {
ma.messageWithSound(
getString(R.string.palletScanError),
true,
true,
isToasted = true
)
}*//*
}
*//* "expeditionPallet" -> {
if (dataScanned.table == "expeditionPallet") {
ma.messageWithSound(
getString(R.string.errorCmrNotScanned),
true,
true,
isToasted = true
)
}
if (dataScanned.table == "cmr") {
cmrExpeditionPallet_add(
itemScanedValue(customDialogList.getValueTwo()),
itemScanedValue(customDialogList.getValue()),
)
}
}*//*
else ->
customDialogList.setValueTwo("No ha escanado ni pallet ni CMR")
}*/
// customDialogList.setFocusTextTwo()
/* if (itemScaned(customDialogList.getValueTwo())) {
itemScaned = dataScanned.value
customDialogList.setValueTwo("")
cmrExpeditionPallet_add(
customDialogList.getValue(),
itemScaned
)
} else {
customDialogList.setValueTwo("")
ma.messageWithSound(
getString(R.string.errorCmrNotScanned),
true,
true,
isToasted = true
)
}
*/
}
return@setOnEditorActionListener true
@ -154,18 +264,43 @@ class CmrExpeditionPalletFragment(
}
}
private fun itemScanedIsCMR(valueTwo: String): Boolean {
private fun itemScanedValue(valueTwo: String): String {
return try {
dataScanned = itemScanned(JSONObject(valueTwo))
dataScanned.table == "cmr"
return itemScanned(JSONObject(valueTwo)).id
} catch (Ex: Exception) {
false
return valueTwo
}
}
}
private fun itemScan(value: String): itemScanned {
return try {
itemScanned(JSONObject(value))
} catch (Ex: Exception) {
return itemScan("")
}
}
private fun itemScaned(valueTwo: String): String {
try {
return itemScanned(JSONObject(valueTwo)).table
} catch (Ex: Exception) {
d("VERDNATURA::", "EL VALUE ES " + Ex.message.toString())
return ""
}
}
}

View File

@ -155,8 +155,8 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
)
)
)
//Tarea 4585
/* _pasillerositem.add(
//tarea 4585
_pasillerositem.add(
PasillerosItemVO(
7,
R.drawable.ic_packing_mistake,
@ -166,7 +166,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
R.string.titlePackingMistakeDescrip
)
)
)*/
)
_pasillerositem.add(
PasillerosItemVO(
@ -312,8 +312,8 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
)
)
//Tarea #3986
/* _pasillerositem.add(
/* //Tarea #3986
_pasillerositem.add(
PasillerosItemVO(
31,
R.drawable.ic_cmr,

View File

@ -149,7 +149,7 @@ class PackingMistakeFragment(var menuOrigin: String) :
binding.splashProgress.visibility = VISIBLE
d("VERDNATURA::", "el code es " + item.code + it.description)
viewModel.expeditionMistake_Add(
viewModel.expeditionMistake_add(
usuario = getData(USER),
password = getData(PASSWORD),
vExpeditionFk = expeditionScan,

View File

@ -55,7 +55,7 @@
android:background="@drawable/background_round"
android:enabled="true"
android:hint="@string/quantity"
android:inputType="number"
android:inputType="text"
android:lines="1"
android:maxLines="1"
android:textColor="@color/verdnatura_white"

View File

@ -28,7 +28,16 @@
app:layout_constraintTop_toTopOf="@+id/main_toolbar"
android:paddingLeft="@dimen/default_layout_margin"/>
<ImageView
android:id="@+id/previaButton"
android:layout_width="32dp"
android:layout_height="32dp"
android:visibility="invisible"
android:tooltipText="Permite marcar las líneas de previa escaneando ticket"
app:srcCompat="@drawable/ic_streetview_black_24dp"
app:layout_constraintStart_toEndOf="@+id/scan_input"
app:layout_constraintTop_toTopOf="@+id/scan_input"
/>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/collection_swipe"
@ -47,6 +56,8 @@
android:layout_marginTop="8dp"
tools:listitem="@layout/item_article_row_fragment" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<LinearLayout
android:id="@+id/splash_progress"
@ -64,6 +75,7 @@
app:lottie_loop="true"
app:lottie_rawRes="@raw/orange_loading"
app:lottie_speed="2" />
</LinearLayout>
<include

View File

@ -363,20 +363,22 @@
app:layout_constraintTop_toTopOf="@+id/item_article_quantity_line2"
tool:text="cel2" />
<TextView
android:id="@+id/item_article_quantity"
android:layout_width="wrap_content"
android:paddingTop="@dimen/layout_margin_minest"
android:paddingBottom="@dimen/layout_margin_minest"
android:paddingLeft="@dimen/layout_margin_1"
android:layout_height="wrap_content"
android:paddingTop="@dimen/layout_margin_minest"
android:paddingBottom="@dimen/default_layout_margin"
android:paddingLeft="@dimen/layout_collection_quantity"
android:text="@{Integer.toString(sale.quantity)}"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body3"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="@+id/item_article_quantity_line2"
app:layout_constraintTop_toTopOf="@+id/item_article_quantity_line2"
tool:text="100" />
tool:text="100"
/>
<TextView
android:id="@+id/item_article_quantity_line3"

View File

@ -491,5 +491,8 @@
<string name="noAssigned">No asignado</string>
<string name="titlePackingMistake">Fallo encajado</string>
<string name="titlePackingMistakeDescrip">Permite añadir error al encajado de una expedición</string>
<string name="printerRemoved">(Su impresora ha sido borrada)</string>
<string name="expeditionPalletCMR">Escanea Pallet y CMR</string>
<string name="expeditionPalletOrCMR">Escanea pallet o cmr</string>
</resources>

View File

@ -7,6 +7,7 @@
<dimen name="layout_margin_minest">1dp</dimen>
<dimen name="layout_margin_min">4dp</dimen>
<dimen name="layout_margin_1">8dp</dimen>
<dimen name="layout_collection_quantity">10dp</dimen>
<dimen name="default_layout_margin">16dp</dimen>
<dimen name="layout_end_ticket_color">20dp</dimen>
<dimen name="layout_margin_3">32dp</dimen>

View File

@ -50,6 +50,7 @@
<string name="Noprinters">There are no printers.</string>
<string name="Seleccionaunsector">Select a sector</string>
<string name="Selecccionaimpresoara">Select a printer</string>
<string name="printerRemoved">Printer that you had selected has been removed</string>
<string name="titleCorridors">Corridors</string>
<string name="titleControllers">Controllers</string>
<string name="titlePalletizers">Palletizers</string>
@ -340,6 +341,8 @@
<string name="expeditionsError">You have not scanned expeditions</string>
<string name="expeditionNoSorter">Scan expeditions that have not passed through the Sorter</string>
<string name="expeditionPalletScan">Scan pallet expedition </string>
<string name="expeditionPalletCMR">Scan pallet and CMR </string>
<string name="expeditionPalletOrCMR">Scan pallet or CMR </string>
<string name="palletScan">Scan pallet to receive it</string>
<string name="palletScanAdd">Scan pallet to add expeditions</string>
<string name="cmrScan">Scan CMR</string>