Modifico control vehiculo para que no vuelva a pedir escanear cuando se vuelve atrás, modificado historico de vehiculos ahora informa en el caso que esté vacía la lista y añadido fallo de trabajador. En test. No subida

This commit is contained in:
Sergio De la torre 2022-02-10 07:01:48 +01:00
parent b76c721258
commit 87aea478c3
74 changed files with 834 additions and 1101 deletions

View File

@ -13,7 +13,9 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/background_oval_unchecked.xml" value="0.30052083333333335" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/barcode.xml" value="0.2359375" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/barcode_scan.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/border.xml" value="0.27447916666666666" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/border_parental.xml" value="0.11979166666666667" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/btn_blue.xml" value="0.27447916666666666" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_accumulate.xml" value="0.18489583333333334" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_accumulation.xml" value="0.19814814814814816" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_desactivate.xml" value="0.1" />
@ -31,6 +33,7 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/crane.xml" value="0.23802083333333332" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/day_of_sale.xml" value="0.184375" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/delete.xml" value="0.19166666666666668" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/emoticon_error.xml" value="0.27447916666666666" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/eraser.xml" value="0.26564102564102565" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/face_man_outline.xml" value="0.22708333333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/filter_outline.xml" value="0.22239583333333332" />
@ -75,6 +78,7 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/pallet_shipping_black.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/pallet_shipping_selected.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/phone_call.xml" value="0.26145833333333335" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/previous_delete.xml" value="0.27447916666666666" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/qrcode_scan.xml" value="0.17395833333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/rectangle.xml" value="0.31979166666666664" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/revision_icon.xml" value="0.1" />
@ -84,13 +88,13 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/worker.xml" value="0.12" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/worker_mistake.xml" value="0.15364583333333334" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/activity_imageview.xml" value="0.134375" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/activity_login.xml" value="0.134375" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/activity_login.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/activity_main.xml" value="0.17916666666666667" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/buyers_fragment.xml" value="0.18333333333333332" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_dialog.xml" value="0.1490036231884058" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_edit_dialog.xml" value="0.10208333333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_hour.xml" value="0.1793478260869565" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_list_dialog.xml" value="0.1490036231884058" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_list_dialog.xml" value="0.3333333333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_three_dialog.xml" value="0.12817028985507245" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_two_dialog.xml" value="0.1793478260869565" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_ajustes.xml" value="0.3333333333333333" />
@ -150,6 +154,7 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_expeditionstate_row.xml" value="0.23489583333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_expeditiontruck_row.xml" value="0.1793478260869565" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_faltas_row.xml" value="0.1793478260869565" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_general_row.xml" value="0.13360507246376813" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_historico_row.xml" value="0.15353260869565216" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_historicovehiculo_row.xml" value="0.18795289855072464" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_inventary_row.xml" value="0.22604166666666667" />
@ -167,7 +172,7 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_toolbar_row.xml" value="0.15307971014492755" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_ubication_row.xml" value="0.11822916666666666" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_worker_image.xml" value="0.23177083333333334" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_workermistake_row.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_workermistake_row.xml" value="0.4466666666666667" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/qauality_fragment.xml" value="0.15353260869565216" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/reposicion_fragment.xml" value="0.15353260869565216" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/shelvinglog_row.xml" value="0.18385416666666668" />

View File

@ -7,7 +7,7 @@ class ApiNodeJsUtils {
companion object {
//const val BASE_URL:String = "http://192.168.1.108:8000/"
const val BASE_URL:String = "http://10.2.2.49:7777"
const val BASE_URL:String = "https://smart-tag.verdnatura.es"
fun getApiService():NodeJsService{
val nodeJsRetrofit = Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(
GsonConverterFactory.create()).build()

View File

@ -75,24 +75,21 @@ class GetLoginUserCase(context: Context) : RestClient(context)
shelving: String
): Call<NodeJsService.SmartTagNode>
{
return nodejsClient!!.bindShelving("application/json", "A0A3B8224DBF", "ABC", "2")
//https://smart-tag.verdnatura.es/bindShelving/A0A3B8224DBF&ABC&1
return nodejsClient!!.bindShelving("application/json", "A0A3B8224DBF", "ABB", "1")
// return nodejsClient!!.bindShelving("application/json", NodeJsService.SmartTagNode(smarttag, wagon, shelving),"A0A3B8224DBF","ABC","2")
}
/* fun checkVersion_old(usuario: String, password: String, version: String): Call<Boolean>
{
val params: ArrayList<String> = ArrayList()
params.add(version)
return restClient!!.version("json", "1", usuario, password, "application/json", params)
*/
//SALIX SERGIO MENSAJE : PARA NO ENVIAR MENSAJES A COMERCIALES PONGO QUE LAS MODIFICACIONES SE ENVIAN AL CANAL CREADO.
fun sendChekingPresence(token:String,workerId:Int,message:String) : Call<Boolean>{
return salixClient!!.sendChekingPresence(content_type = "application/json", authorization = token, params = SalixMessageVO(workerId = workerId,message = message))
}
// SERGIO: PARA DESARROLLO SE DESCOMENTA ESTAS LÍNEAS Y SE COMENTAN LAS DE ARRIBA
/*fun sendChekingPresence(token: String, workerId: Int, message: String): Call<Boolean>

View File

@ -150,6 +150,23 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
)
}
fun saleTracking_update(
usuario: String,
password: String,
saleFk: String
): Call<Unit> {
val params: ArrayList<String> = ArrayList()
params.add(saleFk)
return restClient!!.saleTracking_update(
"json",
"1",
usuario,
password,
"application/json",
params
)
}
fun itemPlacementSupplyAiming(
usuario: String,
password: String,

View File

@ -23,18 +23,16 @@ class GetWokerMistakeUSerCase(context: Context) : RestClient(context) {
}
fun saleMistakeAdd(
fun workerMistake_Add(
usuario: String,
password: String,
vSaleFk: String,
vUserFk: String,
vTypeFk: String
): Call<String> {
): Call<Unit> {
val params: ArrayList<String> = ArrayList()
params.add(vSaleFk)
params.add(vUserFk)
params.add(vTypeFk)
return restClient!!.saleMistakeAdd(
return restClient!!.workerMistake_Add(
"json",
"1",
usuario,

View File

@ -1,6 +1,7 @@
package es.verdnatura.domain
import retrofit2.Call
import retrofit2.http.FormUrlEncoded
import retrofit2.http.Header
import retrofit2.http.POST
import retrofit2.http.Path
@ -14,7 +15,7 @@ interface NodeJsService {
//NODEJS TEST
// @FormUrlEncoded
//@FormUrlEncoded
@POST("/bindShelving/{Id1}&{Id2}&{Id3}")
fun bindShelving(
@Header("Content-Type") content_type: String,

View File

@ -37,7 +37,7 @@ interface SalixService {
fun getSectorsSalix(
@Header("Content-Type") content_type: String,
@Header("Authorization") authorization: String,
//@Body params: SalixGrupo
):
Call<List<SectorItemVO>>

View File

@ -238,6 +238,17 @@ interface VerdnaturaService {
):
Call<String>
@POST("almacennew/saleTracking_update")//REVISADA
fun saleTracking_update(
@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<Unit>
@POST("almacennew/itemPlacementSupplyAiming")//REVISADA
fun itemPlacementSupplyAiming(
@Header("aplicacion") aplicacion: String,
@ -416,6 +427,17 @@ interface VerdnaturaService {
):
Call<String>
@POST("almacennew/workerMistake_Add")//REVISADA
fun workerMistake_Add(
@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<Unit>
@POST("almacennew/mistakeType")//REVISADA
fun mistakeType(
@Header("aplicacion") aplicacion: String,

View File

@ -14,7 +14,6 @@ import android.speech.RecognizerIntent
import android.speech.SpeechRecognizer
import android.speech.tts.TextToSpeech
import android.speech.tts.UtteranceProgressListener
import android.text.Editable
import android.util.Log
import android.view.LayoutInflater
import android.view.View
@ -31,6 +30,7 @@ import es.verdnatura.domain.ConstAndValues
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.toast
import es.verdnatura.presentation.common.mediaCurrentVolume
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import org.koin.androidx.viewmodel.ext.android.viewModel
import timber.log.Timber
import java.util.*
@ -60,10 +60,14 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
protected val WAGON = "wagon"
protected val TAGSTYPE = "tagstype"
protected val WAREHOUSEFK_DEFAULT = 60
protected val DATENOVEHICLE="DATENOVEHICLE"
protected val DEPARTMENTMISTAKE="DEPARTMENTMISTAKE"
protected val DEPARTMENTMISTAKEID="DEPARTMENTMISTAKEID"
protected val viewModel: V by viewModel(viewModelClass)
protected lateinit var binding: T
private var isOnReadyForSpeech = false
protected lateinit var ma: MainActivity
private var textToSpeech: TextToSpeech? = null
private var mAudioManager: AudioManager? = null
@ -89,6 +93,16 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
)
override fun onAttach(context: Context) {
super.onAttach(context)
if ((requireActivity().componentName).toString().contains("MainActivity")){
ma=activity as MainActivity
}
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
@ -120,6 +134,7 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
init()
}
@LayoutRes
@ -185,8 +200,7 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
if (textScanned.length>13) {
var size = textScanned.length
if (textScanned!!.substring((size / 2), size)
.equals(textScanned.substring(0, size / 2))
if (textScanned.substring((size / 2), size) == textScanned.substring(0, size / 2)
) {
return textScanned.substring(0, size / 2)
@ -224,6 +238,7 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
R.drawable.alpha_b_circle_outline->"Ver movimientos de Basura"
R.drawable.filter_outline->"Filtra por tipo de flor"
R.drawable.previous_delete->"Quita de pantalla lo que ya está sacado ( misma función que escanear 2.000.000)"
else -> {""}
}
@ -495,13 +510,29 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
SECTORDESCRIP->prefs.getString(name,getString(R.string.Sinsector)).toString()
BUYER->prefs.getString(name,"").toString()
BUYERID->prefs.getString(name,"").toString()
DATENOVEHICLE->prefs.getString(name,"0").toString()
DEPARTMENTMISTAKE->prefs.getString(name,"").toString()
DEPARTMENTMISTAKEID->prefs.getString(name,"").toString()
else -> {""}
}
}
fun saveData(name:String,value:String){
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
val editor = prefs.edit()
when (name){
name-> editor.putString(name, value)
}
editor.apply()
}
fun saveBuyer(buyernickname: String) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
val editor = prefs.edit()
@ -522,23 +553,6 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
return imei.toString()
}
/* fun getANDROIDID(): String {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
val androidid = prefs.getString(ANDROID_ID, "0")
return androidid.toString()
}*/
/*fun getWagons(): Int {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
val wagons = prefs.getInt(WAGON, 2)
return wagons
}*/
/* fun getTagsType(): String {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
val tagstype = prefs.getString(TAGSTYPE, "Stickers")
return tagstype.toString()
}*/
fun getMessageFromJSON(json: String): String {
val gson = Gson()

View File

@ -29,6 +29,7 @@ fun getMessageFromAllResponse(callFunction: String, ResponseMessage: String): St
messageFromError = ResponseMessage
}
//sergio:para personalizar los mensajes de respuesta según la llamada.
when (callFunction)
{

View File

@ -0,0 +1,47 @@
package es.verdnatura.presentation.common
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.databinding.ItemGeneralRowBinding
class GeneralAdapter(
private val items: List<GeneralItem>,
private val OnGeneralItemRowClickListener: OnGeneralItemRowClickListener,
// private var showDelete: Boolean = true
): RecyclerView.Adapter<GeneralAdapter.ItemHolder> () {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
return ItemHolder(
ItemGeneralRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
)
}
override fun getItemCount() =items.size
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
holder.bind(items[position])
holder.binding.root.setOnClickListener {
OnGeneralItemRowClickListener.OnGeneralItemRowClickListener(items[position])
}
}
inner class ItemHolder(
val binding: ItemGeneralRowBinding
) : RecyclerView.ViewHolder(binding.root){
//private val res = binding.root.context.resources
fun bind(item: GeneralItem) {
binding.apply {
this.item = item
/* if (showDelete) itemImage.visibility = View.VISIBLE
else itemImage.visibility = View.GONE*/
itemTitle.visibility=View.GONE
}
}
}
}

View File

@ -20,3 +20,8 @@ class DataMessageSalix(
var personSale: String = ""
)
class GeneralItem(
var code:String? = "",
var text:String? = ""
)

View File

@ -45,9 +45,9 @@ interface OnAjustesItemClickListener {
interface OnItemCardRowClickListener {
fun onItemCardRowClickListener(item: ItemCardRowVO)
}
interface OnItemExpeditionStateRowClickListener {
/*interface OnItemExpeditionStateRowClickListener {
fun OnItemExpeditionStateRowClickListener(item: ItemExpeditionStateRow)
}
}*/
interface OnBarcodeRowClickListener {
fun onBarcodeRowClickListener(item: BarcodeVO)
@ -57,6 +57,10 @@ interface OnSmartTagRowClickListener {
fun OnSmartTagRowClickListener(item: SmartTag)
}
interface OnGeneralItemRowClickListener {
fun OnGeneralItemRowClickListener(item: GeneralItem)
}
interface OnLocationRowClickListener {
fun onLocationRowClickListener(item: ItemLocationVO)
}

View File

@ -66,7 +66,7 @@ class AjustesFragment :
override fun init() {
(activity as MainActivity).hideBottomNavigation(View.VISIBLE)
ma.hideBottomNavigation(View.VISIBLE)
binding.userText.setText(getData(USER))
val versionName = requireActivity().packageManager.getPackageInfo(
requireActivity().packageName,
@ -137,7 +137,7 @@ class AjustesFragment :
val array = arrayOfNulls<String>(listTagsType.size)
showItemPickerType(array = listTagsType.toArray(array))
} else if (item.id == 4) {
(activity as MainActivity).onPasillerosItemClickListener(
ma.onPasillerosItemClickListener(
PasillerosItemVO(
title = "Control de usuario de vehículo"
), getData(USERFK)

View File

@ -66,7 +66,7 @@ class ItemCardFragment(
override fun init() {
binding.itemcardLayout.visibility = View.GONE
(activity as MainActivity).hideBottomNavigation(View.GONE)
ma.hideBottomNavigation(View.GONE)
setEvents()
//toolbar_title.text = getString(R.string.ConsultarArticulo)
@ -117,7 +117,7 @@ class ItemCardFragment(
if (itemFk.isNullOrEmpty()) {
"Escanea un item".toast(requireActivity())
} else {
(activity as MainActivity).onPasillerosItemClickListener(
ma.onPasillerosItemClickListener(
PasillerosItemVO(title = "Historico"),
itemInfoG!!.id
)
@ -147,7 +147,7 @@ class ItemCardFragment(
if (!binding.editItemFk.text.toString().isNullOrEmpty())
getItemCard(binding.editItemFk.text.toString())
binding.editItemFk.setText("")
(activity as MainActivity).hideKeyboard(binding.editItemFk)
ma.hideKeyboard(binding.editItemFk)
return@setOnEditorActionListener true
}
false
@ -190,7 +190,7 @@ class ItemCardFragment(
binding.itemcardLayout.visibility = GONE
binding.splashProgressTwo.visibility = GONE
binding.mainToolbar.toolbarTitle.text = "ItemCard"
(activity as MainActivity).messageWithSound(it.errorMessage,true,false)
ma.messageWithSound(it.errorMessage,true,false)
} else {
if (it.id != "0") {
@ -200,7 +200,7 @@ class ItemCardFragment(
binding.splashProgressTwo.visibility = GONE
binding.itemcardLayout.visibility = View.GONE
binding.mainToolbar.toolbarTitle.text = "ItemCard"
(activity as MainActivity).messageWithSound("No hemos podido encontrar el articulo. Revisa el sector.",true,false,"Sin resultados")
ma.messageWithSound("No hemos podido encontrar el articulo. Revisa el sector.",true,false,"Sin resultados")
}
@ -216,7 +216,7 @@ class ItemCardFragment(
response.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.GONE
if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage,true,false)
ma.messageWithSound(it.errorMessage,true,false)
} else {
getItemCard(itemFk)
}
@ -386,7 +386,7 @@ class ItemCardFragment(
if (item.action == "itemProposal") {
(activity as MainActivity).onPasillerosItemClickListener(
ma.onPasillerosItemClickListener(
PasillerosItemVO(
title = "Buscar artículos similares"
), itemFk
@ -400,12 +400,12 @@ class ItemCardFragment(
customDialogInput.setTitle(item.title!!)
.setDescription("Valor actual: " + item.value!!)
.setOkButton("Guardar") {
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
ma.hideKeyboard(customDialogInput.getEditText())
editItemCardRow(item, customDialogInput.getValue())
customDialogInput.dismiss()
}.setKoButton("Cancelar") {
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
ma.hideKeyboard(customDialogInput.getEditText())
customDialogInput.dismiss()
}.setValue("").show()
customDialogInput.getEditText().requestFocus()
@ -416,7 +416,7 @@ class ItemCardFragment(
editItemCardRow(item, customDialogInput.getValue())
customDialogInput.setValue("")
customDialogInput.dismiss()
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
ma.hideKeyboard(customDialogInput.getEditText())
return@setOnEditorActionListener true
}
false
@ -425,7 +425,7 @@ class ItemCardFragment(
//BARCODE ROW
prepareBarcodeDialog(item)
} else if (item.action == "buscarItem") {
(activity as MainActivity).onPasillerosItemClickListener(
ma.onPasillerosItemClickListener(
PasillerosItemVO(
title = "Buscar item"
), itemFk
@ -434,12 +434,12 @@ class ItemCardFragment(
customDialogInput.setTitle(item.title!!)
.setDescription("Indica la cantidad a dar de alta")
.setOkButton("Guardar") {
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
ma.hideKeyboard(customDialogInput.getEditText())
editItemCardRow(item, customDialogInput.getValue())
customDialogInput.dismiss()
}.setKoButton("Cancelar") {
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
ma.hideKeyboard(customDialogInput.getEditText())
customDialogInput.dismiss()
}.setValue("").show()
customDialogInput.getEditText().requestFocus()
@ -450,7 +450,7 @@ class ItemCardFragment(
editItemCardRow(item, customDialogInput.getValue())
customDialogInput.setValue("")
customDialogInput.dismiss()
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
ma.hideKeyboard(customDialogInput.getEditText())
return@setOnEditorActionListener true
}
false
@ -459,12 +459,12 @@ class ItemCardFragment(
customDialogInput.setTitle(item.title!!)
.setDescription("Indica la cantidad a dar de baja ")
.setOkButton("Guardar") {
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
ma.hideKeyboard(customDialogInput.getEditText())
editItemCardRow(item, customDialogInput.getValue())
customDialogInput.dismiss()
}.setKoButton("Cancelar") {
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
ma.hideKeyboard(customDialogInput.getEditText())
customDialogInput.dismiss()
}.setValue("").show()
customDialogInput.getEditText().requestFocus()
@ -475,7 +475,7 @@ class ItemCardFragment(
editItemCardRow(item, customDialogInput.getValue())
customDialogInput.setValue("")
customDialogInput.dismiss()
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
ma.hideKeyboard(customDialogInput.getEditText())
return@setOnEditorActionListener true
}
false
@ -663,7 +663,7 @@ class ItemCardFragment(
}
} catch (e: Exception) {
// binding.itemcardLayout.visibility = View.GONE
(activity as MainActivity).messageWithSound("El elemento introducido no es un número",true,true)
ma.messageWithSound("El elemento introducido no es un número",true,true)
}
}
@ -671,25 +671,25 @@ class ItemCardFragment(
private fun prepareBarcodeDialog(itemB: ItemCardRowVO) {
customDialogList.setTitle("Barcodes").setOkButton("Guardar") {
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
if (!customDialogList.getValue().isNullOrEmpty())
updateBarcode(customDialogList.getValue(), "0", itemB)
customDialogList.dismiss()
}.setKoButton("Cerrar") {
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
customDialogList.dismiss()
}.setValue("").show()
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
if (!customDialogList.getValue().isNullOrEmpty())
updateBarcode(customDialogList.getValue(), "0", itemB)
customDialogList.setValue("")
customDialogList.dismiss()
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
return@setOnEditorActionListener true
}
false

View File

@ -68,7 +68,7 @@ class ItemProposalFragment(
override fun init() {
(activity as MainActivity).hideBottomNavigation(View.GONE)
ma.hideBottomNavigation(View.GONE)
binding.splashProgress.visibility = View.VISIBLE
"${getString(R.string.ArticleSimilar)}:$itemFk".also { it -> it.also { binding.mainToolbar.toolbarTitle.text = it } }
setToolBar()

View File

@ -77,7 +77,7 @@ class BufferFragment(
}
binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard( binding.scanInput)
ma.hideKeyboard( binding.scanInput)
return@setOnEditorActionListener true
}
false
@ -91,12 +91,12 @@ class BufferFragment(
binding.splashProgress.visibility = View.GONE
if (it.isError) {
(activity as MainActivity).messageWithSound(
ma.messageWithSound(
it.errorMessage,true,isPlayed = true)
} else {
(activity as MainActivity).messageWithSound("Operación "+entryPoint.lowercase() + " buffer realizada correctamente",false,isPlayed = true)
ma.messageWithSound("Operación "+entryPoint.lowercase() + " buffer realizada correctamente",false,isPlayed = true)
binding.mainToolbar.backButton.performClick()
}

View File

@ -41,7 +41,7 @@ class BufferLoadFragment(
customDialogList = CustomDialogList(requireContext())
goBack = false
(activity as MainActivity).hideBottomNavigation(GONE)
ma.hideBottomNavigation(GONE)
binding.splashProgress.visibility = GONE
mperror = MediaPlayer.create((activity as MainActivity),R.raw.error)
@ -107,12 +107,12 @@ class BufferLoadFragment(
if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage,it.isError,true)
ma.messageWithSound(it.errorMessage,it.isError,true)
} else {
if (it.response.equals("Registro añadido")){
(activity as MainActivity).messageWithSound(it.response,false,true)
ma.messageWithSound(it.response,false,true)
}else{
mperror?.start()
it.response.toast(requireContext())
@ -156,7 +156,7 @@ class BufferLoadFragment(
customDialogList.setTitle("Escanea etiqueta de la expedición.")
.setOkButton("Cerrar") {
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
listTags.clear()
@ -168,7 +168,7 @@ class BufferLoadFragment(
customDialogList.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
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) {
@ -179,7 +179,7 @@ class BufferLoadFragment(
}
customDialogList.setValue("")
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
return@setOnEditorActionListener true
}
false

View File

@ -36,7 +36,7 @@ class BuscarItemFragment(
override fun init() {
(activity as MainActivity).hideBottomNavigation(GONE)
ma.hideBottomNavigation(GONE)
binding.mainToolbar.toolbarTitle.text = getString(R.string.getubicaition)
// customDialog = CustomDialog(requireContext())
setEvents()
@ -54,7 +54,7 @@ class BuscarItemFragment(
if (!binding.editItemFk.text.toString().isNullOrEmpty())
getLocations(binding.editItemFk.text.toString())
binding.editItemFk.setText("")
(activity as MainActivity).hideKeyboard(binding.editItemFk)
ma.hideKeyboard(binding.editItemFk)
return@setOnEditorActionListener true
}
false

View File

@ -47,7 +47,7 @@ class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(Buyer
override fun init() {
// customDialog = CustomDialog(requireContext())
(activity as MainActivity).hideBottomNavigation(View.GONE)
ma.hideBottomNavigation(View.GONE)
binding.splashProgress.visibility = View.VISIBLE
binding.mainToolbar.toolbarTitle.text = getString(R.string.quality)

View File

@ -53,7 +53,7 @@ class QaualityFragment(
override fun init() {
customDialog = CustomDialog(requireContext())
(activity as MainActivity).hideBottomNavigation(View.GONE)
ma.hideBottomNavigation(View.GONE)
binding.splashProgress.visibility = View.VISIBLE
binding.mainToolbar.toolbarTitle.text = "itemShelving_BuyerTask"
setToolBar()

View File

@ -52,13 +52,6 @@ class CollectionFragment(
) : BaseFragment<FragmentCollectionBinding, CollectionViewModel>(CollectionViewModel::class) {
private lateinit var dataMessageSalix: DataMessageSalix
/* private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var SectorDescription = ""
private var token = ""
private var voz = ""*/
private var sales: List<SaleVO> = listOf()
private var saleAdapter: SaleAdapter? = null
private var lm: LinearLayoutManager? = null
@ -156,8 +149,7 @@ class CollectionFragment(
customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext())
customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
//requireActivity().main_bottom_navigation.visibility = View.GONE
(activity as MainActivity).hideBottomNavigation(View.GONE)
ma.hideBottomNavigation(View.GONE)
if (binding.splashProgress != null) binding.splashProgress.visibility = VISIBLE
setEvents()
@ -252,7 +244,7 @@ class CollectionFragment(
private fun showUser() {
(activity as MainActivity).onPasillerosItemClickListener(
ma.onPasillerosItemClickListener(
PasillerosItemVO(title = "Control de usuario de vehículo"),
workerFkFromTicket
)
@ -357,7 +349,7 @@ class CollectionFragment(
responseUsedShelves.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = GONE
(activity as MainActivity).messageWithSound(
ma.messageWithSound(
if (it.isError) it.errorMessage else "Baldas guardadas",
it.isError,true
)
@ -365,7 +357,7 @@ class CollectionFragment(
})
responseItem_updatePackingShelve.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = GONE
(activity as MainActivity).messageWithSound(
ma.messageWithSound(
if (it.isError) it.errorMessage else "Packing guardado",
it.isError,!it.isError
)
@ -386,9 +378,9 @@ class CollectionFragment(
if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage, true,true)
ma.messageWithSound(it.errorMessage, true,true)
} else {
(activity as MainActivity).messageWithSound("Previa recogida", false,true)
ma.messageWithSound("Previa recogida", false,true)
binding.splashProgress.visibility = VISIBLE
viewModel.collectionTicketGet(
getData(USER),
@ -479,7 +471,7 @@ class CollectionFragment(
responseMissingTrash.observe(viewLifecycleOwner, Observer {
if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage, isError = true,true)
ma.messageWithSound(it.errorMessage, isError = true,true)
} else {
@ -494,7 +486,7 @@ class CollectionFragment(
responseIncQuantity.observe(viewLifecycleOwner, Observer {
if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage, isError = true,true)
ma.messageWithSound(it.errorMessage, isError = true,true)
} else {
incresaseSuccesful()
@ -505,7 +497,7 @@ class CollectionFragment(
responseSaleMove.observe(viewLifecycleOwner, Observer {
if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage, isError = true,true)
ma.messageWithSound(it.errorMessage, isError = true,true)
} else {
responseSaleMoveSuccesful()
@ -517,7 +509,7 @@ class CollectionFragment(
binding.splashProgress.visibility=GONE
if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage+"Usuario:"+workerFkFromTicket, isError = true,true)
ma.messageWithSound(it.errorMessage+"Usuario:"+workerFkFromTicket, isError = true,true)
} else {
@ -537,13 +529,15 @@ class CollectionFragment(
responsecheckfully.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.GONE
if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage)
ma.messageWithSound(it.errorMessage,it.isError,false)
/*customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Aceptar") {
customDialog.dismiss()
}.show()
}.show()*/
} else {
//sergio: devuelve false si no hay para revisar y <> false.
if (it.response != "false") {
customDialog.setTitle("Aviso")
.setDescription("Pendiente de revisar : " + it.response)
.setOkButton("Aceptar") {
@ -570,11 +564,14 @@ class CollectionFragment(
})
responseSalixMessage.observe(viewLifecycleOwner, Observer {
if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage)
ma.messageWithSound(it.errorMessage,it.isError,false)
/*customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Aceptar") {
customDialog.dismiss()
}.show()
}.show()*/
}
})
@ -734,8 +731,7 @@ class CollectionFragment(
markLine(index, type)
//////Log.i("VERDNATURA:","marcamos linea")
} else if (type == SACADOR) {
Log.d("VERDNATURA", "El tipo es sacador")
Log.d("VERDNATURA", "La sale es" + sale.isPrepared)
if (sale.isPrepared == "0" || sale.isPrepared.isNullOrEmpty()) {
showScanner(index, sale)
} else {
@ -1624,7 +1620,7 @@ class CollectionFragment(
}
private fun setTotalLines() {
// Log.d("VERDNTURA::","el itempacking ggg es "+collection.tickets.get(0).itemPackingTypeFk)
var totalMark = 0
sales.forEach {
if (type == SACADOR) {
@ -1644,10 +1640,9 @@ class CollectionFragment(
if (collection.collectionFk != null) collection.collectionFk else ""
if (binding.mainToolbar.toolbarSubtitle != null && totalMark != null && sales != null) binding.mainToolbar.toolbarSubtitle.text =
"" + totalMark + "/" + sales.size
if (totalMark == sales.size) {
getString(R.string.Coleccióncompleta).toast(this.context, Toast.LENGTH_SHORT)
ticketCollection_setUsedShelves()
//showBottomNavigation(View.VISIBLE)
@ -2243,7 +2238,7 @@ class CollectionFragment(
}
customDialogList.setTitle("Causa de error").setKoButton("Cerrar") {
customDialogList.setTitle("Causa de error").setKoButton("Cancelar") {
scanRequest()
hideKeyboards()
customDialogList.dismiss()

View File

@ -67,7 +67,7 @@ class CollectionShowTicketFragment(
override fun init() {
customDialog = CustomDialog(requireContext())
(activity as MainActivity).hideBottomNavigation(GONE)
ma.hideBottomNavigation(GONE)
binding.splashProgress.visibility = VISIBLE
setEvents()
setToolBarIcon()
@ -186,7 +186,7 @@ class CollectionShowTicketFragment(
binding.mainToolbar.toolbarSubtitle.text = "0/0"
}
} else {
(activity as MainActivity).messageWithSound(it.errorMessage,it.isError,false)
ma.messageWithSound(it.errorMessage,it.isError,false)
if (activity != null) requireActivity().onBackPressed()
}

View File

@ -36,7 +36,7 @@ class ControladorFragment :
// customDialog = CustomDialog(requireContext())
binding.mainToolbar.toolbarTitle.text = getString(R.string.controlticket)
setEvents()
(activity as MainActivity).hideBottomNavigation(View.VISIBLE)
ma.hideBottomNavigation(View.VISIBLE)
super.init()
}
@ -73,7 +73,7 @@ class ControladorFragment :
}
binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard(binding.scanInput)
ma.hideKeyboard(binding.scanInput)
return@setOnEditorActionListener true
}
false
@ -85,7 +85,7 @@ class ControladorFragment :
collectionTicketList.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.GONE
if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage,isError = true, isPlayed = false)
ma.messageWithSound(it.errorMessage,isError = true, isPlayed = false)
/*customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Aceptar") {
customDialog.dismiss()

View File

@ -7,7 +7,6 @@ import android.util.TypedValue
import android.view.View.*
import android.view.inputmethod.EditorInfo
import android.widget.ImageView
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentVehiclecontrolBinding
@ -18,9 +17,9 @@ import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.component.CustomDialogThreeButtons
import es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoFragment
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorFragment
import java.text.SimpleDateFormat
import java.util.*
import kotlin.collections.ArrayList
@ -58,7 +57,7 @@ class ControlVehiculoFragment(
/* if (getWagons() < 2 && !tagName.equals(SacadorFragment.TAG))
{
(activity as MainActivity).openFragmentPickers()
ma.openFragmentPickers()
}*/
@ -66,20 +65,24 @@ class ControlVehiculoFragment(
setToolBar("HISTORY")
showScanner("Escanea matrícula para ver histórico", "HISTORY")
} else {
checkControlTimeVehicle()
setToolBar("ALL")
}
setEvents()
setEvents()
super.init()
}
override fun onPause() {
goBack = true
super.onPause()
}
private fun setToolBar(direction: String) {
private fun setToolBar(direction: String?) {
binding.mainToolbar.toolbarTitle.text = getString(R.string.vehiclecontrol)
binding.mainToolbar.toolbarTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13F)
@ -112,28 +115,7 @@ class ControlVehiculoFragment(
listIcons.add(iconVehicleIn)
listIcons.add(iconHistory)
}
"OUT"->{
listIcons.remove(iconVehicleOut)
listIcons.remove(iconVehicleIn)
listIcons.add(iconHistory)
}
}
/* if (direction.equals("OUT")) {
listIcons.remove(iconVehicleIn)
listIcons.add(iconVehicleOut)
listIcons.add(iconHistory)
}
if (direction.equals("IN")) {
listIcons.remove(iconVehicleOut)
listIcons.add(iconVehicleIn)
listIcons.add(iconHistory)
}
if (direction.equals("HISTORY")) {
listIcons.remove(iconVehicleOut)
listIcons.remove(iconVehicleIn)
listIcons.add(iconHistory)
}*/
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
@ -154,7 +136,7 @@ class ControlVehiculoFragment(
customDialogInput.setTitle(getString(R.string.vehiclecontrol)).setDescription(description)
.setOkButton("Aceptar") {
if (!customDialogInput.getValue().isNullOrEmpty()) {
if (customDialogInput.getValue().isNotEmpty()) {
// "$description ${customDialogInput.getValue()} OK".toast(requireContext())
insertControlTimeVehicle(customDialogInput.getValue(), action)
}
@ -166,6 +148,10 @@ class ControlVehiculoFragment(
.setKoButton("Cancelar") {
customDialogInput.dismiss()
if (tagName.equals(HistoricoVehiculoFragment.TAG)) {
ma.onBackPressed()
}
}.setValue("").show()
customDialogInput.getEditText().requestFocus()
@ -173,7 +159,7 @@ class ControlVehiculoFragment(
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
if (!customDialogInput.getValue().isNullOrEmpty()) {
if (customDialogInput.getValue().isNotEmpty()) {
insertControlTimeVehicle(customDialogInput.getValue(), action)
}
@ -191,15 +177,20 @@ class ControlVehiculoFragment(
private fun checkControlTimeVehicle() {
if (!goBack) {
// d("la fecha es "+getData("DATENOVEHICLE"))
//if (!IsNoVehicleDataToday()){
binding.splashProgress.visibility = VISIBLE
viewModel.workerMachinery_isRegistered(getData(USER),getData(PASSWORD),"workerMachinery_isRegistered")
/*}else{
ma.openFragmentPickers()
}*/
}
}
private fun insertControlTimeVehicle(plateNumber: String, direction: String) {
if (direction.equals("HISTORY")) {
(activity as MainActivity).onPasillerosItemClickListener(
ma.onPasillerosItemClickListener(
PasillerosItemVO(title = "Historico Vehículo"),
plateNumber
)
@ -211,15 +202,15 @@ class ControlVehiculoFragment(
viewModel.machineWorker_update(getData(USER),getData(PASSWORD), plateNumber,"machineWorker_update")
} else if (direction.equals("")) {
(activity as MainActivity).openFragmentPickers()
ma.openFragmentPickers(true)
}
}
private fun scanRequest() {
if (binding.scanInput != null) {
// if (binding.scanInput != null) {
binding.scanInput.requestFocus()
}
//}
hideKeyboards()
}
@ -234,7 +225,9 @@ class ControlVehiculoFragment(
private fun setEvents() {
binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed()
ma.openFragmentPickers(true)
//requireActivity().onBackPressed()
}
binding.scanInput.requestFocus()
@ -249,7 +242,7 @@ class ControlVehiculoFragment(
}
}
binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard(binding.scanInput)
ma.hideKeyboard(binding.scanInput)
return@setOnEditorActionListener true
}
false
@ -264,7 +257,7 @@ class ControlVehiculoFragment(
.setValue(plate)
if (isWorkedTimed.equals("UNREGISTERED")) {
customDialogThreeButtons.setOkButtonTwo("COGER") {
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
if (customDialogThreeButtons.getValue().trim().isEmpty()) {
"Vuelva a escanear".toast(requireContext())
} else {
binding.splashProgress.visibility = VISIBLE
@ -275,7 +268,7 @@ class ControlVehiculoFragment(
} else {
customDialogThreeButtons.setOkButtonThree("DEJAR") {
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
if (customDialogThreeButtons.getValue().trim().isEmpty()) {
"Vuelva a escanear".toast(requireContext())
} else {
binding.splashProgress.visibility = VISIBLE
@ -284,7 +277,7 @@ class ControlVehiculoFragment(
}
}
}.setOkButtonFour("HISTÓRICO") {
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
if (customDialogThreeButtons.getValue().trim().isEmpty()) {
"Vuelva a escanear".toast(requireContext())
} else {
customDialogThreeButtons.dismiss()
@ -306,7 +299,7 @@ class ControlVehiculoFragment(
.setValue(plate)
.setOkButtonFour("HISTÓRICO") {
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
if (customDialogThreeButtons.getValue().trim().isEmpty()) {
"Vuelva a escanear".toast(requireContext())
} else {
customDialogThreeButtons.dismiss()
@ -324,16 +317,16 @@ class ControlVehiculoFragment(
with(viewModel) {
binding.splashProgress.visibility = GONE
responseinsert.observe(viewLifecycleOwner, Observer {
responseinsert.observe(viewLifecycleOwner, {
if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage)
ma.messageWithSound(it.errorMessage,true,false)
/*customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
}.show()*/
} else {
if (it.response == null || it.response == "false") {
if (it.response == "false") {
customDialog.setTitle("Error")
.setDescription("Revisar llamada del registro de vehículos")
@ -350,8 +343,8 @@ class ControlVehiculoFragment(
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()*/
(activity as MainActivity).openFragmentPickers()
//(activity as MainActivity).onPasillerosItemClickListener( PasillerosItemVO(title = "Sacadores"),"CONTROL")
ma.openFragmentPickers(true)
//ma.onPasillerosItemClickListener( PasillerosItemVO(title = "Sacadores"),"CONTROL")
//checkControlTimeVehicle()
}
@ -360,21 +353,15 @@ class ControlVehiculoFragment(
binding.splashProgress.visibility = GONE
})
responsecontrol.observe(viewLifecycleOwner, Observer {
responsecontrol.observe(viewLifecycleOwner, {
binding.splashProgress.visibility = GONE
// Log.i("VERDNATURA:","${it.response}")
if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage)
ma.messageWithSound(it.errorMessage,true,false)
/*customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
} else {
if (it.response == null) {
customDialog.setTitle("Error")
.setDescription("Revisar llamada de control de vehículos")
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
}.show()*/
} else {
if (it.response.equals("1")) {
isWorkedTimed = "REGISTERED"
@ -385,7 +372,7 @@ class ControlVehiculoFragment(
customDialog.dismiss()
}.show()*/
if (!tagName.equals(SacadorFragment.TAG)) {
(activity as MainActivity).openFragmentPickers()
ma.openFragmentPickers(true)
}
} else {
@ -400,21 +387,26 @@ class ControlVehiculoFragment(
}
.setKoButton("SIN VEHÍCULO") {
customDialog.dismiss()
saveData(DATENOVEHICLE, SimpleDateFormat("yyyy-MM-dd",Locale.getDefault()).format(Date()).toString())
ma.openFragmentPickers(true)
(activity as MainActivity).openFragmentPickers()
// getActivity()?.getFragmentManager()?.popBackStack();
}.show()
}
}
}
}
})
}
}
private fun IsNoVehicleDataToday(): Boolean {
return (getData(DATENOVEHICLE)==SimpleDateFormat("yyyy-MM-dd",Locale.getDefault()).format(Date()))
}
}

View File

@ -87,7 +87,7 @@ class ControlVehiculoUsuarioFragment(
responsemachine.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = GONE
if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage,true,false)
ma.messageWithSound(it.errorMessage,true,false)
/*customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()

View File

@ -83,7 +83,7 @@ class DayOfSaleFragment(
itemScan = binding.scanInput.text.toString()
}
binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard(binding.scanInput)
ma.hideKeyboard(binding.scanInput)
return@setOnEditorActionListener true
}
false
@ -126,7 +126,7 @@ class DayOfSaleFragment(
}else{
if (it.list.get(0).isError){
(activity as MainActivity).messageWithSound(it.list.get(0).errorMessage,it.list.get(0).isError,isPlayed = false)
ma.messageWithSound(it.list.get(0).errorMessage,it.list.get(0).isError,isPlayed = false)
/*customDialog.setTitle("Error")
.setDescription(it.list.get(0).errorMessage)
.setOkButton("Cerrar") {
@ -141,7 +141,7 @@ class DayOfSaleFragment(
if (it.isError){
binding.splashProgress.visibility = View.GONE
(activity as MainActivity).messageWithSound(it.errorMessage,true,false)
ma.messageWithSound(it.errorMessage,true,false)
/*customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()*/
@ -166,7 +166,7 @@ class DayOfSaleFragment(
customDialogList.setTitle("Escanea el parking")
.setOkButton("Cerrar") {
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
customDialogList.dismiss()
@ -174,7 +174,7 @@ class DayOfSaleFragment(
customDialogList.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
customDialogList.getEditText().setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) {
@ -182,7 +182,7 @@ class DayOfSaleFragment(
parking(customDialogList.getValue())
}
customDialogList.setValue("")
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
return@setOnEditorActionListener true
}
false

View File

@ -50,7 +50,7 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
override fun init() {
binding.splashProgress.visibility = View.VISIBLE
(activity as MainActivity).hideBottomNavigation(View.GONE)
ma.hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text = getString(R.string.faultsReview)
setToolBar()
@ -154,7 +154,7 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
}
customDialogInput.setValue("")
customDialogInput.dismiss()
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
ma.hideKeyboard(customDialogInput.getEditText())
return@setOnEditorActionListener true
}
false
@ -176,7 +176,7 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
response.observe(viewLifecycleOwner, Observer {
if (it.isError){
(activity as MainActivity).messageWithSound(it.errorMessage,it.isError,false)
ma.messageWithSound(it.errorMessage,it.isError,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()*/

View File

@ -48,7 +48,7 @@ class HistoricoArticuloFragment(
// customDialogInput = CustomDialogInput(requireContext())
// customDialog = CustomDialog(requireContext())
(activity as MainActivity).hideBottomNavigation(View.GONE)
ma.hideBottomNavigation(View.GONE)
filter = "all"
viewModel.itemDiary(getData(USER), getData(PASSWORD), itemFk, getData(WAREHOUSEFK),"itemDiary")
binding.mainToolbar.toolbarTitle.text = getString(R.string.itemdiary) + ":" + itemFk

View File

@ -56,7 +56,7 @@ class itemShelvingLogFragment(
itemScan = binding.scanInput.text.toString()
}
binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard(binding.scanInput)
ma.hideKeyboard(binding.scanInput)
return@setOnEditorActionListener true
}
false

View File

@ -57,7 +57,7 @@ class shelvingLogFragment(
itemScan = binding.scanInput.text.toString()
}
binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard(binding.scanInput)
ma.hideKeyboard(binding.scanInput)
return@setOnEditorActionListener true
}
false

View File

@ -12,6 +12,7 @@ import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.historicovehiculo.adapter.HistoricoVehiculoAdapter
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculoList
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import timber.log.Timber.d
import java.text.SimpleDateFormat
import java.util.*
@ -22,9 +23,6 @@ class HistoricoVehiculoFragment (
HistoricoVehiculoViewModel::class) {
private var adapter : HistoricoVehiculoAdapter? = null
// private lateinit var customDialogInput: CustomDialogInput
// private lateinit var customDialog: CustomDialog
companion object {
fun newInstance(entryPoint:String) = HistoricoVehiculoFragment(entryPoint)
@ -36,9 +34,7 @@ class HistoricoVehiculoFragment (
override fun init()
{
// customDialogInput = CustomDialogInput(requireContext())
// customDialog = CustomDialog(requireContext())
(activity as MainActivity).hideBottomNavigation(View.GONE)
ma.hideBottomNavigation(View.GONE)
viewModel.machineWorker_getHistorical(getData(USER),getData(PASSWORD),numberPlate,"machineWorker_getHistorical")
binding.mainToolbar.toolbarTitle.text = getString(R.string.vehiclediary)
@ -63,6 +59,10 @@ class HistoricoVehiculoFragment (
binding.historicovehiculoRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
navigateToToday(it)
if (it.list.isEmpty()){
ma.messageWithSound("Solo puedes visualizar cuando has cogido tu mismo el vehículo a no ser que tengas permisos para ello.",true,true,"Información")
}
}
})
}

View File

@ -90,7 +90,7 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext())
(activity as MainActivity).hideBottomNavigation(View.GONE)
ma.hideBottomNavigation(View.GONE)
binding.splashProgress.visibility = View.VISIBLE
binding.mainToolbar.toolbarTitle.text = getString(R.string.itemShelvingRadar)
setToolBar()
@ -241,7 +241,7 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
response.observe(viewLifecycleOwner, Observer {
if (it.isError){
(activity as MainActivity).messageWithSound(it.errorMessage,true,false)
ma.messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()*/

View File

@ -59,6 +59,9 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
val mistakeWorkerList: LiveData<workerMistakeTypeList>
get() = _mistakeWorkerList
private val _responseAddMistake by lazy { MutableLiveData<ResponseItemVO>() }
val responseAddMistake: LiveData<ResponseItemVO>
get() = _responseAddMistake
//sergio para obtener comprador
fun itemShelvingBuyerGet(user:String,password:String,callFunction:String){
@ -281,5 +284,45 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
})
}
fun workerMistake_Add(
usuario: String,
password: String,
vUserFk: String,
vTypeFk: String,callFunction:String
)
{
getWorkerMistakeUserCase.workerMistake_Add(usuario, password, vUserFk, vTypeFk)
.enqueue(object :
Callback<Unit>
{
override fun onFailure(call: Call<Unit>, t: Throwable)
{
_responseAddMistake.value = ResponseItemVO(
isError = true,
errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
override fun onResponse(
call: Call<Unit>,
response: Response<Unit>
)
{
if (!response.isSuccessful)
{
_responseAddMistake.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
_responseAddMistake.value =
// sergio:refactor:solo debería haber un mensaje no un response o errorMessage
ResponseItemVO(isError = false, response ="Causa del error registrada", errorMessage = "Causa del error registrada")
}
}
})
}
}

View File

@ -9,6 +9,7 @@ import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.net.Uri
import android.provider.Settings
import android.util.Log
import android.view.KeyEvent
import android.view.View
import androidx.lifecycle.Observer
@ -83,8 +84,8 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
}
//NODEJS TEST
// Log.i("VERDNATURA:","NODEJS in")
// viewModel.nodeJsTest("A0A3B8224DBF","ABC","1")
/* Log.d("VERDNATURA:","NODEJS in")
viewModel.nodeJsTest("A0A3B8224DBF","AAA","1")*/
}
@ -122,10 +123,11 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
if (it.isError) {
binding.splashProgress.visibility = View.INVISIBLE
customDialog.setTitle("Error").setDescription(it.errorMessage)
ma.messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
}.show()*/
} else {
if (it.version.equals(getInfoVersionNameApp())) {
@ -163,10 +165,11 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
if (it.isError) {
binding.splashProgress.visibility = View.INVISIBLE
customDialog.setTitle("Error").setDescription(it.errorMessage)
ma.messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
}.show()*/
} else {
if (it.vIsAuthorized.equals("0")) {
@ -249,10 +252,11 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
loginitem.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.INVISIBLE
if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage)
ma.messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
}.show()*/
} else {
binding.splashProgress.visibility = View.VISIBLE
saveUserFkPref(it)

View File

@ -374,6 +374,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
)
{
var workerId: NodeJsService.SmartTagNode?
/* if (response.isSuccessful()){
@ -410,7 +411,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
val workerId =
NodeJsService.SmartTagNode(isError = true, errorMessage = t.message!!)
// Log.i("VERDNATURA::","el error nodejs es "+t.message+"--"+t.cause.toString()+"--"+t.stackTrace.toString())
Log.i("VERDNATURA::","el error nodejs es "+t.message+"--"+t.cause.toString()+"--"+t.stackTrace.toString())
_nodejs.value = workerId
}

View File

@ -351,9 +351,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
"Paletizar" -> {
addFragmentOnTop(ExpeditionTruckListFragment.newInstance())
}
"Consultar expedición" -> {
getString(R.string.ExpeditionState) -> {
// addFragment(ExpeditionStateFragment.newInstance(entryPoint),R.id.main_frame_layout, ExpeditionTruckListFragment.TAG,false)
addFragmentOnTop(ExpeditionStateFragment.newInstance(entryPoint))
addFragmentOnTop(ExpeditionStateFragment.newInstance(item.title))
}
"Escanear expedición" -> {
addFragmentOnTop(ExpeditionScanSorterFragment.newInstance(item.title))
@ -471,8 +471,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
"Log Shelving" -> {
addFragmentOnTop(shelvingLogFragment.newInstance("Log Shelving"))
}
"Fallo personal" -> {
addFragmentOnTop(WorkermistakeFragment.newInstance("Fallo personal"))
"Fallo del trabajador" -> {
addFragmentOnTop(WorkermistakeFragment.newInstance(item.title))
}
}
@ -551,26 +551,33 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
addFragmentOnTop(QaualityFragment.newInstance(userFk))
}
//sergio:se llama al pulsar sobre el coche IN desde Sacador
fun onVehicleSelected(tag: String) {
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
// se pone a true en la pila para que cuando se vuelva atrás permanezca ya que se borran todos los fragmentos desde otras opciones
addFragment(
ControlVehiculoFragment.newInstance(tag),
R.id.main_frame_layout,
ControlVehiculoFragment.TAG,
false
true
)
//sergio: de esta manera la llamada del fragment no se vuelve a repetir.
// addFragmentOnTop(ControlVehiculoFragment.newInstance(tag))
}
fun openFragmentPickers() {
fun openFragmentPickers(delete:Boolean) {
//delete_Fragments()
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
if (delete){delete_Fragments()}
addFragment(
SacadorFragment.newInstance(),
R.id.main_frame_layout,
SacadorFragment.TAG,
false
)
//addFragmentOnTop(SacadorFragment.newInstance())
@ -589,16 +596,17 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
binding.mainBottomNavigation.visibility = visible
}
fun messageWithSound(message: String, isError: Boolean,isPlayed:Boolean?,title:String="Error") {
fun messageWithSound(message: String, isError: Boolean,isPlayed:Boolean?,titleWithError:String="Error") {
if (!isError) {
if (isPlayed == true)(mpok?.start())
message.toast(this, Toast.LENGTH_SHORT)
} else {
if (isPlayed == true)( mperror?.start())
customDialog.setTitle(title).setDescription(message)
customDialog.setTitle(titleWithError).setDescription(message)
.setOkButton("Aceptar") {
customDialog.dismiss()
}.show()

View File

@ -5,19 +5,15 @@ import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.databinding.ItemExpeditionstateRowBinding
import es.verdnatura.presentation.common.OnItemExpeditionStateRowClickListener
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionStateRow
class ExpeditionStateAdapter (
private val items: List<ItemExpeditionStateRow>,
private val OnItemExpeditionStateRowClickListener: OnItemExpeditionStateRowClickListener
): RecyclerView.Adapter<ExpeditionStateAdapter.ItemHolder> () {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
return ItemHolder(
//ItemCardRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
ItemExpeditionstateRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
)
}
@ -26,34 +22,20 @@ class ExpeditionStateAdapter (
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
holder.bind(items[position])
if (items[position].isEditable){
/* if (items[position].isEditable){
holder.binding.root.setOnClickListener {
OnItemExpeditionStateRowClickListener.OnItemExpeditionStateRowClickListener(items[position])
}
// OnItemExpeditionStateRowClickListener.OnItemExpeditionStateRowClickListener(items[position])
}
}*/
}
class ItemHolder(
val binding: ItemExpeditionstateRowBinding
) : RecyclerView.ViewHolder(binding.root){
private val res = binding.root.context.resources
fun bind(item: ItemExpeditionStateRow) {
binding.apply {
if (item.barcodes.isNotEmpty()){
item.value = ""
item.barcodes.forEach {
item.value = item.value + it.code + "\n"
}
}
this.item = item
/* if (item.isEditable){
itemImage.visibility = View.VISIBLE
itemRowLayout.setBackgroundColor(res.getColor(R.color.verdnatura_black_5))
}else{
itemImage.visibility = View.INVISIBLE
itemRowLayout.setBackgroundColor(res.getColor(R.color.verdnatura_black_9))
}*/
}
}

View File

@ -56,7 +56,7 @@ class ExpeditionPalletDetailFragment(
binding.expeditionPalletDetailPallet.text = "Pallet "+itemPallet!!.Pallet
binding.splashProgress.visibility = View.VISIBLE
//requireActivity().main_bottom_navigation.visibility = View.GONE
(activity as MainActivity).hideBottomNavigation(View.GONE)
ma.hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino
setToolBar()
@ -131,7 +131,7 @@ class ExpeditionPalletDetailFragment(
response.observe(viewLifecycleOwner, Observer {
if (it.isError){
(activity as MainActivity).messageWithSound(it.errorMessage,true,false)
ma.messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()*/

View File

@ -73,7 +73,7 @@ class ExpeditionPalletFragment(
customDialogList = CustomDialogList(requireContext())
binding.splashProgress.visibility = View.VISIBLE
//requireActivity().main_bottom_navigation.visibility = View.GONE
(activity as MainActivity).hideBottomNavigation(View.GONE)
ma.hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino
setToolBar()
setEvents()
@ -130,7 +130,7 @@ class ExpeditionPalletFragment(
response.observe(viewLifecycleOwner, Observer {
if (it.isError){
(activity as MainActivity).messageWithSound(it.errorMessage,true,false)
ma.messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()*/
@ -140,7 +140,7 @@ class ExpeditionPalletFragment(
responseCheckexpeditionScanPut.observe(viewLifecycleOwner, Observer {
if (it.isError){
(activity as MainActivity).messageWithSound(it.errorMessage,true,false)
ma.messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()*/
@ -192,7 +192,7 @@ class ExpeditionPalletFragment(
}
customDialogList.setTitle("Expedition ("+binding.mainToolbar.toolbarTitle.text+")").setOkButton("Comprobar"){
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
if (listExpeditions.size > 0){
@ -208,7 +208,7 @@ class ExpeditionPalletFragment(
}.setKoButton("Cerrar"){
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
binding.splashProgress.visibility = View.VISIBLE
viewModel.expeditionPallet_List(getData(USER),
getData(PASSWORD),itemExpeditionTruckVO!!.truckFk,"expeditionPallet_List")
@ -217,7 +217,7 @@ class ExpeditionPalletFragment(
}.setValue("").show()
customDialogList.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
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) {
@ -243,7 +243,7 @@ class ExpeditionPalletFragment(
expeditionAdapter!!.notifyDataSetChanged()
}
customDialogList.setValue("")
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
return@setOnEditorActionListener true
}
false

View File

@ -42,7 +42,6 @@ class ExpeditionScanFragment (
private var expeditionAdapter : BarcodeAdapter? = null
private lateinit var customDialog: CustomDialog
var mperror: MediaPlayer? = null
var mpok: MediaPlayer? = null
companion object {
fun newInstance(item: ItemExpeditionTruckVO,itemPalletVO: ItemPalletVO) =
@ -69,7 +68,7 @@ class ExpeditionScanFragment (
customDialogTwoButtons = CustomDialogTwoButtons(requireContext())
binding.expeditionScanDetailPallet.text = "Pallet "+itemPalletVO!!.Pallet
binding.splashProgress.visibility = View.VISIBLE
(activity as MainActivity).hideBottomNavigation(View.GONE)
ma.hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino
setToolBar()
@ -99,7 +98,6 @@ class ExpeditionScanFragment (
viewModel.expeditionScanList(getData(USER),
getData(PASSWORD),itemPalletVO!!.Pallet)
}else if(item == iconPlus){
//Log.i("VERDNATURA:","ENTRAMOS A SCAN ADD")
expeditionScanAdd ()
}
@ -128,43 +126,29 @@ class ExpeditionScanFragment (
response.observe(viewLifecycleOwner, Observer {
if (it.isError){
(activity as MainActivity).messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()*/
ma.messageWithSound(it.errorMessage,true,false)
}
})
responseCheckexpeditionScanPut.observe(viewLifecycleOwner, Observer {
if (it.isError){
(activity as MainActivity).messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()*/
ma.messageWithSound(it.errorMessage,true,false)
}else{
////Log.i("VERDNATURA:"," Resultado llamada es ${it.response.toString()}")
if (it.response=="0") {
//"Rutas iguales ${it.response}".toast(requireActivity())
////Log.i("VERDNATURA:","Rutas iguales")
}
if (it.response=="1"){
mperror?.start()
// "Resultado llamada $it.response".toast(requireActivity())
// customDialog.setTitle("Rutas distintas").setDescription(it.response).setOkButton("Cerrar"){
// customDialog.dismiss()
// }.show()
}}
})
responseDeleteScan.observe(viewLifecycleOwner, Observer {
if (it.isError){
(activity as MainActivity).messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()*/
ma.messageWithSound(it.errorMessage,true,false)
}else{
viewModel.expeditionScanList(getData(USER),
getData(PASSWORD),itemPalletVO!!.Pallet)
@ -202,28 +186,23 @@ class ExpeditionScanFragment (
binding.splashProgress.visibility = View.VISIBLE
viewModel.expeditionScanAdd(usuario = getData(USER),
getData(PASSWORD),vPalletFk = itemPalletVO!!.Pallet,vTruckFk = itemExpeditionTruckVO!!.truckFk)
//Log.i("VERDNATURA:","entramos a escanear ticket del pallet")
}
private fun showScanExpeditions(it: ItemScanList){
//sergio para smarttags:
// Log.i("VERDNATURA:","muestra expediciones y a escanear")
listExpeditions = ArrayList()
binding.splashProgress.visibility = View.GONE
it.list.forEach {
if(it.expeditionFk != "0")
listExpeditions.add(BarcodeVO(code = it.expeditionFk))
}
//sergio:Comprueba si el numero es mayor>0
customDialogList.setTitle("Pallet"+itemPalletVO!!.Pallet+" ("+binding.mainToolbar.toolbarTitle.text+")").setOkButton("Comprobar"){
//Log.i("VERDNATURA:","Añadida etiqueta")
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
if (listExpeditions.size > 0){
////Log.i("VERDNATURA:","boton comprobar . si las expediciones >0 muetra DetailFragment")
onComprobarPalletViewClickListener!!.onComprobarPalletViewClickListener(itemExpeditionTruckVO!!,
ItemPalletVO(Pallet = it.list.get(0).palletFk)
)
@ -237,24 +216,18 @@ class ExpeditionScanFragment (
}.setKoButton("Cerrar"){
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
listExpeditions = ArrayList()
customDialogList.dismiss()
}.setValue("").show()
customDialogList.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
//sergio: seguimos escaneando id=0 -> sin especificar id=5->next
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!customDialogList.getValue().isNullOrEmpty()) {
////Log.i("VERDNATURA:", "scan put pallet ${it.list.get(0).palletFk}");
////Log.i("VERDNATURA:", "scan put list ${customDialogList.getValue()}");
listExpeditions.add(BarcodeVO(code = customDialogList.getValue()))
viewModel.expeditionScanPut(
getData(USER),
@ -262,22 +235,15 @@ class ExpeditionScanFragment (
it.list.get(0).palletFk,
customDialogList.getValue()
)
////Log.i("VERDNATURA:", "scan put pallet ${it.list.get(0).palletFk}");
////Log.i("VERDNATURA:", "scan put list ${customDialogList.getValue()}");
// ////Log.i("VERDNATURA:","misma ruta ?")
//sergio:comprueba si es de la misma ruta. Check_route_expedition.
checkRouteExpeditionScanPut(getData(USER),
getData(PASSWORD),it.list.get(0).palletFk,customDialogList.getValue())
////Log.i("VERDNATURA:", "scan put pallet ${it.list.get(0).palletFk}");
////Log.i("VERDNATURA:", "scan put list ${customDialogList.getValue()}");
expeditionAdapter!!.notifyDataSetChanged()
}
customDialogList.setValue("")
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
return@setOnEditorActionListener true
}
false

View File

@ -1,50 +1,35 @@
package es.verdnatura.presentation.view.feature.paletizador.fragment
import android.content.SharedPreferences
import android.os.Bundle
import android.view.View
import android.view.View.*
import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentExpeditionscanSorterBinding
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.*
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogList
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.smarttag.adapter.SmartTagAdapter
import es.verdnatura.presentation.view.feature.smarttag.model.SmartTag
class ExpeditionScanSorterFragment(
var entryPoint: String = ""
var title: String = ""
) : BaseFragment<FragmentExpeditionscanSorterBinding, ExpeditionScanSorterViewModel>(
ExpeditionScanSorterViewModel::class
) {
private var user = ""
private var password = ""
private var goBack: Boolean = false
override fun getLayoutId(): Int = R.layout.fragment_expeditionscan_sorter
// private lateinit var customDialog: CustomDialog
private lateinit var customDialogList: CustomDialogList
private var listExpeditionScan: ArrayList<SmartTag> = ArrayList()
private var expeditionScanAdapter: SmartTagAdapter? = null
private var listExpeditionScan: ArrayList<GeneralItem> = ArrayList()
private var expeditionScanAdapter: GeneralAdapter? = null
private var itemScaned: String = ""
companion object {
fun newInstance(entryPoint: String) = ExpeditionScanSorterFragment(entryPoint)
fun newInstance(title: String) = ExpeditionScanSorterFragment(title)
}
override fun init() {
//customDialog = CustomDialog(requireContext())
customDialogList = CustomDialogList(requireContext())
goBack = false
(activity as MainActivity).hideBottomNavigation(View.GONE)
ma.hideBottomNavigation(GONE)
binding.splashProgress.visibility = GONE
setEvents()
@ -53,33 +38,18 @@ class ExpeditionScanSorterFragment(
super.init()
}
override fun onPause() {
goBack = true
super.onPause()
}
private fun setToolBar() {
binding.mainToolbar.toolbarTitle.text = entryPoint
binding.mainToolbar.toolbarTitle.text = title
}
private fun expeditionscan(ExpeditionScan: String) {
binding.splashProgress.visibility = VISIBLE
viewModel.expedition_scan(user, password, ExpeditionScan,"expedition_scan")
viewModel.expedition_scan(getData(USER),getData(PASSWORD), ExpeditionScan,"expedition_scan")
itemScaned = ExpeditionScan
}
override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = getData(USER)
password = getData(PASSWORD)
super.onCreate(savedInstanceState)
}
private fun setEvents() {
binding.mainToolbar.backButton.setOnClickListener {
@ -89,29 +59,25 @@ class ExpeditionScanSorterFragment(
}
override fun observeViewModel() {
with(viewModel) {
binding.splashProgress.visibility = GONE
responsescan.observe(viewLifecycleOwner, Observer {
responsescan.observe(viewLifecycleOwner, {
if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage,true,false)
/*customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()*/
ma.messageWithSound(it.errorMessage,true,false)
} else {
listExpeditionScan.add(SmartTag(itemScaned, itemScaned))
listExpeditionScan.add(GeneralItem(itemScaned, itemScaned))
customDialogList.setDescription("Total:" + listExpeditionScan.size)
expeditionScanAdapter!!.notifyItemInserted(listExpeditionScan.size-1)
customDialogList.setValue("")
ma.messageWithSound("Añadida",false,true)
}
binding.splashProgress.visibility = GONE
})
}
@ -123,23 +89,16 @@ class ExpeditionScanSorterFragment(
customDialogList.setTitle("Escanea expediciones que no han pasado por el Sorter")
.setOkButton("Finalizar") {
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
/* if (listExpeditionScan.size > 0) {
customDialogList.dismiss()
backButton.performClick()
} else {*/
ma.hideKeyboard(customDialogList.getEditText())
customDialogList.dismiss()
binding.mainToolbar.backButton.performClick()
// }
}.setValue("").show()
customDialogList.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
customDialogList.getEditText().setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) {
@ -147,17 +106,18 @@ class ExpeditionScanSorterFragment(
expeditionscan(customDialogList.getValue())
}
customDialogList.setValue("")
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
return@setOnEditorActionListener true
}
false
}
expeditionScanAdapter =
SmartTagAdapter(listExpeditionScan, object : OnSmartTagRowClickListener {
override fun OnSmartTagRowClickListener(item: SmartTag) {
GeneralAdapter(listExpeditionScan, object : OnGeneralItemRowClickListener {
override fun OnGeneralItemRowClickListener(item: GeneralItem) {
}
}, showDelete = false)
})
customDialogList.getRecyclerView().adapter = expeditionScanAdapter
customDialogList.getRecyclerView().layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)

View File

@ -1,32 +1,21 @@
package es.verdnatura.presentation.view.feature.paletizador.fragment
import android.content.Intent
import android.content.SharedPreferences
import android.view.View
import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentItemexpeditionstateCardBinding
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnItemExpeditionStateRowClickListener
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.imageview.activity.ImageViewActivity
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.paletizador.adapter.ExpeditionStateAdapter
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionStateRow
import es.verdnatura.presentation.view.feature.paletizador.model.itemExpedetionState
class ExpeditionStateFragment(
var entryPoint: String = ""
// ) : BaseFragment<FragmentExpeditionstateBinding, ExpeditionStateViewModel>(ExpeditionStateViewModel::class) {
var title: String = ""
) : BaseFragment<FragmentItemexpeditionstateCardBinding, ExpeditionStateViewModel>(ExpeditionStateViewModel::class) {
private var urlLarge: String = ""
private var titleImage: String = ""
private var user = ""
private var password = ""
private var warehouseFk = ""
private var adapter: ExpeditionStateAdapter? = null
private var listItemsRow: ArrayList<ItemExpeditionStateRow> = ArrayList()
private var itemScan = ""
@ -35,16 +24,11 @@ class ExpeditionStateFragment(
fun newInstance(entryPoint: String) = ExpeditionStateFragment(entryPoint)
}
private lateinit var customDialog: CustomDialog
override fun getLayoutId(): Int = R.layout.fragment_itemexpeditionstate_card
override fun init() {
binding.itemcardLayout.visibility = View.GONE
customDialog = CustomDialog(requireContext())
setEvents()
setToolBar(getString(R.string.ExpeditionState))
setToolBar(title)
super.init()
}
@ -57,12 +41,12 @@ class ExpeditionStateFragment(
binding.editItemFk.requestFocus()
binding.editItemFk.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!binding.editItemFk.text.toString().isNullOrEmpty()) {
if (binding.editItemFk.text.toString().isNotEmpty()) {
getExpedtionState(binding.editItemFk.text.toString())
itemScan = binding.editItemFk.text.toString()
}
binding.editItemFk.setText("")
(activity as MainActivity).hideKeyboard(binding.editItemFk)
ma.hideKeyboard(binding.editItemFk)
return@setOnEditorActionListener true
}
false
@ -73,58 +57,26 @@ class ExpeditionStateFragment(
requireActivity().onBackPressed()
}
binding.itemcardImage.setOnClickListener {
val i: Intent = Intent(activity, ImageViewActivity::class.java)
i.putExtra("url", urlLarge)
i.putExtra("title", titleImage)
startActivity(i)
}
}
private fun getExpedtionState(expeditionFk: String) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = getData(USER)
password = getData(PASSWORD)
warehouseFk = getData(WAREHOUSEFK)
// this.itemFk = itemFk
binding.splashProgress.visibility = View.VISIBLE
viewModel.expedition_getStateJSON(expeditionFk, user, password,"expedition_getState")
viewModel.expedition_getStateJSON(expeditionFk, getData(USER), getData(PASSWORD),"expedition_getState")
}
override fun observeViewModel() {
with(viewModel) {
// itemcard.observe(viewLifecycleOwner, Observer {
itemexpedition.observe(viewLifecycleOwner, Observer {
itemexpedition.observe(viewLifecycleOwner,{
binding.splashProgress.visibility = View.GONE
if (it.isError) {
binding.itemcardLayout.visibility = View.GONE
binding.mainToolbar.toolbarTitle.text = "Estado de la expedición"
customDialog.setTitle("Error")
.setDescription("No se ha podido obtener el estado de la expedición escaneada. ")
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
} else {
binding.mainToolbar.toolbarTitle.text = title
ma.messageWithSound("No se ha podido obtener el estado de la expedición escaneada.",true,false,"Sin resultados")
if (it != null) {
binding.itemcardLayout.visibility = View.VISIBLE
} else {
setItemExpeditionState(it)
} else {
binding.itemcardLayout.visibility = View.GONE
binding.mainToolbar.toolbarTitle.text = "Estado de la expedición"
customDialog.setTitle("Sin resultados")
.setDescription("No hemos podido encontrar el estado de la expedición.")
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
}
}
})
@ -134,25 +86,19 @@ class ExpeditionStateFragment(
private fun setItemExpeditionState(itemInfo: itemExpedetionState) {
setToolBar(getString(R.string.expedition) + itemScan)
binding.itemcardLayout.visibility = View.VISIBLE
listItemsRow = ArrayList()
for (i in itemInfo.list) {
listItemsRow.add(
ItemExpeditionStateRow(
title = i.key,
value = i.value.replace(".0",""),
value = i.value?.replace(".0",""),
isEditable = false
)
)
}
adapter = ExpeditionStateAdapter(listItemsRow, object :
OnItemExpeditionStateRowClickListener {
override fun OnItemExpeditionStateRowClickListener(item: ItemExpeditionStateRow) {
}
})
adapter = ExpeditionStateAdapter(listItemsRow)
binding.itemexpeditionstateRecyclerview.adapter = adapter
binding.itemexpeditionstateRecyclerview.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
@ -163,4 +109,3 @@ class ExpeditionStateFragment(
}

View File

@ -157,7 +157,7 @@ class ExpeditionStateViewModel(context: Context) : BaseViewModel() {
gson.fromJson(json, object : TypeToken<Map<String, Any>>() {}.type)
expeditionState.forEach {
list.add(itemsExpeditionDynamics(key=it.key,value=it.value.toString()))
list.add(itemsExpeditionDynamics(key=it.key,it.value?.toString()))
}
return list

View File

@ -76,7 +76,7 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
addTruck()
}
if (item == iconState){
(activity as MainActivity).openFragmentExpeditionState()
ma.openFragmentExpeditionState()
}
}
})
@ -112,14 +112,14 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
private fun addTruck(){
customDialogHor.setTitle("Nuevo Camión").setOkButton("Guardar"){
(activity as MainActivity).hideKeyboard(customDialogHor.getDestinoEditText())
ma.hideKeyboard(customDialogHor.getDestinoEditText())
if (!customDialogHor.getDestinoValue().isNullOrEmpty() && !customDialogHor.getHoraValue().isNullOrEmpty()){
viewModel.expeditionTruckAdd(getData(USER),
getData(PASSWORD),customDialogHor.getHoraValue(),customDialogHor.getDestinoValue(),"expeditionTruck_Add")
binding.splashProgress.visibility = View.VISIBLE
customDialogHor.dismiss()
}
(activity as MainActivity).hideKeyboard(customDialogHor.getDestinoEditText())
ma.hideKeyboard(customDialogHor.getDestinoEditText())
customDialogHor.dismiss()
}.setKoButton("Cancelar"){
customDialogHor.dismiss()
@ -137,7 +137,7 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
return@setOnEditorActionListener true
}
(activity as MainActivity).hideKeyboard(customDialogHor.getDestinoEditText())
ma.hideKeyboard(customDialogHor.getDestinoEditText())
false
}
}

View File

@ -1,7 +1,6 @@
package es.verdnatura.presentation.view.feature.paletizador.model
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
class ItemExpeditionTruckVO (
var truckFk:String = "",
@ -17,19 +16,6 @@ class ItemExpeditionTruckList(
)
class itemExpedetionState(
/* var ticket: String = "",
var cliente : String = "",
var ciudad : String = "",
var provincia : String ="",
var zonaTicket : String = "",
var zonaRuta : String = "",
var ruta : String ="",
var ubicacion : String="",
var ETD : String="",
var camion : String="",
var ticketsPendientes : String= "",
var etiquetasTotales : String = "",
var etiquetasEscaneadas : String="",*/
var isError:Boolean = false,
var errorMessage:String = "",
var list:MutableList<itemsExpeditionDynamics>
@ -38,16 +24,9 @@ class itemExpedetionState(
class itemsExpeditionDynamics(
var key: String = "",
var value:String = ""
)
/*
class itemExpeditionDynamicsList(
var list: List<itemsExpeditionDynamics> = listOf()
var value: String? = null
)
class itemExpedetionStateList (
var list: List<itemExpedetionState> = listOf()
)*/
class ItemExpeditionStateRow (
var title:String? = "",
var value:String? = "",

View File

@ -68,7 +68,7 @@ class ParkingFragment : BaseFragment<FragmentParkingBinding,ParkingViewModel>(Pa
if (it.isError){
// mperror?.start()
// binding.splashProgress.visibility = View.GONE
(activity as MainActivity).messageWithSound(it.errorMessage, isError = true,isPlayed = true)
ma.messageWithSound(it.errorMessage, isError = true,isPlayed = true)
/*customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()*/

View File

@ -66,7 +66,7 @@ class ParkingSaleFragment : BaseFragment<FragmentParkingBinding,ParkingSaleViewM
response.observe(viewLifecycleOwner, Observer {
if (it.isError){
mperror?.start()
(activity as MainActivity).messageWithSound(it.errorMessage,true,false)
ma.messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()*/

View File

@ -8,7 +8,6 @@ import es.verdnatura.R
import es.verdnatura.databinding.FragmentPasilleroBinding
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.pasillero.adapter.PasillerosAdapter
@ -30,7 +29,7 @@ class PasilleroFragment(
override fun getLayoutId(): Int = R.layout.fragment_pasillero
override fun init() {
(activity as MainActivity).hideBottomNavigation(View.VISIBLE)
ma.hideBottomNavigation(View.VISIBLE)
binding.mainToolbar.toolbarTitle.text = tagName
binding.mainToolbar.backButton.visibility = View.GONE
super.init()

View File

@ -31,14 +31,6 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
//sergio para que aparezca el nuevo menu
/* _pasillerositem.add(
PasillerosItemVO(
7,
R.drawable.worker_mistake,
"Fallo personal", R.string.workermistake,"Permite añadir fallos a un trabajador"
)
)*/
_pasillerositem.add(
PasillerosItemVO(
7,
@ -112,6 +104,14 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
)
)
_pasillerositem.add(
PasillerosItemVO(
7,
R.drawable.worker_mistake,
"Fallo del trabajador", R.string.workermistake,"Permite añadir fallos a un trabajador"
)
)
_pasillerositem.add(
PasillerosItemVO(
10,
@ -190,7 +190,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
31,
R.drawable.ic_visibility_black_24dp,
"Consultar expedición", R.string.ExpeditionState,"Permite conocer el estado de una expedición"
"Consultar estado expedición", R.string.ExpeditionState,"Permite conocer el estado de una expedición"
)
)
_pasillerositem.add(

View File

@ -74,7 +74,7 @@ class PreControladorFragment: BaseFragment<FragmentControladorBinding,ShowTicket
}
binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard(binding.scanInput)
ma.hideKeyboard(binding.scanInput)
return@setOnEditorActionListener true
}
false
@ -86,7 +86,7 @@ class PreControladorFragment: BaseFragment<FragmentControladorBinding,ShowTicket
collectionTicketList.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.GONE
if (it.isError){
(activity as MainActivity).messageWithSound(it.errorMessage,true,false)
ma.messageWithSound(it.errorMessage,true,false)
}else{
if (!goBack)navigateToCollectionList(it)

View File

@ -63,7 +63,7 @@ class PreSacadorFragment :
private var originalScanned = ""
fun changevariables(){
TODO("llevar variables i deixar soles una com positionToChange i quantityToChange")
TODO("Refactor llevar variables i deixar soles una com positionToChange i quantityToChange")
}
private var typeCollectionMissing = ""
private var positionCollectionMissing = 0
@ -73,6 +73,8 @@ class PreSacadorFragment :
private var quantityCollectionSplit = ""
private var positionCollectionSplit = 0
private val listIcons:ArrayList<ImageView> = ArrayList()
//sergio: se añada para leer el articulo leido que era el buyFk
private var originalItemScan: String = ""
@ -175,17 +177,18 @@ class PreSacadorFragment :
responseSalixMessage.observe(viewLifecycleOwner, Observer {
if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage)
ma.messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Aceptar") {
customDialog.dismiss()
}.show()
}.show()*/
}
})
responseIncQuantity.observe(viewLifecycleOwner, Observer {
if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage, isError = true,true)
ma.messageWithSound(it.errorMessage, isError = true,true)
} else {
incresaseSuccesful()
}
@ -196,20 +199,36 @@ class PreSacadorFragment :
responseParkingAdd.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = GONE
if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage)
ma.messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Aceptar") {
customDialog.dismiss()
}.show()
}.show()*/
} else {
if (mpok != null) mpok!!.start()
"Sale/s aparcada/s".toast(requireContext())
}
})
responseSaleTrackingUpdate.observe(viewLifecycleOwner, Observer {
ma.messageWithSound(it.errorMessage, isError = it.isError,true)
try {
sales.clear()
}
catch(e:Exception)
{
}
})
responseSaleMove.observe(viewLifecycleOwner, Observer {
if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage, isError = true,true)
ma.messageWithSound(it.errorMessage, isError = true,true)
} else {
responseSaleMoveSuccesful()
@ -219,7 +238,7 @@ class PreSacadorFragment :
responseMissingTrash.observe(viewLifecycleOwner, Observer {
if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage, isError = true,true)
ma.messageWithSound(it.errorMessage, isError = true,true)
} else {
missingTrashSuccesful()
@ -390,7 +409,7 @@ class PreSacadorFragment :
binding.splashProgress.visibility = GONE
if (salesList.isNullOrEmpty()) {
(activity as MainActivity).messageWithSound("No hemos podido obtener movimientos para el ticket escaneado",true,false,"Pre Sacador")
ma.messageWithSound("No hemos podido obtener movimientos para el ticket escaneado",true,false,"Pre Sacador")
/* customDialog.setTitle("Pre Sacador")
.setDescription("No hemos podido obtener movimientos para el ticket escaneado")
@ -576,6 +595,16 @@ class PreSacadorFragment :
setTotalLines()
}
private fun saleTracking_update(){
viewModel.saleTracking_update(
usuario = getData(USER),
password = getData(PASSWORD),
saleFk ="000"
)
}
private fun saleTrackingReplace(position: Int) {
viewModel.saleTrackingReplace(
usuario = getData(USER),
@ -913,35 +942,29 @@ class PreSacadorFragment :
private fun setToolBar() {
binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE
val listIcons:ArrayList<ImageView> = ArrayList()
// val listIcons:ArrayList<ImageView> = ArrayList()
val iconParking = ImageView(context)
iconParking.setImageResource(R.drawable.ic_local_parking_black_24dp)
val iconEraser = ImageView(context)
iconEraser.setImageResource(R.drawable.previous_delete)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconParking.tooltipText=getTooltip(R.drawable.ic_local_parking_black_24dp)
iconEraser.tooltipText=getTooltip(R.drawable.previous_delete)
}
//listIcons.add(iconEraser)
listIcons.add(iconParking)
/*val listIcons: ArrayList<Drawable> = ArrayList()
val iconEraser: Drawable = resources.getDrawable(R.drawable.eraser, resources.newTheme())
val iconParking: Drawable =
resources.getDrawable(R.drawable.ic_local_parking_black_24dp, resources.newTheme())*/
//sergio para hacer el presacador como sacador
//val iconAdd : Drawable = resources.getDrawable(R.drawable.ic_add_black_24dp,resources.newTheme())
//val iconTransferir : Drawable = resources.getDrawable(R.drawable.ic_swap_horiz_black_24dp,resources.newTheme())
// listIcons.add(iconEraser)
//listIcons.add(iconParking)
//listIcons.add(iconAdd)
//listIcons.add(iconTransferir)
binding.mainToolbar.toolbarIcons.adapter =
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
/*if (item == iconEraser) {
// saleTracking_update()
saleTracking_update()
} else*/
when (item){
iconParking.drawable-> pasillerosItemClickListener?.onPasillerosItemClickListener(
@ -949,6 +972,7 @@ class PreSacadorFragment :
title = "Parking"
), ""
)
iconEraser.drawable->saleTracking_update()
}
}

View File

@ -35,6 +35,11 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
val response: LiveData<ResponseItemVO>
get() = _response
private val _responseSaleTrackingUpdate by lazy { MutableLiveData<ResponseItemVO>() }
val responseSaleTrackingUpdate: LiveData<ResponseItemVO>
get() = _responseSaleTrackingUpdate
private val _responseSaleMove by lazy { MutableLiveData<ResponseItemVO>() }
val responseSaleMove: LiveData<ResponseItemVO>
get() = _responseSaleMove
@ -279,6 +284,44 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
})
}
fun saleTracking_update(
usuario: String,
password: String,
saleFk: String,
)
{
getSacadorControladorUserCase.saleTracking_update(
usuario,
password,
saleFk
).enqueue(object : Callback<Unit>
{
override fun onFailure(call: Call<Unit>, t: Throwable)
{
_responseSaleTrackingUpdate.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
override fun onResponse(call: Call<Unit>, response: Response<Unit>)
{
if (!response.isSuccessful)
{
_responseSaleTrackingUpdate.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
_responseSaleTrackingUpdate.value = ResponseItemVO(isError = false, errorMessage = "Actualizado listado previa", response = "Actualizado listado previa")
}
}
})
}
fun saleTrackingReplace(
usuario: String,
password: String,

View File

@ -16,7 +16,7 @@ class PreSacadorItemVO (
var carros : List<PlacementVO> = listOf(),
//var priority:Int =0, 7-1-2022
var pickingOrder:Int =0,
var salesPersonFk:String= "sergio"
var salesPersonFk:String= ""
)

View File

@ -68,7 +68,7 @@ class QrFragment(
}
binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard(binding.scanInput)
ma.hideKeyboard(binding.scanInput)
return@setOnEditorActionListener true
}
// false
@ -83,10 +83,11 @@ class QrFragment(
if (it.isError) {
// getMessageFromJSON(it.errorMessage)
customDialog.setTitle("Error").setDescription( it.errorMessage+ " "+itemscaned)
ma.messageWithSound(it.errorMessage+ " "+itemscaned,true,false)
/*customDialog.setTitle("Error").setDescription( it.errorMessage+ " "+itemscaned)
.setOkButton("Aceptar") {
customDialog.dismiss()
}.show()
}.show()*/
} else {
customDialog.setTitle("Mensaje")

View File

@ -72,7 +72,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
customDialog = CustomDialog(requireContext())
customDialogList = CustomDialogList(requireContext())
customDialogInput = CustomDialogInput(requireContext())
(activity as MainActivity).hideBottomNavigation(View.GONE)
ma.hideBottomNavigation(View.GONE)
binding.splashProgress.visibility = View.GONE
binding.mainToolbar.toolbarTitle.text = getString(R.string.itemPlacementSupplyGetOrder)
setToolBar()
@ -519,7 +519,6 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
}
private fun showScanner(index:Int, sale:PreSacadorItemVO){
//////Log.i("VERDNATURA:","CUSTOMDIALOG para enviar")
customDialogInput.setTitle(""+sale.itemFk).setDescription("Escanea el carro para el item seleccionado").setOkButton("Aceptar"){
if (!customDialogInput.getValue().isNullOrEmpty()) {
findSale(customDialogInput.getValue(),index)

View File

@ -27,7 +27,7 @@ class CollectionAdapter (
holder.bind(items[position])
holder.binding.root.setOnClickListener {
onCollectionSelected.onCollectionSelected(items[position],SACADOR)
//////Log.i("VERDNATURA:","2-Click item ${items[position].collectionFk}")
Log.d("VERDNATURA::","2-Click item ${items[position].collectionFk}")
}
}

View File

@ -17,6 +17,7 @@ import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.sacador.adapter.CollectionAdapter
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
import es.verdnatura.presentation.view.feature.smarttag.sacador.fragment.AssociateSmartTagsFragment
import timber.log.Timber.d
class SacadorFragment :
@ -52,9 +53,11 @@ class SacadorFragment :
setToolBar()
setEvents()
viewModel.collectionGetSalix(token = getData(TOKEN))
/*viewModel.collectionGet( getData(USER),
/* viewModel.collectionGet( getData(USER),
getData(PASSWORD),"collection_get")*/
super.init()
}
override fun onPause() {
@ -66,7 +69,7 @@ class SacadorFragment :
private fun setToolBar() {
// requireActivity().main_bottom_navigation.visibility = View.VISIBLE
(activity as MainActivity).hideBottomNavigation(View.VISIBLE)
ma.hideBottomNavigation(View.VISIBLE)
binding.mainToolbar.backButton.visibility = View.GONE
val listIcons: ArrayList<ImageView> = ArrayList()
@ -99,19 +102,9 @@ class SacadorFragment :
viewModel.collectionNew(getData(USER),
getData(PASSWORD),getData(SECTORFK),getData(WAGON),getData(TAGSTYPE),"collection_new_wagon")
}
iconVehicleIn.drawable-> (activity as MainActivity).onVehicleSelected(SacadorFragment.TAG)
}
/* if (item == iconAdd) {
binding.splashProgress.visibility = View.VISIBLE
//viewModel.collectionNew(user, password, sectorFk, wagons)
viewModel.collectionNew(user,password,sectorFk,wagons,getTagsType(),"collection_new_wagon")
//checkTagsMode()
iconVehicleIn.drawable-> ma.onVehicleSelected(SacadorFragment.TAG)
}
if (item.drawable == iconVehicleIn) {
(activity as MainActivity).onVehicleSelected(SacadorFragment.TAG)
}*/
}
})
binding.mainToolbar.toolbarIcons.layoutManager =
@ -122,8 +115,8 @@ class SacadorFragment :
binding.sacadorSwipe.setOnRefreshListener {
viewModel.collectionGetSalix(token = getData(TOKEN))
/* viewModel.collectionGet(getData(USER),
getData(PASSWORD),"collection_get")
binding.sacadorSwipe.isRefreshing = false*/
getData(PASSWORD),"collection_get")*/
binding.sacadorSwipe.isRefreshing = false
}
}
@ -182,7 +175,7 @@ class SacadorFragment :
binding.splashProgressTwo.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage,true,false)
ma.messageWithSound(it.errorMessage,true,false)
} else {
if (goBack) addCollectionToList(it.response)

View File

@ -27,7 +27,7 @@ class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, She
override fun init() {
(activity as MainActivity).hideBottomNavigation(View.GONE)
ma.hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text = getString(R.string.shelvingParking_get)
setEvents()
@ -50,7 +50,7 @@ class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, She
}
binding.shelvingText.setText("")
(activity as MainActivity).hideKeyboard(binding.shelvingText)
ma.hideKeyboard(binding.shelvingText)
return@setOnEditorActionListener true
}
@ -67,7 +67,7 @@ class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, She
binding.mainToolbar.toolbarTitle.text = binding.shelvingText.text.toString()
viewModel.shelvingParking_get( getData(USER),getData(PASSWORD),binding.shelvingText.text.toString(),getData(WAREHOUSEFK),binding.dayrange.text.toString(),"shelvingParking_get")
binding.shelvingText.setText("")
(activity as MainActivity).hideKeyboard(binding.dayrange)
ma.hideKeyboard(binding.dayrange)
return@setOnEditorActionListener true
}

View File

@ -73,7 +73,7 @@ class ShowTicketFragment: BaseFragment<FragmentControladorBinding, ShowTicketVie
)
}
binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard(binding.scanInput)
ma.hideKeyboard(binding.scanInput)
return@setOnEditorActionListener true
}
false
@ -85,7 +85,7 @@ class ShowTicketFragment: BaseFragment<FragmentControladorBinding, ShowTicketVie
collectionTicketList.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.GONE
if (it.isError){
(activity as MainActivity).messageWithSound(it.errorMessage,true,false)
ma.messageWithSound(it.errorMessage,true,false)
}else{
if (!goBack)navigateToCollectionList(it)
goBack = false

View File

@ -67,7 +67,7 @@ class RegisterSmartTagsFragment(
customDialog = CustomDialog(requireContext())
customDialogList = CustomDialogList(requireContext())
goBack = false
(activity as MainActivity).hideBottomNavigation(View.GONE)
ma.hideBottomNavigation(View.GONE)
binding.splashProgress.visibility = GONE
setEvents()
@ -157,11 +157,11 @@ class RegisterSmartTagsFragment(
if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage)
ma.messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
}.show()*/
} else {
var nameSmartTagwithWagon: String
@ -218,12 +218,12 @@ class RegisterSmartTagsFragment(
customDialogList.setTitle("Escanea matrícula del carro y etiquetas smartTags de arriba a abajo.")
.setOkButton("Finalizar") {
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
if (listSmartTags.size > 0) {
// setFragmentResult("requestkey", bundleOf("tagMode" to "SmartTag"))
customDialogList.dismiss()
// (activity as MainActivity).openFragmentPickers()
// ma.openFragmentPickers()
/*listSmartTags.forEach {
Log.i("VERDNATURA:","El codigo es :${it.code}")
}
@ -239,7 +239,7 @@ class RegisterSmartTagsFragment(
}
}.setKoButton("Deshacer") {
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
if (!listSmartTags.isEmpty()) {
@ -256,7 +256,7 @@ class RegisterSmartTagsFragment(
}.setValue("").show()
customDialogList.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
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) {
@ -293,7 +293,7 @@ class RegisterSmartTagsFragment(
}
customDialogList.setValue("")
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
return@setOnEditorActionListener true
}
false

View File

@ -73,7 +73,7 @@ class AssociateSmartTagsFragment(
customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
goBack = false
//requireActivity().main_bottom_navigation.visibility = GONE
(activity as MainActivity).hideBottomNavigation(View.GONE)
ma.hideBottomNavigation(View.GONE)
binding.splashProgress.visibility = GONE
setEvents()
@ -160,11 +160,11 @@ class AssociateSmartTagsFragment(
// Log.i("VERDNATURA::", "Revisar llamada de las etiquetas smarttags : ${it.response}")
if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage)
ma.messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
}.show()*/
} else {
/* if (it.response != null) {
@ -195,10 +195,11 @@ class AssociateSmartTagsFragment(
responseremove.observe(viewLifecycleOwner, Observer {
if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage)
ma.messageWithSound(it.errorMessage,true,false)
/*customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
}.show()*/
} else {
if (it.response == null) {
@ -264,7 +265,7 @@ class AssociateSmartTagsFragment(
customDialogList.setTitle("Escanea etiqueta/s electrónica/s o matrícula/s.")
.setOkButton("Finalizar") {
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
if (listSmartTags.size > 0) {
// setFragmentResult("requestkey", bundleOf("tagMode" to "SmartTag"))
@ -272,7 +273,7 @@ class AssociateSmartTagsFragment(
val result = "complete"
setFragmentResult("requestKey", bundleOf("tagMode" to result))
(activity as MainActivity).openFragmentPickers()
ma.openFragmentPickers(true)
/*listSmartTags.forEach {
Log.i("VERDNATURA:","El codigo es :${it.code}")
}
@ -288,7 +289,7 @@ class AssociateSmartTagsFragment(
}
}.setKoButton("Deshacer") {
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
if (!listSmartTags.isEmpty()) {
@ -304,7 +305,7 @@ class AssociateSmartTagsFragment(
}.setValue("").show()
customDialogList.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
customDialogList.getEditText().setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) {
@ -312,7 +313,7 @@ class AssociateSmartTagsFragment(
bindShelving_add(customDialogList.getValue())
}
customDialogList.setValue("")
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
return@setOnEditorActionListener true
}
false

View File

@ -33,7 +33,7 @@ class AutomaticAddItemFragment(
override fun init() {
(activity as MainActivity).hideBottomNavigation(View.GONE)
ma.hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text = "itemShelvingMake"
setEvents()
setViews()
@ -76,7 +76,7 @@ class AutomaticAddItemFragment(
adapter!!.notifyDataSetChanged()
}
binding.editMatricula.setText("")
(activity as MainActivity).hideKeyboard(binding.editMatricula)
ma.hideKeyboard(binding.editMatricula)
return@setOnEditorActionListener true
}
@ -103,7 +103,7 @@ class AutomaticAddItemFragment(
response.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.GONE
if (it.isError){
(activity as MainActivity).messageWithSound(it.errorMessage,true,false)
ma.messageWithSound(it.errorMessage,true,false)
/*customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()*/

View File

@ -66,7 +66,7 @@ class UbicadorFragment(
customDialogUbicador = CustomDialogUbicador(requireContext())
customDialogTwoButtons = CustomDialogTwoButtons(requireContext())
(activity as MainActivity).hideBottomNavigation(View.GONE)
ma.hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text = getString(R.string.locator)
setEvents()
setToolBar()
@ -154,7 +154,7 @@ class UbicadorFragment(
}
binding.editMatricula.setText("")
(activity as MainActivity).hideKeyboard(binding.editMatricula)
ma.hideKeyboard(binding.editMatricula)
return@setOnEditorActionListener true
}
@ -173,7 +173,7 @@ class UbicadorFragment(
)
}
(activity as MainActivity).hideKeyboard(binding.editPrioridad)
ma.hideKeyboard(binding.editPrioridad)
return@setOnEditorActionListener true
}
@ -183,7 +183,7 @@ class UbicadorFragment(
binding.automaticImg.setOnClickListener {
if (!shelvingFk.isNullOrEmpty())
(activity as MainActivity).onPasillerosItemClickListener(
ma.onPasillerosItemClickListener(
PasillerosItemVO(title = "Automatic"),
entryPoint = shelvingFk
)
@ -210,7 +210,7 @@ class UbicadorFragment(
}.show()
customDialogInput.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
ma.hideKeyboard(customDialogInput.getEditText())
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
@ -259,7 +259,7 @@ class UbicadorFragment(
}.show()
customDialogInput.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
ma.hideKeyboard(customDialogInput.getEditText())
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
@ -375,17 +375,24 @@ class UbicadorFragment(
})
response.observe(viewLifecycleOwner, Observer {
if (it.isError) {
mperror!!.start()
ma.messageWithSound(it.errorMessage,it.isError,false)
/* mperror!!.start()
customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
}.show()*/
}
})
responsepriority.observe(viewLifecycleOwner, Observer {
if (it.isError) {
ma.messageWithSound(
if (it.isError) it.errorMessage else{it.response},it.isError,true)
/* if (it.isError) {
mperror!!.start()
customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
@ -393,7 +400,7 @@ class UbicadorFragment(
}.show()
} else {
(it.response).toast(requireContext())
}
}*/
})
responseMake.observe(viewLifecycleOwner, Observer {
@ -439,7 +446,7 @@ class UbicadorFragment(
}.show()
customDialogUbicador.getEditItem().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem())
ma.hideKeyboard(customDialogUbicador.getEditItem())
customDialogUbicador.getVisibleItem().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
@ -518,7 +525,7 @@ class UbicadorFragment(
customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("")
.setEtiquetaValue("").setVisibleValue("")
customDialogUbicador.getEditItem().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem())
ma.hideKeyboard(customDialogUbicador.getEditItem())
customDialogUbicador.dismiss()
} else if (!itemFk.isNullOrEmpty() && !etiquetas.isNullOrEmpty()) {
@ -547,7 +554,7 @@ class UbicadorFragment(
customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("")
.setEtiquetaValue("").setVisibleValue("")
customDialogUbicador.getEditItem().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem())
ma.hideKeyboard(customDialogUbicador.getEditItem())
customDialogUbicador.dismiss()
} else {
@ -582,7 +589,7 @@ class UbicadorFragment(
customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("")
.setEtiquetaValue("").setVisibleValue("")
customDialogUbicador.getEditItem().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem())
ma.hideKeyboard(customDialogUbicador.getEditItem())
customDialogUbicador.dismiss()
} else if (!itemFk.isNullOrEmpty() && !etiquetas.isNullOrEmpty() && updatePacking) {
@ -616,7 +623,7 @@ class UbicadorFragment(
customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("")
.setEtiquetaValue("").setVisibleValue("")
customDialogUbicador.getEditItem().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem())
ma.hideKeyboard(customDialogUbicador.getEditItem())
customDialogUbicador.dismiss()
} else {
@ -639,14 +646,14 @@ class UbicadorFragment(
changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible,packing = packing))
customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("")
customDialogUbicador.getEditItem().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem())
ma.hideKeyboard(customDialogUbicador.getEditItem())
}else if(!itemFk.isNullOrEmpty() && !etiquetas.isNullOrEmpty()){
val visible_calc = (etiquetas.toInt() * packing.toInt()).toString()
viewModel.itemShelvingMake(user,password,shelvingFk,itemFk,deep.toString(),visible_calc,packing,warehouseFk,"1","itemShelvingMake")
changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible_calc,packing = packing,stickers = etiquetas))
customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("")
customDialogUbicador.getEditItem().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem())
ma.hideKeyboard(customDialogUbicador.getEditItem())
}else{
"Rellena campos obligatorios".toast((activity as MainActivity), Toast.LENGTH_LONG)
}
@ -687,7 +694,7 @@ class UbicadorFragment(
customDialogInput.dismiss()
}.show()
customDialogInput.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
ma.hideKeyboard(customDialogInput.getEditText())
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
viewModel.itemShelvingTransfer(

View File

@ -1,61 +1,52 @@
package es.verdnatura.presentation.view.feature.workermistake.adapter
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryViewModel
import es.verdnatura.presentation.view.feature.inventario.fragment.SearchBuyerModel
import android.content.Context
import android.graphics.drawable.Drawable
import android.os.Build
import android.os.Bundle
import android.view.View
import android.widget.ImageView
import androidx.lifecycle.Observer
import androidx.core.widget.addTextChangedListener
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentWorkermistakeBinding
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.*
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.common.onMistakeWorkerClickListener
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
import es.verdnatura.presentation.view.feature.inventario.adapter.InventoryAdapter
import es.verdnatura.presentation.view.component.CustomDialogList
import es.verdnatura.presentation.view.feature.articulo.adapter.BarcodeAdapter
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryViewModel
import es.verdnatura.presentation.view.feature.inventario.fragment.SearchDepartmentModel
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake
import es.verdnatura.presentation.view.feature.workermistake.model.MistakeWorkerType
import es.verdnatura.presentation.view.feature.workermistake.model.WorkerFromMistake
import es.verdnatura.presentation.view.feature.workermistake.model.workerFromMistakeList
import ir.mirrajabi.searchdialog.SimpleSearchDialogCompat
import ir.mirrajabi.searchdialog.core.SearchResultListener
import timber.log.Timber.d
class WorkermistakeFragment( var entryPoint: String = ""
) : BaseFragment<FragmentWorkermistakeBinding, InventaryViewModel>(
InventaryViewModel::class) {
private var adapter : InventoryAdapter? = null
private var adapterworker:WorkermistakeAdapter? = null
private lateinit var customDialogInput: CustomDialogInput
private var listInvetory:ArrayList<ItemInventaryVO> = ArrayList()
private var listInvetoryAux:ArrayList<ItemInventaryVO> = ArrayList()
private var listWorker:ArrayList<WorkerFromMistake> = ArrayList()
private var listWorker:MutableList<WorkerFromMistake> = ArrayList()
private var listWorkerAuxiliary:MutableList<WorkerFromMistake> = ArrayList()
private lateinit var customDialog: CustomDialog
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
private var reload = false
private var hideLoad = true
private var layoutManager : LinearLayoutManager? = null
private var firstVisiblePosition = 0
// private var firstVisiblePosition = 0
private lateinit var customDialogList: CustomDialogList
private var listMistakes: ArrayList<BarcodeVO> = ArrayList()
private var listMistakesAdapter: BarcodeAdapter? = null
private var workerMistakeName: WorkerFromMistake? = null
//sergio : cmbios para insertar lista compradores en inventary en el searchable
private val items=ArrayList<SearchBuyerModel>()
private val departments=ArrayList<SearchDepartmentModel>()
private lateinit var buyerId:String
private lateinit var departmentId:String
companion object {
fun newInstance(entryPoint:String) = WorkermistakeFragment(entryPoint)
@ -69,9 +60,6 @@ class WorkermistakeFragment( var entryPoint: String = ""
}
override fun onCreate(savedInstanceState: Bundle?) {
//viewModel.itemShelvingBuyerGet(user = getData(USER),password = getData(PASSWORD),"itemShelvingBuyerGet")
viewModel.department_getHasMistake(usuario = getData(USER),password = getData(PASSWORD))
super.onCreate(savedInstanceState)
}
@ -79,22 +67,28 @@ class WorkermistakeFragment( var entryPoint: String = ""
override fun init() {
binding.filterBuyer.setText(getData(BUYER))
binding.filterDepartment.setText(getData(DEPARTMENTMISTAKE))
binding.splashProgress.visibility = View.VISIBLE
buyerId=getData(BUYERID)
departmentId=getData(DEPARTMENTMISTAKEID)
// viewModel.getInventory(getData(USER),getData(PASSWORD),buyerId,getData(WAREHOUSEFK),"itemShelving_filterBuyer")
binding.filterBuyer.setOnClickListener{
customDialogList = CustomDialogList(requireContext())
if (!departmentId.isEmpty()){
viewModel.worker_getFromHasMistake(getData(USER),getData(PASSWORD),getData(DEPARTMENTMISTAKEID),"worker_getFromHasMistake")
}
binding.filterDepartment.setOnClickListener{
SimpleSearchDialogCompat(context,getString(R.string.departamentos),getString(R.string.escribirparteNombre),null,departments,
SearchResultListener { baseSearchDialogCompat, nombre, position ->
{ baseSearchDialogCompat, nombre, position ->
binding.filterBuyer.setText((nombre.title))
saveBuyer(nombre.getDepartmentName())
saveBuyerId(nombre.getDepartmentId())
buyerId=nombre.getDepartmentId()
// viewModel.getInventory(getData(USER),getData(PASSWORD),nombre.getBuyerId(),getData(WAREHOUSEFK),"itemShelving_filterBuyer")
binding.filterDepartment.setText((nombre.title))
saveData(DEPARTMENTMISTAKE,nombre.getDepartmentName())
saveData(DEPARTMENTMISTAKEID,nombre.getDepartmentId())
viewModel.worker_getFromHasMistake(getData(USER),getData(PASSWORD),nombre.getDepartmentId(),"worker_getFromHasMistake")
binding.splashProgress.visibility = View.VISIBLE
binding.filterItemFk.isEnabled = true
baseSearchDialogCompat.dismiss()
}).show()
}
@ -102,19 +96,10 @@ class WorkermistakeFragment( var entryPoint: String = ""
customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext())
(activity as MainActivity).hideBottomNavigation(View.GONE)
ma.hideBottomNavigation(View.GONE)
binding.splashProgress.visibility = View.VISIBLE
binding.mainToolbar.toolbarTitle.text = getString(R.string.itemShelvingRadar)
setToolBar()
setEvents()
if (reload){
reload = false
binding.splashProgress.visibility = View.VISIBLE
hideLoad = false
viewModel.getInventory(getData(USER),getData(PASSWORD),buyerId,getData(WAREHOUSEFK),"itemShelving_filterBuyer")
}
super.init()
}
@ -122,230 +107,155 @@ class WorkermistakeFragment( var entryPoint: String = ""
binding.mainToolbar.toolbarTitle.text=entryPoint
val listIcons: ArrayList<ImageView> = ArrayList()
val iconReload = ImageView(context)
iconReload.setImageResource(R.drawable.ic_autorenew_black_24dp)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconReload.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
}
listIcons.add(iconReload)
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons,object: OnOptionsSelectedListener{
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload.drawable){
binding.splashProgress.visibility = View.VISIBLE
firstVisiblePosition = layoutManager?.findFirstVisibleItemPosition() ?: 0
viewModel.department_getHasMistake(usuario = getData(USER),password = getData(PASSWORD))
}
}
})
binding.mainToolbar.toolbarIcons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
private fun setEvents(){
binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed()
}
binding.filterItemFk.setOnKeyListener { v, keyCode, event ->
if (binding.filterItemFk.text.toString().isNullOrEmpty()){
if (listInvetory.size != listInvetoryAux.size){
listInvetory.removeAll(listInvetoryAux)
listInvetoryAux.forEach {
listInvetory.add(it)
}
if (binding.filterDepartment.text.isNullOrEmpty()){binding.filterItemFk.isEnabled = false}
binding.filterItemFk.addTextChangedListener{ filter()}
}
}else{
listInvetory.removeAll(listInvetoryAux)
listInvetoryAux.forEach {
if ((it.itemFk.contains(binding.filterItemFk.text.toString(),true)) || (it.producer.contains(binding.filterItemFk.text.toString(),true))){
listInvetory.add(it)
}
private fun filter() {
if (!listWorker.isNullOrEmpty())
{listWorker.clear()
listWorker.addAll(listWorkerAuxiliary.filter{it.firstName.uppercase().contains(binding.filterItemFk.text.toString().uppercase()) || it.lastName.uppercase().contains(binding.filterItemFk.text.toString().uppercase())} as MutableList<WorkerFromMistake>)
adapterworker!!.notifyDataSetChanged()}
}
}
adapter!!.notifyDataSetChanged()
return@setOnKeyListener false
}
}
override fun onPause() {
/* override fun onPause() {
super.onPause()
firstVisiblePosition = layoutManager?.findFirstVisibleItemPosition() ?: 0
}
}*/
override fun onResume() {
/* override fun onResume() {
super.onResume()
if (binding.workermistakeRecyclerview.layoutManager != null){
if (firstVisiblePosition <= listInvetory.size){
binding.workermistakeRecyclerview.layoutManager!!.scrollToPosition(firstVisiblePosition)
}
}
}
}*/
override fun observeViewModel() {
with(viewModel){
//sergio: para compradores
buyersList.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.GONE
createBuyerList(it.list)
})
mistakeDepartmentList.observe(viewLifecycleOwner, Observer {
mistakeDepartmentList.observe(viewLifecycleOwner, {
binding.splashProgress.visibility = View.GONE
createDepartmentList(it.list)
})
workerFromMistakeList.observe(viewLifecycleOwner, Observer {
workerFromMistakeList.observe(viewLifecycleOwner, {
binding.splashProgress.visibility = View.GONE
createWorkerList(it.list)
it.list.forEach {
if (it.id != "0"){
listWorker.add(it)
}
}
adapterworker= WorkermistakeAdapter(listWorker,object:onMistakeWorkerClickListener{
override fun onMistakeWorkerClickListener(item: WorkerFromMistake) {
viewModel.workerMistakeType_get(usuario = getData(USER), password = getData(PASSWORD))
workerMistakeName=WorkerFromMistake(item.id,item.firstName,item.lastName,true,"")
}
})
binding.workermistakeRecyclerview.adapter = adapterworker
layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
binding.workermistakeRecyclerview.layoutManager = layoutManager
})
inventaryList.observe(viewLifecycleOwner, Observer {
if (hideLoad){
mistakeWorkerList.observe(viewLifecycleOwner,{
binding.splashProgress.visibility = View.GONE
}else{
hideLoad = true
}
listInvetory = ArrayList()
listInvetoryAux = ArrayList()
it.list.forEach {
if (it.nicho != "0"){
listInvetory.add(it)
listInvetoryAux.add(it)
}
}
adapter = InventoryAdapter(listInvetory,object: OnInvetoryNichoClickListener{
override fun onInvetoryNichoClickListener(item: ItemInventaryVO) {
//sergio: cambiado customdialogInput pòr customdialog 6.1.4
customDialog.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){
//customDialogInput.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){
viewModel.itemTrash(item.itemFk,getData(WAREHOUSEFK),getData(USER),getData(PASSWORD),item.nicho,"0","itemTrash")
//viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,"0","0")
// viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0")
changeOfflineValue(item)
// customDialogInput.dismiss()
customDialog.dismiss()
}.setKoButton("Cancelar"){
// customDialogInput.dismiss()
customDialog.dismiss()
}.show()
}
},onPasillerosItemClickListener = pasillerosItemClickListener!!)
binding.workermistakeRecyclerview.adapter = adapter
layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
binding.workermistakeRecyclerview.layoutManager = layoutManager
if (firstVisiblePosition <= listInvetory.size){
binding.workermistakeRecyclerview.layoutManager!!.scrollToPosition(firstVisiblePosition)
}
showMistakeList(it.list)
//goBack = false
})
responseAddMistake.observe(viewLifecycleOwner, {
response.observe(viewLifecycleOwner, Observer {
ma.messageWithSound(it.errorMessage,it.isError,true)
})
response.observe(viewLifecycleOwner, {
if (it.isError){
(activity as MainActivity).messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()*/
ma.messageWithSound(it.errorMessage,true,false)
}
})
}
}
private fun changeOfflineValue(item:ItemInventaryVO){
var i = 0
var position = 0
listInvetory.forEach {
if (it.itemFk == item.itemFk) {
position = i
}
i = i.plus(1)
}
listInvetory.removeAt(position)
i = 0
position = 0
listInvetoryAux.forEach {
if (it.itemFk == item.itemFk) {
position = i
private fun showMistakeList(list: List<MistakeWorkerType>) {
binding.splashProgress.visibility = View.GONE
listMistakes = ArrayList()
list.forEach {
listMistakes.add(BarcodeVO(code = it.description))
}
i = i.plus(1)
}
listInvetoryAux.removeAt(position)
adapter?.notifyDataSetChanged()
reload = true
customDialogList.setTitle("Causa de error para : ${workerMistakeName!!.firstName}").setKoButton("Cancelar") {
customDialogList.dismiss()
}.hideDialog().show()
listMistakesAdapter =
BarcodeAdapter(listMistakes, object : OnBarcodeRowClickListener {
override fun onBarcodeRowClickListener(item: BarcodeVO) {
list.forEach {
if (it.description == item.code) {
viewModel.workerMistake_Add(usuario = getData(USER),
password = getData(PASSWORD),
vUserFk = workerMistakeName!!.id,
vTypeFk = it.code, callFunction ="workerMistake_Add"
)
// "Causa del error registrado".toast(requireContext())
customDialogList.dismiss()
}
}
}
}, showDelete = false)
customDialogList.getRecyclerView().adapter = listMistakesAdapter
customDialogList.getRecyclerView().layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
}
//sergio:añadido para compradores
private fun createBuyerList(list: List<BuyerVO>){
items.clear()
list.forEach { buyer ->
if (!buyer.isError){
try {
items.add(SearchBuyerModel(buyer.nickname,buyer.userFk));
}catch (e:Exception){}
}
}}
private fun createDepartmentList(list: List<DepartmentMistake>){
departments.clear()
list.forEach { department ->
d("department"+department.name)
if (!department.isError){
try {
departments.add(SearchDepartmentModel(department.name,department.id));
departments.add(SearchDepartmentModel(department.name,department.id))
}catch (e:Exception){}
}
}}
private fun createWorkerList(list: List<WorkerFromMistake>){
departments.clear()
listWorker.clear()
list.forEach { worker ->
d("worker "+worker.firstName)
d("lastname "+worker.lastName)
if (!worker.isError){
try {
//departments.add(SearchDepartmentModel(department.name,department.id));
listWorker.add(worker)
}catch (e:Exception){}
}
}}
}
listWorkerAuxiliary.clear()
listWorkerAuxiliary.addAll(listWorker)
}
}

View File

@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.workermistake.model
class MistakeWorkerType (
var id: String = "",
var code:String = "",
var description: String = "",
var isError:Boolean = false,
var errorMessage:String = ""

View File

@ -0,0 +1,8 @@
<!-- drawable/playlist_remove.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#FFF" android:pathData="M2,6V8H14V6H2M2,10V12H11V10H2M14.17,10.76L12.76,12.17L15.59,15L12.76,17.83L14.17,19.24L17,16.41L19.83,19.24L21.24,17.83L18.41,15L21.24,12.17L19.83,10.76L17,13.59L14.17,10.76M2,14V16H11V14H2Z" />
</vector>

View File

@ -55,13 +55,6 @@
android:padding="10dp"
android:orientation="vertical">
<ImageView
android:id="@+id/itemcard_image"
android:layout_width="match_parent"
android:layout_height="@dimen/itemcard_image_height"
android:scaleType="centerCrop"
android:visibility="gone"
android:src="@drawable/loadphoto" />
<!-- TAGS ======================================================================================================= -->
<LinearLayout
android:layout_width="match_parent"
@ -69,302 +62,6 @@
android:orientation="horizontal"
android:padding="@dimen/layout_margin_min"
android:layout_marginBottom="@dimen/layout_margin_min">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
android:visibility="gone">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Ticket"
android:textColor="@color/verdnatura_brown_grey"
android:textSize="@dimen/body2"
android:textStyle="bold"
android:layout_marginEnd="@dimen/layout_margin_min"/>
<TextView
android:id="@+id/itemcard_tag1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" "
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cliente"
android:textColor="@color/verdnatura_brown_grey"
android:textSize="@dimen/body2"
android:textStyle="bold"
android:layout_marginEnd="@dimen/layout_margin_min"/>
<TextView
android:id="@+id/itemcard_tag2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" "
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ciudad"
android:textColor="@color/verdnatura_brown_grey"
android:textSize="@dimen/body2"
android:textStyle="bold"
android:layout_marginEnd="@dimen/layout_margin_min"/>
<TextView
android:id="@+id/itemcard_tag3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Provincia"
android:textColor="@color/verdnatura_brown_grey"
android:textSize="@dimen/body2"
android:textStyle="bold"
android:layout_marginEnd="@dimen/layout_margin_min"/>
<TextView
android:id="@+id/itemcard_tag4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2"
android:textStyle="bold"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Zona ticket"
android:textColor="@color/verdnatura_brown_grey"
android:textSize="@dimen/body2"
android:textStyle="bold"
android:layout_marginEnd="@dimen/layout_margin_min"/>
<TextView
android:id="@+id/itemcard_tag5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2"
android:textStyle="bold"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="zonaRuta"
android:textColor="@color/verdnatura_brown_grey"
android:textSize="@dimen/body2"
android:textStyle="bold"
android:layout_marginEnd="@dimen/layout_margin_min"/>
<TextView
android:id="@+id/itemcard_tag6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2"
android:textStyle="bold"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ruta"
android:textColor="@color/verdnatura_brown_grey"
android:textSize="@dimen/body2"
android:textStyle="bold"
android:layout_marginEnd="@dimen/layout_margin_min"/>
<TextView
android:id="@+id/itemcard_tag7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2"
android:textStyle="bold"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ubicacion"
android:textColor="@color/verdnatura_brown_grey"
android:textSize="@dimen/body2"
android:textStyle="bold"
android:layout_marginEnd="@dimen/layout_margin_min"/>
<TextView
android:id="@+id/itemcard_tag8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2"
android:textStyle="bold"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ETD"
android:textColor="@color/verdnatura_brown_grey"
android:textSize="@dimen/body2"
android:textStyle="bold"
android:layout_marginEnd="@dimen/layout_margin_min"/>
<TextView
android:id="@+id/itemcard_tag9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2"
android:textStyle="bold"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Camión"
android:textColor="@color/verdnatura_brown_grey"
android:textSize="@dimen/body2"
android:textStyle="bold"
android:layout_marginEnd="@dimen/layout_margin_min"/>
<TextView
android:id="@+id/itemcard_tag10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2"
android:textStyle="bold"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ticketsPendientes"
android:textColor="@color/verdnatura_brown_grey"
android:textSize="@dimen/body2"
android:textStyle="bold"
android:layout_marginEnd="@dimen/layout_margin_min"/>
<TextView
android:id="@+id/itemcard_tag11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2"
android:textStyle="bold"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="etiquetasTotales"
android:textColor="@color/verdnatura_brown_grey"
android:textSize="@dimen/body2"
android:textStyle="bold"
android:layout_marginEnd="@dimen/layout_margin_min"/>
<TextView
android:id="@+id/itemcard_tag12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2"
android:textStyle="bold"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="etiquetasEscaneadas"
android:textColor="@color/verdnatura_brown_grey"
android:textSize="@dimen/body2"
android:textStyle="bold"
android:layout_marginEnd="@dimen/layout_margin_min"/>
<TextView
android:id="@+id/itemcard_tag13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2"
android:textStyle="bold"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<!-- VALORES ================================================================================================== -->

View File

@ -33,10 +33,10 @@
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/filter_itemFk"
style="@style/InputLineTextSearch"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_weight="1.5"
android:backgroundTint="@android:color/white"
android:hint="@string/Filtro"
android:hint="Nombre o apellido"
android:inputType="text"
android:lines="1"
android:maxLines="1"
@ -45,14 +45,14 @@
android:textColorHint="@android:color/darker_gray" />
<TextView
android:id="@+id/filter_buyer"
android:id="@+id/filter_department"
style="@style/InputLineTextSearch"
android:layout_width="match_parent"
android:layout_weight="1"
android:backgroundTint="@android:color/white"
android:drawableEnd="@drawable/ic_arrow_drop_down_black_24dp"
android:focusable="false"
android:hint="@string/buscarcomprador"
android:hint="@string/buscarDepartamento"
android:inputType="text"
android:lines="1"
android:maxLines="1"
@ -79,7 +79,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_weight="1.25"
android:gravity="center"
android:text="Nombre"
android:textColor="@color/verdnatura_white"
@ -90,7 +90,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Apellido"
android:text="Apellidos"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" />

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
>
<data>
<variable
name="item"
type="es.verdnatura.presentation.common.GeneralItem" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/item_row_layout"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/verdnatura_black_5"
android:padding="@dimen/pasilleros_margin_main_menu">
<TextView
android:id="@+id/item_code"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@{item.code}"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/h7"
android:gravity="center_vertical"
android:layout_marginLeft="@dimen/pasilleros_margin_main_menu"
android:textStyle="bold"/>
<TextView
android:id="@+id/item_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@{item.text}"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/h7"
android:gravity="center_vertical"
android:layout_marginLeft="@dimen/pasilleros_margin_main_menu"
android:visibility="visible"
android:textStyle="bold"/>
<ImageView
android:layout_marginLeft="@dimen/default_layout_margin"
android:id="@+id/item_image"
android:layout_width="30dp"
android:layout_height="27dp"
android:scaleType="centerCrop"
android:src="@drawable/ic_delete_black_24dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/verdnatura_black_9"/>
</LinearLayout>
</layout>

View File

@ -45,33 +45,33 @@
<TextView
android:id="@+id/item_firstname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingRight="@dimen/pasilleros_margin_main_menu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left"
android:text="@{item.firstName}"
android:textColor="@color/verdnatura_pumpkin_orange"
android:textSize="@dimen/row"
android:textStyle="bold"
android:layout_weight="2"
tool:text="Sergio" />
<TextView
android:id="@+id/item_lastname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left"
android:text="@{item.lastName}"
android:textColor="@color/verdnatura_pumpkin_orange"
android:textSize="@dimen/row"
android:textStyle="bold"
android:layout_weight="1"
android:layout_marginLeft="5dp"
tool:text="de la Torre Nebot" />
<ImageView
android:id="@+id/imageErrorMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="end"
app:srcCompat="@drawable/emoticon_error" />

View File

@ -158,4 +158,5 @@
<string name="bufferfstrapping">Flejado buffer</string>
<string name="Split">Split</string>
<string name="workermistake">Fallo del trabajador</string>
<string name="buscarDepartamento">Buscar departamento</string>
</resources>

View File

@ -156,5 +156,6 @@
<string name="bufferfstrapping">Buffer strapping</string>
<string name="Split">Split</string>
<string name="workermistake">Worker mistaker</string>
<string name="buscarDepartamento">Find department</string>
</resources>