diff --git a/app/build.gradle b/app/build.gradle index 8fe85f30..64e9acc9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,8 +12,8 @@ android { applicationId "es.verdnatura" minSdkVersion 21 targetSdkVersion 29 - versionCode 19 - versionName "5.0.19" + versionCode 23 + versionName "5.1.3" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/ic_launcher-playstore.png b/app/src/main/ic_launcher-playstore.png new file mode 100644 index 00000000..e6d54026 Binary files /dev/null and b/app/src/main/ic_launcher-playstore.png differ diff --git a/app/src/main/java/es/verdnatura/domain/ApiUtils.kt b/app/src/main/java/es/verdnatura/domain/ApiUtils.kt index 68eac4c2..0be3b3c3 100644 --- a/app/src/main/java/es/verdnatura/domain/ApiUtils.kt +++ b/app/src/main/java/es/verdnatura/domain/ApiUtils.kt @@ -8,7 +8,7 @@ import java.util.concurrent.TimeUnit class ApiUtils { companion object { - //const val BASE_URL:String = "http://192.168.1.104:8009/" + //const val BASE_URL:String = "http://192.168.1.106:8009/" const val BASE_URL:String = "https://app.verdnatura.es/" fun getApiService():VerdnaturaService{ val retrofit = Retrofit.Builder() diff --git a/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt index 610e53cb..c9c303a4 100644 --- a/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt @@ -1,6 +1,7 @@ package es.verdnatura.domain import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO +import es.verdnatura.presentation.view.feature.login.model.SalixMessageVO import retrofit2.Call class GetLoginUserCase() : RestClient() { @@ -13,7 +14,6 @@ class GetLoginUserCase() : RestClient() { } fun salixLogin(usuario:String,password:String) : Call{ - return salixClient!!.login("application/json", LoginSalixVO(usuario,password)) } @@ -23,4 +23,8 @@ class GetLoginUserCase() : RestClient() { return restClient!!.version("json","1",usuario,password,"application/json",params) } + fun sendChekingPresence(token:String,workerId:Int,message:String) : Call{ + return salixClient!!.sendChekingPresence(content_type = "application/json", authorization = token, params = SalixMessageVO(workerId = workerId,message = message)) + } + } \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt index ee0c7f71..d96a9fc8 100644 --- a/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt @@ -15,6 +15,12 @@ class GetSacadorControladorUserCase : RestClient() { return restClient!!.collectionTicketGet("json","1",usuario,password,"application/json",params) } + fun collectionNew(usuario:String,password:String,sectorFk:String) : Call { + val params:ArrayList = ArrayList(); + params.add(sectorFk) + return restClient!!.collectionNew("json","1",usuario,password,"application/json",params) + } + fun collectionGet(usuario:String,password:String) : Call> { val params:ArrayList = ArrayList(); return restClient!!.collectionGet("json","1",usuario,password,"application/json") diff --git a/app/src/main/java/es/verdnatura/domain/SalixService.kt b/app/src/main/java/es/verdnatura/domain/SalixService.kt index 02938f32..37382f7e 100644 --- a/app/src/main/java/es/verdnatura/domain/SalixService.kt +++ b/app/src/main/java/es/verdnatura/domain/SalixService.kt @@ -1,6 +1,7 @@ package es.verdnatura.domain import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO +import es.verdnatura.presentation.view.feature.login.model.SalixMessageVO import retrofit2.Call import retrofit2.http.Body import retrofit2.http.Header @@ -12,4 +13,11 @@ interface SalixService { fun login(@Header("Content-Type") content_type: String, @Body params: LoginSalixVO): Call + + @POST("chats/sendCheckingPresence") + fun sendChekingPresence( + @Header("Content-Type") content_type: String, + @Header("Authorization") authorization: String, + @Body params: SalixMessageVO): + Call } \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt index 62e3352e..7bc2b2a6 100644 --- a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt +++ b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt @@ -53,6 +53,8 @@ interface VerdnaturaService { @Header("pass") pass: String, @Header("Content-Type") content_type: String): Call> + + //PRESACADORES ========================================================================> @POST("almacennew/ticketToPrePrepare") @@ -76,6 +78,15 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String): Call> + @POST("almacennew/collectionNew") + fun collectionNew(@Header("aplicacion") aplicacion: String, + @Header("version") version: String, + @Header("user") user: String, + @Header("pass") pass: String, + @Header("Content-Type") content_type: String, + @Body params: List): + Call + @POST("almacennew/collectionTicketGet") fun collectionTicketGet(@Header("aplicacion") aplicacion: String, @Header("version") version: String, diff --git a/app/src/main/java/es/verdnatura/presentation/common/UICallbacks.kt b/app/src/main/java/es/verdnatura/presentation/common/UICallbacks.kt index f6ad5ef9..bfe910f0 100644 --- a/app/src/main/java/es/verdnatura/presentation/common/UICallbacks.kt +++ b/app/src/main/java/es/verdnatura/presentation/common/UICallbacks.kt @@ -10,7 +10,6 @@ import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionScanVO 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.ItemScanVO import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO import es.verdnatura.presentation.view.feature.sacador.model.SaleVO diff --git a/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogThreeButtons.kt b/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogThreeButtons.kt index 4ec76e12..c7210f47 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogThreeButtons.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogThreeButtons.kt @@ -6,7 +6,6 @@ import android.view.View import com.google.android.material.textfield.TextInputEditText import es.verdnatura.R import kotlinx.android.synthetic.main.component_custom_three_dialog.* -import kotlinx.android.synthetic.main.component_custom_two_dialog.* import kotlinx.android.synthetic.main.component_custom_two_dialog.custom_dialog_button_ko import kotlinx.android.synthetic.main.component_custom_two_dialog.custom_dialog_button_ok import kotlinx.android.synthetic.main.component_custom_two_dialog.custom_dialog_button_ok_two diff --git a/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogTwoButtons.kt b/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogTwoButtons.kt index f2b1bc13..d308aa3a 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogTwoButtons.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogTwoButtons.kt @@ -4,11 +4,7 @@ import android.app.Dialog import android.content.Context import android.view.View import es.verdnatura.R -import kotlinx.android.synthetic.main.component_custom_two_dialog.custom_dialog_button_ko -import kotlinx.android.synthetic.main.component_custom_two_dialog.custom_dialog_button_ok -import kotlinx.android.synthetic.main.component_custom_two_dialog.custom_dialog_button_ok_two -import kotlinx.android.synthetic.main.component_custom_two_dialog.custom_dialog_description -import kotlinx.android.synthetic.main.component_custom_two_dialog.custom_dialog_title +import kotlinx.android.synthetic.main.component_custom_two_dialog.* class CustomDialogTwoButtons (context: Context) : Dialog(context, R.style.DialogTheme) { 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 34f89aa4..cf164b86 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 @@ -9,6 +9,7 @@ import androidx.recyclerview.widget.LinearLayoutManager import es.verdnatura.R import es.verdnatura.databinding.FragmentAjustesBinding import es.verdnatura.domain.notNull +import es.verdnatura.domain.toast import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.common.OnAjustesItemClickListener import es.verdnatura.presentation.view.component.CustomDialog @@ -60,6 +61,10 @@ class AjustesFragment : BaseFragment(Aj viewModel.getSectors(user!!,password!!) } else if (item.id == 1){ activity!!.onBackPressed() + }else if (item.id == 2){ + "No disponible en esta versión".toast(requireContext()) + }else if (item.id == 3){ + "No disponible en esta versión".toast(requireContext()) } } }) @@ -71,7 +76,7 @@ class AjustesFragment : BaseFragment(Aj splash_progress.visibility = View.INVISIBLE if (it.list != null && it.list.size > 0 && it.list.get(0).isError){ customDialog.setTitle("Error").setDescription(it.list.get(0).errorMessage).setOkButton("Cerrar"){ - customDialog.hide() + customDialog.dismiss() }.show() }else{ @@ -86,7 +91,7 @@ class AjustesFragment : BaseFragment(Aj }else{ customDialog.setTitle("Sectores").setDescription("No existes sectores.").setOkButton("Cerrar"){ - customDialog.hide() + customDialog.dismiss() }.show() } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesViewModel.kt index 2bcd6e89..e7729d43 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesViewModel.kt @@ -50,6 +50,20 @@ class AjustesViewModel : BaseViewModel() { 0, 0) ) + _ajustesitem.add( + AjustesItemVO(2, + "Carros", + "", + 0, + 0) + ) + _ajustesitem.add( + AjustesItemVO(3, + "Voz", + "", + 0, + 0) + ) } 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 551d535b..3faedf4b 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 @@ -146,7 +146,7 @@ class ItemCardFragment( itemcard_layout.visibility = View.GONE toolbar_title.text = "ItemCard" customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ - customDialog.hide() + customDialog.dismiss() }.show() }else{ if (it.id != "0"){ @@ -156,7 +156,7 @@ class ItemCardFragment( itemcard_layout.visibility = View.GONE toolbar_title.text = "ItemCard" customDialog.setTitle("Sin resultados").setDescription("No hemos podido encontrar el articulo. Revisa el sector.").setOkButton("Cerrar"){ - customDialog.hide() + customDialog.dismiss() }.show() } @@ -167,7 +167,7 @@ class ItemCardFragment( splash_progress.visibility = View.GONE if (it.isError){ customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ - customDialog.hide() + customDialog.dismiss() }.show() } }) @@ -208,11 +208,11 @@ class ItemCardFragment( customDialogInput.setTitle(item.title!!).setDescription("Valor actual: "+item.value!!).setOkButton("Guardar"){ (activity as MainActivity).hideKeyboard(customDialogInput.getEditText()) editItemCardRow(item,customDialogInput.getValue()) - customDialogInput.hide() + customDialogInput.dismiss() }.setKoButton("Cancelar"){ (activity as MainActivity).hideKeyboard(customDialogInput.getEditText()) - customDialogInput.hide() + customDialogInput.dismiss() }.setValue("").show() customDialogInput.getEditText().requestFocus() customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event -> @@ -220,7 +220,7 @@ class ItemCardFragment( if (!customDialogInput.getValue().isNullOrEmpty()) editItemCardRow(item,customDialogInput.getValue()) customDialogInput.setValue("") - customDialogInput.hide() + customDialogInput.dismiss() (activity as MainActivity).hideKeyboard(customDialogInput.getEditText()) return@setOnEditorActionListener true } @@ -280,16 +280,16 @@ class ItemCardFragment( customDialogTwo.setTitle(itemB.title!!).setDescription("Indica la causa de eliminar stock:").setOkButton("Falta"){ viewModel.itemStockUpdate(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "0") changeOfflineValue(itemB,value, listBarcodes) - customDialogTwo.hide() + customDialogTwo.dismiss() }.setOkButtonTwo("Basura"){ viewModel.itemStockUpdate(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "1") changeOfflineValue(itemB,value, listBarcodes) - customDialogTwo.hide() + customDialogTwo.dismiss() }.setKoButton("Cancelar"){ - customDialogTwo.hide() + customDialogTwo.dismiss() }.show() }else{ changeOfflineValue(itemB,value, listBarcodes) @@ -305,11 +305,11 @@ class ItemCardFragment( (activity as MainActivity).hideKeyboard(customDialogList.getEditText()) if (!customDialogList.getValue().isNullOrEmpty()) updateBarcode(customDialogList.getValue(),"0",itemB) - customDialogList.hide() + customDialogList.dismiss() }.setKoButton("Cerrar"){ (activity as MainActivity).hideKeyboard(customDialogList.getEditText()) - customDialogList.hide() + customDialogList.dismiss() }.setValue("").show() @@ -319,7 +319,7 @@ class ItemCardFragment( if (!customDialogList.getValue().isNullOrEmpty()) updateBarcode(customDialogList.getValue(),"0",itemB) customDialogList.setValue("") - customDialogList.hide() + customDialogList.dismiss() (activity as MainActivity).hideKeyboard(customDialogList.getEditText()) return@setOnEditorActionListener true } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapter.kt index 9a6e45f3..7de24edf 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapter.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapter.kt @@ -77,9 +77,9 @@ class SaleAdapter ( //ERROR if (sale.originalQuantity != sale.quantity){ layoutError.visibility = View.VISIBLE - txtError.text = "Cantidad original: "+sale.quantity + txtError.text = "Cantidad original: "+sale.originalQuantity if (sale.isPrepared == "1" || sale.isControlled == "1") - sale.pickedQuantity = sale.originalQuantity + sale.pickedQuantity = sale.quantity } if (sale.isNew){ 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 d449f2ee..3b8219e2 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 @@ -34,6 +34,7 @@ import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO +import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO import es.verdnatura.presentation.view.feature.sacador.model.SaleVO import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.fragment_collection.* @@ -47,6 +48,7 @@ class CollectionFragment( private var password = "" private var sectorFk = "" private var warehouseFk = "" + private var token = "" private var sales:List = listOf() private var saleAdapter:SaleAdapter? = null private var lm : LinearLayoutManager? = null @@ -84,6 +86,7 @@ class CollectionFragment( user = prefs.getString(USER,"").toString() password = prefs.getString(PASSWORD,"").toString() sectorFk = prefs.getInt(SECTORFK,1).toString() + token = prefs.getString(TOKEN,"").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) @@ -313,9 +316,9 @@ class CollectionFragment( fragment_sacador_collections.layoutManager = lm setTotalLines() if (storedPosition != 0) - setListPosition(storedPosition) + setListPosition(storedPosition,true) else if (storedBackPosition != 0) - setListPosition(storedBackPosition) + setListPosition(storedBackPosition,true) setScrollListener(lm!!) } @@ -336,7 +339,7 @@ class CollectionFragment( var isOk = false if (type == SACADOR){ for (saleVO in sales) { - if(saleVO.isPrepared != "1"){ + if(saleVO.isPrepared != "1" && saleVO.isPreviousPrepared != "1"){ //1- Por itemFk if (txtscan == saleVO.itemFk){ mpok!!.start() @@ -347,7 +350,7 @@ class CollectionFragment( //2- Por carro var shelvingIndex = 0 for (placementVO in saleVO.placements){ - if (txtscan.toUpperCase() == placementVO.shelving.toUpperCase()){ + if (txtscan.toUpperCase() == placementVO.shelving.toUpperCase() && placementVO.visible != "(0)"){ mpok!!.start() isOk = true showShelving(index,shelvingIndex) @@ -419,7 +422,7 @@ class CollectionFragment( if (type == SACADOR){ var saleVO = sales[position] - if(saleVO.isPrepared != "1"){ + if(saleVO.isPrepared != "1" && saleVO.isPreviousPrepared != "1"){ //1- Por itemFk if (txtscan == saleVO.itemFk){ mpok!!.start() @@ -461,24 +464,28 @@ class CollectionFragment( if (type == SACADOR){ sales[position].isPrepared = if (sales[position].isPrepared == "1") "0" else "1" if (sales[position].isPrepared == "1"){ - sales[position].pickedQuantity = sales[position].originalQuantity + sales[position].pickedQuantity = sales[position].quantity } }else if (type == CONTROLADOR) sales[position].isControlled = if (sales[position].isControlled == "1") "0" else "1" saleAdapter!!.notifyDataSetChanged() - setListPosition(position) + setListPosition(position,false) saleTrackingReplace(position,newType) setTotalLines() } - private fun setListPosition(position:Int){ + private fun setListPosition(position:Int,isFromBack:Boolean){ storedPosition = position if (type == SACADOR){ fragment_sacador_collections.addViewObserver { lm!!.scrollToPositionWithOffset(position,0) } + }else if (isFromBack){ + fragment_sacador_collections.addViewObserver { + lm!!.scrollToPositionWithOffset(position,0) + } } } @@ -501,7 +508,7 @@ class CollectionFragment( sales[position].isPrepared = "0" sales[position].pickedQuantity = "0" saleAdapter!!.notifyDataSetChanged() - setListPosition(position) + setListPosition(position,false) viewModel.saleTrackingDel( usuario = user, password = password, @@ -528,7 +535,7 @@ class CollectionFragment( splash_progress.visibility = View.VISIBLE var quantityGet = "0" try{ - quantityGet = (sales[position].originalQuantity.toInt() - sales[position].pickedQuantity.toInt()).toString() + quantityGet = (sales[position].quantity.toInt() - sales[position].pickedQuantity.toInt()).toString() }catch (e:Exception){} viewModel.itemPlacementSupplyAiming( usuario = user, @@ -563,47 +570,61 @@ class CollectionFragment( var total = "0" var itemShelvingFk = "0" if (!placementSupplyListVO.list.isEmpty()){ - val placement = placementSupplyListVO.list[0] - shelving = placement.shelving - item = placement.itemFk - longName = placement.longName - total = placement.total - itemShelvingFk = placement.itemShelvingFk + var placement:PlacementSupplyVO? = null + placementSupplyListVO.list.forEach { placementVO -> + if (placementVO.stock != "0" && placement == null) + placement = placementVO + } + if (placement != null){ + shelving = placement!!.shelving + item = placement!!.itemFk + longName = placement!!.longName + total = placement!!.total + itemShelvingFk = placement!!.itemShelvingFk + } + } listPlacementSupply = ArrayList() placementSupplyListVO.list.forEach { - listPlacementSupply.add(BarcodeVO(code = it.proposal)) + if (it.stock != "0") + listPlacementSupply.add(BarcodeVO(code = it.proposal)) } + try { + customDialogList.setTitle("$shelving($item) $total de $longName").setOkButton("Coger") { + if (customDialogList.getValueTwo().isNotEmpty()) { + if (customDialogList.getValue().toInt() > total.toInt()) { + "La cantidad supera a la disponible".toast(requireContext()) + } else { + if (checkItemScan(customDialogList.getValueTwo())) { + onQuantityOfShelvingSelected(itemShelvingFk) + mpok?.start() + customDialogList.dismiss() + } else { + itemShelvingFkStored = itemShelvingFk + splash_progress.visibility = View.VISIBLE + viewModel.getIdFromCode( + usuario = user, + password = password, + code = customDialogList.getValueTwo() + ) + customDialogList.dismiss() + } + scanRequest() + hideKeyboards() + } - customDialogList.setTitle("$shelving($item) $total de $longName").setOkButton("Coger"){ - if (customDialogList.getValueTwo().isNotEmpty()){ - if (checkItemScan(customDialogList.getValueTwo())){ - onQuantityOfShelvingSelected(itemShelvingFk) - mpok?.start() - customDialogList.dismiss() - }else{ - itemShelvingFkStored = itemShelvingFk - splash_progress.visibility = View.VISIBLE - viewModel.getIdFromCode( - usuario = user, - password = password, - code = customDialogList.getValueTwo() - ) - customDialogList.dismiss() + } else { + "Escanea item para validar".toast(requireContext()) } + + + }.setKoButton("Cerrar") { scanRequest() hideKeyboards() - }else{ - "Escanea item para validar".toast(requireContext()) - } - - - }.setKoButton("Cerrar"){ - scanRequest() - hideKeyboards() - customDialogList.dismiss() - }.setHintValue("Cantidad que coges:").setValue(total).setHintValueTwo("Escanea item").setValueTwo("").show() - + customDialogList.dismiss() + }.setHintValue("Cantidad que coges:").setValue(total).setHintValueTwo("Escanea item") + .setValueTwo("").show() + }catch (e:Exception){} customDialogList.getEditTextTwo().post(Runnable { customDialogList.getEditTextTwo().requestFocusFromTouch() @@ -611,34 +632,40 @@ class CollectionFragment( activity!!.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager lManager.hideSoftInputFromWindow(customDialogList.getEditTextTwo().windowToken, InputMethodManager.SHOW_FORCED) }) + try { + customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event -> + if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { + if (customDialogList.getValueTwo().isNotEmpty()) { + if (customDialogList.getValue().toInt() > total.toInt()) { + "La cantidad supera a la disponible".toast(requireContext()) + } else { + if (checkItemScan(customDialogList.getValueTwo())) { + onQuantityOfShelvingSelected(itemShelvingFk) + mpok?.start() + customDialogList.dismiss() + } else { + itemShelvingFkStored = itemShelvingFk + splash_progress.visibility = View.VISIBLE + viewModel.getIdFromCode( + usuario = user, + password = password, + code = customDialogList.getValueTwo() + ) + customDialogList.dismiss() + } + } - customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event -> - if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { - if (customDialogList.getValueTwo().isNotEmpty()){ - if (checkItemScan(customDialogList.getValueTwo())){ - onQuantityOfShelvingSelected(itemShelvingFk) - mpok?.start() - customDialogList.dismiss() - }else{ - itemShelvingFkStored = itemShelvingFk - splash_progress.visibility = View.VISIBLE - viewModel.getIdFromCode( - usuario = user, - password = password, - code = customDialogList.getValueTwo() - ) - customDialogList.dismiss() + } else { + "Escanea item para validar".toast(requireContext()) } - }else{ - "Escanea item para validar".toast(requireContext()) - } - scanRequest() - hideKeyboards() - return@setOnEditorActionListener true + scanRequest() + hideKeyboards() + return@setOnEditorActionListener true + } + false } - false - } + }catch (e:Exception){} placementSupplyAdapter = BarcodeAdapter(listPlacementSupply,object: OnBarcodeRowClickListener { override fun onBarcodeRowClickListener(item: BarcodeVO) { @@ -696,7 +723,7 @@ class CollectionFragment( }catch (e:Exception){} //3- MARCAR LINEA - if (sales[storedPosition].pickedQuantity != sales[storedPosition].originalQuantity){ + if (sales[storedPosition].pickedQuantity != sales[storedPosition].quantity){ sales[storedPosition].isPrepared = "1" markLine(storedPosition, OK) }else{ @@ -930,16 +957,16 @@ class CollectionFragment( private fun split(position: Int,quantity:String){ var totalQuantity: Int = 0 try { - totalQuantity = sales[position].originalQuantity.toInt() - quantity.toInt() + totalQuantity = sales[position].quantity.toInt() - quantity.toInt() }catch (e:Exception){} viewModel.saleMove( usuario = user, password = password, saleFk = sales[position].saleFk, quantity = totalQuantity.toString(), - originalQuantity = quantity + originalQuantity = sales[position].quantity ) - sales[position].originalQuantity = quantity + //sales[position].originalQuantity = quantity sales[position].quantity = quantity //sales[position].startQuantity = quantity @@ -948,12 +975,18 @@ class CollectionFragment( saleAdapter!!.notifyDataSetChanged() + //enviar mensaje a salix + val ticket = "[" + sales[position].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].ticketFk + "/summary)" + val message = "Se ha enviado a Split el articulo "+sales[position].itemFk+" del ticket "+ticket + viewModel.sendChekingPresence(token = token,workerId = sales[position].salePersonFk,message = message) + + } private fun trash(position: Int,quantity:String){ var totalQuantity: Int = 0 try { - totalQuantity = sales[position].originalQuantity.toInt() - quantity.toInt() + totalQuantity = sales[position].quantity.toInt() - quantity.toInt() }catch (e:Exception){} viewModel.collectionMissingTrash( usuario = user, @@ -964,18 +997,24 @@ class CollectionFragment( type = "FALSE", originalQuantity = quantity ) - sales[position].originalQuantity = quantity + //sales[position].originalQuantity = quantity sales[position].quantity = quantity //sales[position].startQuantity = quantity saleAdapter!!.notifyDataSetChanged() if (quantity == "0") markLine(position,type) + + + //enviar mensaje a salix + val ticket = "[" + sales[position].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].ticketFk + "/summary)" + val message = "Se ha enviado a Faltas el articulo "+sales[position].itemFk+" del ticket "+ticket + viewModel.sendChekingPresence(token = token,workerId = sales[position].salePersonFk,message = message) } private fun missing(position: Int,quantity:String){ var totalQuantity: Int = 0 try { - totalQuantity = sales[position].originalQuantity.toInt() - quantity.toInt() + totalQuantity = sales[position].quantity.toInt() - quantity.toInt() }catch (e:Exception){} viewModel.collectionMissingTrash( usuario = user, @@ -986,13 +1025,19 @@ class CollectionFragment( type = "TRUE", originalQuantity = quantity ) - sales[position].originalQuantity = quantity + //sales[position].originalQuantity = quantity sales[position].quantity = quantity //sales[position].startQuantity = quantity if (quantity == "0") markLine(position,type) saleAdapter!!.notifyDataSetChanged() + + + //enviar mensaje a salix + val ticket = "[" + sales[position].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].ticketFk + "/summary)" + val message = "Se ha enviado a Basura el articulo "+sales[position].itemFk+" del ticket "+ticket + viewModel.sendChekingPresence(token = token,workerId = sales[position].salePersonFk,message = message) } private fun increaseQuantity(position:Int,quantity:String){ @@ -1002,20 +1047,19 @@ class CollectionFragment( saleFk = sales[position].saleFk, quantity = quantity ) - try { - val quantityPicked = (quantity.toInt() - sales[position].quantity.toInt()).toString() - sales[position].originalQuantity = quantity - sales[position].quantity = quantity - if (type == CONTROLADOR){ - showShelving(position,0,quantityPicked) - } + try { + //val quantityPicked = (quantity.toInt() - sales[position].quantity.toInt()).toString() + //sales[position].originalQuantity = quantity + sales[position].quantity = quantity + /*if (type == CONTROLADOR){ + showShelving(position,0,quantityPicked) + }*/ }catch (e:Exception){} saleAdapter?.notifyDataSetChanged() } //ESTADOS - private fun changeTicketState(){ if (type == CONTROLADOR){ viewModel.collectionUpdateState( 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 a6400510..f184801d 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 @@ -1,14 +1,16 @@ package es.verdnatura.presentation.view.feature.collection.fragment +import android.util.Log import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData +import es.verdnatura.domain.GetLoginUserCase import es.verdnatura.domain.GetSacadorControladorUserCase -import es.verdnatura.domain.GetShelvingParkingUserCase import es.verdnatura.domain.GetUbicadorUserCase import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.view.feature.collection.ItemVO import es.verdnatura.presentation.view.feature.collection.mapper.map +import es.verdnatura.presentation.view.feature.login.model.SalixMessageVO import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO @@ -22,6 +24,7 @@ class CollectionViewModel : BaseViewModel() { private val getSacadorControladorUserCase: GetSacadorControladorUserCase = GetSacadorControladorUserCase() private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase() + private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase() private val _collectionTicketList by lazy { MutableLiveData() } val collectionTicketList: LiveData @@ -288,4 +291,19 @@ class CollectionViewModel : BaseViewModel() { } }) } + + fun sendChekingPresence(token:String,workerId:String,message:String){ + try{ + getLoginUserCase.sendChekingPresence(token,workerId.toInt(),message).enqueue(object : Callback{ + override fun onResponse(call: Call, response: Response) { + Log.i("Salix","Mensaje enviado a salix") + } + + override fun onFailure(call: Call, t: Throwable) { + Log.i("Salix Error",""+t.message) + } + }) + }catch (e:Exception){} + + } } 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 ed2e675c..b594bd1d 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 @@ -2,7 +2,6 @@ package es.verdnatura.presentation.view.feature.collection.mapper import es.verdnatura.presentation.common.convertToDateString import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO -import java.lang.NumberFormatException import java.text.SimpleDateFormat import java.util.* @@ -12,6 +11,7 @@ fun CollectionVO.map() : CollectionVO{ 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" @@ -33,7 +33,7 @@ fun CollectionVO.map() : CollectionVO{ } placement.created = getCalendarFromDate(placement.created).convertToDateString() - placement.visible = "(" + placement.visible + ")" + placement.visible = "(" + (if(placement.visible.toInt() > 0) placement.visible else "0") + ")" } } else { it.placements = listOf() @@ -43,7 +43,7 @@ fun CollectionVO.map() : CollectionVO{ } }catch (e:Exception){ this.isError = true - this.errorMessage = "La colección no tiene tickets" + this.errorMessage = "Error al construir la colección" } return this } 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 e305b8c9..5439f044 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 @@ -86,7 +86,7 @@ class ControladorFragment : BaseFragment(Falt customDialogInput.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){ viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0") changeOfflineValue(item) - customDialogInput.hide() + customDialogInput.dismiss() }.setKoButton("Cancelar"){ - customDialogInput.hide() + customDialogInput.dismiss() }.setValue("0").show() customDialogInput.getEditText().requestFocus() @@ -159,7 +159,7 @@ class FaltasFragment : BaseFragment(Falt changeOfflineValue(item) } customDialogInput.setValue("") - customDialogInput.hide() + customDialogInput.dismiss() (activity as MainActivity).hideKeyboard(customDialogInput.getEditText()) return@setOnEditorActionListener true } @@ -183,7 +183,7 @@ class FaltasFragment : BaseFragment(Falt response.observe(viewLifecycleOwner, Observer { if (it.isError){ customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ - customDialog.hide() + customDialog.dismiss() }.show() } }) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryFragment.kt index 8eebc6a6..04b53e78 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryFragment.kt @@ -156,9 +156,9 @@ class InventaryFragment : BaseFragment (LoginVi splash_progress.visibility = View.INVISIBLE if (it.isError){ customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ - customDialog.hide() + customDialog.dismiss() }.show() }else{ splash_progress.visibility = View.VISIBLE @@ -78,7 +78,7 @@ class LoginFragment : BaseFragment (LoginVi if (it.isError){ saveTokenPref("") customDialog.setTitle("Error").setDescription(it.errorMessage+". Puedes continuar pero algunas funcionalidades no estarán disponibles.").setOkButton("Entendido"){ - customDialog.hide() + customDialog.dismiss() getVersion() }.show() }else{ @@ -90,12 +90,13 @@ class LoginFragment : BaseFragment (LoginVi version.observe(viewLifecycleOwner, Observer { splash_progress.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"){ + /* 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.hide() + customDialog.dismiss() }.setKoButton("Cancelar"){ - customDialog.hide() - }.show() + customDialog.dismiss() + }.show()*/ + goToMain() }else{ customDialog.setTitle("Actualizar").setDescription("Existe una versión nueva, es recomendable actualizar.").setOkButton("Actualizar"){ @@ -103,7 +104,7 @@ class LoginFragment : BaseFragment (LoginVi openURL.data = Uri.parse("https://app.verdnatura.es/bin/vn-pickingV2.apk") startActivity(openURL) }.setKoButton("Omitir"){ - customDialog.hide() + customDialog.dismiss() goToMain() }.show() } 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 a6a912cb..e7ee2363 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 @@ -53,9 +53,6 @@ class LoginViewModel() : BaseViewModel() { } fun loginSalix(user:String,password:String){ - val loginSalixVO = LoginSalixVO(user,password, "aaa") - _loginsalixitem.value = loginSalixVO - /* getLoginUserCase.salixLogin(user,password).enqueue(object : Callback{ override fun onResponse(call: Call, response: Response) { @@ -73,7 +70,7 @@ class LoginViewModel() : BaseViewModel() { val loginSalixVO = LoginSalixVO(user,password, "",isError = true,errorMessage = t.message!!) _loginsalixitem.value = loginSalixVO } - })*/ + }) } fun checkVersion(user:String,password:String,version:String){ diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/login/model/LoginItemVO.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/login/model/LoginItemVO.kt index 04d4e85d..f5cbae37 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/login/model/LoginItemVO.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/login/model/LoginItemVO.kt @@ -12,4 +12,12 @@ class LoginSalixVO ( val token:String = "", var isError:Boolean = false, var errorMessage:String = "" +) + +class SalixMessageVO ( + val workerId:Int = 0, + val message:String = "", + val token:String = "", + var isError:Boolean = false, + var errorMessage:String = "" ) \ No newline at end of file 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 cab325bd..82cebca1 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 @@ -8,7 +8,6 @@ import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentManager import es.verdnatura.R import es.verdnatura.databinding.ActivityMainBinding -import es.verdnatura.domain.toast import es.verdnatura.presentation.base.BaseActivity import es.verdnatura.presentation.common.* import es.verdnatura.presentation.view.component.CustomDialog @@ -216,10 +215,10 @@ class MainActivity : BaseActivity() , OnPasillerosItemClick fm.popBackStackImmediate() }else { customDialog.setTitle("Cerrar sesión").setDescription("¿Estás seguro de cerrar la sesión?").setOkButton("Salir"){ - customDialog.hide() + customDialog.dismiss() finish() }.setKoButton("Cancelar") { - customDialog.hide() + customDialog.dismiss() }.show() } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/adapter/ExpeditionScanAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/adapter/ExpeditionScanAdapter.kt index a9944f2a..15d4466f 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/adapter/ExpeditionScanAdapter.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/adapter/ExpeditionScanAdapter.kt @@ -3,17 +3,10 @@ package es.verdnatura.presentation.view.feature.paletizador.adapter import android.content.Context import android.view.LayoutInflater import android.view.ViewGroup -import androidx.core.content.ContextCompat import androidx.recyclerview.widget.RecyclerView -import es.verdnatura.R -import es.verdnatura.databinding.ItemExpeditionpalletRowBinding import es.verdnatura.databinding.ItemExpeditionscanRowBinding -import es.verdnatura.presentation.common.OnComprobarPalletViewClickListener -import es.verdnatura.presentation.common.OnPalletClickListener import es.verdnatura.presentation.common.OnScanLongClickListener import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionScanVO -import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO -import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO class ExpeditionScanAdapter ( private val items: List, 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 3da8beec..ed76f4e4 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 @@ -3,40 +3,28 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment import android.content.Context import android.content.SharedPreferences import android.graphics.drawable.Drawable -import androidx.lifecycle.ViewModelProviders import android.os.Bundle -import androidx.fragment.app.Fragment -import android.view.LayoutInflater import android.view.View -import android.view.ViewGroup -import android.view.inputmethod.EditorInfo import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager - import es.verdnatura.R -import es.verdnatura.databinding.FragmentExpeditionPalletBinding import es.verdnatura.databinding.FragmentExpeditionPalletDetailBinding import es.verdnatura.domain.notNull import es.verdnatura.presentation.base.BaseFragment -import es.verdnatura.presentation.common.OnBarcodeRowClickListener import es.verdnatura.presentation.common.OnOptionsSelectedListener import es.verdnatura.presentation.common.OnPalletClickListener import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialogList -import es.verdnatura.presentation.view.feature.articulo.adapter.BarcodeAdapter -import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter -import es.verdnatura.presentation.view.feature.main.activity.MainActivity -import es.verdnatura.presentation.view.feature.paletizador.adapter.ExpeditionPalletAdapter import es.verdnatura.presentation.view.feature.paletizador.adapter.ExpeditionPalletViewAdapter -import es.verdnatura.presentation.view.feature.paletizador.model.* +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 class ExpeditionPalletDetailFragment( @@ -147,7 +135,7 @@ class ExpeditionPalletDetailFragment( response.observe(viewLifecycleOwner, Observer { if (it.isError){ customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ - customDialog.hide() + customDialog.dismiss() }.show() }else{ activity!!.onBackPressed() diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailViewModel.kt index a3ab7185..0068dbb5 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailViewModel.kt @@ -7,7 +7,8 @@ import es.verdnatura.domain.GetPaletizadoresUserCase import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.common.Event import es.verdnatura.presentation.common.ResponseItemVO -import es.verdnatura.presentation.view.feature.paletizador.model.* +import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletViewListVO +import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletViewVO import retrofit2.Call import retrofit2.Callback import retrofit2.Response 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 a55d9793..25110599 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 @@ -17,7 +17,6 @@ import es.verdnatura.presentation.common.OnComprobarPalletViewClickListener import es.verdnatura.presentation.common.OnOptionsSelectedListener import es.verdnatura.presentation.common.OnPalletClickListener import es.verdnatura.presentation.view.component.CustomDialog -import es.verdnatura.presentation.view.component.CustomDialogHour import es.verdnatura.presentation.view.component.CustomDialogList import es.verdnatura.presentation.view.feature.articulo.adapter.BarcodeAdapter import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO @@ -135,7 +134,7 @@ class ExpeditionPalletFragment( response.observe(viewLifecycleOwner, Observer { if (it.isError){ customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ - customDialog.hide() + customDialog.dismiss() }.show() } }) @@ -171,11 +170,11 @@ class ExpeditionPalletFragment( ItemPalletVO(Pallet = it.list.get(0).palletFk)) }else{ customDialog.setTitle("Atención").setDescription("No ha escaneado expediciones").setOkButton("Ok"){ - customDialog.hide() + customDialog.dismiss() }.show() } - customDialogList.hide() + customDialogList.dismiss() }.setKoButton("Cerrar"){ @@ -183,7 +182,7 @@ class ExpeditionPalletFragment( splash_progress.visibility = View.VISIBLE viewModel.expeditionPallet_List(user,password,itemExpeditionTruckVO!!.truckFk) listExpeditions = ArrayList() - customDialogList.hide() + customDialogList.dismiss() }.setValue("").show() customDialogList.getEditText().requestFocus() 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 00c392c9..25e41265 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 @@ -3,18 +3,12 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment import android.content.Context import android.content.SharedPreferences import android.graphics.drawable.Drawable -import androidx.lifecycle.ViewModelProviders import android.os.Bundle -import androidx.fragment.app.Fragment -import android.view.LayoutInflater import android.view.View -import android.view.ViewGroup import android.view.inputmethod.EditorInfo import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager - import es.verdnatura.R -import es.verdnatura.databinding.FragmentExpeditionPalletBinding import es.verdnatura.databinding.FragmentExpeditionScanBinding import es.verdnatura.domain.notNull import es.verdnatura.presentation.base.BaseFragment @@ -26,16 +20,13 @@ import es.verdnatura.presentation.view.feature.articulo.adapter.BarcodeAdapter import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter import es.verdnatura.presentation.view.feature.main.activity.MainActivity -import es.verdnatura.presentation.view.feature.paletizador.adapter.ExpeditionPalletAdapter 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 class ExpeditionScanFragment ( @@ -142,7 +133,7 @@ class ExpeditionScanFragment ( response.observe(viewLifecycleOwner, Observer { if (it.isError){ customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ - customDialog.hide() + customDialog.dismiss() }.show() } }) @@ -150,7 +141,7 @@ class ExpeditionScanFragment ( responseDeleteScan.observe(viewLifecycleOwner, Observer { if (it.isError){ customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ - customDialog.hide() + customDialog.dismiss() }.show() }else{ viewModel.expeditionScanList(user,password,itemPalletVO!!.Pallet) @@ -170,9 +161,9 @@ class ExpeditionScanFragment ( .setOkButton("Borrar"){ splash_progress.visibility = View.VISIBLE viewModel.expeditionScanDel(user,password,itemExpeditionScanVO.id) - customDialogTwoButtons.hide() + customDialogTwoButtons.dismiss() }.setKoButton("Cancelar"){ - customDialogTwoButtons.hide() + customDialogTwoButtons.dismiss() }.show() } @@ -206,17 +197,17 @@ class ExpeditionScanFragment ( ) }else{ customDialog.setTitle("Atención").setDescription("No ha escaneado expediciones").setOkButton("Ok"){ - customDialog.hide() + customDialog.dismiss() }.show() } - customDialogList.hide() + customDialogList.dismiss() }.setKoButton("Cerrar"){ (activity as MainActivity).hideKeyboard(customDialogList.getEditText()) listExpeditions = ArrayList() - customDialogList.hide() + customDialogList.dismiss() }.setValue("").show() customDialogList.getEditText().requestFocus() diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanViewModel.kt index d9ce2420..dd97632d 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanViewModel.kt @@ -3,12 +3,14 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.Transformations -import androidx.lifecycle.ViewModel import es.verdnatura.domain.GetPaletizadoresUserCase import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.common.Event import es.verdnatura.presentation.common.ResponseItemVO -import es.verdnatura.presentation.view.feature.paletizador.model.* +import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionScanList +import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionScanVO +import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanList +import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanVO import retrofit2.Call import retrofit2.Callback import retrofit2.Response diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/parking/fragment/ParkingFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/parking/fragment/ParkingFragment.kt index fa25a31b..6b2b058f 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/parking/fragment/ParkingFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/parking/fragment/ParkingFragment.kt @@ -74,7 +74,7 @@ class ParkingFragment : BaseFragment(Pa mperror?.start() splash_progress.visibility = View.GONE customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ - customDialog.hide() + customDialog.dismiss() }.show() }else{ numParking -= 1 diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/adapter/PreSacadorAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/adapter/PreSacadorAdapter.kt index 246e886b..4f04077c 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/adapter/PreSacadorAdapter.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/adapter/PreSacadorAdapter.kt @@ -2,7 +2,6 @@ package es.verdnatura.presentation.view.feature.presacador.adapter import android.content.Context import android.view.LayoutInflater -import android.view.View import android.view.ViewGroup import androidx.core.content.ContextCompat import androidx.recyclerview.widget.LinearLayoutManager @@ -10,10 +9,8 @@ import androidx.recyclerview.widget.RecyclerView import es.verdnatura.R import es.verdnatura.databinding.ItemArticleRowBinding import es.verdnatura.presentation.common.OnPasillerosItemClickListener -import es.verdnatura.presentation.common.OnQuantityClickListener import es.verdnatura.presentation.common.OnSaleClickListener import es.verdnatura.presentation.view.feature.collection.adapter.PlacementAdapter -import es.verdnatura.presentation.view.feature.collection.adapter.SaleAdapter import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO import es.verdnatura.presentation.view.feature.presacador.mapper.toSale import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorFragment.kt index a8e19b6c..af2e354d 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorFragment.kt @@ -14,10 +14,12 @@ import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import es.verdnatura.R import es.verdnatura.databinding.FragmentPreSacadorBinding +import es.verdnatura.domain.ConstAndValues.PRESACADOR import es.verdnatura.domain.toast import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.common.* import es.verdnatura.presentation.view.component.CustomDialog +import es.verdnatura.presentation.view.component.CustomDialogInput import es.verdnatura.presentation.view.component.CustomDialogList import es.verdnatura.presentation.view.feature.articulo.adapter.BarcodeAdapter import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO @@ -31,8 +33,6 @@ import es.verdnatura.presentation.view.feature.sacador.model.SaleVO import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.fragment_pre_sacador.* import kotlinx.android.synthetic.main.toolbar.* -import es.verdnatura.domain.ConstAndValues.PRESACADOR -import es.verdnatura.presentation.view.component.CustomDialogInput class PreSacadorFragment : BaseFragment(PreSacadorViewModel::class) { private var user = "" @@ -560,11 +560,11 @@ class PreSacadorFragment : BaseFragment = ArrayList() val iconPrint : Drawable = resources.getDrawable(R.drawable.ic_print_black_24dp,resources.newTheme()) val iconParking : Drawable = resources.getDrawable(R.drawable.ic_local_parking_black_24dp,resources.newTheme()) - val iconTransferir : Drawable = resources.getDrawable(R.drawable.ic_swap_horiz_black_24dp,resources.newTheme()) + //val iconTransferir : Drawable = resources.getDrawable(R.drawable.ic_swap_horiz_black_24dp,resources.newTheme()) listIcons.add(iconPrint) listIcons.add(iconParking) - listIcons.add(iconTransferir) + //listIcons.add(iconTransferir) toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener { override fun onOptionsItemSelected(item: Drawable) { @@ -572,8 +572,6 @@ class PreSacadorFragment : BaseFragment(SacadorViewModel::class) { @@ -84,7 +81,7 @@ class SacadorFragment : BaseFragment(Sa override fun onOptionsItemSelected(item: Drawable) { if(item == iconAdd){ splash_progress_two.visibility = View.VISIBLE - viewModel.collectionTicketGet(user,password,"",sectorFk,"1") + viewModel.collectionNew(user,password,sectorFk) } } }) @@ -106,16 +103,27 @@ class SacadorFragment : BaseFragment(Sa createCollectionList(it.list) goBack2 = false }) - collectionTicketList.observe(viewLifecycleOwner, Observer { + /* collectionTicketList.observe(viewLifecycleOwner, Observer { splash_progress_two.visibility = View.GONE if (it.isError){ customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Aceptar"){ - customDialog.hide() + customDialog.dismiss() }.show() }else{ if (!goBack)navigateToCollectionList(it) } goBack = false + })*/ + response.observe(viewLifecycleOwner, Observer { + splash_progress_two.visibility = View.GONE + if (it.isError){ + customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Aceptar"){ + customDialog.dismiss() + }.show() + }else{ + if (!goBack)addCollectionToList(it.response) + } + goBack = false }) } } @@ -132,6 +140,23 @@ class SacadorFragment : BaseFragment(Sa } + private fun addCollectionToList(collection:String){ + var isNew = true + collectionsList.forEach { + if (it.collectionFk == collection){ + isNew = false + } + } + if (isNew){ + collectionsList.add(CollectionVO(collectionFk = collection,created = "Nuevo")) + adapter?.notifyDataSetChanged() + }else{ + customDialog.setTitle("Atención").setDescription("La colección "+collection+" sigue pendiente de preparar").setOkButton("Aceptar"){ + customDialog.dismiss() + }.show() + } + } + private fun navigateToCollectionList(collection:CollectionVO){ collectionsList.add(collection) adapter?.notifyDataSetChanged() diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorViewModel.kt index 8cc2328b..0a8ded89 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorViewModel.kt @@ -5,6 +5,7 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import es.verdnatura.domain.GetSacadorControladorUserCase import es.verdnatura.presentation.base.BaseViewModel +import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.view.feature.collection.mapper.map import es.verdnatura.presentation.view.feature.sacador.mapper.toDateFormat import es.verdnatura.presentation.view.feature.sacador.model.CollectionListVO @@ -27,6 +28,10 @@ class SacadorViewModel : BaseViewModel() { val collectionTicketList: LiveData get() = _collectionTicketList + private val _response by lazy { MutableLiveData() } + val response: LiveData + get() = _response + fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String,print:String){ getSacadorControladorUserCase.collectionTicketGet(usuario,password,collectionFk,sectorFk,print).enqueue(object : @@ -47,6 +52,25 @@ class SacadorViewModel : BaseViewModel() { }) } + fun collectionNew(usuario:String,password:String,sectorFk:String){ + getSacadorControladorUserCase.collectionNew(usuario,password,sectorFk).enqueue(object : + Callback { + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!) + } + override fun onResponse( + call: Call, + response: Response + ) { + if (response.body() != null){ + _response.value = ResponseItemVO(isError = false,response = response.body()!!) + }else{ + _response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada collectionNew") + } + } + }) + } + fun collectionGet(usuario:String,password:String){ getSacadorControladorUserCase.collectionGet(usuario,password).enqueue(object : Callback> { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/model/TicketItemVO.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/model/TicketItemVO.kt index e9bfdadf..673e8f56 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/model/TicketItemVO.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/model/TicketItemVO.kt @@ -16,6 +16,7 @@ class TicketVO( var ticketFk : String = "", var level : String = "", var agencyName : String = "", + var salesPersonFk : String = "", var sales : List = listOf() ) class SaleVO( @@ -49,7 +50,8 @@ class SaleVO( var workerFk : String = "", var placements : List = listOf(), var Barcodes : List = listOf(), - var isNew : Boolean = false + var isNew : Boolean = false, + var salePersonFk : String = "" ) class PlacementVO( diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/transferencia/fragment/TransferenciaFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/transferencia/fragment/TransferenciaFragment.kt new file mode 100644 index 00000000..96383ab5 --- /dev/null +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/transferencia/fragment/TransferenciaFragment.kt @@ -0,0 +1,16 @@ +package es.verdnatura.presentation.view.feature.transferencia.fragment + +import es.verdnatura.R +import es.verdnatura.databinding.FragmentTransferenciaBinding +import es.verdnatura.presentation.base.BaseFragment + +class TransferenciaFragment : BaseFragment(TransferenciaViewModel::class) { + + companion object { + fun newInstance() = TransferenciaFragment() + } + + override fun getLayoutId(): Int = R.layout.fragment_transferencia + + +} diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/transferencia/fragment/TransferenciaViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/transferencia/fragment/TransferenciaViewModel.kt new file mode 100644 index 00000000..53861a54 --- /dev/null +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/transferencia/fragment/TransferenciaViewModel.kt @@ -0,0 +1,35 @@ +package es.verdnatura.presentation.view.feature.transferencia.fragment + +import androidx.lifecycle.LiveData +import androidx.lifecycle.MutableLiveData +import es.verdnatura.domain.GetUbicadorUserCase +import es.verdnatura.presentation.base.BaseViewModel +import es.verdnatura.presentation.common.ResponseItemVO +import retrofit2.Call +import retrofit2.Callback +import retrofit2.Response + +class TransferenciaViewModel : BaseViewModel() { + + private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase() + + private val _response by lazy { MutableLiveData() } + val response: LiveData + get() = _response + + fun itemShelvingTransfer(usuario:String,password:String,itemFk:String,shelvingFk:String){ + getUbicadorUserCase.itemShelvingTransfer(usuario,password,itemFk,shelvingFk).enqueue(object : + Callback { + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO(isError = true,errorMessage ="Error al guardar item: "+itemFk+ " Respuesta:"+t.message!!) + } + override fun onResponse(call: Call, response: Response) { + if (response.body() == null){ + _response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelvingTransfer") + }else{ + _response.value = ResponseItemVO(isError = false,response = response.body()!!) + } + } + }) + } +} diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/adapter/UbicadorAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/adapter/UbicadorAdapter.kt index cb75ae2e..1590de0f 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/adapter/UbicadorAdapter.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/adapter/UbicadorAdapter.kt @@ -58,6 +58,9 @@ class UbicadorAdapter ( moreImg.setOnClickListener { onMoreClickListener.onMoreClickListener(item) } + namelayout.setOnClickListener { + onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = "Consultar artículo"),item.item) + } } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemFragment.kt index dd17537f..14ba7df6 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemFragment.kt @@ -105,7 +105,7 @@ class AutomaticAddItemFragment( splash_progress.visibility = View.GONE if (it.isError){ customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ - customDialog.hide() + customDialog.dismiss() }.show() }else{ activity!!.onBackPressed() diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt index bff7c4d1..fddfc0dc 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt @@ -152,9 +152,9 @@ class UbicadorFragment( parking = customDialogInput.getValue() toolbar_title.text = shelvingFk.toUpperCase() + " P: "+parking + " E: "+etiquetas mpok!!.start() - customDialogInput.hide() + customDialogInput.dismiss() }.setKoButton("Cancelar"){ - customDialogInput.hide() + customDialogInput.dismiss() }.show() customDialogInput.getEditText().requestFocus() @@ -163,7 +163,7 @@ class UbicadorFragment( customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event -> if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { viewModel.shelvingPark(user,password,shelvingFk,customDialogInput.getValue()) - customDialogInput.hide() + customDialogInput.dismiss() parking = customDialogInput.getValue() toolbar_title.text = shelvingFk.toUpperCase() + " P: "+parking+ " E: "+etiquetas mpok!!.start() @@ -180,9 +180,9 @@ class UbicadorFragment( shelvingFk = customDialogInput.getValue() toolbar_title.text = shelvingFk.toUpperCase() + " P: "+parking+ " E: "+etiquetas mpok!!.start() - customDialogInput.hide() + customDialogInput.dismiss() }.setKoButton("Cancelar"){ - customDialogInput.hide() + customDialogInput.dismiss() }.show() customDialogInput.getEditText().requestFocus() @@ -191,7 +191,7 @@ class UbicadorFragment( customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event -> if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { viewModel.shelvingChange(user,password,shelvingFk,customDialogInput.getValue()) - customDialogInput.hide() + customDialogInput.dismiss() shelvingFk = customDialogInput.getValue() toolbar_title.text = shelvingFk.toUpperCase() + " P: "+parking+ " E: "+etiquetas mpok!!.start() @@ -210,9 +210,9 @@ class UbicadorFragment( it.visible = "0" } adapter!!.notifyDataSetChanged() - customDialog.hide() + customDialog.dismiss() }.setKoButton("Cancelar"){ - customDialog.hide() + customDialog.dismiss() }.show() @@ -243,36 +243,7 @@ class UbicadorFragment( },onMoreClickListener = object: OnMoreClickListener{ override fun onMoreClickListener(item: ItemUbicadorVO) { - customDialogTwoButtons.setTitle(item.item).setDescription("Selecciona una acción").setOkButton("Transferir"){ - customDialogInput.setTitle("Nueva matrícula").setDescription("Introduce el destino para item: "+item.item).setValue("").setOkButton("Transferir"){ - viewModel.itemShelvingTransfer(user,password,item.id,customDialogInput.getValue()) - listItems.remove(item) - adapter!!.notifyDataSetChanged() - customDialogInput.hide() - }.setKoButton("Cancelar"){ - customDialogInput.hide() - }.show() - customDialogInput.getEditText().requestFocus() - (activity as MainActivity).hideKeyboard(customDialogInput.getEditText()) - customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event -> - if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { - viewModel.itemShelvingTransfer(user,password,item.id,customDialogInput.getValue()) - listItems.remove(item) - adapter!!.notifyDataSetChanged() - customDialogInput.hide() - return@setOnEditorActionListener true - } - false - } - customDialogTwoButtons.hide() - }.setOkButtonTwo("Eliminar"){ - listItems.remove(item) - adapter!!.notifyDataSetChanged() - viewModel.itemShelvingDelete(user,password,item.id) - customDialogTwoButtons.hide() - }.setKoButton("Cancelar"){ - customDialogTwoButtons.hide() - }.show() + showMoreOptions(item) } }) @@ -287,7 +258,7 @@ class UbicadorFragment( if (it.isError){ mperror!!.start() customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ - customDialog.hide() + customDialog.dismiss() }.show() } }) @@ -317,7 +288,7 @@ class UbicadorFragment( } saveNewItem(customDialogUbicador.getItemValue(),customDialogUbicador.getEtiquetaValue(),customDialogUbicador.getPackingValue(),customDialogUbicador.getVisibleValue(),if (delete)packingUpdate else null) }.setKoButton("Cerrar"){ - customDialogUbicador.hide() + customDialogUbicador.dismiss() }.show() customDialogUbicador.getEditItem().requestFocus() @@ -368,7 +339,7 @@ class UbicadorFragment( customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("") customDialogUbicador.getEditItem().requestFocus() (activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem()) - customDialogUbicador.hide() + customDialogUbicador.dismiss() }else if(!itemFk.isNullOrEmpty() && !etiquetas.isNullOrEmpty()){ val visible_calc = (etiquetas.toInt() * packing.toInt()).toString() @@ -377,7 +348,7 @@ class UbicadorFragment( customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("") customDialogUbicador.getEditItem().requestFocus() (activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem()) - customDialogUbicador.hide() + customDialogUbicador.dismiss() }else{ "Rellena campos obligatorios".toast((activity as MainActivity), Toast.LENGTH_LONG) @@ -389,7 +360,7 @@ class UbicadorFragment( customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("") customDialogUbicador.getEditItem().requestFocus() (activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem()) - customDialogUbicador.hide() + customDialogUbicador.dismiss() }else if(!itemFk.isNullOrEmpty() && !etiquetas.isNullOrEmpty() && updatePacking){ val visible_calc = (etiquetas.toInt() * packing.toInt()).toString() @@ -398,7 +369,7 @@ class UbicadorFragment( customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("") customDialogUbicador.getEditItem().requestFocus() (activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem()) - customDialogUbicador.hide() + customDialogUbicador.dismiss() }else{ "Rellena campos obligatorios".toast((activity as MainActivity), Toast.LENGTH_LONG) @@ -437,4 +408,44 @@ class UbicadorFragment( listItems.add(item) adapter?.notifyDataSetChanged() } + + private fun showMoreOptions(item:ItemUbicadorVO){ + customDialogTwoButtons.setTitle(item.item).setDescription("Selecciona una acción").setOkButton("Transferir"){ + customDialogInput.setTitle("Nueva matrícula").setDescription("Introduce el destino para item: "+item.item).setValue("").setOkButton("Transferir"){ + viewModel.itemShelvingTransfer(user,password,item.id,customDialogInput.getValue()) + listItems.remove(item) + adapter!!.notifyDataSetChanged() + customDialogInput.dismiss() + }.setKoButton("Cancelar"){ + customDialogInput.dismiss() + }.show() + customDialogInput.getEditText().requestFocus() + (activity as MainActivity).hideKeyboard(customDialogInput.getEditText()) + customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event -> + if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { + viewModel.itemShelvingTransfer(user,password,item.id,customDialogInput.getValue()) + listItems.remove(item) + adapter!!.notifyDataSetChanged() + customDialogInput.dismiss() + return@setOnEditorActionListener true + } + false + } + customDialogTwoButtons.dismiss() + }.setOkButtonTwo("Eliminar"){ + customDialog.setTitle("Confirmar").setDescription("Confirmas eliminar el artículo: "+item.item+"?").setOkButton("Eliminar"){ + listItems.remove(item) + adapter!!.notifyDataSetChanged() + viewModel.itemShelvingDelete(user,password,item.id) + customDialogTwoButtons.dismiss() + customDialog.dismiss() + }.setKoButton("Cancelar"){ + customDialog.dismiss() + customDialogTwoButtons.dismiss() + }.show() + + }.setKoButton("Cancelar"){ + customDialogTwoButtons.dismiss() + }.show() + } } \ No newline at end of file diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml index 2b068d11..b49b3b0f 100644 --- a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -4,27 +4,6 @@ android:height="108dp" android:viewportWidth="108" android:viewportHeight="108"> - - - - - - - - - + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml index 07d5da9c..369dd5c0 100644 --- a/app/src/main/res/drawable/ic_launcher_background.xml +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -5,166 +5,7 @@ android:viewportWidth="108" android:viewportHeight="108"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/app/src/main/res/drawable/ic_spa_black_launcher.xml b/app/src/main/res/drawable/ic_spa_black_launcher.xml new file mode 100644 index 00000000..25f34b08 --- /dev/null +++ b/app/src/main/res/drawable/ic_spa_black_launcher.xml @@ -0,0 +1,6 @@ + + + + diff --git a/app/src/main/res/layout/fragment_transferencia.xml b/app/src/main/res/layout/fragment_transferencia.xml new file mode 100644 index 00000000..d327448f --- /dev/null +++ b/app/src/main/res/layout/fragment_transferencia.xml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +