This commit is contained in:
Enrique Blasco 2020-10-28 16:12:52 +01:00
parent d45e713166
commit cc596b589b
12 changed files with 90 additions and 23 deletions

View File

@ -14,8 +14,8 @@ android {
applicationId "es.verdnatura"
minSdkVersion 21
targetSdkVersion 29
versionCode 42
versionName "5.3.2"
versionCode 44
versionName "5.3.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

@ -53,6 +53,12 @@ class CustomDialogList (context: Context) : Dialog(context, R.style.DialogTheme)
return this
}
fun setDescription(title: String): CustomDialogList {
custom_dialog_description.visibility = View.VISIBLE
custom_dialog_description.text = title
return this
}
fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogList {
custom_dialog_button_ok.visibility = View.VISIBLE

View File

@ -1047,7 +1047,7 @@ class CollectionFragment(
}
//toolbar_title.text = "" + totalMark + "/" + sales.size
if (toolbar_title != null) toolbar_title.text = if (collection.collectionFk != null )collection.collectionFk else ""
toolbar_subtitle.text = "" +totalMark + "/" + sales.size
if (toolbar_subtitle != null && totalMark != null && sales != null) toolbar_subtitle.text = "" +totalMark + "/" + sales.size
if (totalMark == sales.size) {
getString(R.string.Coleccióncompleta).toast(this.context,Toast.LENGTH_SHORT)
changeTicketState()

View File

@ -43,7 +43,12 @@ fun CollectionVO.map() : CollectionVO{
}
}catch (e:Exception){
this.isError = true
this.errorMessage = "Error al construir la colección"
if (this.tickets == null || this.tickets.isEmpty()){
this.errorMessage = "La colección no tiene tickets"
}else{
this.errorMessage = "Error al construir la colección"
}
}
return this
}

View File

@ -40,6 +40,8 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
private var reload = false
private var hideLoad = true
private var layoutManager : LinearLayoutManager? = null
private var firstVisiblePosition = 0
companion object {
fun newInstance() = InventaryFragment()
@ -130,6 +132,19 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
}
override fun onPause() {
super.onPause()
firstVisiblePosition = layoutManager?.findFirstVisibleItemPosition() ?: 0
}
override fun onResume() {
super.onResume()
if (location_recyclerview.layoutManager != null){
if (firstVisiblePosition <= listInvetory.size){
location_recyclerview.layoutManager!!.scrollToPosition(firstVisiblePosition)
}
}
}
override fun observeViewModel() {
with(viewModel){
@ -179,7 +194,12 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
}
},onPasillerosItemClickListener = pasillerosItemClickListener!!)
location_recyclerview.adapter = adapter
location_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
location_recyclerview.layoutManager = layoutManager
if (firstVisiblePosition <= listInvetory.size){
location_recyclerview.layoutManager!!.scrollToPosition(firstVisiblePosition)
}
})

View File

@ -208,7 +208,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
.beginTransaction()
.replace(R.id.main_frame_layout, fragment!!)
.addToBackStack(null)
.commit()
.commitAllowingStateLoss()
}

View File

@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment
import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.media.MediaPlayer
import android.os.Bundle
import android.view.View
import android.view.inputmethod.EditorInfo
@ -50,7 +51,8 @@ class ExpeditionPalletFragment(
private var listExpeditions:ArrayList<BarcodeVO> = ArrayList()
private var expeditionAdapter : BarcodeAdapter? = null
private lateinit var customDialog: CustomDialog
var mperror: MediaPlayer? = null
var mpok: MediaPlayer? = null
companion object {
fun newInstance(item: ItemExpeditionTruckVO) =
@ -71,7 +73,8 @@ class ExpeditionPalletFragment(
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,1).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
mperror = MediaPlayer.create((activity as MainActivity),R.raw.error)
mpok = MediaPlayer.create((activity as MainActivity),R.raw.ok)
super.onCreate(savedInstanceState)
}
@ -156,6 +159,9 @@ class ExpeditionPalletFragment(
private fun showScanExpeditions(it:ItemScanList){
splash_progress.visibility = View.GONE
listExpeditions = ArrayList()
it.list.forEach {
if(it.expeditionFk != "0")
listExpeditions.add(BarcodeVO(code = it.expeditionFk))
@ -191,8 +197,19 @@ class ExpeditionPalletFragment(
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!customDialogList.getValue().isNullOrEmpty()){
listExpeditions.add(BarcodeVO(code = customDialogList.getValue()))
viewModel.expeditionScanPut(user,password,it.list.get(0).palletFk,customDialogList.getValue())
try{
val numExpedition = customDialogList.getValue().toDouble()
if(customDialogList.getValue().length >= 7){
listExpeditions.add(0,BarcodeVO(code = customDialogList.getValue()))
customDialogList.setDescription("Total: "+listExpeditions.size)
viewModel.expeditionScanPut(user,password,it.list.get(0).palletFk,customDialogList.getValue())
}else{
if (mperror != null) mperror!!.start()
}
}catch (e:Exception){
if (mperror != null) mperror!!.start()
}
expeditionAdapter!!.notifyDataSetChanged()
}

View File

@ -280,7 +280,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
var shelvingIndex = 0
for (placementVO in saleVO.carros){
if (txtscan.toUpperCase() == placementVO.shelving.toUpperCase()){
mpok!!.start()
if (mpok != null) mpok!!.start()
isOk = true
showShelving(index,shelvingIndex)
isBreak = true
@ -312,7 +312,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
var shelvingIndex = 0
for (placementVO in saleVO.carros){
if (txtscan.toUpperCase() == placementVO.shelving.toUpperCase()){
mpok!!.start()
if (mpok != null) mpok!!.start()
isOk = true
showShelving(position,shelvingIndex)
isBreak = true
@ -612,7 +612,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
ticketFk = ticket,
parking = parking
)
mpok!!.start()
if (mpok != null) mpok!!.start()
"Ticket aparcado".toast(requireContext())
}

View File

@ -324,7 +324,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
var shelvingIndex = 0
for (placementVO in saleVO.carros){
if (txtscan.toUpperCase() == placementVO.shelving.toUpperCase()){
mpok!!.start()
if(mpok != null) mpok!!.start()
isOk = true
showShelving(position,shelvingIndex)
isBreak = true

View File

@ -75,7 +75,10 @@ class AutomaticAddItemFragment(
override fun onAutomaticItemClickListener(position: Int) {
contador -= 1
setSubtitle()
listItems.removeAt(position)
if (listItems.size > position){
listItems.removeAt(position)
}
adapter!!.notifyDataSetChanged()
}
})

View File

@ -166,7 +166,7 @@ class UbicadorFragment(
viewModel.shelvingPark(user,password,shelvingFk,customDialogInput.getValue())
parking = customDialogInput.getValue()
toolbar_title.text = shelvingFk.toUpperCase() + " P: "+parking + " E: "+etiquetas
mpok!!.start()
if(mpok != null) mpok!!.start()
customDialogInput.dismiss()
}.setKoButton("Cancelar"){
customDialogInput.dismiss()
@ -201,7 +201,7 @@ class UbicadorFragment(
viewModel.shelvingChange(user,password,shelvingFk,customDialogInput.getValue())
shelvingFk = customDialogInput.getValue()
toolbar_title.text = shelvingFk.toUpperCase() + " P: "+parking+ " E: "+etiquetas
mpok!!.start()
if(mpok != null) mpok!!.start()
customDialogInput.dismiss()
}.setKoButton("Cancelar"){
customDialogInput.dismiss()
@ -215,7 +215,7 @@ class UbicadorFragment(
viewModel.shelvingChange(user,password,shelvingFk,customDialogInput.getValue())
shelvingFk = customDialogInput.getValue()
toolbar_title.text = shelvingFk.toUpperCase() + " P: "+parking+ " E: "+etiquetas
mpok!!.start()
if(mpok != null) mpok!!.start()
customDialogInput.dismiss()
return@setOnEditorActionListener true
}
@ -377,7 +377,10 @@ class UbicadorFragment(
customDialogUbicador.dismiss()
}else if(!itemFk.isNullOrEmpty() && !etiquetas.isNullOrEmpty() && updatePacking){
val visible_calc = (etiquetas.toInt() * packing.toInt()).toString()
var visible_calc = "0"
try{
visible_calc = (etiquetas.toInt() * packing.toInt()).toString()
}catch (e:Exception){}
viewModel.itemShelvingMakeEdit(user,password,shelvingFk,itemFk,deep.toString(),visible_calc,packing,warehouseFk,"1",itemShelvingFk)
changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible_calc,packing = packing,stickers = etiquetas))
customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("")

View File

@ -17,17 +17,30 @@
android:focusableInTouchMode="true">
<TextView
android:id="@+id/custom_dialog_title"
android:id="@+id/custom_dialog_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/layout_margin_1"
android:layout_marginBottom="@dimen/layout_margin_min"
android:textAlignment="center"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/h6"
android:textStyle="bold"
android:visibility="gone"
tools:text="¿Estás seguro de que deseas eliminar el dispositivo de celia?"
tools:visibility="visible" />
<TextView
android:id="@+id/custom_dialog_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/layout_margin_1"
android:layout_marginBottom="@dimen/layout_margin_min"
android:textAlignment="center"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/h6"
android:textStyle="bold"
android:textSize="@dimen/body1"
android:visibility="gone"
tools:text="¿Estás seguro de que deseas eliminar el dispositivo de celia?"
tools:text="Total: 25"
tools:visibility="visible" />