diff --git a/.idea/misc.xml b/.idea/misc.xml index 40015792..cfa598f9 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -73,6 +73,7 @@ + diff --git a/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt index 65a598b6..3e44e660 100644 --- a/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt @@ -89,18 +89,18 @@ 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{ - 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 -{ - return salixClient!!.sendGroup( - content_type = "application/json", - authorization = token, - params = SalixGrupo(to = "#android-test", message = message) - ) -}*/ + /* 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 + { + return salixClient!!.sendGroup( + content_type = "application/json", + authorization = token, + params = SalixGrupo(to = "#android-test", message = message) + ) + } fun checkVersion(usuario: String, password: String, nameApp: String): Call { diff --git a/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt index 7122c32c..9e4de291 100644 --- a/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt @@ -32,7 +32,8 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) { quantity: String, packing: String, warehouse: String, - level: String + level: String, + grouping:String ): Call { val params: ArrayList = ArrayList() params.add(shelving) @@ -42,6 +43,7 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) { params.add(packing) params.add(warehouse) params.add(level) + params.add(grouping) return restClient!!.itemShelvingMake( "json", "1", @@ -62,7 +64,9 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) { packing: String, warehouse: String, level: String, - itemShelvingFk: String + itemShelvingFk: String, + grouping:String + ): Call { val params: ArrayList = ArrayList() params.add(shelving) @@ -73,6 +77,7 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) { params.add(warehouse) params.add(level) params.add(itemShelvingFk) + params.add(grouping) return restClient!!.itemShelvingMakeEdit( "json", "1", diff --git a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt index d6414109..d20e9e7d 100644 --- a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt +++ b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt @@ -167,7 +167,7 @@ interface VerdnaturaService { ): Call - @POST("almacennew/collectionTicketGet")//REVISADA + /* @POST("almacennew/collectionTicketGet")//REVISADA-ANULADA POT collection_getTickets fun collectionTicketGet( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -176,7 +176,7 @@ interface VerdnaturaService { @Header("Content-Type") content_type: String, @Body params: List ): - Call + Call*/ @POST("almacennew/ticketOrCollection_checkFullyControlled")//REVISADA fun ticketOrCollection_checkFullyControlled( diff --git a/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogUbicador.kt b/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogUbicador.kt index d878c07c..34e5be3d 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogUbicador.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogUbicador.kt @@ -57,6 +57,15 @@ class CustomDialogUbicador (context: Context) : Dialog(context, R.style.DialogT return this } + fun setGroupingValue(value:String):CustomDialogUbicador{ + custom_dialog_grouping.setText(value) + custom_dialog_grouping.visibility = View.VISIBLE + return this + } + fun getGroupingValue() : String{ + return custom_dialog_grouping.text.toString() + } + fun getPackingValue() : String{ return custom_dialog_packing.text.toString() } 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 c62391ba..6e09bd02 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 @@ -1,14 +1,13 @@ package es.verdnatura.presentation.view.feature.collection.fragment -import android.app.KeyguardManager import android.content.Context import android.content.SharedPreferences import android.graphics.drawable.Drawable import android.media.MediaPlayer import android.os.Bundle import android.speech.SpeechRecognizer -import android.text.InputType import android.util.Log +import android.util.Log.d import android.view.View import android.view.inputmethod.EditorInfo import android.view.inputmethod.InputMethodManager @@ -145,7 +144,7 @@ class CollectionFragment( customDialogThreeButtons = CustomDialogThreeButtons(requireContext()) requireActivity().main_bottom_navigation.visibility = View.GONE if (splash_progress != null) splash_progress.visibility = View.VISIBLE - //toolbar_title.text = "collectionTicket_get" + @@ -462,15 +461,19 @@ class CollectionFragment( sales = salesList.sortedWith(compareBy({it.saleOrder})) - /* for (s in sales) + /* for (s in sales) { Log.i("VERDNATURA:","La sale del ticket ${s.ticketFk} es ${s.saleOrder}") for (p in s.placements){ Log.i("VERDNATURA:","La sale del ticket ${s.saleOrder} es ${p.placement}") + //s.placements=s.placements.sortedBy { it.saleOrder}.sortedBy { !it.visible.equals("0") } + s.placements=s.placements.sortedBy { !it.visible.equals("0") } // Log.i("VERDNATURA:","La sale del ticket ${s.saleOrder} es saleorder ${p.saleOrder}") } - }ticket_checkFullyControlled - for (s in salesList) + }*/ + + + /*for (s in salesList) { Log.i("VERDNATURA:","La sale del ticket ${s.ticketFk} es ${s.saleOrder}") for (p in s.placements){ @@ -480,6 +483,9 @@ class CollectionFragment( }*/ //pruebas sergio // sales = salesList.sortedWith(compareBy({it.placements.get(0).created})) + // SalesSorter() + + saleAdapter = SaleAdapter(sales, pasillerosItemClickListener!!, object : OnQuantityClickListener { @@ -946,6 +952,7 @@ class CollectionFragment( "cantidad introducida erronea".toast(requireContext()) } + } else { "Escanea item para validar".toast(requireContext()) } @@ -994,6 +1001,7 @@ class CollectionFragment( mpok?.start() ReviewQuantityForRefreshingAndSorting(customDialogList.getValue().toInt(),sales[storedPosition].quantity.toInt(), sales[storedPosition].pickedQuantity.toInt()) + // SalesSorter(sales) customDialogList.dismiss() } else { @@ -1055,18 +1063,47 @@ class CollectionFragment( quantityPicked: Int ) { - /* Log.i("VERDNATURA::","Entramos") - Log.i("VERDNATURA::","Picking"+quantityPicking) + /* Log.i("VERDNATURA::","Picking"+quantityPicking) Log.i("VERDNATURA::","Total"+quantityTotal) Log.i("VERDNATURA::","Now picked"+quantityPicked)*/ if (quantityPicked= 0 && sales.size > storedPosition) { 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 c183de91..065573b7 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 @@ -104,7 +104,7 @@ class UbicadorFragment( toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener { override fun onOptionsItemSelected(item: Drawable) { if (item == iconAdd){ - showAddItem("","","","",false,ItemUbicadorVO()) + showAddItem("","","","",false,ItemUbicadorVO(),"") }else if(item == iconReload){ splash_progress.visibility = View.VISIBLE viewModel.itemShelvingList(user,password,shelvingFk,"itemShelvingList") @@ -262,10 +262,12 @@ class UbicadorFragment( if(it.list.size > 0) edit_prioridad.setText(it.list[0].priority) splash_progress.visibility = View.GONE + + //sergio: para mostrar CustomDialogUbicator, ubicador con grouping adapter = UbicadorAdapter(listItems,onPasillerosItemClickListener = pasillerosItemClickListener!!, onVisibleClickListener = object: OnVisibleClickListener{ override fun onVisibleClickListener(item: ItemUbicadorVO) { - showAddItem(item.item,item.packing,item.stickers,item.visible,true,item) + showAddItem(item.item,item.packing,item.stickers,item.visible,true,item,item.grouping) } },onMoreClickListener = object: OnMoreClickListener{ @@ -300,15 +302,15 @@ class UbicadorFragment( } } - private fun showAddItem(itemFk:String,packing: String,etiquetas: String,visible: String, delete:Boolean,itemUbicador:ItemUbicadorVO){ + private fun showAddItem(itemFk:String,packing: String,etiquetas: String,visible: String, delete:Boolean,itemUbicador:ItemUbicadorVO,grouping:String){ var title = "Nuevo Item" if (delete) title = "Editar item "+itemFk - customDialogUbicador.setTitle(title).setItemValue(itemFk).setPackingValue(packing).setEtiquetaValue(etiquetas).setVisibleValue(visible).setOkButton("Guardar"){ + customDialogUbicador.setTitle(title).setItemValue(itemFk).setPackingValue(packing).setGroupingValue(grouping).setEtiquetaValue(etiquetas).setVisibleValue(visible).setOkButton("Guardar"){ var packingUpdate = false if (packing != customDialogUbicador.getPackingValue() || etiquetas != customDialogUbicador.getEtiquetaValue()){ packingUpdate = true } - saveNewItem(customDialogUbicador.getItemValue(),customDialogUbicador.getEtiquetaValue(),customDialogUbicador.getPackingValue(),customDialogUbicador.getVisibleValue(),if (delete)packingUpdate else null,itemUbicador.id) + saveNewItem(customDialogUbicador.getItemValue(),customDialogUbicador.getEtiquetaValue(),customDialogUbicador.getPackingValue(),customDialogUbicador.getVisibleValue(),if (delete)packingUpdate else null,itemUbicador.id,customDialogUbicador.getGroupingValue()) }.setKoButton("Cerrar"){ customDialogUbicador.dismiss() }.show() @@ -322,7 +324,7 @@ class UbicadorFragment( if (packing != customDialogUbicador.getPackingValue() || etiquetas != customDialogUbicador.getEtiquetaValue()){ packingUpdate = true } - saveNewItem(customDialogUbicador.getItemValue(),customDialogUbicador.getEtiquetaValue(),customDialogUbicador.getPackingValue(),customDialogUbicador.getVisibleValue(),if (delete)packingUpdate else null,itemUbicador.id) + saveNewItem(customDialogUbicador.getItemValue(),customDialogUbicador.getEtiquetaValue(),customDialogUbicador.getPackingValue(),customDialogUbicador.getVisibleValue(),if (delete)packingUpdate else null,itemUbicador.id,customDialogUbicador.getGroupingValue()) return@setOnEditorActionListener true } false @@ -334,7 +336,7 @@ class UbicadorFragment( if (packing != customDialogUbicador.getPackingValue() || etiquetas != customDialogUbicador.getEtiquetaValue()){ packingUpdate = true } - saveNewItem(customDialogUbicador.getItemValue(),customDialogUbicador.getEtiquetaValue(),customDialogUbicador.getPackingValue(),customDialogUbicador.getVisibleValue(),if (delete)packingUpdate else null,itemUbicador.id) + saveNewItem(customDialogUbicador.getItemValue(),customDialogUbicador.getEtiquetaValue(),customDialogUbicador.getPackingValue(),customDialogUbicador.getVisibleValue(),if (delete)packingUpdate else null,itemUbicador.id,customDialogUbicador.getGroupingValue()) return@setOnEditorActionListener true } false @@ -342,22 +344,22 @@ class UbicadorFragment( } - private fun saveNewItem(itemFk:String,etiquetas:String,packing:String,visible:String,updatePacking:Boolean? = null,itemShelvingFk:String){ + private fun saveNewItem(itemFk:String,etiquetas:String,packing:String,visible:String,updatePacking:Boolean? = null,itemShelvingFk:String,groupingPack:String){ if (!packing.isNullOrEmpty()){ if (updatePacking == null){ if (!itemFk.isNullOrEmpty() && !visible.isNullOrEmpty()){ - viewModel.itemShelvingMake(user,password,shelvingFk,itemFk,deep.toString(),visible,packing,warehouseFk,"1","itemShelvingMake") + viewModel.itemShelvingMake(user,password,shelvingFk,itemFk,deep.toString(),visible,packing,warehouseFk,"1","itemShelvingMake",groupingPack) changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible,packing = packing)) - customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("") + customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("").setEtiquetaValue("").setVisibleValue("") customDialogUbicador.getEditItem().requestFocus() (activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem()) customDialogUbicador.dismiss() }else if(!itemFk.isNullOrEmpty() && !etiquetas.isNullOrEmpty()){ val visible_calc = (etiquetas.toInt() * packing.toInt()).toString() - viewModel.itemShelvingMake(user,password,shelvingFk,itemFk,deep.toString(),visible_calc,packing,warehouseFk,"1","itemShelvingMake") + viewModel.itemShelvingMake(user,password,shelvingFk,itemFk,deep.toString(),visible_calc,packing,warehouseFk,"1","itemShelvingMake",groupingPack) changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible_calc,packing = packing,stickers = etiquetas)) - customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("") + customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("").setEtiquetaValue("").setVisibleValue("") customDialogUbicador.getEditItem().requestFocus() (activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem()) customDialogUbicador.dismiss() @@ -367,9 +369,9 @@ class UbicadorFragment( } }else{ if (!itemFk.isNullOrEmpty() && !visible.isNullOrEmpty() && !updatePacking){ - viewModel.itemShelvingMakeEdit(user,password,shelvingFk,itemFk,deep.toString(),visible,packing,warehouseFk,"1",itemShelvingFk,"itemShelvingMakeEdit") + viewModel.itemShelvingMakeEdit(user,password,shelvingFk,itemFk,deep.toString(),visible,packing,warehouseFk,"1",itemShelvingFk,"itemShelvingMakeEdit",groupingPack) changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible,packing = packing)) - customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("") + customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("").setEtiquetaValue("").setVisibleValue("") customDialogUbicador.getEditItem().requestFocus() (activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem()) customDialogUbicador.dismiss() @@ -379,9 +381,9 @@ class UbicadorFragment( 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,"itemShelvingMakeEdit") + viewModel.itemShelvingMakeEdit(user,password,shelvingFk,itemFk,deep.toString(),visible_calc,packing,warehouseFk,"1",itemShelvingFk,"itemShelvingMakeEdit",groupingPack) changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible_calc,packing = packing,stickers = etiquetas)) - customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("") + customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("").setEtiquetaValue("").setVisibleValue("") customDialogUbicador.getEditItem().requestFocus() (activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem()) customDialogUbicador.dismiss() @@ -396,7 +398,7 @@ class UbicadorFragment( } } - private fun editItem(itemFk:String,etiquetas:String,packing:String,visible:String){ + /* private fun editItem(itemFk:String,etiquetas:String,packing:String,visible:String){ if (!packing.isNullOrEmpty()){ if (!itemFk.isNullOrEmpty() && !visible.isNullOrEmpty()){ viewModel.itemShelvingMake(user,password,shelvingFk,itemFk,deep.toString(),visible,packing,warehouseFk,"1","itemShelvingMake") @@ -417,7 +419,7 @@ class UbicadorFragment( }else{ "Packing obligatorio".toast((activity as MainActivity), Toast.LENGTH_LONG) } - } + }*/ private fun changeOfflineValue(item:ItemUbicadorVO){ if (splash_progress != null) splash_progress.visibility = View.VISIBLE diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt index 36a0a493..6ae2c277 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt @@ -79,8 +79,8 @@ class UbicadorViewModel(context: Context) : BaseViewModel() { } - fun itemShelvingMake(usuario:String,password:String,shelving:String,item:String,deep:String,quantity:String,packing:String,warehouse:String,level:String,callFunction:String){ - getUbicadorUserCase.itemShelvingMake(usuario,password,shelving,item,deep,quantity,packing,warehouse,level).enqueue(object : Callback{ + fun itemShelvingMake(usuario:String,password:String,shelving:String,item:String,deep:String,quantity:String,packing:String,warehouse:String,level:String,callFunction:String,grouping: String){ + getUbicadorUserCase.itemShelvingMake(usuario,password,shelving,item,deep,quantity,packing,warehouse,level,grouping).enqueue(object : Callback{ override fun onFailure(call: Call, t: Throwable) { _responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!)) } @@ -97,8 +97,8 @@ class UbicadorViewModel(context: Context) : BaseViewModel() { }) } - fun itemShelvingMakeEdit(usuario:String,password:String,shelving:String,item:String,deep:String,quantity:String,packing:String,warehouse:String,level:String,itemShelvingFk:String,callFunction:String){ - getUbicadorUserCase.itemShelvingMakeEdit(usuario,password,shelving,item,deep,quantity,packing,warehouse,level,itemShelvingFk).enqueue(object : Callback{ + fun itemShelvingMakeEdit(usuario:String,password:String,shelving:String,item:String,deep:String,quantity:String,packing:String,warehouse:String,level:String,itemShelvingFk:String,callFunction:String,grouping:String){ + getUbicadorUserCase.itemShelvingMakeEdit(usuario,password,shelving,item,deep,quantity,packing,warehouse,level,itemShelvingFk,grouping).enqueue(object : Callback{ override fun onFailure(call: Call, t: Throwable) { _responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!)) } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/model/ItemUbicadorVO.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/model/ItemUbicadorVO.kt index 9ee2978e..37b0bdd6 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/model/ItemUbicadorVO.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/model/ItemUbicadorVO.kt @@ -6,6 +6,7 @@ class ItemUbicadorVO ( var visible:String = "", var stickers:String = "", var packing:String = "", + var grouping:String = "", var col:String = "", var row:String = "", var code:String = "", diff --git a/app/src/main/res/layout/component_custom_ubicador_dialog.xml b/app/src/main/res/layout/component_custom_ubicador_dialog.xml index 9fa0ef61..ddd6895c 100644 --- a/app/src/main/res/layout/component_custom_ubicador_dialog.xml +++ b/app/src/main/res/layout/component_custom_ubicador_dialog.xml @@ -33,8 +33,8 @@ android:id="@+id/textinputlayout_item" android:layout_width="match_parent" android:layout_height="wrap_content" - android:textColorHint="@android:color/darker_gray" - android:layout_marginTop="@dimen/default_layout_margin"> + android:layout_marginTop="@dimen/default_layout_margin" + android:textColorHint="@android:color/darker_gray"> - + android:orientation="horizontal"> - - + + + + + + + + + + + + + android:textColorHint="@android:color/darker_gray"> + android:textColorHint="@android:color/darker_gray">