diff --git a/.idea/misc.xml b/.idea/misc.xml index acb8c240..c83f2b67 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -18,10 +18,12 @@ + + @@ -86,6 +88,7 @@ + @@ -106,6 +109,7 @@ + @@ -114,12 +118,14 @@ + + diff --git a/app/build.gradle b/app/build.gradle index 8444f4de..0a6b823e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,6 +1,6 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions'//deprecated:sergio +//apply plugin: 'kotlin-android-extensions'//deprecated:sergio apply plugin: 'kotlin-kapt' apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.firebase.crashlytics' @@ -14,8 +14,9 @@ android { applicationId "es.verdnatura" minSdkVersion 21 targetSdkVersion 29 - versionCode 83 - versionName "6.3" //VERSION CODE 83 Nueva funcionalidad Cargar expedición en buffer + versionCode 84 + versionName "6.4" //VERSION CODE 84. Modificados menus buffer y añadido hsitorico carro por items y por carro. + //versionName "6.3" //VERSION CODE 83 Nueva funcionalidad Cargar expedición en buffer //versionName "6.2.1" // VERSION CODE 82 Aparece mensaje de error completo en "Error al construir la colección". //versionName "6.2" //VERSION CODE 81, arreglado el null de grouping en ubicador. //versionName "6.1.9.1" //VERSION CODE 80, arreglado el null de grouping en ubicador. diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json index 7889bae7..c8f48aae 100644 --- a/app/release/output-metadata.json +++ b/app/release/output-metadata.json @@ -11,8 +11,8 @@ "type": "SINGLE", "filters": [], "attributes": [], - "versionCode": 83, - "versionName": "6.3", + "versionCode": 84, + "versionName": "6.4", "outputFile": "app-release.apk" } ], diff --git a/app/release/vn-picking-test.apk b/app/release/vn-picking-test.apk deleted file mode 100644 index 5460a034..00000000 Binary files a/app/release/vn-picking-test.apk and /dev/null differ diff --git a/app/release/vn-picking.apk b/app/release/vn-picking.apk new file mode 100644 index 00000000..aee49a5c Binary files /dev/null and b/app/release/vn-picking.apk differ diff --git a/app/src/main/java/es/verdnatura/di/viewModelModule.kt b/app/src/main/java/es/verdnatura/di/viewModelModule.kt index 5d737860..9014b205 100644 --- a/app/src/main/java/es/verdnatura/di/viewModelModule.kt +++ b/app/src/main/java/es/verdnatura/di/viewModelModule.kt @@ -4,7 +4,6 @@ import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesViewModel import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardViewModel import es.verdnatura.presentation.view.feature.buffer.fragment.BufferFragmentViewModel import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemViewModel -import es.verdnatura.presentation.view.feature.buscaritemall.fragment.BuscarItemAllViewModel import es.verdnatura.presentation.view.feature.calidad.fragment.BuyersViewModel import es.verdnatura.presentation.view.feature.calidad.fragment.QaualityViewModel import es.verdnatura.presentation.view.feature.collection.fragment.CollectionViewModel @@ -65,9 +64,6 @@ val viewModelModule = module { } // Pasilleros / Buscar Item 2 - viewModel { - BuscarItemAllViewModel(androidContext()) - } viewModel { PreControladorViewModel(androidContext()) diff --git a/app/src/main/java/es/verdnatura/domain/GetBuscarItemAllUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetBuscarItemAllUserCase.kt index 949c977c..fee32dc0 100644 --- a/app/src/main/java/es/verdnatura/domain/GetBuscarItemAllUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetBuscarItemAllUserCase.kt @@ -1,12 +1,12 @@ package es.verdnatura.domain import android.content.Context -import es.verdnatura.presentation.view.feature.buscaritemall.model.ItemLocationAll +//import es.verdnatura.presentation.view.feature.buscaritemall.model.ItemLocationAll import retrofit2.Call class GetBuscarItemAllUserCase(context: Context) : RestClient(context) { - fun searchItemsUbicadorAll( + /* fun searchItemsUbicadorAll( usuario: String, password: String, itemFk: String @@ -21,6 +21,6 @@ class GetBuscarItemAllUserCase(context: Context) : RestClient(context) { "application/json", params = params ) - } + }*/ } \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt index b835ce8e..e265d283 100644 --- a/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt @@ -88,13 +88,13 @@ class GetLoginUserCase(context: Context) : RestClient(context) //SALIX MENSAJE :SERGIO: PARA NO ENVIAR MENSAJES A COMERCIALES PONGO QUE LAS MODIFICACIONES SE ENVIAN AL CANAL CREADO. */ - fun sendChekingPresence(token:String,workerId:Int,message:String) : Call{ + fun sendChekingPresence(token:String,workerId:Int,message:String) : Call{ return salixClient!!.sendChekingPresence(content_type = "application/json", authorization = token, params = SalixMessageVO(workerId = workerId,message = message)) } // SERGIO: PARA DESARROLLO Y PRUEBAS SE DESCOMENTA ESTAS LÍNEAS Y SE COMENTAN LAS DE ARRIBA - /* fun sendChekingPresence(token: String, workerId: Int, message: String): Call + /* fun sendChekingPresence(token: String, workerId: Int, message: String): Call { return salixClient!!.sendGroup( content_type = "application/json", diff --git a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt index 831e3b9c..be46ebb3 100644 --- a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt +++ b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt @@ -6,7 +6,7 @@ import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType import es.verdnatura.presentation.view.feature.articulo.model.ItemProposal import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO -import es.verdnatura.presentation.view.feature.buscaritemall.model.ItemLocationAll +//import es.verdnatura.presentation.view.feature.buscaritemall.model.ItemLocationAll import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO import es.verdnatura.presentation.view.feature.calidad.model.ItemBuyerVO import es.verdnatura.presentation.view.feature.diadeventa.model.ItemShelvingSaleDate @@ -526,7 +526,7 @@ interface VerdnaturaService { Call> // BUSCAR ITEM ALL - @POST("almacennew/getItemUbication")//REVISADA +/* @POST("almacennew/getItemUbication")//REVISADA fun searchItemsUbicadorAll( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -535,7 +535,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call> + Call>*/ //INVENTARIO ========================================================================> diff --git a/app/src/main/java/es/verdnatura/presentation/base/BaseActivity.kt b/app/src/main/java/es/verdnatura/presentation/base/BaseActivity.kt index 12a46dfe..d7e281b3 100644 --- a/app/src/main/java/es/verdnatura/presentation/base/BaseActivity.kt +++ b/app/src/main/java/es/verdnatura/presentation/base/BaseActivity.kt @@ -40,5 +40,4 @@ abstract class BaseActivity : AppCompatActivity() { } - } \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogMainActivity.kt b/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogMainActivity.kt index 67dea32c..78af9e08 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogMainActivity.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogMainActivity.kt @@ -4,11 +4,17 @@ package es.verdnatura.presentation.view.component import android.app.Dialog import android.content.Context import android.view.View +import android.widget.TextView import es.verdnatura.R import es.verdnatura.databinding.ComponentCustomDialogBinding -import kotlinx.android.synthetic.main.component_custom_dialog.* + +//import kotlinx.android.synthetic.main.component_custom_dialog.* private lateinit var binding: ComponentCustomDialogBinding +private lateinit var custom_dialog_title: TextView +private lateinit var custom_dialog_description: TextView +private lateinit var custom_dialog_button_ok: TextView +private lateinit var custom_dialog_button_ko: TextView class CustomDialogMainActivity(context: Context) : Dialog(context, R.style.DialogTheme) { @@ -16,48 +22,52 @@ class CustomDialogMainActivity(context: Context) : Dialog(context, R.style.Dialo //sergio: de momento se deja el componentDialogMainActivity porque no acaba de funciona bien // con el viewbinding del customDialog - setContentView(R.layout.component_custom_dialog) + /* setContentView(R.layout.component_custom_dialog) - /* binding = ComponentCustomDialogBinding.inflate(layoutInflater) - setContentView(binding.root)*/ + custom_dialog_title = findViewById(R.id.custom_dialog_title) + custom_dialog_description = findViewById(R.id.custom_dialog_description) + custom_dialog_button_ok = findViewById(R.id.custom_dialog_button_ok) + custom_dialog_button_ko = findViewById(R.id.custom_dialog_button_ko)*/ + binding = ComponentCustomDialogBinding.inflate(layoutInflater) + setContentView(binding.root) } - fun setTitle(title: String): CustomDialogMainActivity { - custom_dialog_title.visibility = View.VISIBLE - custom_dialog_title.text = title - /* binding.customDialogTitle.visibility = View.VISIBLE - binding.customDialogTitle.text = title*/ + /* custom_dialog_title.visibility = View.VISIBLE + custom_dialog_title.text = title*/ + binding.customDialogTitle.visibility = View.VISIBLE + binding.customDialogTitle.text = title return this } fun setDescription(description: String): CustomDialogMainActivity { - custom_dialog_description.visibility = View.VISIBLE + /* custom_dialog_description.visibility = View.VISIBLE custom_dialog_description.text = description - /*binding.customDialogDescription.visibility = View.VISIBLE - binding.customDialogDescription.text = description*/ + */ + binding.customDialogDescription.visibility = View.VISIBLE + binding.customDialogDescription.text = description return this } fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogMainActivity { - custom_dialog_button_ok.visibility = View.VISIBLE - custom_dialog_button_ok.text = text - custom_dialog_button_ok.setOnClickListener { onButtonClicked() } - /* binding.customDialogButtonOk.visibility = View.VISIBLE - binding.customDialogButtonOk.text = text - binding.customDialogButtonOk.setOnClickListener { onButtonClicked() }*/ + /* custom_dialog_button_ok.visibility = View.VISIBLE + custom_dialog_button_ok.text = text + custom_dialog_button_ok.setOnClickListener { onButtonClicked() }*/ + binding.customDialogButtonOk.visibility = View.VISIBLE + binding.customDialogButtonOk.text = text + binding.customDialogButtonOk.setOnClickListener { onButtonClicked() } return this } fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogMainActivity { - custom_dialog_button_ko.visibility = View.VISIBLE - custom_dialog_button_ko.text = text - custom_dialog_button_ko.setOnClickListener { onButtonClicked() } - /* binding.customDialogButtonKo.visibility = View.VISIBLE - binding.customDialogButtonKo.text = text - binding.customDialogButtonKo.setOnClickListener { onButtonClicked() }*/ + /* custom_dialog_button_ko.visibility = View.VISIBLE + custom_dialog_button_ko.text = text + custom_dialog_button_ko.setOnClickListener { onButtonClicked() }*/ + binding.customDialogButtonKo.visibility = View.VISIBLE + binding.customDialogButtonKo.text = text + binding.customDialogButtonKo.setOnClickListener { onButtonClicked() } return this } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesFragment.kt index 6cc66518..0e1081ac 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesFragment.kt @@ -13,6 +13,7 @@ import android.os.Bundle import android.provider.Settings import android.view.KeyEvent import android.view.View +import androidx.appcompat.widget.TooltipCompat.setTooltipText import androidx.preference.PreferenceManager import androidx.recyclerview.widget.LinearLayoutManager import es.verdnatura.R @@ -27,7 +28,7 @@ import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO -import kotlinx.android.synthetic.main.activity_main.view.* +//import kotlinx.android.synthetic.main.activity_main.view.* //import kotlinx.android.synthetic.main.fragment_login.* @@ -345,7 +346,7 @@ class AjustesFragment : BaseFragment(Aj //androidid_text.performLongClick() //Log.i(TD,"se copia $string") //getString(R.string.copied).toast(requireContext()) - //setTooltipText(androidid_text, getString(R.string.copied)) + setTooltipText(binding.androididText, getString(R.string.copied)) return false } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt index bd982caf..fa8e6136 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt @@ -11,7 +11,9 @@ import android.app.AlertDialog import android.content.Intent import android.content.SharedPreferences import android.graphics.drawable.Drawable +import android.util.Log import android.view.View +import android.view.View.GONE import android.view.inputmethod.EditorInfo import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager @@ -143,13 +145,11 @@ class ItemCardFragment( false } - //backButton.setOnClickListener { binding.mainToolbar.backButton.setOnClickListener { requireActivity().onBackPressed() } - //itemcard_image.setOnClickListener { binding.itemcardImage.setOnClickListener{ val i = Intent(activity,ImageViewActivity::class.java) @@ -165,9 +165,12 @@ class ItemCardFragment( password = prefs.getString(PASSWORD,"").toString() warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString() this.itemFk = itemFk - binding.splashProgress.visibility = View.VISIBLE + + binding.splashProgressTwo.visibility = View.VISIBLE viewModel.getItemCard(itemFk,warehouseFk,user,password,"item_card") + binding.splashProgress.visibility = View.VISIBLE viewModel.getItemPackingType(user,password,"get_ItemPackingType") + } override fun observeViewModel() { @@ -175,7 +178,8 @@ class ItemCardFragment( itemcard.observe(viewLifecycleOwner, Observer { if (it.isError){ - binding.itemcardLayout.visibility = View.GONE + binding.itemcardLayout.visibility = GONE + binding.splashProgressTwo.visibility=GONE binding.mainToolbar.toolbarTitle.text = "ItemCard" customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ customDialog.dismiss() @@ -185,6 +189,7 @@ class ItemCardFragment( binding.itemcardLayout.visibility = View.VISIBLE setItemCard(it) }else{ + binding.splashProgressTwo.visibility=GONE binding.itemcardLayout.visibility = View.GONE binding.mainToolbar.toolbarTitle.text = "ItemCard" customDialog.setTitle("Sin resultados").setDescription("No hemos podido encontrar el articulo. Revisa el sector.").setOkButton("Cerrar"){ @@ -193,13 +198,11 @@ class ItemCardFragment( } } - //binding.splashProgress.visibility = View.GONE }) itemspackinglist.observe(viewLifecycleOwner, Observer { - binding.splashProgress.visibility = View.GONE - // //Log.i("VERDNATURA:","el code es $it.code") - // //Log.i("VERDNATURA:","la descrip es $it.description") + binding.splashProgress.visibility = GONE + createItemTypeTypeList(it.list) }) @@ -385,7 +388,7 @@ class ItemCardFragment( binding.scrollView.scrollTo(0, position[1]) } } - binding.splashProgress.visibility = View.GONE + binding.splashProgressTwo.visibility=GONE } private fun editItemCardRow(item:ItemCardRowVO,value:String){ diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemProposalFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemProposalFragment.kt index 0fb232df..b5dbe635 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemProposalFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemProposalFragment.kt @@ -3,20 +3,16 @@ package es.verdnatura.presentation.view.feature.articulo.fragment import android.content.Context import android.content.SharedPreferences import android.graphics.drawable.Drawable -import android.os.Build import android.os.Bundle -import android.util.Log import android.view.Gravity import android.view.View import android.widget.Toast -import androidx.annotation.RequiresApi -import androidx.appcompat.widget.TooltipCompat import androidx.core.content.ContextCompat -import androidx.core.content.res.ResourcesCompat.getColor import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import es.verdnatura.R import es.verdnatura.databinding.FragmentInventaryBinding +import es.verdnatura.databinding.FragmentItemproposalBinding import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.common.OnItemProposalClickListener import es.verdnatura.presentation.common.OnOptionsSelectedListener @@ -26,19 +22,17 @@ import es.verdnatura.presentation.view.component.CustomDialogInput import es.verdnatura.presentation.view.feature.articulo.adapter.ItemProposalAdapter import es.verdnatura.presentation.view.feature.articulo.model.ItemProposal import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter -import es.verdnatura.presentation.view.feature.inventario.fragment.SearchBuyerModel -import kotlinx.android.synthetic.main.activity_main.* +import es.verdnatura.presentation.view.feature.main.activity.MainActivity +/*import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.fragment_buscar_item.* -import kotlinx.android.synthetic.main.toolbar.* +import kotlinx.android.synthetic.main.toolbar.**/ import java.text.SimpleDateFormat -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter import java.util.* import kotlin.collections.ArrayList class ItemProposalFragment( var itemFk: String = "" -) : BaseFragment( +) : BaseFragment( ItemCardViewModel::class ) { @@ -106,9 +100,10 @@ class ItemProposalFragment( customDialogInput = CustomDialogInput(requireContext()) customDialog = CustomDialog(requireContext()) - requireActivity().main_bottom_navigation.visibility = View.GONE - splash_progress.visibility = View.VISIBLE - toolbar_title.text = getString(R.string.ArticleSimilar) + ":" + itemFk + //requireActivity().main_bottom_navigation.visibility = View.GONE + (activity as MainActivity).hideBottomNavigation(View.GONE) + binding.splashProgress.visibility = View.VISIBLE + binding.mainToolbar.toolbarTitle.text = getString(R.string.ArticleSimilar) + ":" + itemFk setToolBar() setEvents() @@ -125,10 +120,10 @@ class ItemProposalFragment( listIcons.add(iconFilter) - toolbar_icons.adapter = ToolBarAdapter(listIcons, object : OnOptionsSelectedListener { + binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons, object : OnOptionsSelectedListener { override fun onOptionsItemSelected(item: Drawable) { if (item == iconReload) { - splash_progress.visibility = View.VISIBLE + binding.splashProgress.visibility = View.VISIBLE firstVisiblePosition = layoutManager?.findFirstVisibleItemPosition() ?: 0 viewModel.item_getSimilar( itemFk, @@ -142,7 +137,7 @@ class ItemProposalFragment( } if (item == iconFilter) { - splash_progress.visibility = View.VISIBLE + binding.splashProgress.visibility = View.VISIBLE firstVisiblePosition = layoutManager?.findFirstVisibleItemPosition() ?: 0 @@ -179,7 +174,7 @@ class ItemProposalFragment( } }) - toolbar_icons.layoutManager = + binding.mainToolbar.toolbarIcons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) } @@ -194,7 +189,7 @@ class ItemProposalFragment( mytoast.show() } private fun setEvents() { - backButton.setOnClickListener { + binding.mainToolbar.backButton.setOnClickListener { requireActivity().onBackPressed() } @@ -207,9 +202,9 @@ class ItemProposalFragment( override fun onResume() { super.onResume() - if (location_recyclerview.layoutManager != null) { + if (binding.locationRecyclerview.layoutManager != null) { if (firstVisiblePosition <= listInvetory.size) { - location_recyclerview.layoutManager!!.scrollToPosition(firstVisiblePosition) + binding.locationRecyclerview.layoutManager!!.scrollToPosition(firstVisiblePosition) } } } @@ -219,7 +214,7 @@ class ItemProposalFragment( itemProposallist.observe(viewLifecycleOwner, Observer { if (hideLoad) { - splash_progress.visibility = View.GONE + binding.splashProgress.visibility = View.GONE } else { hideLoad = true } @@ -249,13 +244,13 @@ class ItemProposalFragment( } }, onPasillerosItemClickListener = pasillerosItemClickListener!!) - location_recyclerview.adapter = adapter + binding.locationRecyclerview.adapter = adapter layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) - location_recyclerview.layoutManager = layoutManager + binding.locationRecyclerview.layoutManager = layoutManager if (firstVisiblePosition <= listInvetory.size) { - location_recyclerview.layoutManager!!.scrollToPosition(firstVisiblePosition) + binding.locationRecyclerview.layoutManager!!.scrollToPosition(firstVisiblePosition) } }) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragment.kt index 04646df8..7da53dd2 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragment.kt @@ -78,7 +78,25 @@ class BufferFragment( if (! binding.scanInput.text.isNullOrEmpty()) { binding.splashProgress.visibility = View.VISIBLE - if (entryPoint.equals("Vaciado buffer")){ + + when (entryPoint){ + "Vaciado buffer"->entryPoint="UNLOADING" + "Llenado buffer"-> entryPoint="LOADING" + "Acumulación buffer"->entryPoint="ACCUMULATION" + "Desactivado buffer"->entryPoint="DISABLED" + "Flejado buffer"->entryPoint="STRAPPING" + } + + viewModel.buffer_setTypeByName( + user, + password, + binding.scanInput.text.toString(), + entryPoint, + "buffer_setTypeByName" + ) + + + /* if (entryPoint.equals("Vaciado buffer")){ viewModel.buffer_setTypeByName(user,password, binding.scanInput.text.toString(),"UNLOADING","buffer_setTypeByName") } if (entryPoint.equals("Llenado buffer")){ @@ -89,7 +107,8 @@ class BufferFragment( } if (entryPoint.equals("Desactivado buffer")){ viewModel.buffer_setTypeByName(user,password, binding.scanInput.text.toString(),"DISABLED","buffer_setTypeByName") - } + }*/ + } binding.scanInput.setText("") @@ -106,18 +125,14 @@ class BufferFragment( itembuffertype.observe(viewLifecycleOwner, Observer { binding.splashProgress.visibility = View.GONE if (it.isError) { - customDialog.setTitle("Error").setDescription(it.errorMessage) - .setOkButton("Aceptar") { - customDialog.dismiss() - }.show() - } else { - // customDialog.setTitle("Mensaje").setDescription(it.errorMessage) - customDialog.setTitle("Mensaje").setDescription("Operación "+entryPoint.lowercase() + " realizada correctamente") - .setOkButton("Aceptar") { - customDialog.dismiss() - binding.mainToolbar.backButton.performClick() - }.show() + (activity as MainActivity).messageWithSound( + it.errorMessage,false) + + } else { + + (activity as MainActivity).messageWithSound("Operación "+entryPoint.lowercase() + " buffer realizada correctamente",true) + binding.mainToolbar.backButton.performClick() } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragmentViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragmentViewModel.kt index 36ee9039..698d1216 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragmentViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragmentViewModel.kt @@ -58,7 +58,7 @@ class BufferFragmentViewModel(context: Context) : BaseViewModel() { //_bufferresponse.value = false _itembuffertype.value = ResponseItemVO( isError = true, - errorMessage = getMessageFromAllResponse(callFunction,response.message())) + errorMessage = getMessageFromAllResponse(callFunction,"Error al realizar la operación")) } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritemall/adapter/LocationAdapterAll.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritemall/adapter/LocationAdapterAll.kt deleted file mode 100644 index 0db9a888..00000000 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritemall/adapter/LocationAdapterAll.kt +++ /dev/null @@ -1,44 +0,0 @@ -package es.verdnatura.presentation.view.feature.buscaritemall.adapter - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.recyclerview.widget.RecyclerView -import es.verdnatura.databinding.ItemLocationAllRowBinding -import es.verdnatura.databinding.ItemLocationRowBinding -import es.verdnatura.presentation.common.OnPasillerosItemClickListener -import es.verdnatura.presentation.view.feature.buscaritemall.model.ItemLocationAll -import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO - -class LocationAdapterAll ( - private val items: List, - private val onPasillerosItemClickListener: OnPasillerosItemClickListener -): RecyclerView.Adapter () { - - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolderAll{ - return ItemHolderAll( - ItemLocationAllRowBinding.inflate(LayoutInflater.from(parent.context),parent,false) - ) - } - - override fun getItemCount() =items.size - - override fun onBindViewHolder(holder: ItemHolderAll, position: Int) { - holder.bind(items[position]) - holder.binding.root.setOnClickListener { - onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = "Ubicador"),items[position].Matricula) - } - - } - - class ItemHolderAll( - val binding: ItemLocationAllRowBinding - ) : RecyclerView.ViewHolder(binding.root){ - private val res = binding.root.context.resources - fun bind(item: ItemLocationAll) { - binding.apply { - this.item = item - } - } - } -} \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritemall/fragment/BuscarItemAllFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritemall/fragment/BuscarItemAllFragment.kt deleted file mode 100644 index 06816ab8..00000000 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritemall/fragment/BuscarItemAllFragment.kt +++ /dev/null @@ -1,143 +0,0 @@ -package es.verdnatura.presentation.view.feature.buscaritem.fragment - -import android.content.Context -import android.content.SharedPreferences -import android.util.Log -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.FragmentBuscarItemAllBinding -import es.verdnatura.domain.notNull -import es.verdnatura.presentation.base.BaseFragment -import es.verdnatura.presentation.common.OnPasillerosItemClickListener -import es.verdnatura.presentation.view.component.CustomDialog -import es.verdnatura.presentation.view.feature.buscaritemall.adapter.LocationAdapterAll -import es.verdnatura.presentation.view.feature.buscaritemall.fragment.BuscarItemAllViewModel -import es.verdnatura.presentation.view.feature.main.activity.MainActivity -import kotlinx.android.synthetic.main.activity_main.* -import kotlinx.android.synthetic.main.fragment_buscar_item.* -import kotlinx.android.synthetic.main.fragment_buscar_item.edit_itemFk -import kotlinx.android.synthetic.main.fragment_buscar_item.location_recyclerview -import kotlinx.android.synthetic.main.fragment_buscar_item.splash_progress -import kotlinx.android.synthetic.main.fragment_buscar_item_all.* -import kotlinx.android.synthetic.main.fragment_inventary.* -import kotlinx.android.synthetic.main.toolbar.* - -class BuscarItemAllFragment( - var itemFk:String = "" -) : BaseFragment(BuscarItemAllViewModel::class) { - - private var user = "" - private var password = "" - private var warehouseFk = "" - private var adapter : LocationAdapterAll? = null - private lateinit var customDialog: CustomDialog - private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null - - companion object { - fun newInstance(entryPoint:String) = BuscarItemAllFragment(entryPoint) - } - - override fun onAttach(context: Context) { - if (context is OnPasillerosItemClickListener) pasillerosItemClickListener = context - super.onAttach(context) - } - override fun getLayoutId(): Int = R.layout.fragment_buscar_item_all - - override fun init() { - requireActivity().main_bottom_navigation.visibility = View.GONE - toolbar_title.text = getString(R.string.getubicaition) - customDialog = CustomDialog(requireContext()) - setEvents() - if (!itemFk.isNullOrEmpty()){ - getLocations(itemFk) - } - super.init() - } - - - private fun setEvents(){ - edit_itemFk.requestFocus() - edit_itemFk.setOnEditorActionListener { v, actionId, event -> - if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { - if (!edit_itemFk.text.toString().isNullOrEmpty()) - getLocations(edit_itemFk.text.toString()) - edit_itemFk.setText("") - (activity as MainActivity).hideKeyboard(edit_itemFk) - return@setOnEditorActionListener true - } - false - } - - edit_itemFk.setOnKeyListener { v, keyCode, event -> - //Log.i("VERDNATURA:","text") - return@setOnKeyListener false} - /*if (filter_itemFk.text.toString().isNullOrEmpty()){ - if (listInvetory.size != listInvetoryAux.size){ - listInvetory.removeAll(listInvetoryAux) - listInvetoryAux.forEach { - listInvetory.add(it) - } - - } - - }else{ - listInvetory.removeAll(listInvetoryAux) - listInvetoryAux.forEach { - if ((it.itemFk.contains(filter_itemFk.text.toString(),true)) || (it.producer?.contains(filter_itemFk.text.toString(),true))){ - listInvetory.add(it) - } - } - - - } - LocationAdapterAll!!.notifyDataSetChanged() - return@setOnKeyListener false - }*/ - - - - - backButton.setOnClickListener { - requireActivity().onBackPressed() - } - - } - - private fun getLocations(itemFk:String){ - val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0) - user = prefs.getString(USER,"").toString() - password = prefs.getString(PASSWORD,"").toString() - warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString() - this.itemFk = itemFk - splash_progress.visibility = View.VISIBLE - viewModel.getLocationsAll(user,password,itemFk,"getItemUbication") - } - - override fun observeViewModel() { - with(viewModel){ - loadLocationListAll.observe(viewLifecycleOwner, Observer { event -> - - event.getContentIfNotHandled().notNull { - splash_progress.visibility = View.GONE - adapter = LocationAdapterAll(it.list,pasillerosItemClickListener!!) - - location_all_recyclerview.adapter = adapter - location_all_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) - - var totalVisible:Int = 0 - it.list.forEach { - if (!it.visible.isNullOrEmpty()) - totalVisible += it.visible.toInt() - } - toolbar_title.text = "Item: "+itemFk+ " Total visible: "+totalVisible - - - } - }) - } - } - -} diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritemall/fragment/BuscarItemAllViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritemall/fragment/BuscarItemAllViewModel.kt deleted file mode 100644 index b8984335..00000000 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritemall/fragment/BuscarItemAllViewModel.kt +++ /dev/null @@ -1,55 +0,0 @@ -package es.verdnatura.presentation.view.feature.buscaritemall.fragment - -import android.content.Context -import androidx.lifecycle.LiveData -import androidx.lifecycle.MutableLiveData -import androidx.lifecycle.Transformations -import es.verdnatura.domain.GetBuscarItemAllUserCase -import es.verdnatura.presentation.base.BaseViewModel -import es.verdnatura.presentation.base.getMessageError -import es.verdnatura.presentation.base.getMessageFromAllResponse -import es.verdnatura.presentation.common.Event -import es.verdnatura.presentation.view.feature.buscaritemall.model.ItemLocationAll -import es.verdnatura.presentation.view.feature.buscaritemall.model.LocationListAll - -import retrofit2.Call -import retrofit2.Callback -import retrofit2.Response - -class BuscarItemAllViewModel(context: Context) : BaseViewModel() { - private val getBuscarItemAllUserCase: GetBuscarItemAllUserCase = GetBuscarItemAllUserCase(context) - - - private val _locationListAll by lazy { MutableLiveData() } - val locationListAll: LiveData - get() = _locationListAll - - - val loadLocationListAll = Transformations.map(_locationListAll) { Event(it) } - - - fun getLocationsAll(user:String,password:String,itemFk:String,callFunction:String){ - getBuscarItemAllUserCase.searchItemsUbicadorAll(user,password,itemFk).enqueue(object : Callback> { - override fun onFailure(call: Call>, t: Throwable) { - val listError:ArrayList = ArrayList() - listError.add(ItemLocationAll(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!))) - _locationListAll.value = LocationListAll(listError) - } - - override fun onResponse( - call: Call>, - response: Response> - ) { - if (response.body() != null){ - _locationListAll.value = response.body()?.let { LocationListAll(it) } - }else{ - val listError:ArrayList = ArrayList() - listError.add(ItemLocationAll(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))) - _locationListAll.value = LocationListAll(listError) - } - } - - }) - } - -} diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritemall/model/ItemLocationAll.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritemall/model/ItemLocationAll.kt deleted file mode 100644 index 16698f65..00000000 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritemall/model/ItemLocationAll.kt +++ /dev/null @@ -1,18 +0,0 @@ -package es.verdnatura.presentation.view.feature.buscaritemall.model - - -class ItemLocationAll ( - var Parking:String = "", - var Matricula:String = "", - var visible:String = "", - var Disponible:String = "", - var level:String = "", - var created:String = "", - var itemFk:String = "", - val isError : Boolean = false, - var errorMessage : String = "" -) - -class LocationListAll ( - var list: List = listOf() -) \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityFragment.kt index e11df2f3..76a93fb1 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityFragment.kt @@ -16,12 +16,13 @@ import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.feature.calidad.adapter.ItemBuyersAdapter import es.verdnatura.presentation.view.feature.calidad.model.ItemBuyerVO import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter -import kotlinx.android.synthetic.main.activity_main.* +import es.verdnatura.presentation.view.feature.main.activity.MainActivity +/*import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.fragment_collection.* import kotlinx.android.synthetic.main.qauality_fragment.* -import kotlinx.android.synthetic.main.qauality_fragment.scan_input -import kotlinx.android.synthetic.main.qauality_fragment.splash_progress -import kotlinx.android.synthetic.main.toolbar.* +import kotlinx.android.synthetic.main.qauality_fragment. binding.scanInput +import kotlinx.android.synthetic.main.qauality_fragment.binding.splashProgress +import kotlinx.android.synthetic.main.toolbar.**/ import java.text.SimpleDateFormat import java.util.* import kotlin.collections.ArrayList @@ -67,9 +68,10 @@ class QaualityFragment( override fun init() { customDialog = CustomDialog(requireContext()) - requireActivity().main_bottom_navigation.visibility = View.GONE - splash_progress.visibility = View.VISIBLE - toolbar_title.text = "itemShelving_BuyerTask" + //requireActivity().main_bottom_navigation.visibility = View.GONE + (activity as MainActivity).hideBottomNavigation(View.GONE) + binding.splashProgress.visibility = View.VISIBLE + binding.mainToolbar.toolbarTitle.text = "itemShelving_BuyerTask" setToolBar() setEvents() super.init() @@ -85,31 +87,31 @@ class QaualityFragment( val listIcons:ArrayList = ArrayList() val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme()) listIcons.add(iconReload) - toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener { + binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener { override fun onOptionsItemSelected(item: Drawable) { if (item == iconReload){ - splash_progress.visibility = View.VISIBLE + binding.splashProgress.visibility = View.VISIBLE viewModel.itemShelvingBuyerTask(user = user,password = password,userFk = userFk,"itemShelving_BuyerTask") } } }) - toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) + binding.mainToolbar.toolbarIcons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) } private fun setEvents(){ - backButton.setOnClickListener { + binding.mainToolbar.backButton.setOnClickListener { requireActivity().onBackPressed() } //ESCANER ========= hideKeyboards() - scan_input.requestFocus() - scan_input.setOnEditorActionListener { v, actionId, event -> + binding.scanInput.requestFocus() + binding.scanInput.setOnEditorActionListener { v, actionId, event -> if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { - if (!scan_input.text.toString().isNullOrEmpty()){ - findSale(scan_input.text.toString()) + if (! binding.scanInput.text.toString().isNullOrEmpty()){ + findSale( binding.scanInput.text.toString()) } - scan_input.setText("") + binding.scanInput.setText("") hideKeyboards() return@setOnEditorActionListener true } @@ -126,7 +128,7 @@ class QaualityFragment( override fun observeViewModel() { with(viewModel) { buyersList.observe(viewLifecycleOwner, Observer { - splash_progress.visibility = View.GONE + binding.splashProgress.visibility = View.GONE createBuyerList(it.list) }) @@ -157,14 +159,14 @@ class QaualityFragment( listItems = list buyersAdapter = ItemBuyersAdapter(listItems,pasillerosItemClickListener!!,object: OnStarSelectedListener{ override fun onStarSelected(vId: String, vStars: String) { - splash_progress.visibility = View.VISIBLE + binding.splashProgress.visibility = View.VISIBLE viewModel.itemShelvingStarsUpdate(user,password,vId,vStars) } }) - shelving_buyers_items.adapter = buyersAdapter + binding.shelvingBuyersItems.adapter = buyersAdapter lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) - shelving_buyers_items.layoutManager = lm + binding.shelvingBuyersItems.layoutManager = lm if (storedPosition < listItems.size) goToPosition(storedPosition) @@ -201,8 +203,8 @@ class QaualityFragment( } private fun goToPosition(position:Int){ - if (shelving_buyers_items != null){ - shelving_buyers_items.addViewObserver { + if (binding.shelvingBuyersItems != null){ + binding.shelvingBuyersItems.addViewObserver { lm!!.scrollToPositionWithOffset(position,0) } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt index 11764a08..65cf48c7 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt @@ -8,6 +8,8 @@ import android.os.Bundle import android.speech.SpeechRecognizer import android.util.Log import android.view.View +import android.view.View.GONE +import android.view.View.VISIBLE import android.view.inputmethod.EditorInfo import android.view.inputmethod.InputMethodManager import android.widget.Toast @@ -41,6 +43,7 @@ import es.verdnatura.presentation.view.feature.sacador.model.* import kotlinx.android.synthetic.main.fragment_collection.* import kotlinx.android.synthetic.main.toolbar.**/ import timber.log.Timber +import timber.log.Timber.d class CollectionFragment( var collection: CollectionVO = CollectionVO(), @@ -75,6 +78,8 @@ class CollectionFragment( private var storedBackPosition: Int = 0 private var tickets: ArrayList = ArrayList() private var mistakeSale: SaleVO? = null + private var positionIncreaseQuantity=0 + private var quantityIncrease="" //private var myKM: KeyguardManager? = null @@ -142,9 +147,7 @@ class CollectionFragment( customDialogThreeButtons = CustomDialogThreeButtons(requireContext()) //requireActivity().main_bottom_navigation.visibility = View.GONE (activity as MainActivity).hideBottomNavigation(View.GONE) - if (binding.splashProgress != null) binding.splashProgress.visibility = View.VISIBLE - - + if (binding.splashProgress != null) binding.splashProgress.visibility = VISIBLE setEvents() @@ -176,12 +179,15 @@ class CollectionFragment( private fun setToolBar() { binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE + if (!collection.collectionFk.isNullOrEmpty()){ + binding.mainToolbar.toolbarTitle.text = collection.collectionFk + } val listIcons: ArrayList = ArrayList() val iconPrint: Drawable = resources.getDrawable(R.drawable.ic_print_black_24dp, resources.newTheme()) - val iconSearch: Drawable = - resources.getDrawable(R.drawable.ic_visibility, resources.newTheme()) + /*val iconSearch: Drawable = + resources.getDrawable(R.drawable.ic_visibility, resources.newTheme())*/ val iconAdd: Drawable = resources.getDrawable(R.drawable.ic_playlist_add_black_24dp, resources.newTheme()) val iconFace: Drawable = @@ -190,7 +196,6 @@ class CollectionFragment( listIcons.add(iconFace) listIcons.add(iconPrint) // listIcons.add(iconSearch) - listIcons.add(iconAdd) @@ -243,7 +248,7 @@ class CollectionFragment( binding.scanInput.setOnEditorActionListener { v, actionId, event -> if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {//ID=0 ACTION_NEXT ID=5 ACTION_UNESPECEFIED) if (!binding.scanInput.text.toString().isNullOrEmpty()) { - //////Log.i("VERDNATURA:","Pita o no pita si encuentra. Diferencia si es matricula o no") + d("La tecla es "+actionId) findSale(binding.scanInput.text.toString()) @@ -263,7 +268,7 @@ class CollectionFragment( binding.collectionSwipe.isRefreshing = false if (type != PRECHECKER) { - if (binding.splashProgress != null) binding.splashProgress.visibility = View.VISIBLE + if (binding.splashProgress != null) binding.splashProgress.visibility = VISIBLE viewModel.collectionTicketGet( user, password, @@ -285,9 +290,9 @@ class CollectionFragment( override fun observeViewModel() { with(viewModel) { - + binding.splashProgress.visibility=GONE collectionTicketList.observe(viewLifecycleOwner, Observer { - if (binding.splashProgress != null) binding.splashProgress.visibility = View.GONE + if (!it.isError) { if (it.tickets.isNotEmpty()) { collection = it @@ -386,11 +391,42 @@ class CollectionFragment( }) - responseIncQuantity.observe(viewLifecycleOwner, Observer { + responseMissingTrash.observe(viewLifecycleOwner, Observer { + + if (it.isError){ + customDialog.setTitle("Error").setDescription(it.errorMessage) + .setOkButton("Aceptar") { + customDialog.dismiss() + }.show() + }else + { + //incresaseSuccesful() + /*FALTA RELLENAR*/ + //TODO() + } //sergio:esto ya estaba /* binding.splashProgress.visibility = View.VISIBLE + viewModel.collectionTicketGet(user,password,collection.collectionFk,sectorFk)*/ + }) + + + responseIncQuantity.observe(viewLifecycleOwner, Observer { + + if (it.isError){ + customDialog.setTitle("Error").setDescription(it.errorMessage) + .setOkButton("Aceptar") { + customDialog.dismiss() + }.show() + }else + { + incresaseSuccesful() + } + //sergio:esto ya estaba + /* binding.splashProgress.visibility = View.VISIBLE viewModel.collectionTicketGet(user,password,collection.collectionFk,sectorFk)*/ }) + + mistakeList.observe(viewLifecycleOwner, Observer { if (binding.splashProgress != null) binding.splashProgress.visibility = View.GONE if (!goBack) showMistakeList(it.list) @@ -1460,53 +1496,78 @@ class CollectionFragment( // //Log.i("VERDNATURA:","Aparece CustomDialog") customDialogThreeButtons.setDescription(getString(R.string.txtnuevacantidad)).setValue("") .setOkButton(getString(R.string.Faltas)) { - if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) { + checkAndCall(position,customDialogThreeButtons.getValue(),getString(R.string.Faltas)) + /*if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) { getString(R.string.Indicanuevacantidad).toast(requireContext()) } else { trash(position, customDialogThreeButtons.getValue()) scanRequest() customDialogThreeButtons.dismiss() - } + }*/ }.setOkButtonTwo(getString(R.string.BasuraRechazar)) { - if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) { + + checkAndCall(position,customDialogThreeButtons.getValue(),getString(R.string.BasuraRechazar)) + /* if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) { getString(R.string.Indicanuevacantidad).toast(requireContext()) } else { missing(position, customDialogThreeButtons.getValue()) scanRequest() customDialogThreeButtons.dismiss() - } + }*/ }.setOkButtonThree(getString(R.string.Reject)) { - if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) { + checkAndCall(position,customDialogThreeButtons.getValue(),getString(R.string.Reject)) + /* if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) { getString(R.string.Indicanuevacantidad).toast(requireContext()) } else { reject(position, customDialogThreeButtons.getValue()) scanRequest() customDialogThreeButtons.dismiss() - } + }*/ + + }.setOkButtonFour(getString(R.string.Split)) { + checkAndCall(position,customDialogThreeButtons.getValue(),getString(R.string.Split)) + /*if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) { - }.setOkButtonFour("Split") { - if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) { getString(R.string.Indicanuevacantidad).toast(requireContext()) } else { split(position, customDialogThreeButtons.getValue()) scanRequest() customDialogThreeButtons.dismiss() - } + }*/ }.setOkButtonAdd(getString(R.string.Agregar)) { - if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) { + checkAndCall(position,customDialogThreeButtons.getValue(),getString(R.string.Agregar)) + /* if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) { getString(R.string.Indicanuevacantidad).toast(requireContext()) } else { increaseQuantity(position, customDialogThreeButtons.getValue()) scanRequest() customDialogThreeButtons.dismiss() - } + }*/ }.setKoButton("Cancelar") { scanRequest() customDialogThreeButtons.dismiss() }.show() } + private fun checkAndCall(position: Int, value: String, action: String) { + if (value.trim().isNullOrEmpty()) { + getString(R.string.Indicanuevacantidad).toast(requireContext()) + } else { + + when (action){ + getString(R.string.Agregar)->increaseQuantity(position, value) + getString(R.string.BasuraRechazar)-> missing(position, value) + getString(R.string.Faltas)->trash(position, value) + getString(R.string.Reject)->reject(position, value) + getString(R.string.Split)-> split(position, value) + + } + + scanRequest() + customDialogThreeButtons.dismiss() + } + } private fun split(position: Int, quantity: String) { var totalQuantity: Int = 0 try { @@ -1647,35 +1708,42 @@ class CollectionFragment( message = message,"sendChekingPresence" ) } - - private fun increaseQuantity(position: Int, quantity: String) { - viewModel.collectionIncreaseQuantity( - usuario = user, - password = password, - saleFk = sales[position].saleFk, - quantity = quantity,"collection_increaseQuantity" - ) + private fun incresaseSuccesful(){ try { //val quantityPicked = (quantity.toInt() - sales[position].quantity.toInt()).toString() //sales[position].originalQuantity = quantity - sales[position].quantity = quantity + sales[positionIncreaseQuantity].quantity = quantityIncrease /*if (type == CONTROLADOR){ showShelving(position,0,quantityPicked) }*/ } catch (e: Exception) { } saleAdapter?.notifyDataSetChanged() - //enviar mensaje a salix val ticket = - "[" + sales[position].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].ticketFk + "/summary)" + "[" + sales[positionIncreaseQuantity].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionIncreaseQuantity].ticketFk + "/summary)" val message = - "Se ha modificado la cantidad original " + sales[position].originalQuantity + " del artículo " + sales[position].itemFk + " a nueva cantidad: " + sales[position].quantity + " del ticket " + ticket + "Se ha modificado la cantidad original " + sales[positionIncreaseQuantity].originalQuantity + " del artículo " + sales[positionIncreaseQuantity].itemFk + " a nueva cantidad: " + sales[positionIncreaseQuantity].quantity + " del ticket " + ticket viewModel.sendChekingPresence( token = token, - workerId = sales[position].salePersonFk, + workerId = sales[positionIncreaseQuantity].salePersonFk, message = message,"sendChekingPresence" ) + + + } + private fun increaseQuantity(position: Int, quantity: String) { + positionIncreaseQuantity=position + quantityIncrease=quantity + + viewModel.collectionIncreaseQuantity( + usuario = user, + password = password, + saleFk = sales[position].saleFk, + quantity = quantity,"collection_increaseQuantity" + ) + + } //ESTADOS diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionViewModel.kt index bf80b259..7152af7d 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionViewModel.kt @@ -44,6 +44,10 @@ class CollectionViewModel(context: Context) : BaseViewModel() val responsecheckfully: LiveData get() = _responsecheckfully + private val _responseMissingTrash by lazy { MutableLiveData() } + val responseMissingTrash: LiveData + get() = _responseMissingTrash + private val _responseNew by lazy { MutableLiveData() } val responseNew: LiveData get() = _responseNew @@ -424,7 +428,7 @@ class CollectionViewModel(context: Context) : BaseViewModel() { override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO( + _responseMissingTrash.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse(callFunction,t.message!!) ) @@ -434,13 +438,13 @@ class CollectionViewModel(context: Context) : BaseViewModel() { if (response.body() == null) { - _response.value = ResponseItemVO( + _responseMissingTrash.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse(callFunction,response.message()) ) } else { - _response.value = ResponseItemVO(isError = false, response = response.body()!!) + _responseMissingTrash.value = ResponseItemVO(isError = false, response = response.body()!!) } } }) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/mapper/CollectionMapper.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/mapper/CollectionMapper.kt index 9af92753..17f13a23 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/mapper/CollectionMapper.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/mapper/CollectionMapper.kt @@ -6,30 +6,43 @@ import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO import java.text.SimpleDateFormat import java.util.* -fun CollectionVO.map() : CollectionVO{ +fun CollectionVO.map(): CollectionVO { try { - - this.tickets.forEach { - ticket -> ticket.sales.forEach { + this.tickets.forEach { ticket -> + ticket.sales.forEach { it.ticketFk = ticket.ticketFk it.level = ticket.level it.salePersonFk = ticket.salesPersonFk it.agencyName = ticket.agencyName - it.quantity = it.quantity.substring(0, it.quantity.indexOf(".")) - it.isNew = it.isAdded == "1" - // Log.d("VERDNATURA:","ORIGINAL QUANT"+it.originalQuantity) - it.originalQuantity = - if (it.originalQuantity != "-1") it.originalQuantity.substring( - 0, - it.originalQuantity.indexOf(".") - ) else it.quantity + it.isNew = it.isAdded == "1" + + // sergio: OBLIGAR A ACTUALIZAR VERSIÓN PARA SUBIR DESPUÉS FICHEROS DEL BACK collection_getTickets al mismo tiempo") + + //it.quantity = it.quantity.substring(0, it.quantity.indexOf(".")) + it.quantity = if (it.quantity.indexOf(".") > 0) { + it.quantity.substring(0, it.quantity.indexOf(".")) + } else { + it.quantity + } + + it.originalQuantity = (if (it.originalQuantity.indexOf(".") > 0) { + it.originalQuantity.substring(0, it.originalQuantity.indexOf(".")) + } else it.originalQuantity) + + if (it.originalQuantity.equals("-1")) it.originalQuantity = it.quantity + + /* it.originalQuantity = + if (it.originalQuantity != "-1") it.originalQuantity.substring( + 0, + it.originalQuantity.indexOf(".") + ) else it.quantity*/ + - // it.originalQuantity=it.originalQuantity.toInt().toString() it.pickedQuantity = if (it.isPrepared == "1" || it.isPreviousPrepared == "1" || it.isControlled == "1") it.quantity else it.pickedQuantity - if (!it.placements.isNullOrEmpty()) { + if (!it.placements.isNullOrEmpty()) { it.placements.forEachIndexed { index, placement -> if (index == 0) { try { @@ -40,7 +53,8 @@ fun CollectionVO.map() : CollectionVO{ } placement.created = getCalendarFromDate(placement.created).convertToDateString() - placement.visible = "(" + (if(placement.visible.toInt() > 0) placement.visible else "0") + ")" + placement.visible = + "(" + (if (placement.visible.toInt() > 0) placement.visible else "0") + ")" } } else { it.placements = listOf() @@ -48,20 +62,21 @@ fun CollectionVO.map() : CollectionVO{ } } - }catch (e:Exception){ + } catch (e: Exception) { this.isError = true - if (this.tickets == null || this.tickets.isEmpty()){ + if (this.tickets == null || this.tickets.isEmpty()) { this.errorMessage = "La colección no tiene tickets" - }else{ + } else { - this.errorMessage = "Error al construir la colección. Descripción del error:"+ e.message.toString() + this.errorMessage = + "Error al construir la colección. Descripción del error:" + e.message.toString() } } return this } -private fun getCalendarFromDate(date:String): Calendar { +private fun getCalendarFromDate(date: String): Calendar { val sdf = SimpleDateFormat("yyyy-MM-dd") val cal = Calendar.getInstance() cal.setTime(sdf.parse(date)) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/controlador/fragment/ControladorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/controlador/fragment/ControladorFragment.kt index 44f2169a..516ca5dc 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/controlador/fragment/ControladorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/controlador/fragment/ControladorFragment.kt @@ -14,6 +14,8 @@ import es.verdnatura.presentation.common.OnCollectionSelectedListener import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO +import timber.log.Timber.d +import timber.log.Timber.i /* import kotlinx.android.synthetic.main.activity_main.* @@ -79,7 +81,8 @@ class ControladorFragment : BaseFragment - if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { + if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { + d("Action id "+actionId) goBack=false if (!binding.scanInput.text.isNullOrEmpty()) { binding.splashProgress.visibility = View.VISIBLE diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoUsuarioFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoUsuarioFragment.kt index a8754398..39b46f7e 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoUsuarioFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoUsuarioFragment.kt @@ -5,12 +5,10 @@ import android.os.Bundle import android.view.View.* import androidx.lifecycle.Observer import es.verdnatura.R -import es.verdnatura.databinding.FragmentVehiclecontrolBinding import es.verdnatura.databinding.FragmentVehiclecontrolUserBinding import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.common.loadUrl import es.verdnatura.presentation.view.component.CustomDialog -import kotlinx.android.synthetic.main.fragment_vehiclecontrol_user.* /*import kotlinx.android.synthetic.main.fragment_controlador.splash_progress import kotlinx.android.synthetic.main.fragment_vehiclecontrol_user.* diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/fragment/DayOfSaleFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/fragment/DayOfSaleFragment.kt index 2547394d..24ce59a8 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/fragment/DayOfSaleFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/fragment/DayOfSaleFragment.kt @@ -2,8 +2,11 @@ package es.verdnatura.presentation.view.feature.diadeventa.fragment import android.content.SharedPreferences import android.graphics.drawable.Drawable +import android.view.Gravity import android.view.View import android.view.inputmethod.EditorInfo +import android.widget.Toast +import androidx.appcompat.widget.TooltipCompat import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import es.verdnatura.R @@ -67,6 +70,8 @@ class DayOfSaleFragment( listIcons.add(iconParking) + + binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons, object : OnOptionsSelectedListener { override fun onOptionsItemSelected(item: Drawable) { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/login/activity/LoginActivity.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/login/activity/LoginActivity.kt index cbc65c68..8d17a3e1 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/login/activity/LoginActivity.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/login/activity/LoginActivity.kt @@ -27,9 +27,7 @@ class LoginActivity : BaseActivity() { ViewGroup.LayoutParams.WRAP_CONTENT))*/ //goToMain() - - //goToMain() - addFragment(LoginFragment.newInstance(), R.id.main_frame_layout, LoginFragment.TAG) + addFragment(LoginFragment.newInstance(), R.id.main_frame_layout, LoginFragment.TAG) } fun goToMain() { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt index 8df74fc7..ebffa304 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt @@ -26,6 +26,7 @@ import es.verdnatura.presentation.view.feature.login.activity.LoginActivity import es.verdnatura.presentation.view.feature.login.model.LoginItemVO import es.verdnatura.presentation.view.feature.main.activity.MainActivity import java.lang.Boolean.TRUE +import kotlin.system.exitProcess class LoginFragment : BaseFragment(LoginViewModel::class) { @@ -44,18 +45,11 @@ class LoginFragment : BaseFragment(LoginVi checkUser() binding.buttonLogin.setOnClickListener(View.OnClickListener { binding.splashProgress.visibility = View.VISIBLE - // Log.i(TD,"el imei pasado al login es ${getANDROIDID()}") - /* viewModel.login( - binding.edittextUsername.text.toString(), - binding.edittextPassword.text.toString(), - getANDROIDID() - )*/ - - viewModel.device_checkLogin( + viewModel.device_checkLogin( binding.edittextUsername.text.toString(), binding.edittextPassword.text.toString(), - getANDROIDID(),callFunction = "device_checkLogin" - ) + getANDROIDID(), callFunction = "device_checkLogin" + ) }) @@ -68,12 +62,17 @@ class LoginFragment : BaseFragment(LoginVi - binding.edittextServer.setText(this.getDefaults("base_url", this.requireContext())) - binding.edittextServer.setOnKeyListener(View.OnKeyListener { v, keyCode, event -> + binding.edittextServer.setText(this.getDefaults("base_url", this.requireContext())) + binding.edittextServer.setOnKeyListener(View.OnKeyListener { v, keyCode, event -> if (keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_UP) { - this.setDefaults("base_url", binding.edittextServer.text.toString(), this.requireContext()) + this.setDefaults( + "base_url", + binding.edittextServer.text.toString(), + this.requireContext() + ) this.hideKeyboard() -//sergio: deberia lanzar la funcion nueva creada por mi restartapp de BaseFragment. Pero no vuelve a arrancar + //sergio: deberia lanzar la funcion nueva creada por mi restartapp de BaseFragment. Pero no vuelve a arrancar + exitProcess(0) restartapp() return@OnKeyListener false @@ -88,8 +87,8 @@ class LoginFragment : BaseFragment(LoginVi } //NODEJS TEST - // Log.i("VERDNATURA:","NODEJS in") - // viewModel.nodeJsTest("A0A3B8224DBF","ABC","1") + // Log.i("VERDNATURA:","NODEJS in") + // viewModel.nodeJsTest("A0A3B8224DBF","ABC","1") } @@ -124,16 +123,16 @@ class LoginFragment : BaseFragment(LoginVi with(viewModel) { versionappitem.observe(viewLifecycleOwner, Observer { - binding.splashProgress.visibility = View.INVISIBLE + if (it.isError) { + binding.splashProgress.visibility = View.INVISIBLE customDialog.setTitle("Error").setDescription(it.errorMessage) .setOkButton("Cerrar") { customDialog.dismiss() }.show() } else { - binding.splashProgress.visibility = View.VISIBLE + if (it.version.equals(getInfoVersionNameApp())) { - binding.splashProgress.visibility = View.INVISIBLE goToMain() } else { @@ -165,21 +164,20 @@ class LoginFragment : BaseFragment(LoginVi }) logindevice.observe(viewLifecycleOwner, Observer { - binding.splashProgress.visibility = View.INVISIBLE + if (it.isError) { + binding.splashProgress.visibility = View.INVISIBLE customDialog.setTitle("Error").setDescription(it.errorMessage) .setOkButton("Cerrar") { customDialog.dismiss() }.show() } else { - binding.splashProgress.visibility = View.VISIBLE if (it.vIsAuthorized.equals("0")) { - binding.splashProgress.visibility = View.INVISIBLE - // Log.i("VERDNATURA:",it.vMessage) customDialog.setTitle("Error").setDescription(it.vMessage!!) .setOkButton("Cerrar") { customDialog.dismiss() + binding.splashProgress.visibility = View.INVISIBLE // goToMain() }.show() @@ -195,10 +193,9 @@ class LoginFragment : BaseFragment(LoginVi binding.edittextPassword.text.toString(), "warehouse", getInfoVersionNameApp(), - getANDROIDID(),"deviceLog_add" + getANDROIDID(), "deviceLog_add" ) - binding.splashProgress.visibility = View.INVISIBLE //saveUserFkPref(it) if (binding.switchRemember.isChecked) { saveRemember(true) @@ -213,8 +210,7 @@ class LoginFragment : BaseFragment(LoginVi if (it.vIsAuthorized.equals("1") && it.vMessage.isNullOrEmpty()) { - // Log.i("VERDNATURA", "Sin mensaje") - binding.splashProgress.visibility = View.VISIBLE + loginSalix( user = binding.edittextUsername.text.toString(), password = binding.edittextPassword.text.toString(), @@ -223,14 +219,15 @@ class LoginFragment : BaseFragment(LoginVi } if (it.vIsAuthorized.equals("1") && !it.vMessage.isNullOrEmpty()) { - + binding.splashProgress.visibility = View.GONE customDialog.setTitle("Mensaje").setDescription(it.vMessage) .setOkButton("Cerrar") { customDialog.dismiss() binding.splashProgress.visibility = View.VISIBLE loginSalix( user = binding.edittextUsername.text.toString(), - password = binding.edittextPassword.text.toString(),"login de Salix" + password = binding.edittextPassword.text.toString(), + "login de Salix" ) }.show() @@ -245,17 +242,11 @@ class LoginFragment : BaseFragment(LoginVi workerId.observe(viewLifecycleOwner, Observer { - binding.splashProgress.visibility = View.INVISIBLE + if (!it.isError) { saveUserFkPref(it.Id.toString()) } - /* customDialog.setTitle("Error").setDescription(it.errorMessage) - .setOkButton("Cerrar") { - customDialog.dismiss() - }.show() - } else { - saveUserFkPref(it.Id.toString()) - }*/ + }) @@ -290,7 +281,7 @@ class LoginFragment : BaseFragment(LoginVi }) devicelogresponse.observe(viewLifecycleOwner, Observer { - binding.splashProgress.visibility = View.INVISIBLE + if (it.isError) { customDialog.setTitle("Error") .setDescription(it.errorMessage) @@ -300,13 +291,11 @@ class LoginFragment : BaseFragment(LoginVi customDialog.dismiss() getVersion() }.show() - } else { - } }) loginsalixitem.observe(viewLifecycleOwner, Observer { - binding.splashProgress.visibility = View.INVISIBLE + if (it.isError) { saveTokenPref("") customDialog.setTitle("Error") @@ -323,33 +312,30 @@ class LoginFragment : BaseFragment(LoginVi } }) - version.observe(viewLifecycleOwner, Observer { - binding.splashProgress.visibility = View.INVISIBLE - if (it) { - /* customDialog.setTitle("Atención").setDescription("La aplicación se encuentra en fase de desarrollo. Algunas funcionalidades están desactivadas y se van a ir añadiendo de forma progresiva.").setOkButton("Entrar"){ - goToMain() - customDialog.dismiss() - }.setKoButton("Cancelar"){ - customDialog.dismiss() - }.show()*/ - goToMain() + /* version.observe(viewLifecycleOwner, Observer { + binding.splashProgress.visibility = View.INVISIBLE + if (it) { + binding.constrainlayoutLogin.visibility=INVISIBLE + goToMain() + binding.splashProgress.visibility = View.INVISIBLE - } else { - customDialog.setTitle(getString(R.string.Actualizar)) - .setDescription(getString(R.string.updatemng)).setOkButton( - getString( - R.string.Actualizar - ) - ) { - val openURL = Intent(Intent.ACTION_VIEW) - openURL.data = Uri.parse("https://app.verdnatura.es/bin/vn-picking.apk") - startActivity(openURL) - }.setKoButton("Cancelar") { - customDialog.dismiss() - goToMain() - }.show() - } - }) + } else { + binding.splashProgress.visibility = View.INVISIBLE + customDialog.setTitle(getString(R.string.Actualizar)) + .setDescription(getString(R.string.updatemng)).setOkButton( + getString( + R.string.Actualizar + ) + ) { + val openURL = Intent(Intent.ACTION_VIEW) + openURL.data = Uri.parse("https://app.verdnatura.es/bin/vn-picking.apk") + startActivity(openURL) + }.setKoButton("Cancelar") { + customDialog.dismiss() + goToMain() + }.show() + } + })*/ } super.observeViewModel() } @@ -408,7 +394,7 @@ class LoginFragment : BaseFragment(LoginVi viewModel.checkVersion( user = binding.edittextUsername.text.toString(), password = binding.edittextPassword.text.toString(), - nameApp = "warehouse","getVersion" + nameApp = "warehouse", "getVersion" ) } @@ -437,7 +423,7 @@ class LoginFragment : BaseFragment(LoginVi ) val mgr = requireContext().getSystemService(Context.ALARM_SERVICE) as AlarmManager mgr[AlarmManager.RTC, System.currentTimeMillis() + 100] = mPendingIntent - System.exit(0) + exitProcess(0) } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt index 30e9e709..f0d942ba 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt @@ -30,9 +30,9 @@ class LoginViewModel(context: Context) : BaseViewModel() val loginsalixitem: LiveData get() = _loginsalixitem - private val _version by lazy { MutableLiveData() } + /* private val _version by lazy { MutableLiveData() } val version: LiveData - get() = _version + get() = _version*/ private val _devicelogresponse by lazy { MutableLiveData() } val devicelogresponse: LiveData @@ -165,10 +165,6 @@ class LoginViewModel(context: Context) : BaseViewModel() var loginDevice: LoginDevice? - /* Log.d("VERDNATIRA",response.message()) - Log.d("VERDNATIRA",response.errorBody().toString()) - Log.d("VERDNATIRA",response.toString()) - Log.d("VERDNATIRA",response.raw().toString())*/ if (!response.isSuccessful) { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt index c845278b..59f3fb2b 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt @@ -2,7 +2,9 @@ package es.verdnatura.presentation.view.feature.main.activity //import kotlinx.android.synthetic.main.activity_main.* import android.content.SharedPreferences +import android.media.MediaPlayer import android.view.Menu +import android.widget.Toast import androidx.core.content.ContextCompat import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentManager @@ -10,6 +12,7 @@ import es.verdnatura.BuildConfig import es.verdnatura.R import es.verdnatura.databinding.ActivityMainBinding import es.verdnatura.domain.ConstAndValues.MAINACTIVITY +import es.verdnatura.domain.toast import es.verdnatura.presentation.base.BaseActivity import es.verdnatura.presentation.common.* import es.verdnatura.presentation.view.component.CustomDialogMainActivity @@ -66,10 +69,15 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL var firstItem: ItemMenuVO? = null var fm = supportFragmentManager var TAG = "MainActivity" - + var mperror: MediaPlayer? = null + var mpok: MediaPlayer? = null override fun getLayoutId(): Int = R.layout.activity_main override fun init() { + + mperror = MediaPlayer.create((this),R.raw.error) + mpok = MediaPlayer.create((this),R.raw.ok) + customDialog = CustomDialogMainActivity(this) setBottomMenu() if (haveSector()) addFragment( @@ -393,21 +401,23 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL //Menu buffer "Vaciado buffer" -> { - addFragmentOnTop(BufferFragment.newInstance("Vaciado buffer")) + addFragmentOnTop(BufferFragment.newInstance(item.title)) } "Llenado buffer" -> { - addFragmentOnTop(BufferFragment.newInstance("Llenado buffer")) + addFragmentOnTop(BufferFragment.newInstance(item.title)) } "Acumulación buffer" -> { - addFragmentOnTop(BufferFragment.newInstance("Acumulación buffer")) + addFragmentOnTop(BufferFragment.newInstance(item.title)) } "Desactivado buffer" -> { - addFragmentOnTop(BufferFragment.newInstance("Desactivado buffer")) + addFragmentOnTop(BufferFragment.newInstance(item.title)) } "Cargar expedición en buffer"->{ addFragmentOnTop(BufferLoadFragment.newInstance("Cargar expedición en buffer")) } - + "Flejado buffer"->{ + addFragmentOnTop(BufferFragment.newInstance(item.title)) + } /*sergio:pruebas*/ "Pre Control" -> { addFragmentOnTop(PreControladorFragment.newInstance()) @@ -523,4 +533,22 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL binding.mainBottomNavigation.visibility = visible } + fun messageWithSound(message:String,isSuccess:Boolean){ + + if (isSuccess){ + mpok?.start() + } + else{ + mperror?.start() + message.toast(this, Toast.LENGTH_SHORT) + customDialog.setTitle("Error").setDescription(message) + .setOkButton("Aceptar") { + customDialog.dismiss() + }.show() + + + } + + + } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailFragment.kt index e74699d5..2934a744 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailFragment.kt @@ -1,10 +1,12 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment +/*import kotlinx.android.synthetic.main.activity_main.* +import kotlinx.android.synthetic.main.fragment_expedition_pallet_detail.* +import kotlinx.android.synthetic.main.toolbar.**/ import android.content.Context import android.content.SharedPreferences import android.graphics.drawable.Drawable import android.os.Bundle -import android.util.Log import android.view.View import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager @@ -23,9 +25,6 @@ import es.verdnatura.presentation.view.feature.paletizador.adapter.ExpeditionPal import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletViewListVO -import kotlinx.android.synthetic.main.activity_main.* -import kotlinx.android.synthetic.main.fragment_expedition_pallet_detail.* -import kotlinx.android.synthetic.main.toolbar.* import java.text.SimpleDateFormat import java.util.* import kotlin.collections.ArrayList @@ -75,10 +74,12 @@ class ExpeditionPalletDetailFragment( override fun init() { customDialog = CustomDialog(requireContext()) customDialogList = CustomDialogList(requireContext()) - expedition_pallet_detail_pallet.text = "Pallet "+itemPallet!!.Pallet - splash_progress.visibility = View.VISIBLE - requireActivity().main_bottom_navigation.visibility = View.GONE - toolbar_title.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino + binding.expeditionPalletDetailPallet.text = "Pallet "+itemPallet!!.Pallet + binding.splashProgress.visibility = View.VISIBLE + //requireActivity().main_bottom_navigation.visibility = View.GONE + (activity as MainActivity).hideBottomNavigation(View.GONE) + binding.mainToolbar.toolbarTitle.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino + setToolBar() setEvents() viewModel.expeditionPallet_List(user,password,itemPallet!!.Pallet,"expeditionPallet_View") @@ -86,11 +87,11 @@ class ExpeditionPalletDetailFragment( } private fun setEvents(){ - backButton.setOnClickListener { + binding.mainToolbar.backButton.setOnClickListener { requireActivity().onBackPressed() } - button_ok.setOnClickListener { + binding.buttonOk.setOnClickListener { requireActivity().onBackPressed() // sergio: en caso de que hay problemas habrá que cambiar aquí la llamada // MainActivity.addFragmentOnTop(ExpeditionPalletDetailFragment.newInstance(itemTruck,itemPallet)) @@ -109,18 +110,18 @@ class ExpeditionPalletDetailFragment( listIcons.add(iconEditar) listIcons.add(iconBorrar) listIcons.add(iconPrint) - toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener { + binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener { override fun onOptionsItemSelected(item: Drawable) { if (item == iconReload){ - splash_progress.visibility = View.VISIBLE + binding.splashProgress.visibility = View.VISIBLE viewModel.expeditionPallet_List(user,password,itemPallet!!.Pallet,"expeditionPallet_View") }else if(item == iconEditar){ onPalletClickListener!!.onPalletClickListener(itemExpeditionTruckVO!!,itemPallet!!) }else if(item == iconBorrar){ - splash_progress.visibility = View.VISIBLE + binding.splashProgress.visibility = View.VISIBLE viewModel.expeditionPalletDel(user,password,itemPallet!!.Pallet,"expeditionPallet_Del") }else if(item == iconPrint){ - splash_progress.visibility = View.VISIBLE + binding.splashProgress.visibility = View.VISIBLE (getString(R.string.Imprimiendo)+" por " +SectorDescription).toast(requireContext()) viewModel.expeditionPalletPrintSet(user,password,itemPallet!!.Pallet,sectorFk,"expeditionPallet_PrintSet") @@ -128,7 +129,7 @@ class ExpeditionPalletDetailFragment( } } }) - toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) + binding.mainToolbar.toolbarIcons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) } private fun getCURDATE(date:String):String{ @@ -158,11 +159,11 @@ class ExpeditionPalletDetailFragment( } private fun printExpeditionList(it: ItemPalletViewListVO){ - splash_progress.visibility = View.GONE + binding.splashProgress.visibility = View.GONE val lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) adapter = ExpeditionPalletViewAdapter(it.list) - expedition_pallet_recyclerview.adapter = adapter - expedition_pallet_recyclerview.layoutManager = lm + binding.expeditionPalletRecyclerview.adapter = adapter + binding.expeditionPalletRecyclerview.layoutManager = lm } } \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletFragment.kt index dfe6d1c5..be6e181e 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletFragment.kt @@ -1,11 +1,13 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment +/*import kotlinx.android.synthetic.main.activity_main.* +import kotlinx.android.synthetic.main.fragment_expedition_pallet.* +import kotlinx.android.synthetic.main.toolbar.**/ import android.content.Context import android.content.SharedPreferences import android.graphics.drawable.Drawable import android.media.MediaPlayer import android.os.Bundle -import android.util.Log import android.view.View import android.view.inputmethod.EditorInfo import androidx.lifecycle.Observer @@ -29,9 +31,6 @@ import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionT import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletListVO import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanList -import kotlinx.android.synthetic.main.activity_main.* -import kotlinx.android.synthetic.main.fragment_expedition_pallet.* -import kotlinx.android.synthetic.main.toolbar.* import java.text.SimpleDateFormat import java.util.* import kotlin.collections.ArrayList @@ -83,9 +82,10 @@ class ExpeditionPalletFragment( override fun init() { customDialog = CustomDialog(requireContext()) customDialogList = CustomDialogList(requireContext()) - splash_progress.visibility = View.VISIBLE - requireActivity().main_bottom_navigation.visibility = View.GONE - toolbar_title.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino + binding.splashProgress.visibility = View.VISIBLE + //requireActivity().main_bottom_navigation.visibility = View.GONE + (activity as MainActivity).hideBottomNavigation(View.GONE) + binding.mainToolbar.toolbarTitle.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino setToolBar() setEvents() viewModel.expeditionPallet_List(user,password,itemExpeditionTruckVO!!.truckFk,"expeditionPallet_List") @@ -94,7 +94,7 @@ class ExpeditionPalletFragment( } private fun setEvents(){ - backButton.setOnClickListener { + binding.mainToolbar.backButton.setOnClickListener { requireActivity().onBackPressed() } @@ -106,17 +106,17 @@ class ExpeditionPalletFragment( val iconPlus : Drawable = resources.getDrawable(R.drawable.ic_add_black_24dp,resources.newTheme()) listIcons.add(iconReload) listIcons.add(iconPlus) - toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener { + binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener { override fun onOptionsItemSelected(item: Drawable) { if (item == iconReload){ - splash_progress.visibility = View.VISIBLE + binding.splashProgress.visibility = View.VISIBLE viewModel.expeditionPallet_List(user,password,itemExpeditionTruckVO!!.truckFk,"expeditionPallet_List") }else if(item == iconPlus){ expeditionScanAdd() } } }) - toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) + binding.mainToolbar.toolbarIcons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) } private fun getCURDATE(date:String):String{ @@ -172,23 +172,23 @@ class ExpeditionPalletFragment( } private fun printExpeditionList(it: ItemPalletListVO){ - splash_progress.visibility = View.GONE + binding.splashProgress.visibility = View.GONE val lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) adapter = ExpeditionPalletAdapter(it.list,onPalletClickListener!!,onComprobarPalletViewClickListener!!,itemExpeditionTruckVO!!) - expedition_pallet_recyclerview.adapter = adapter - expedition_pallet_recyclerview.layoutManager = lm + binding.expeditionPalletRecyclerview.adapter = adapter + binding.expeditionPalletRecyclerview.layoutManager = lm } private fun expeditionScanAdd(){ - splash_progress.visibility = View.VISIBLE + binding.splashProgress.visibility = View.VISIBLE viewModel.expeditionScanAdd(usuario = user,password = password,vPalletFk = "0",vTruckFk = itemExpeditionTruckVO!!.truckFk,"expeditionScan_Add") } private fun showScanExpeditions(it:ItemScanList){ //Log.i("VERDNATURA:","VA A ESCANEAR EN PALLETFRAGMENT") - splash_progress.visibility = View.GONE + binding.splashProgress.visibility = View.GONE listExpeditions = ArrayList() @@ -197,7 +197,7 @@ class ExpeditionPalletFragment( listExpeditions.add(BarcodeVO(code = it.expeditionFk)) } - customDialogList.setTitle("Expedition ("+toolbar_title.text+")").setOkButton("Comprobar"){ + customDialogList.setTitle("Expedition ("+binding.mainToolbar.toolbarTitle.text+")").setOkButton("Comprobar"){ (activity as MainActivity).hideKeyboard(customDialogList.getEditText()) @@ -215,7 +215,7 @@ class ExpeditionPalletFragment( }.setKoButton("Cerrar"){ (activity as MainActivity).hideKeyboard(customDialogList.getEditText()) - splash_progress.visibility = View.VISIBLE + binding.splashProgress.visibility = View.VISIBLE viewModel.expeditionPallet_List(user,password,itemExpeditionTruckVO!!.truckFk,"expeditionPallet_List") listExpeditions = ArrayList() customDialogList.dismiss() diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanFragment.kt index cb86e322..0b0ebcc6 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanFragment.kt @@ -1,12 +1,13 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment -import android.app.Activity +/*import kotlinx.android.synthetic.main.activity_main.* +import kotlinx.android.synthetic.main.fragment_expedition_scan.* +import kotlinx.android.synthetic.main.toolbar.**/ import android.content.Context import android.content.SharedPreferences import android.graphics.drawable.Drawable import android.media.MediaPlayer import android.os.Bundle -import android.util.Log import android.view.View import android.view.inputmethod.EditorInfo import androidx.lifecycle.Observer @@ -14,7 +15,6 @@ import androidx.recyclerview.widget.LinearLayoutManager import es.verdnatura.R import es.verdnatura.databinding.FragmentExpeditionScanBinding import es.verdnatura.domain.notNull -import es.verdnatura.domain.toast import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.common.* import es.verdnatura.presentation.view.component.CustomDialog @@ -26,9 +26,6 @@ import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.paletizador.adapter.ExpeditionScanAdapter import es.verdnatura.presentation.view.feature.paletizador.model.* -import kotlinx.android.synthetic.main.activity_main.* -import kotlinx.android.synthetic.main.fragment_expedition_scan.* -import kotlinx.android.synthetic.main.toolbar.* import java.text.SimpleDateFormat import java.util.* import kotlin.collections.ArrayList @@ -82,10 +79,12 @@ class ExpeditionScanFragment ( customDialog = CustomDialog(requireContext()) customDialogList = CustomDialogList(requireContext()) customDialogTwoButtons = CustomDialogTwoButtons(requireContext()) - expedition_scan_detail_pallet.text = "Pallet "+itemPalletVO!!.Pallet - splash_progress.visibility = View.VISIBLE - requireActivity().main_bottom_navigation.visibility = View.GONE - toolbar_title.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino + binding.expeditionScanDetailPallet.text = "Pallet "+itemPalletVO!!.Pallet + binding.splashProgress.visibility = View.VISIBLE + //requireActivity().main_bottom_navigation.visibility = View.GONE + (activity as MainActivity).hideBottomNavigation(View.GONE) + binding.mainToolbar.toolbarTitle.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino + setToolBar() setEvents() viewModel.expeditionScanList(user,password,itemPalletVO!!.Pallet) @@ -93,7 +92,7 @@ class ExpeditionScanFragment ( } private fun setEvents(){ - backButton.setOnClickListener { + binding.mainToolbar.backButton.setOnClickListener { requireActivity().onBackPressed() } @@ -105,10 +104,10 @@ class ExpeditionScanFragment ( val iconPlus : Drawable = resources.getDrawable(R.drawable.ic_add_black_24dp,resources.newTheme()) listIcons.add(iconReload) listIcons.add(iconPlus) - toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener { + binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener { override fun onOptionsItemSelected(item: Drawable) { if (item == iconReload){ - splash_progress.visibility = View.VISIBLE + binding.splashProgress.visibility = View.VISIBLE viewModel.expeditionScanList(user,password,itemPalletVO!!.Pallet) }else if(item == iconPlus){ //Log.i("VERDNATURA:","ENTRAMOS A SCAN ADD") @@ -117,7 +116,7 @@ class ExpeditionScanFragment ( } } }) - toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) + binding.mainToolbar.toolbarIcons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) } private fun getCURDATE(date:String):String{ @@ -184,14 +183,14 @@ class ExpeditionScanFragment ( private fun printExpeditionList(it: ItemExpeditionScanList){ - splash_progress.visibility = View.GONE + binding.splashProgress.visibility = View.GONE val lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) adapter = ExpeditionScanAdapter(it.list,object: OnScanLongClickListener{ override fun onScanLongClickListener(itemExpeditionScanVO: ItemExpeditionScanVO) { customDialogTwoButtons.setTitle("Ticket: "+itemExpeditionScanVO.Ticket+" Pallet: "+itemPalletVO!!.Pallet) .setDescription("Expedition: "+itemExpeditionScanVO!!.expeditionFk) .setOkButton("Borrar"){ - splash_progress.visibility = View.VISIBLE + binding.splashProgress.visibility = View.VISIBLE viewModel.expeditionScanDel(user,password,itemExpeditionScanVO.id) customDialogTwoButtons.dismiss() }.setKoButton("Cancelar"){ @@ -200,14 +199,14 @@ class ExpeditionScanFragment ( } }) - expedition_pallet_recyclerview.adapter = adapter - expedition_pallet_recyclerview.layoutManager = lm + binding.expeditionPalletRecyclerview.adapter = adapter + binding.expeditionPalletRecyclerview.layoutManager = lm } private fun expeditionScanAdd(){ - splash_progress.visibility = View.VISIBLE + binding.splashProgress.visibility = View.VISIBLE viewModel.expeditionScanAdd(usuario = user,password = password,vPalletFk = itemPalletVO!!.Pallet,vTruckFk = itemExpeditionTruckVO!!.truckFk) //Log.i("VERDNATURA:","entramos a escanear ticket del pallet") @@ -217,13 +216,13 @@ class ExpeditionScanFragment ( //sergio para smarttags: // Log.i("VERDNATURA:","muestra expediciones y a escanear") listExpeditions = ArrayList() - splash_progress.visibility = View.GONE + 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+" ("+toolbar_title.text+")").setOkButton("Comprobar"){ + customDialogList.setTitle("Pallet"+itemPalletVO!!.Pallet+" ("+binding.mainToolbar.toolbarTitle.text+")").setOkButton("Comprobar"){ //Log.i("VERDNATURA:","Añadida etiqueta") (activity as MainActivity).hideKeyboard(customDialogList.getEditText()) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanSorterFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanSorterFragment.kt index 086b3976..e00925d5 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanSorterFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanSorterFragment.kt @@ -2,6 +2,7 @@ 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 @@ -15,16 +16,16 @@ 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 -import kotlinx.android.synthetic.main.activity_main.* +/*import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.component_custom_three_dialog.* import kotlinx.android.synthetic.main.fragment_collection.* import kotlinx.android.synthetic.main.fragment_controlador.* -import kotlinx.android.synthetic.main.fragment_controlador.splash_progress +import kotlinx.android.synthetic.main.fragment_controlador.binding.splashProgress import kotlinx.android.synthetic.main.fragment_expedition_scan.* import kotlinx.android.synthetic.main.fragment_login.* import kotlinx.android.synthetic.main.fragment_sacador.* import kotlinx.android.synthetic.main.fragment_sacador_associatesmarttag.* -import kotlinx.android.synthetic.main.toolbar.* +import kotlinx.android.synthetic.main.toolbar.**/ class ExpeditionScanSorterFragment( var entryPoint: String = "" @@ -52,8 +53,9 @@ class ExpeditionScanSorterFragment( customDialogList = CustomDialogList(requireContext()) goBack = false - requireActivity().main_bottom_navigation.visibility = GONE - splash_progress.visibility = GONE + //requireActivity().main_bottom_navigation.visibility = GONE + (activity as MainActivity).hideBottomNavigation(View.GONE) + binding.splashProgress.visibility = GONE setEvents() setToolBar() @@ -68,13 +70,13 @@ class ExpeditionScanSorterFragment( private fun setToolBar() { - toolbar_title.text = entryPoint + binding.mainToolbar.toolbarTitle.text = entryPoint } private fun expeditionscan(ExpeditionScan: String) { - splash_progress.visibility = VISIBLE + binding.splashProgress.visibility = VISIBLE viewModel.expedition_scan(user, password, ExpeditionScan,"expedition_scan") itemScaned = ExpeditionScan @@ -90,7 +92,7 @@ class ExpeditionScanSorterFragment( private fun setEvents() { - backButton.setOnClickListener { + binding.mainToolbar.backButton.setOnClickListener { requireActivity().onBackPressed() } @@ -101,7 +103,7 @@ class ExpeditionScanSorterFragment( override fun observeViewModel() { with(viewModel) { - splash_progress.visibility = GONE + binding.splashProgress.visibility = GONE responsescan.observe(viewLifecycleOwner, Observer { if (it.isError) { @@ -118,7 +120,7 @@ class ExpeditionScanSorterFragment( customDialogList.setValue("") } - splash_progress.visibility = GONE + binding.splashProgress.visibility = GONE }) } @@ -138,7 +140,7 @@ class ExpeditionScanSorterFragment( } else {*/ customDialogList.dismiss() - backButton.performClick() + binding.mainToolbar.backButton.performClick() // } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionStateFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionStateFragment.kt index 54a9fd2c..128d65ef 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionStateFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionStateFragment.kt @@ -1,6 +1,15 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment +/*import kotlinx.android.synthetic.main.activity_main.* +import kotlinx.android.synthetic.main.buyers_fragment.* +import kotlinx.android.synthetic.main.fragment_item_card.* +import kotlinx.android.synthetic.main.fragment_item_card.binding.editItemFk +import kotlinx.android.synthetic.main.fragment_item_card.binding.itemcardImage +import kotlinx.android.synthetic.main.fragment_item_card. binding.itemcardLayout +import kotlinx.android.synthetic.main.fragment_item_card.binding.splashProgress +import kotlinx.android.synthetic.main.fragment_itemexpeditionstate_card.* +import kotlinx.android.synthetic.main.toolbar.**/ import android.content.Intent import android.content.SharedPreferences import android.view.View @@ -17,16 +26,6 @@ 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 -import kotlinx.android.synthetic.main.activity_main.* -import kotlinx.android.synthetic.main.buyers_fragment.* -import kotlinx.android.synthetic.main.fragment_item_card.* -import kotlinx.android.synthetic.main.fragment_item_card.edit_itemFk -import kotlinx.android.synthetic.main.fragment_item_card.itemcard_image -import kotlinx.android.synthetic.main.fragment_item_card.itemcard_layout -import kotlinx.android.synthetic.main.fragment_item_card.splash_progress -import kotlinx.android.synthetic.main.fragment_itemexpeditionstate_card.* -import kotlinx.android.synthetic.main.toolbar.* -import timber.log.Timber.i class ExpeditionStateFragment( var entryPoint: String = "" @@ -50,7 +49,7 @@ class ExpeditionStateFragment( override fun getLayoutId(): Int = R.layout.fragment_itemexpeditionstate_card override fun init() { - itemcard_layout.visibility = View.GONE + binding.itemcardLayout.visibility = View.GONE customDialog = CustomDialog(requireContext()) setEvents() @@ -60,30 +59,30 @@ class ExpeditionStateFragment( private fun setToolBar(title: String) { - toolbar_title.text = title + binding.mainToolbar.toolbarTitle.text = title } private fun setEvents() { - edit_itemFk.requestFocus() - edit_itemFk.setOnEditorActionListener { v, actionId, event -> + 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 (!edit_itemFk.text.toString().isNullOrEmpty()) { - getExpedtionState(edit_itemFk.text.toString()) - itemScan = edit_itemFk.text.toString() + if (!binding.editItemFk.text.toString().isNullOrEmpty()) { + getExpedtionState(binding.editItemFk.text.toString()) + itemScan = binding.editItemFk.text.toString() } - edit_itemFk.setText("") - (activity as MainActivity).hideKeyboard(edit_itemFk) + binding.editItemFk.setText("") + (activity as MainActivity).hideKeyboard(binding.editItemFk) return@setOnEditorActionListener true } false } - backButton.setOnClickListener { + binding.mainToolbar.backButton.setOnClickListener { requireActivity().onBackPressed() } - itemcard_image.setOnClickListener { + binding.itemcardImage.setOnClickListener { val i: Intent = Intent(activity, ImageViewActivity::class.java) i.putExtra("url", urlLarge) i.putExtra("title", titleImage) @@ -98,7 +97,7 @@ class ExpeditionStateFragment( password = prefs.getString(PASSWORD, "").toString() warehouseFk = prefs.getInt(WAREHOUSEFK, 1).toString() // this.itemFk = itemFk - splash_progress.visibility = View.VISIBLE + binding.splashProgress.visibility = View.VISIBLE viewModel.expedition_getStateJSON(expeditionFk, user, password,"expedition_getState") } @@ -108,10 +107,10 @@ class ExpeditionStateFragment( with(viewModel) { // itemcard.observe(viewLifecycleOwner, Observer { itemexpedition.observe(viewLifecycleOwner, Observer { - splash_progress.visibility = View.GONE + binding.splashProgress.visibility = View.GONE if (it.isError) { - itemcard_layout.visibility = View.GONE - toolbar_title.text = "Estado de la expedición" + 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") { @@ -120,14 +119,14 @@ class ExpeditionStateFragment( } else { if (it != null) { - itemcard_layout.visibility = View.VISIBLE + binding.itemcardLayout.visibility = View.VISIBLE setItemExpeditionState(it) } else { - itemcard_layout.visibility = View.GONE - toolbar_title.text = "Estado de la expedición" + 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") { @@ -163,8 +162,8 @@ class ExpeditionStateFragment( } }) - itemexpeditionstate_recyclerview.adapter = adapter - itemexpeditionstate_recyclerview.layoutManager = + binding.itemexpeditionstateRecyclerview.adapter = adapter + binding.itemexpeditionstateRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionTruckListFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionTruckListFragment.kt index beeb5e48..656b1138 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionTruckListFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionTruckListFragment.kt @@ -1,10 +1,11 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment +/*import kotlinx.android.synthetic.main.fragment_expedition_truck_list.* +import kotlinx.android.synthetic.main.toolbar.**/ import android.content.Context import android.content.SharedPreferences import android.graphics.drawable.Drawable import android.os.Bundle -import android.util.Log import android.view.View import android.view.inputmethod.EditorInfo import androidx.lifecycle.Observer @@ -15,15 +16,11 @@ import es.verdnatura.domain.notNull import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.common.OnOptionsSelectedListener import es.verdnatura.presentation.common.OnTruckClickListener -import es.verdnatura.presentation.common.TAG import es.verdnatura.presentation.view.component.CustomDialogHour import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.paletizador.adapter.ExpeditionListAdapter import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckList -import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorFragment -import kotlinx.android.synthetic.main.fragment_expedition_truck_list.* -import kotlinx.android.synthetic.main.toolbar.* import java.text.SimpleDateFormat import java.util.* import kotlin.collections.ArrayList @@ -64,9 +61,9 @@ class ExpeditionTruckListFragment : BaseFragment(PreSacadorViewModel::class) { private var user = "" @@ -93,9 +93,9 @@ class PreSacadorFragment : BaseFragment + binding.scanInput.requestFocus() + binding.scanInput.setOnEditorActionListener { v, actionId, event -> if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { - if (!scan_input.text.toString().isNullOrEmpty()){ - if (scan_input.text.contains("-")){ + if (!binding.scanInput.text.toString().isNullOrEmpty()){ + if (binding.scanInput.text.contains("-")){ //es parking - parkingTicket(scan_input.text.toString()) + parkingTicket(binding.scanInput.text.toString()) }else{ - if (scan_input.text.length > 6){ + if (binding.scanInput.text.length > 6){ //es ticket - ticketFk = scan_input.text.toString() - searchTicket(scan_input.text.toString()) + ticketFk = binding.scanInput.text.toString() + searchTicket(binding.scanInput.text.toString()) }else{ //es sale - findSale(scan_input.text.toString()) + findSale(binding.scanInput.text.toString()) } } } - scan_input.setText("") + binding.scanInput.setText("") hideKeyboards() return@setOnEditorActionListener true } @@ -141,22 +141,22 @@ class PreSacadorFragment : BaseFragment){ - splash_progress.visibility = View.GONE + binding.splashProgress.visibility = View.GONE if (salesList.isNullOrEmpty()){ customDialog.setTitle("Pre Sacador").setDescription("No hemos podido obtener movimientos para el ticket escaneado").setKoButton("Cancelar"){ customDialog.dismiss() }.show() }else{ - toolbar_title.text = ticket + binding.mainToolbar.toolbarTitle.text = ticket sales = ArrayList() salesList.forEach { sales.add(it) @@ -251,8 +251,8 @@ class PreSacadorFragment : BaseFragment = ArrayList() val iconPrint : Drawable = resources.getDrawable(R.drawable.ic_print_black_24dp,resources.newTheme()) @@ -639,7 +639,7 @@ class PreSacadorFragment : BaseFragment + binding.editMatricula.requestFocus() + binding.editMatricula.setOnEditorActionListener { v, actionId, event -> if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { - if (!edit_matricula.text.toString().isNullOrEmpty()){ + if (!binding.editMatricula.text.toString().isNullOrEmpty()){ contador += 1 setSubtitle() - listItems.add(0,ItemEscanerVO(edit_matricula.text.toString())) + listItems.add(0,ItemEscanerVO(binding.editMatricula.text.toString())) adapter!!.notifyDataSetChanged() } - edit_matricula.setText("") - (activity as MainActivity).hideKeyboard(edit_matricula) + binding.editMatricula.setText("") + (activity as MainActivity).hideKeyboard(binding.editMatricula) return@setOnEditorActionListener true } return@setOnEditorActionListener false } - button_finalizar.setOnClickListener { + binding.buttonFinalizar.setOnClickListener { val listString:ArrayList = ArrayList() listItems.forEach { listString.add(it.item) } listItems = ArrayList() - splash_progress.visibility = View.VISIBLE + binding.splashProgress.visibility = View.VISIBLE viewModel.itemShelvingMake_multi(user,password,shelvingFk,listString,deep.toString(),warehouseFk,"1") } - backButton.setOnClickListener { + binding.mainToolbar.backButton.setOnClickListener { requireActivity().onBackPressed() } } @@ -119,7 +120,7 @@ class AutomaticAddItemFragment( override fun observeViewModel() { with(viewModel){ response.observe(viewLifecycleOwner, Observer { - splash_progress.visibility = View.GONE + binding.splashProgress.visibility = View.GONE if (it.isError){ customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ customDialog.dismiss() diff --git a/app/src/main/res/drawable/buffer_flejado.xml b/app/src/main/res/drawable/buffer_flejado.xml new file mode 100644 index 00000000..a91b3388 --- /dev/null +++ b/app/src/main/res/drawable/buffer_flejado.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/revision_icon.xml b/app/src/main/res/drawable/revision_icon.xml index a8180ab2..fdd4d744 100644 --- a/app/src/main/res/drawable/revision_icon.xml +++ b/app/src/main/res/drawable/revision_icon.xml @@ -6,7 +6,7 @@ android:viewportWidth="24" android:viewportHeight="24"> - + diff --git a/app/src/main/res/layout/fragment_buscar_item_all.xml b/app/src/main/res/layout/fragment_buscar_item_all.xml index d904b116..0f2019db 100644 --- a/app/src/main/res/layout/fragment_buscar_item_all.xml +++ b/app/src/main/res/layout/fragment_buscar_item_all.xml @@ -3,12 +3,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> - - - + /> diff --git a/app/src/main/res/layout/fragment_collection.xml b/app/src/main/res/layout/fragment_collection.xml index 842f3c52..12ab3b33 100644 --- a/app/src/main/res/layout/fragment_collection.xml +++ b/app/src/main/res/layout/fragment_collection.xml @@ -52,7 +52,7 @@ android:layout_height="match_parent" android:layout_marginTop="8dp" tools:listitem="@layout/item_article_row" /> - + - + + + + + diff --git a/app/src/main/res/layout/fragment_itemproposal.xml b/app/src/main/res/layout/fragment_itemproposal.xml index 85b73b51..87c5ee27 100644 --- a/app/src/main/res/layout/fragment_itemproposal.xml +++ b/app/src/main/res/layout/fragment_itemproposal.xml @@ -3,12 +3,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> - - - + \ No newline at end of file diff --git a/app/src/main/res/layout/item_location_all_row.xml b/app/src/main/res/layout/item_location_all_row.xml deleted file mode 100644 index 4458db20..00000000 --- a/app/src/main/res/layout/item_location_all_row.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 76ef4dbc..a5514f18 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -154,4 +154,6 @@ Historico de ítems del carro Histórico del carro Cargar expedición en buffer + Flejado buffer + Split diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 57775fc0..e0d07454 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -152,5 +152,7 @@ Item Log Shelving Log Load buffer + Buffer strapping + Split