diff --git a/.idea/workspace.xml b/.idea/workspace.xml index bfebb87f..daac0a27 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -83,20 +83,47 @@ - - + + + + + + + - + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + - - @@ -295,11 +323,11 @@ + + - - @@ -409,27 +437,6 @@ @@ -853,10 +881,6 @@ - - - - file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt - 313 - - - file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapter.kt - 353 - - - file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPicker.kt - 125 - - - diff --git a/app/beta/release/output-metadata.json b/app/beta/release/output-metadata.json index d5bfa4fe..428f09e6 100644 --- a/app/beta/release/output-metadata.json +++ b/app/beta/release/output-metadata.json @@ -11,8 +11,8 @@ "type": "SINGLE", "filters": [], "attributes": [], - "versionCode": 180, - "versionName": "23.14Beta", + "versionCode": 183, + "versionName": "23.18.2Beta", "outputFile": "app-beta-release.apk" } ], diff --git a/app/build.gradle b/app/build.gradle index 3fd888ea..9d08856e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,8 +13,8 @@ android { applicationId "es.verdnatura" minSdkVersion 24 //21 targetSdkVersion 33 - versionCode 180 - versionName = "23.14Beta" + versionCode 184 + versionName = "23.18.2Beta" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/es/verdnatura/domain/RestClient.kt b/app/src/main/java/es/verdnatura/domain/RestClient.kt index 68dc0e31..e2354bc5 100644 --- a/app/src/main/java/es/verdnatura/domain/RestClient.kt +++ b/app/src/main/java/es/verdnatura/domain/RestClient.kt @@ -5,11 +5,9 @@ import android.content.Context open class RestClient(context: Context) { var restClient: VerdnaturaService var salixClient: SalixService - var salixClientSend:SalixServiceSend init { restClient = ApiUtils.getApiService(context) salixClient = ApiSalixUtils.getApiService(context) - salixClientSend = ApiSalixUtilsSend.getApiService(context) } } \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/domain/SalixService.kt b/app/src/main/java/es/verdnatura/domain/SalixService.kt index 67a6f29d..90aaf5af 100644 --- a/app/src/main/java/es/verdnatura/domain/SalixService.kt +++ b/app/src/main/java/es/verdnatura/domain/SalixService.kt @@ -25,7 +25,7 @@ interface SalixService { ): Call - @POST("chats/sendCheckingPresence") + /* @POST("chats/sendCheckingPresence") fun sendChekingPresence( @Body params: SalixMessageVO ): @@ -35,7 +35,7 @@ interface SalixService { fun sendGroup( @Body params: SalixGrupo ): - Call + Call*/ @GET("collections/getSectors") fun getSectorsSalix( diff --git a/app/src/main/java/es/verdnatura/domain/SalixServiceMessages.kt b/app/src/main/java/es/verdnatura/domain/SalixServiceMessages.kt deleted file mode 100644 index 730eb97b..00000000 --- a/app/src/main/java/es/verdnatura/domain/SalixServiceMessages.kt +++ /dev/null @@ -1,18 +0,0 @@ -package es.verdnatura.domain - -import es.verdnatura.presentation.view.feature.login.model.SalixMessageVO -import retrofit2.Call -import retrofit2.http.Body -import retrofit2.http.Header -import retrofit2.http.POST - -interface SalixServiceMessages { - - @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 eeecdd1f..abb15a4b 100644 --- a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt +++ b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt @@ -11,9 +11,7 @@ import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO import es.verdnatura.presentation.view.feature.calidad.model.ItemBuyerVO import es.verdnatura.presentation.view.feature.collection.SalesModified -import es.verdnatura.presentation.view.feature.delivery.model.DeliveryInfo -import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLog -import es.verdnatura.presentation.view.feature.delivery.model.RouteDelivery +import es.verdnatura.presentation.view.feature.delivery.model.* import es.verdnatura.presentation.view.feature.diadeventa.model.ItemShelvingSaleDate import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO import es.verdnatura.presentation.view.feature.historicoshelving.model.ItemShelvingLog @@ -38,6 +36,7 @@ import retrofit2.http.Body import retrofit2.http.Header import retrofit2.http.POST + @JvmSuppressWildcards interface VerdnaturaService { @@ -849,7 +848,7 @@ interface VerdnaturaService { @POST("delivery/expeditionState_add")//NO SALIX fun expeditionState_add( - @Body vararg params: Any + @Body vararg params: Any? ): Call @@ -859,5 +858,9 @@ interface VerdnaturaService { ): Call> + @POST("/delivery/getExpeditionFromRoute") + fun getExpeditionFromRoute( + @Body vararg params: Any + ): Call> } \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt b/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt index 5c19b7f5..06640f10 100644 --- a/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt @@ -228,6 +228,7 @@ abstract class BaseFragment(viewModelCla R.drawable.ic_collection -> getString(R.string.icViewCollection) R.drawable.ic_ubicator_check -> getString(R.string.checkerUbication) R.drawable.ic_delivery_truck ->"Abre la app de Reparto para escanear carga" + R.drawable.ic_confirm ->getString(R.string.confirmDescription) else -> { "" } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/category/ChangeCategoryFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/category/ChangeCategoryFragment.kt index 82f6ddd9..444a78d1 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/category/ChangeCategoryFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/category/ChangeCategoryFragment.kt @@ -18,7 +18,7 @@ import es.verdnatura.presentation.view.feature.packingHolland.fragment.PackingHo ) { override fun getLayoutId(): Int = R.layout.fragment_general_black - private var shelvingScaned: Int = 0 + private var itemScaned: Int = 0 private lateinit var customDialogInput: CustomDialogInput companion object { @@ -29,6 +29,7 @@ import es.verdnatura.presentation.view.feature.packingHolland.fragment.PackingHo customDialogInput = CustomDialogInput(requireContext()) binding.mainToolbar.toolbarTitle.text = entrypoint + binding.scanInput.hint = "Escanear item" binding.splashProgress.visibility = View.GONE binding.scanInput.visibility = View.VISIBLE setEvents() @@ -56,7 +57,7 @@ import es.verdnatura.presentation.view.feature.packingHolland.fragment.PackingHo "more" ).toString() ) - shelvingScaned = binding.scanInput.text.toString().toInt() + itemScaned = binding.scanInput.text.toString().toInt() showQuantityPacking() } catch (ex: Exception) { ex.message!!.toast(requireActivity()) @@ -92,7 +93,7 @@ import es.verdnatura.presentation.view.feature.packingHolland.fragment.PackingHo customDialogInput.setTitle(getString(R.string.titleChangeCategory)) - customDialogInput.setDescription(getString(R.string.ubication) + shelvingScaned) + customDialogInput.setDescription(getString(R.string.ubication) + itemScaned) .setValue("") .setOkButton(getString(R.string.modify)) { @@ -112,7 +113,8 @@ import es.verdnatura.presentation.view.feature.packingHolland.fragment.PackingHo if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) { if (customDialogInput.getValue().isNotEmpty()) { - callPacking(customDialogInput.getValue()) + //callPacking(customDialogInput.getValue()) + getNewPrice(customDialogInput.getValue(), itemScaned, 5.51) } return@setOnEditorActionListener true @@ -121,15 +123,52 @@ import es.verdnatura.presentation.view.feature.packingHolland.fragment.PackingHo } customDialogInput.setFocusText() + ma.hideKeyboard(customDialogInput.getEditText()) + } + + private fun getNewPrice(shelving:String,item:Int,price:Double) { + customDialogInput.setTitle(getString(R.string.titleChangeCategory)) + customDialogInput.setDescription(getString(R.string.itemChangePrice) + item + "-" + "Matrícula:"+shelving) + .setValue(price.toString()) + .setOkButton(getString(R.string.modify)) { + + if (customDialogInput.getValue().isNotEmpty() + ) { + callPacking(customDialogInput.getValue()) + } + + + }.setKoButton(getString(R.string.cancel)) { + customDialogInput.dismiss() + }.show() + + //ma.hideKeyboard(customDialogInput.getEditText()) + + customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ -> + if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) { + + if (customDialogInput.getValue().isNotEmpty()) { + //callPacking(customDialogInput.getValue()) + //getNewPrice(customDialogInput.getValue().toInt(), 5.51) + } + + return@setOnEditorActionListener true + } + false + } + + customDialogInput.setFocusText() + ma.hideKeyboard(customDialogInput.getEditText()) + } private fun callPacking(value: String) { try { - binding.splashProgress.visibility = View.VISIBLE - viewModel.travel_updatePacking( + // binding.splashProgress.visibility = View.VISIBLE + /* viewModel.travel_updatePacking( itemFk = shelvingScaned, packingFk = value.toInt() - ) + )*/ } catch (ex: Exception) { getString(R.string.errorInput).toast(requireActivity()) 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 354b9eae..a8eb40b2 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 @@ -29,8 +29,7 @@ class SaleAdapter( private val onPackingClick: onPackingClickListener, private var onTicketClick: OnTicketClickListener? = null, private var SaleAdapter: SaleAdapter? = null, - private var type: String? = null - + private var type: String? = null, ) : RecyclerView.Adapter() { var context: Context? = null 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 f513628f..ccba8f07 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 @@ -607,12 +607,12 @@ class CollectionFragment( if (!goBack) { - sendSalixMessage( + /* sendSalixMessage( item = dataMessageSalix.item, ticketFk = dataMessageSalix.ticket, quantity = dataMessageSalix.quantity, salePerson = dataMessageSalix.personSale - ) + )*/ viewModel.collectionTicketGet( collection.collectionFk, getDataInt(SECTORFK), @@ -1027,7 +1027,7 @@ class CollectionFragment( } } - private fun responseSaleMoveSuccesful() { + /* private fun responseSaleMoveSuccesful() { sales[positionCollectionSplit].quantity = quantityCollectionSplit if (quantityCollectionSplit == 0) @@ -1041,7 +1041,7 @@ class CollectionFragment( sendSalixMessageNew(message, sales[positionCollectionSplit].salePersonFk) - } + }*/ private fun callPicker(extensionNumber: String) { @@ -1070,7 +1070,7 @@ class CollectionFragment( return salePerson } - private fun sendSalixMessage( + /* private fun sendSalixMessage( item: String, ticketFk: Int, quantity: String, @@ -1085,7 +1085,7 @@ class CollectionFragment( workerId = salePerson, message = message ) - } + }*/ //CREATE LIST private fun createCollectionList() { @@ -1197,7 +1197,7 @@ class CollectionFragment( var entryPoint = Gson().toJson( mutableMapOf( "entryPoint" to sale.ticketFk, - "web" to "https://salix.verdnatura.es/#!/ticket/${sale.ticketFk}/sale" + "web" to "${getData("base_urlSalix")}/#!/ticket/${sale.ticketFk}/sale" ) ) ma.onPasillerosItemClickListener( @@ -2192,60 +2192,6 @@ class CollectionFragment( } -/* private fun showDisponibility() { - - customDialogInput.setTitle(getString(R.string.Verdisponible)) - .setDescription(getString(R.string.Escaneaetiqueta)) - .setOkButton(getString(R.string.Buscar)) { - try { - if (binding.splashProgress != null) { - binding.splashProgress.visibility = View.VISIBLE - } - - } catch (e: Exception) { - } - - hideKeyboards() - viewModel.itemGetAvailable( - usuario = user, - password = password, - itemFk = customDialogInput.getValue(), - warehouseFk = warehouseFk, - "item_GetVisibleAvailable" - ) - scanRequest() - customDialogInput.dismiss() - - }.setKoButton(getString(R.string.cancel)) { - if (binding.splashProgress != null) { - binding.splashProgress.visibility = View.GONE - } - hideKeyboards() - scanRequest() - customDialogInput.dismiss() - }.setValue("").show() - customDialogInput.getEditText().requestFocus() - customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event -> - if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { - if (!customDialogInput.getValue().isNullOrEmpty()) { - if (binding.splashProgress != null) binding.splashProgress.visibility = View.VISIBLE - viewModel.itemGetAvailable( - usuario = user, - password = password, - itemFk = customDialogInput.getValue(), - warehouseFk = warehouseFk - ,"item_GetVisibleAvailable") - } - customDialogInput.setValue("") - scanRequest() - customDialogInput.dismiss() - hideKeyboards() - return@setOnEditorActionListener true - } - false - } - }*/ - private fun toastDisponibility(item: ItemVO) { if (item.available.isNullOrEmpty()) { item.available = "0" @@ -2296,9 +2242,10 @@ class CollectionFragment( getString(R.string.Coleccióncompleta).toast(this.context, Toast.LENGTH_SHORT) saleAdapter!!.notifyDataSetChanged() - if (!goBack) + // Se quita de la app + /* if (!goBack) ticketCollection_setUsedShelves() - goBack = false + goBack = false*/ changeTicketState() @@ -2590,7 +2537,7 @@ class CollectionFragment( saleAdapter!!.notifyDataSetChanged() - val ticket = + /*val ticket = "[" + sales[positionCollectionMissing].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionCollectionMissing].ticketFk + "/summary)" @@ -2611,7 +2558,7 @@ class CollectionFragment( "Se ha modificado la cantidad de " + sales[positionCollectionMissing].originalQuantity + " del artículo " + sales[positionCollectionMissing].itemFk + " a nueva cantidad: " + sales[positionCollectionMissing].quantity + " del ticket " + ticket } - } + }*/ //sergio:ahora desde encajado // sendSalixMessageNew(message, sales[positionCollectionMissing].salePersonFk) @@ -2639,11 +2586,11 @@ class CollectionFragment( saleAdapter?.notifyDataSetChanged() //enviar mensaje a salix - val ticket = + /* val ticket = "[" + sales[positionIncreaseQuantity].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionIncreaseQuantity].ticketFk + "/summary)" val message = "Se ha modificado la cantidad original " + sales[positionIncreaseQuantity].originalQuantity + " del artículo " + sales[positionIncreaseQuantity].itemFk + " a nueva cantidad: " + sales[positionIncreaseQuantity].quantity + " del ticket " + ticket - +*/ //sergio: ahora desde encajadores // sendSalixMessageNew(message, sales[positionIncreaseQuantity].salePersonFk) @@ -2652,6 +2599,7 @@ class CollectionFragment( } +/* private fun sendSalixMessageNew(message: String, workerId: String) { viewModel.sendChekingPresence( @@ -2660,6 +2608,7 @@ class CollectionFragment( ) } +*/ private fun increaseQuantity(position: Int, quantity: Int) { positionIncreaseQuantity = position diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPicker.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPicker.kt index 08616a0c..b71e4967 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPicker.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPicker.kt @@ -605,12 +605,12 @@ import org.json.JSONObject if (!goBack) { - sendSalixMessage( + /* sendSalixMessage( item = dataMessageSalix.item, ticketFk = dataMessageSalix.ticket, quantity = dataMessageSalix.quantity, salePerson = dataMessageSalix.personSale - ) + )*/ viewModel.collectionTicketGet( collection.collectionFk, getDataInt(SECTORFK), @@ -1032,12 +1032,12 @@ import org.json.JSONObject markLine(positionCollectionSplit, type) saleAdapter!!.notifyDataSetChanged() - val ticket = + /* val ticket = "[" + sales[positionCollectionSplit].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionCollectionSplit].ticketFk + "/summary)" val message = getString(R.string.splitSent) + sales[positionCollectionSplit].itemFk + getString(R.string.fromTicket) + ticket - sendSalixMessageNew(message, sales[positionCollectionSplit].salePersonFk) + sendSalixMessageNew(message, sales[positionCollectionSplit].salePersonFk)*/ } @@ -1068,7 +1068,7 @@ import org.json.JSONObject return salePerson } - private fun sendSalixMessage( + /* private fun sendSalixMessage( item: String, ticketFk: Int, quantity: String, @@ -1084,7 +1084,7 @@ import org.json.JSONObject workerId = salePerson, message = message ) - } + }*/ //CREATE LIST private fun createCollectionList() { @@ -1196,7 +1196,7 @@ import org.json.JSONObject var entryPoint = Gson().toJson( mutableMapOf( "entryPoint" to sale.ticketFk, - "web" to "https://salix.verdnatura.es/#!/ticket/${sale.ticketFk}/sale" + "web" to "${getData("base_urlSalix")}/#!/ticket/${sale.ticketFk}/sale" ) ) ma.onPasillerosItemClickListener( @@ -1666,7 +1666,7 @@ import org.json.JSONObject private fun unMarkLine(position: Int, newType: String) { state = 0 - if (sales[position].isPrepared == "1") { + if ((sales[position].isPrepared == "1") || (sales[position].quantity!! > 0)) { customDialog.setTitle(getString(R.string.unmarkLine)) .setDescription(getString(R.string.goUnmark) + sales[position].itemFk + getString( R.string.sure)) @@ -2635,7 +2635,7 @@ import org.json.JSONObject } saleAdapter!!.notifyDataSetChanged() - +/* val ticket = "[" + sales[positionCollectionMissing].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionCollectionMissing].ticketFk + "/summary)" @@ -2657,7 +2657,7 @@ import org.json.JSONObject "Se ha modificado la cantidad de " + sales[positionCollectionMissing].originalQuantity + " del artículo " + sales[positionCollectionMissing].itemFk + " a nueva cantidad: " + sales[positionCollectionMissing].quantity + " del ticket " + ticket } - } + }*/ //sergio:ahora desde encajado // sendSalixMessageNew(message, sales[positionCollectionMissing].salePersonFk) @@ -2685,11 +2685,11 @@ import org.json.JSONObject saleAdapter?.notifyDataSetChanged() //enviar mensaje a salix - val ticket = + /* val ticket = "[" + sales[positionIncreaseQuantity].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionIncreaseQuantity].ticketFk + "/summary)" val message = "Se ha modificado la cantidad original " + sales[positionIncreaseQuantity].originalQuantity + " del artículo " + sales[positionIncreaseQuantity].itemFk + " a nueva cantidad: " + sales[positionIncreaseQuantity].quantity + " del ticket " + ticket - +*/ //sergio: ahora desde encajadores // sendSalixMessageNew(message, sales[positionIncreaseQuantity].salePersonFk) @@ -2698,14 +2698,14 @@ import org.json.JSONObject } - private fun sendSalixMessageNew(message: String, workerId: String) { + /* private fun sendSalixMessageNew(message: String, workerId: String) { viewModel.sendChekingPresence( workerId = workerId, message = message ) - } + }*/ private fun increaseQuantity(position: Int, quantity: Int) { positionIncreaseQuantity = position diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPreChecker.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPreChecker.kt index d630acac..6ac695e2 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPreChecker.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPreChecker.kt @@ -626,12 +626,12 @@ class CollectionFragmentPreChecker( if (!goBack) { - sendSalixMessage( + /* sendSalixMessage( item = dataMessageSalix.item, ticketFk = dataMessageSalix.ticket, quantity = dataMessageSalix.quantity, salePerson = dataMessageSalix.personSale - ) + )*/ viewModel.collectionTicketGet( collection.collectionFk, getDataInt(SECTORFK), @@ -1053,12 +1053,12 @@ class CollectionFragmentPreChecker( markLine(positionCollectionSplit, type) saleAdapter!!.notifyDataSetChanged() - val ticket = + /* val ticket = "[" + sales[positionCollectionSplit].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionCollectionSplit].ticketFk + "/summary)" val message = getString(R.string.splitSent) + sales[positionCollectionSplit].itemFk + getString(R.string.fromTicket) + ticket - sendSalixMessageNew(message, sales[positionCollectionSplit].salePersonFk) + sendSalixMessageNew(message, sales[positionCollectionSplit].salePersonFk)*/ } @@ -1089,7 +1089,7 @@ class CollectionFragmentPreChecker( return salePerson } - private fun sendSalixMessage( + /* private fun sendSalixMessage( item: String, ticketFk: Int, quantity: String, @@ -1104,7 +1104,7 @@ class CollectionFragmentPreChecker( workerId = salePerson, message = message ) - } + }*/ //CREATE LIST private fun createCollectionList() { @@ -1216,7 +1216,7 @@ class CollectionFragmentPreChecker( var entryPoint = Gson().toJson( mutableMapOf( "entryPoint" to sale.ticketFk, - "web" to "https://salix.verdnatura.es/#!/ticket/${sale.ticketFk}/sale" + "web" to "${getData("base_urlSalix")}/#!/ticket/${sale.ticketFk}/sale" ) ) ma.onPasillerosItemClickListener( @@ -2611,7 +2611,7 @@ class CollectionFragmentPreChecker( saleAdapter!!.notifyDataSetChanged() - val ticket = + /* val ticket = "[" + sales[positionCollectionMissing].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionCollectionMissing].ticketFk + "/summary)" @@ -2632,7 +2632,7 @@ class CollectionFragmentPreChecker( "Se ha modificado la cantidad de " + sales[positionCollectionMissing].originalQuantity + " del artículo " + sales[positionCollectionMissing].itemFk + " a nueva cantidad: " + sales[positionCollectionMissing].quantity + " del ticket " + ticket } - } + }*/ //sergio:ahora desde encajado // sendSalixMessageNew(message, sales[positionCollectionMissing].salePersonFk) @@ -2660,11 +2660,11 @@ class CollectionFragmentPreChecker( saleAdapter?.notifyDataSetChanged() //enviar mensaje a salix - val ticket = + /*val ticket = "[" + sales[positionIncreaseQuantity].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionIncreaseQuantity].ticketFk + "/summary)" val message = "Se ha modificado la cantidad original " + sales[positionIncreaseQuantity].originalQuantity + " del artículo " + sales[positionIncreaseQuantity].itemFk + " a nueva cantidad: " + sales[positionIncreaseQuantity].quantity + " del ticket " + ticket - +*/ //sergio: ahora desde encajadores // sendSalixMessageNew(message, sales[positionIncreaseQuantity].salePersonFk) @@ -2673,14 +2673,14 @@ class CollectionFragmentPreChecker( } - private fun sendSalixMessageNew(message: String, workerId: String) { + /* private fun sendSalixMessageNew(message: String, workerId: String) { viewModel.sendChekingPresence( workerId = workerId, message = message ) - } + }*/ private fun increaseQuantity(position: Int, quantity: Int) { positionIncreaseQuantity = position 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 b2210b49..47928430 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 @@ -784,7 +784,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) { }) } - fun sendChekingPresence( + /* fun sendChekingPresence( workerId: String, message: String @@ -824,7 +824,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) { } catch (e: Exception) { } - } + }*/ fun saleMistakeAdd( vSaleFk: Int, diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/adapters/ExpeditionLoadUnloadAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/adapters/ExpeditionLoadUnloadAdapter.kt new file mode 100644 index 00000000..27e564c5 --- /dev/null +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/adapters/ExpeditionLoadUnloadAdapter.kt @@ -0,0 +1,66 @@ +package es.verdnatura.presentation.view.feature.delivery.adapters + +import android.graphics.Color +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.core.content.ContextCompat +import androidx.core.content.ContextCompat.getColor +import androidx.recyclerview.widget.RecyclerView +import es.verdnatura.R +import es.verdnatura.databinding.ItemExpeditionLoadunloadRowBinding +import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLoadUnload +import java.security.AccessController.getContext + + +class ExpeditionLoadUnloadAdapter( + private val items: List +) : RecyclerView.Adapter() { + + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder { + return ItemHolder( + ItemExpeditionLoadunloadRowBinding.inflate( + LayoutInflater.from(parent.context), + parent, + false + ) + ) + } + + override fun getItemCount() = items.size + + override fun onBindViewHolder(holder: ItemHolder, position: Int) { + holder.bind(items[position]) + } + + inner class ItemHolder( + val binding: ItemExpeditionLoadunloadRowBinding + ) : RecyclerView.ViewHolder(binding.root) { + private val res = binding.root.context.resources + fun bind(item: ExpeditionInfoLoadUnload) { + binding.apply { + when (item.code) { + "ON DELIVERY" -> { + expeditionView.setBackgroundColor( + getColor(expeditionView.context, R.color.verdnatura_pumpkin_orange) + ) + } + "DELIVERED" -> expeditionView.setBackgroundColor( + getColor(expeditionView.context, R.color.verdnatura_dark_mint) + ) + + "PALLETIZED" -> expeditionView.setBackgroundColor( + getColor(expeditionView.context, R.color.verdnatura_black) + ) + else -> { + expeditionView.setBackgroundColor( + getColor(expeditionView.context, R.color.verdnatura_black) + ) + + } + } + this.item = item + } + } + } +} diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/fragments/LoadUnloadFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/fragments/LoadUnloadFragment.kt new file mode 100644 index 00000000..386d547e --- /dev/null +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/fragments/LoadUnloadFragment.kt @@ -0,0 +1,255 @@ +package es.verdnatura.presentation.view.feature.delivery.fragments + +import android.content.Intent +import android.content.pm.PackageInfo +import android.content.pm.PackageManager +import android.graphics.drawable.Drawable +import android.os.Build +import android.view.View +import android.view.inputmethod.EditorInfo +import android.widget.ImageView +import android.widget.Toast +import androidx.annotation.RequiresApi +import androidx.recyclerview.widget.LinearLayoutManager +import es.verdnatura.R +import es.verdnatura.databinding.FragmentExpeditionLoadunloadDeliveryBinding +import es.verdnatura.domain.toast +import es.verdnatura.presentation.base.BaseFragment +import es.verdnatura.presentation.common.OnOptionsSelectedListener +import es.verdnatura.presentation.common.ToolBarAdapterTooltip +import es.verdnatura.presentation.view.feature.delivery.adapters.ExpeditionLoadUnloadAdapter +import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLoadUnload +import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewModel + + +class LoadUnloadFragment( + var title: String = "", + var state: String = "" +) : BaseFragment( + DeliveryViewModel::class +) { + + private var adapter: ExpeditionLoadUnloadAdapter? = null + private var originalItem: Int = 0 + private lateinit var myList: MutableList + + + companion object { + fun newInstance(title: String, state: String) = LoadUnloadFragment(title, state) + } + + override fun getLayoutId(): Int = R.layout.fragment_expedition_loadunload_delivery + + @RequiresApi(Build.VERSION_CODES.O) + override fun init() { + + setEvents() + setToolBar() + binding.scanInput.requestFocus() + viewModel.getExpeditionFromRoute(159390) + super.init() + } + + @RequiresApi(Build.VERSION_CODES.O) + private fun setToolBar() { + ma.hideBottomNavigation(View.GONE) + binding.mainToolbar.toolbarTitle.visibility = View.VISIBLE + binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE + binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE + val listIcons: ArrayList = ArrayList() + val iconConfirm = ImageView(context) + iconConfirm.setImageResource(R.drawable.ic_confirm) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + iconConfirm.tooltipText = getTooltip(R.drawable.ic_confirm) + } + listIcons.add(iconConfirm) + + binding.mainToolbar.toolbarIcons.adapter = + ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener { + + override fun onOptionsItemSelected(item: Drawable) { + + when (item) { + iconConfirm.drawable -> { + // openAppDelivery() + //requireActivity().finish() + setExpeditionsState(myList, state) + } + } + } + }) + + binding.mainToolbar.toolbarIcons.layoutManager = + LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) + binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE + } + + private fun setExpeditionsState(list: MutableList, state: String) { + + + if (list.filter { it.code == state }.size == list.size) { + binding.splashProgress.visibility = View.VISIBLE + viewModel.expeditionState_add(list.filter { it.code == state }, state) + } else { + val alertDialog = android.app.AlertDialog.Builder(requireContext()).create() + alertDialog.setTitle("Información") + alertDialog.setMessage("El total de expediciones escaneadas es diferente al total de la ruta. ¿ Quieres guardar las expediciones escaneadas o buscar la/s expedición/es ?") + alertDialog.setButton( + android.app.AlertDialog.BUTTON_NEUTRAL, "GUARDAR" + ) { dialog, which -> + viewModel.expeditionState_add(list.filter { it.code == state }, state) + } + alertDialog.setButton( + android.app.AlertDialog.BUTTON_POSITIVE, "ORDENAR" + ) { dialog, which -> + adapter = ExpeditionLoadUnloadAdapter(list.sortedByDescending{it.code}) + adapter!!.notifyDataSetChanged() + } + alertDialog.show() + } + + + } + + private fun openAppDelivery() { + val i = Intent() + val manager: PackageManager = requireContext().packageManager + val info: PackageInfo = manager.getPackageInfo(requireContext().packageName, 0) + val version = info.versionName + + if (version.contains("Beta")) { + i.setClassName( + "verdnatura.es.repartoverdnatura.sfusion", + "verdnatura.es.repartoverdnatura.ExpeditionSummaryActivity" + ) + } else { + i.setClassName( + "verdnatura.es.repartoverdnatura", + "verdnatura.es.repartoverdnatura.ExpeditionSummaryActivity" + ) + } + // i.putExtra("routeId", binding.route.text) + i.putExtra("app", "picking") + startActivity(i) + } + + private fun setEvents() { + binding.mainToolbar.backButton.setOnClickListener { + requireActivity().onBackPressed() + } + + binding.scanInput.setOnEditorActionListener { _, actionId, _ -> + if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { + if (!binding.scanInput.text.isNullOrEmpty()) { + + try { + //viewModel.expeditionLoadUnload_get(binding.scanInput.toInt()) + markExpedition(binding.scanInput.text.toString().toInt(), state) + binding.mainToolbar.toolbarTitle.text = + getString(R.string.expedition) + binding.scanInput.text + + } catch (ex: Exception) { + "Error al escanear expedición".toast(context, Toast.LENGTH_SHORT) + } + binding.scanInput.setText("") + } + + return@setOnEditorActionListener false + } + false + } + + } + + private fun markExpedition(expedNumber: Int, state: String) { + + var found = false + + if (myList.filter { it.id == expedNumber }.filter { it.code == state }.isNotEmpty()) { + ma.messageWithSound("Expedición ya marcada", null, true) + } else { + for (exped in myList) { + if (exped.id == expedNumber) { + found = true + exped.code = state + break + } + } + if (found) { + ma.messageWithSound("", false, true, isToasted = false) + } else { + ma.messageWithSound("", true, true, isToasted = null) + } + } + + updateCount(myList, state) + + + } + + @RequiresApi(Build.VERSION_CODES.O) + override fun observeViewModel() { + with(viewModel) { + expeditionInfoLoadUnloadList.observe(viewLifecycleOwner) { + binding.splashProgress.visibility = View.GONE + createList(it.list) + //setSwitchButon() + // viewModel.get_routesFromExpedition(originalItem) + } + routeInfoList.observe(viewLifecycleOwner) { + binding.splashProgress.visibility = View.GONE + if (it.list.isNotEmpty()) { + binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE + binding.mainToolbar.switchButton.visibility = View.VISIBLE + } else { + binding.scanInput.setText("") + // binding.routeLayout.visibility = View.GONE + binding.mainToolbar.toolbarIcons.visibility = View.GONE + binding.mainToolbar.switchButton.visibility = View.GONE + } + } + responseStateAdd.observe(viewLifecycleOwner) { + binding.splashProgress.visibility = View.GONE + if (!it.isError) { + viewModel.getExpeditionFromRoute(159390) + } + + } + } + } + + @RequiresApi(Build.VERSION_CODES.O) + private fun setSwitchButon() { + + binding.mainToolbar.switchButton.setOnCheckedChangeListener { buttonView, isChecked -> + binding.mainToolbar.switchButton.tooltipText = if (isChecked) + getString(R.string.expeditionMarkLost) else + getString(R.string.expeditionMarkFound) + + binding.splashProgress.visibility = View.VISIBLE + + if (isChecked) { + // viewModel.expeditionState_add(arrayListOf(Expedition(originalItem)), "FOUND") + } else { + // viewModel.expeditionState_add(arrayListOf(Expedition(originalItem)), "LOST") + } + } + + } + + private fun createList(list: List) { + myList = list as MutableList + adapter = ExpeditionLoadUnloadAdapter(list) + binding.expeditionloadunloadRecyclerview.adapter = adapter + binding.expeditionloadunloadRecyclerview.layoutManager = + LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) + binding.mainToolbar.toolbarSubtitle.text = + "${list.filter { it.code == state }.size}/${list.size}" + } + + private fun updateCount(list: MutableList, state: String) { + var countMarked = list.filter { it.code == state }.size + binding.mainToolbar.toolbarSubtitle.text = "${countMarked}/${list.size}" + adapter!!.notifyDataSetChanged() + } +} \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/model/InfoCompany.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/model/InfoCompany.kt index df0a8b22..9286009b 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/model/InfoCompany.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/model/InfoCompany.kt @@ -49,3 +49,19 @@ class RouteDelivery( class Expedition( var id: Int ) +class ExpeditionList( + var list: List = listOf() +) +class ExpeditionInfoLoadUnload( + var id:Int, + var ticketFk:Int, + var routeFk:Int, + var addressFk:Int, + var itemPackingTypeConcat:String, + var city:String, + var street:String, + var code:String?, + var nickname:String, + var postalCode:Int +) + diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/viewmodels/DeliveryViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/viewmodels/DeliveryViewModel.kt index b72a735d..f98e68b4 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/viewmodels/DeliveryViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/viewmodels/DeliveryViewModel.kt @@ -8,6 +8,8 @@ import es.verdnatura.domain.SilexCallback import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.view.feature.delivery.model.* +import retrofit2.Call +import retrofit2.Callback import retrofit2.Response import retrofit2.http.POST @@ -16,6 +18,9 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) { private val _expeditionInfoList by lazy { MutableLiveData() } val expeditionInfoList: LiveData = _expeditionInfoList + private val _expeditionInfoLoadUnloadList by lazy { MutableLiveData() } + val expeditionInfoLoadUnloadList: LiveData = _expeditionInfoLoadUnloadList + private val _routeInfoList by lazy { MutableLiveData() } val routeInfoList: LiveData = _routeInfoList @@ -29,6 +34,9 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) { val responseStateAdd: LiveData get() = _responseStateAdd + private val _expeditionList by lazy { MutableLiveData() } + val expeditionList: LiveData = _expeditionList + fun getInfoCompany( userId: Int @@ -79,6 +87,31 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) { }) } + fun getExpeditionFromRoute( + route: Int + ) { + + silex.getExpeditionFromRoute(route) + .enqueue(object : SilexCallback>(context) { + + override fun onSuccess(response: Response>) { + + if (response.body() != null) { + _expeditionInfoLoadUnloadList.value = + response.body()?.let { ExpeditionList(it) } + } else { + _expeditionInfoLoadUnloadList.value = ExpeditionList() + } + } + + override fun onError(t: Throwable) { + _expeditionInfoLoadUnloadList.value = ExpeditionList() + super.onError(t) + + } + }) + } + fun get_routesFromExpedition( expedition: Int ) { @@ -102,7 +135,7 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) { } - fun expeditionState_add(expeditions: List, state: String) { + fun expeditionState_add(expeditions: Any?, state: String) { silex.expeditionState_add(expeditions, state) .enqueue(object : SilexCallback(context) { @@ -117,7 +150,7 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) { }) } - @POST("/delivery/getInfoFreelance") + fun getInfoFreelance( userId: Int ) { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt index b7528934..5e9419c2 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt @@ -54,7 +54,8 @@ class LoginFragment : BaseFragment(LoginVi customDialog = CustomDialog(requireContext()) saveIdentifiers() checkUser() - createFolderSerial() + /*Tarea 4815 + createFolderSerial()*/ binding.buttonLogin.setOnClickListener { binding.splashProgress.visibility = View.VISIBLE viewModel.loginSalix( 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 79a65f43..9b1a8c95 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 @@ -1,6 +1,7 @@ package es.verdnatura.presentation.view.feature.main.activity +//Tarea #4815 import android.content.SharedPreferences import android.media.MediaPlayer import android.view.Menu @@ -35,6 +36,7 @@ import es.verdnatura.presentation.view.feature.controlador.fragment.WebFragment import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoFragment import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoUsuarioFragment import es.verdnatura.presentation.view.feature.delivery.fragments.InfoFragment +import es.verdnatura.presentation.view.feature.delivery.fragments.LoadUnloadFragment import es.verdnatura.presentation.view.feature.delivery.fragments.LogExpeditionFragment import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleFragment import es.verdnatura.presentation.view.feature.historicoarticulo.fragment.HistoricoArticuloFragment @@ -42,7 +44,6 @@ import es.verdnatura.presentation.view.feature.historicoshelving.fragment.itemSh import es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment.shelvingLogFragment import es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoFragment import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryFragment -import es.verdnatura.presentation.view.feature.login.fragment.LoginViewModel import es.verdnatura.presentation.view.feature.main.model.ItemMenuVO import es.verdnatura.presentation.view.feature.packaging.fragment.ObservFragment import es.verdnatura.presentation.view.feature.packaging.fragment.PackagingCountFragment @@ -57,7 +58,6 @@ import es.verdnatura.presentation.view.feature.pasillero.fragment.PasilleroFragm import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO import es.verdnatura.presentation.view.feature.precontrol.PreControladorFragment import es.verdnatura.presentation.view.feature.presacador.fragment.EndSacadorFragment -import es.verdnatura.presentation.view.feature.presacador.fragment.InitPreSacadorFragment import es.verdnatura.presentation.view.feature.qr.QrFragment import es.verdnatura.presentation.view.feature.reubication.fragment.ReubicationCollectionFragment import es.verdnatura.presentation.view.feature.reubication.fragment.ReubicationFragment @@ -65,7 +65,7 @@ import es.verdnatura.presentation.view.feature.reubication.model.Reubication import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorFragment import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO import es.verdnatura.presentation.view.feature.shelvingparking.fragment.ShelvingParkingFragment -import es.verdnatura.presentation.view.feature.showticket.ShowTicketFragment +import es.verdnatura.presentation.view.feature.sacador.fragment.showticket.ShowTicketFragment import es.verdnatura.presentation.view.feature.ubicador.fragment.AutomaticAddItemFragment import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorFragment import es.verdnatura.presentation.view.feature.workermistake.adapter.WorkermistakeFragment @@ -74,9 +74,6 @@ import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch -//Tarea #4815 -import org.koin.androidx.viewmodel.ext.android.viewModel - class MainActivity : BaseActivity(), OnPasillerosItemClickListener, @@ -89,7 +86,9 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL var fm = supportFragmentManager var mperror: MediaPlayer? = null var mpok: MediaPlayer? = null - //Tarea #4815 + var mpErrorRepeat: MediaPlayer? = null + + //Tarea #4815 // var miTime: Long = System.currentTimeMillis() / 1000 / 60 / 60 private var comeFromDelivery: Boolean? = null override fun getLayoutId(): Int = R.layout.activity_main @@ -97,6 +96,8 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL mperror = MediaPlayer.create((this), R.raw.error) mpok = MediaPlayer.create((this), R.raw.ok) + mpErrorRepeat = MediaPlayer.create((this), R.raw.errorrepeat) + mpok customDialog = CustomDialogMainActivity(this) setFragments() setBottomMenuFragment() @@ -559,7 +560,7 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL } getString(R.string.titlePrePicker) -> { - addFragmentOnTop(InitPreSacadorFragment.newInstance(getString(R.string.getPreviousCollection))) + addFragmentOnTop(SacadorFragment.newInstance("PREITEMPICKER")) } getString(R.string.titleClaimUbication) -> { @@ -638,6 +639,32 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL } + getString(R.string.titleLoadTruck) -> { + + addFragmentOnTop( + LoadUnloadFragment.newInstance(item.title, "ON DELIVERY"), + if (comeFromDelivery == true) { + getString(R.string.titleLoadTruck) + } else { + null + } + ) + + } + + getString(R.string.titleUnLoadTruck) -> { + + addFragmentOnTop( + LoadUnloadFragment.newInstance(item.title, "DELIVERED"), + if (comeFromDelivery == true) { + getString(R.string.titleUnLoadTruck) + } else { + null + } + ) + + } + getString(R.string.testing) -> { addFragmentOnTop(testPrint.newInstance(item.title)) @@ -757,6 +784,7 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL addFragmentOnTop(CollectionFragmentPicker.newInstance(collection, type)) } + else -> { addFragmentOnTop(CollectionFragment.newInstance(collection, type)) } @@ -787,7 +815,7 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL delete_Fragments() } addFragment( - SacadorFragment.newInstance(), + SacadorFragment.newInstance("PREPARED"), R.id.main_frame_layout, SacadorFragment.TAG, true @@ -820,30 +848,32 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL fun messageWithSound( message: String, - isError: Boolean, + isError: Boolean?, isPlayed: Boolean?, titleWithError: String = getString(R.string.error), isToasted: Boolean? = true ) { + if (isError != null) { + if (!isError!!) { - if (!isError) { - - if (isPlayed == true) (mpok?.start()) - if (isToasted!!) message.toast(this, Toast.LENGTH_LONG) - } else { - - if (isPlayed == true) (mperror?.start()) - - if (isToasted == true) { - message.toast(this, Toast.LENGTH_LONG) + if (isPlayed == true) (mpok?.start()) + if (isToasted!!) message.toast(this, Toast.LENGTH_LONG) } else { - customDialog.setTitle(titleWithError).setDescription(message) - .setOkButton(getString(R.string.accept)) { - customDialog.dismiss() - }.show() + + if (isPlayed == true) (mperror?.start()) + if (isToasted != null) { + if (isToasted == true) { + message.toast(this, Toast.LENGTH_LONG) + } else { + customDialog.setTitle(titleWithError).setDescription(message) + .setOkButton(getString(R.string.accept)) { + customDialog.dismiss() + }.show() + } + } } - - + }else{ + mpErrorRepeat?.start() } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt index 5fe02267..d8a27db0 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt @@ -146,7 +146,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) { ) //Tarea 4979 - /* _pasillerositem.add( + /* _pasillerositem.add( PasillerosItemVO( 1, R.drawable.ic_category, @@ -489,6 +489,17 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) { ) ) + /*Tarea 4678 + _pasillerositem.add( + PasillerosItemVO( + 6, + R.drawable.ic_delivery_truck, + contextApp.getString(R.string.titleDelivery), + R.string.titleDelivery, + contextApp.getString(R.string.titleDelivery) + ) + )*/ + //#tarea4679 /* _pasillerositem.add( PasillerosItemVO( @@ -565,7 +576,28 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) { ) ) ) + _pasillerositem.add( + PasillerosItemVO( + 30, + R.drawable.ic_delivery_truck, + contextApp.getString(R.string.titleLoadTruck), + R.string.titleLoadTruckInfo, + contextApp.getString( + R.string.titleLoadTruckInfo + ) + ) + ) - + _pasillerositem.add( + PasillerosItemVO( + 30, + R.drawable.ic_delivery_truck, + contextApp.getString(R.string.titleUnLoadTruck), + R.string.titleUnLoadTruckInfo, + contextApp.getString( + R.string.titleUnLoadTruckInfo + ) + ) + ) } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt index b2e64842..f44fcb46 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt @@ -432,10 +432,10 @@ class EndSacadorFragment( //enviar mensaje a salix - val ticket = + /* val ticket = "[" + sales[positionCollectionSplit].id + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionCollectionSplit].id + "/summary)" val message = - getString(R.string.splitSent) + sales[positionCollectionSplit].itemFk + getString(R.string.fromTicket) + ticket + getString(R.string.splitSent) + sales[positionCollectionSplit].itemFk + getString(R.string.fromTicket) + ticket*/ /* viewModel.sendChekingPresence( @@ -444,7 +444,7 @@ class EndSacadorFragment( message = message, "sendChekingPresence" )*/ - sendSalixMessageNew(message, sales[positionCollectionSplit].salesPersonFk) + /* sendSalixMessageNew(message, sales[positionCollectionSplit].salesPersonFk)*/ } @@ -460,7 +460,7 @@ class EndSacadorFragment( saleAdapter?.notifyDataSetChanged() - val ticket = + /* val ticket = "[" + sales[positionIncreaseQuantity].id + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionIncreaseQuantity].id + "/summary)" val message = getString(R.string.modifiedQuantityPrevious) + sales[positionIncreaseQuantity].quantity + getString( @@ -471,7 +471,7 @@ class EndSacadorFragment( - sendSalixMessageNew(message, sales[positionIncreaseQuantity].salesPersonFk) + sendSalixMessageNew(message, sales[positionIncreaseQuantity].salesPersonFk)*/ searchSaleCollection() } @@ -502,7 +502,7 @@ class EndSacadorFragment( saleAdapter!!.notifyDataSetChanged() - var message = "" + /* var message = "" val ticket = "[" + sales[positionCollectionMissing].id + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionCollectionMissing].id + "/summary)" @@ -536,11 +536,11 @@ class EndSacadorFragment( } } - sendSalixMessageNew(message, sales[positionCollectionMissing].salesPersonFk) + sendSalixMessageNew(message, sales[positionCollectionMissing].salesPersonFk)*/ searchSaleCollection() } - private fun sendSalixMessageNew(message: String, workerId: String) { + /* private fun sendSalixMessageNew(message: String, workerId: String) { if (!goBack) { @@ -551,7 +551,7 @@ class EndSacadorFragment( message = message ) } - } + }*/ //CREATE LIST private fun searchSaleCollection() { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorViewModel.kt index 58d49330..f8d268a9 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorViewModel.kt @@ -317,7 +317,7 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) { } - fun sendChekingPresence( + /* fun sendChekingPresence( workerId: String, message: String, ) { @@ -356,7 +356,7 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) { //Log.d("error " + e.message) } - } + }*/ fun ticket_printLabelPrevious(ticketFk: Int) { @@ -377,6 +377,7 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) { } + fun sectorCollection_get() { silex.sectorCollection_get().enqueue(object : @@ -429,7 +430,7 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) { object : SilexCallback(context) { override fun onError(t: Throwable) { - _responseNew.value = + _response.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse( @@ -442,7 +443,7 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) { override fun onSuccess(response: Response) { - _responseNew.value = ResponseItemVO( + _response.value = ResponseItemVO( isError = false, errorMessage = "" + getMessageFromAllResponse( nameofFunction(this), response.message() diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorFragment.kt index bf058389..98056bbb 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorFragment.kt @@ -181,7 +181,6 @@ class SacadorFragment( private fun print() { if (ma.havePrinter()) { - binding.splashProgress.visibility = View.VISIBLE viewModel.ticket_printLabelPrevious(customDialogInput.getValue().toInt()) (getString(R.string.Imprimiendo) + getData(PRINTERNAME)).toast( requireContext() @@ -215,7 +214,9 @@ class SacadorFragment( ma.messageWithSound(it.errorMessage, true, false) } else { - if (goBack) addCollectionToList(it.response.toInt()) + if (goBack) { + if (!it.response.isNullOrBlank())addCollectionToList(it.response.toInt()) + } } goBack = false callBack(type) 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 b96f8c12..6518ce06 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 @@ -34,6 +34,10 @@ class SacadorViewModel(val context: Context) : BaseViewModel(context) { val responseCollectionSmart: LiveData get() = _responseCollectionSmart + private val _responseNew by lazy { MutableLiveData() } + val responseNew: LiveData + get() = _responseNew + fun collectionTicketGet( collectionFk: Int, sectorFk: String, @@ -74,7 +78,53 @@ class SacadorViewModel(val context: Context) : BaseViewModel(context) { } }) } + fun sectorCollection_new( + sectorFk: Int + ) { + silex.sectorCollection_new(sectorFk).enqueue( + object : + SilexCallback(context) { + override fun onError(t: Throwable) { + _response.value = + ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + t.message!! + ) + ) + } + + override fun onSuccess(response: Response) { + + _response.value = ResponseItemVO( + isError = false, + errorMessage = "" + getMessageFromAllResponse( + nameofFunction(this), response.message() + ) + ) + + } + }) + } + fun ticket_printLabelPrevious(ticketFk: Int) { + + silex.ticket_printLabelPrevious(ticketFk).enqueue(object : SilexCallback(context) { + override fun onError(t: Throwable) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) + } + + override fun onSuccess(response: Response) { + _response.value = + ResponseItemVO(isError = false, response = response.message()!!) + } + }) + + } fun collection_assign() { silex.collection_assign().enqueue( object : @@ -148,6 +198,52 @@ class SacadorViewModel(val context: Context) : BaseViewModel(context) { }) } + fun sectorCollection_get() { + + silex.sectorCollection_get().enqueue(object : + SilexCallback>(context) { + override fun onError(t: Throwable) { + val listError: ArrayList = ArrayList() + listError.add( + CollectionVO( + 0, + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + t.message!! + ) + ) + ) + _collectionList.value = CollectionListVO(listError) + } + + + override fun onSuccess(response: Response>) { + + if (response.body() != null) { + _collectionList.value = + response.body()?.let { CollectionListVO(it.toDateFormat(context)) } + } else { + val listError: ArrayList = ArrayList() + listError.add( + CollectionVO( + 0, + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + ) + _collectionList.value = CollectionListVO(listError) + + } + } + + }) + } + + fun collectionGetSalix() { salix.getCollectionSalix().enqueue(object : SilexCallback>(context) { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/showticket/ShowTicketFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/showticket/ShowTicketFragment.kt similarity index 96% rename from app/src/main/java/es/verdnatura/presentation/view/feature/showticket/ShowTicketFragment.kt rename to app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/showticket/ShowTicketFragment.kt index c30b8b1c..efbf4ca7 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/showticket/ShowTicketFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/showticket/ShowTicketFragment.kt @@ -1,4 +1,4 @@ -package es.verdnatura.presentation.view.feature.showticket +package es.verdnatura.presentation.view.feature.sacador.fragment.showticket import android.content.Context import android.os.Bundle @@ -37,6 +37,7 @@ class ShowTicketFragment(var menuOrigin: String) : binding.scanInput.visibility = View.VISIBLE binding.mainToolbar.toolbarTitle.text = getString(R.string.verticket) + ma.hideBottomNavigation(View.VISIBLE) binding.splashProgress.visibility = View.GONE if (menuOrigin == getString(R.string.main)) { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/showticket/ShowTicketViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/showticket/ShowTicketViewModel.kt similarity index 100% rename from app/src/main/java/es/verdnatura/presentation/view/feature/showticket/ShowTicketViewModel.kt rename to app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/showticket/ShowTicketViewModel.kt 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 60efaaa9..533984d2 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 @@ -76,15 +76,16 @@ class AutomaticAddItemFragment( if (!binding.editMatricula.text.toString().isNullOrEmpty()) { contador += 1 setSubtitle() + binding.editMatricula.setText(textScanned_filterDouble(binding.editMatricula.text.toString())) try { - listItems.add( + listItems.add( 0, ItemEscanerVO( itemScanValue( binding.editMatricula.text.toString(), "buy", "more" - ).toString().toInt() + ).toString().toLong() ) ) adapter!!.notifyDataSetChanged() @@ -101,8 +102,8 @@ class AutomaticAddItemFragment( } binding.buttonFinalizar.setOnClickListener { - val listString: ArrayList = ArrayList() - val listInt: ArrayList = ArrayList() + val listString: ArrayList = ArrayList() + val listInt: ArrayList = ArrayList() listItems.forEach { listString.add(it.item) listInt.add(it.item) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemViewModel.kt index e69acae5..5c9f6cdf 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemViewModel.kt @@ -19,7 +19,7 @@ class AutomaticAddItemViewModel(val context: Context) : BaseViewModel(context) { fun itemShelvingMake_multi( shelving: String, - items: List, + items: List, warehouse: Int ) { silex.itemShelvingMake_multi(shelving, items, warehouse) 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 068fe018..d1b6b351 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 @@ -305,7 +305,6 @@ class UbicadorFragment( shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString( R.string.label ) + etiquetas - if (mpok != null) mpok!!.start() customDialogInput.dismiss() }.setKoButton(getString(R.string.cancel)) { customDialogInput.dismiss() @@ -326,9 +325,7 @@ class UbicadorFragment( shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString( R.string.label ) + etiquetas - if (mpok != null) { - mpok!!.start() - } + return@setOnEditorActionListener true } 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 375fb5e7..dd739343 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 @@ -21,7 +21,7 @@ class ItemUbicadorVO( ) class ItemEscanerVO( - var item: Int + var item: Long ) class ItemUbicadorListVO( diff --git a/app/src/main/res/drawable/ic_confirm.xml b/app/src/main/res/drawable/ic_confirm.xml new file mode 100644 index 00000000..d6154f28 --- /dev/null +++ b/app/src/main/res/drawable/ic_confirm.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_expedition_loadunload_delivery.xml b/app/src/main/res/layout/fragment_expedition_loadunload_delivery.xml new file mode 100644 index 00000000..2591efd0 --- /dev/null +++ b/app/src/main/res/layout/fragment_expedition_loadunload_delivery.xml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + > + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_escaner_row.xml b/app/src/main/res/layout/item_escaner_row.xml index 3c6692c5..0517f0b2 100644 --- a/app/src/main/res/layout/item_escaner_row.xml +++ b/app/src/main/res/layout/item_escaner_row.xml @@ -39,7 +39,7 @@ android:layout_weight="1" android:textSize="@dimen/h5" android:textColor="@color/verdnatura_white" - android:text="@{Integer.toString(item.item)}" + android:text="@{Long.toString(item.item)}" tool:text="45532" android:textStyle="bold" android:gravity="center_vertical"/> diff --git a/app/src/main/res/layout/item_expedition_loadunload_row.xml b/app/src/main/res/layout/item_expedition_loadunload_row.xml new file mode 100644 index 00000000..eaa6f4fa --- /dev/null +++ b/app/src/main/res/layout/item_expedition_loadunload_row.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/navigation/nav_graph.xml b/app/src/main/res/navigation/nav_graph.xml index 295be78b..07bcf5de 100644 --- a/app/src/main/res/navigation/nav_graph.xml +++ b/app/src/main/res/navigation/nav_graph.xml @@ -9,6 +9,6 @@ android:label="AjustesFragment" /> \ No newline at end of file diff --git a/app/src/main/res/raw/errorrepeat.mp3 b/app/src/main/res/raw/errorrepeat.mp3 new file mode 100644 index 00000000..719e1e32 Binary files /dev/null and b/app/src/main/res/raw/errorrepeat.mp3 differ diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 3e8b4255..84bec13c 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -559,5 +559,11 @@ Cambiar a A2 Cambiar a A2 Indica el carro donde está ubicado el item: + Cargar furgoneta + Descargar furgoneta + Cargar furgoneta + Descargar furgoneta + Cofirma la carga/descarga de la furgoneta + Introduce el nuevo precio. Por defecto se propone el 50% del precio original.Item: diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 7c10db75..fb0ec5c5 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -45,6 +45,11 @@ 14sp 15sp + 4dp + + 16sp + 20sp + 14sp 12sp 10sp diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a3d771a1..3e8cffa7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -175,6 +175,10 @@ Claim Ubication Show company information Show company information + Load van + Load van + Unload van + Unload van Show data expedition Claims done successful @@ -557,6 +561,8 @@ It\'s not possible to update. Problem with the download of app "Introduce new packing for the item : " "Introduce ubication for the item : " + "Introduce price for the item : " The number of wagons can now only be changed by managers + Cofirm load/unload of the van