From 7b43fdd7e447f0df4c1b93386e145d9568ee7164 Mon Sep 17 00:00:00 2001 From: Sergio De la torre Date: Thu, 22 Sep 2022 14:24:05 +0200 Subject: [PATCH 1/2] Version 9.1Beta- Modificar original y originalQuantity --- .idea/misc.xml | 2 +- .../es/verdnatura/domain/ApiSalixUtils.kt | 17 ++++++ .../java/es/verdnatura/domain/RestClient.kt | 2 + .../java/es/verdnatura/domain/SalixService.kt | 12 +++++ .../feature/collection/adapter/SaleAdapter.kt | 2 +- .../collection/fragment/CollectionFragment.kt | 52 +++++++++---------- .../collection/mapper/CollectionMapper.kt | 15 ++---- .../presacador/adapter/PreSacadorAdapter.kt | 2 +- .../feature/presacador/mapper/SaleMapper.kt | 8 +-- .../reposicion/adapter/ReposicionAdapter.kt | 2 +- .../feature/sacador/model/TicketItemVO.kt | 4 +- .../res/layout/item_article_row_fragment.xml | 4 +- 12 files changed, 74 insertions(+), 48 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 83b8cb7d..cfb076e7 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -207,7 +207,7 @@ - + diff --git a/app/src/main/java/es/verdnatura/domain/ApiSalixUtils.kt b/app/src/main/java/es/verdnatura/domain/ApiSalixUtils.kt index f2aa334c..fb40d72d 100644 --- a/app/src/main/java/es/verdnatura/domain/ApiSalixUtils.kt +++ b/app/src/main/java/es/verdnatura/domain/ApiSalixUtils.kt @@ -35,5 +35,22 @@ class ApiSalixUtils { val preferences = PreferenceManager.getDefaultSharedPreferences(context) return preferences.getString(key, null) } + } +} + + +class ApiSalixUtilsSend { + companion object { + const val BASE_URL: String = "https://salix.verdnatura.es/api/" + + fun getApiService(context: Context): SalixServiceSend { + val salixRetrofit = Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory( + GsonConverterFactory.create() + ).build() + //d("VERDNATURA::","El server Salix es "+getBaseUrlLocal(context = context)) + return salixRetrofit.create(SalixServiceSend::class.java) + } + + } } \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/domain/RestClient.kt b/app/src/main/java/es/verdnatura/domain/RestClient.kt index 2520e91e..2008854a 100644 --- a/app/src/main/java/es/verdnatura/domain/RestClient.kt +++ b/app/src/main/java/es/verdnatura/domain/RestClient.kt @@ -6,11 +6,13 @@ open class RestClient(context: Context) { var restClient: VerdnaturaService? = null var salixClient: SalixService? = null var nodejsClient: NodeJsService? = null + var salixClientSend:SalixServiceSend?=null init { restClient = ApiUtils.getApiService(context) salixClient = ApiSalixUtils.getApiService(context) nodejsClient = ApiNodeJsUtils.getApiService() + 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 3ad5c7b5..6a20e4e3 100644 --- a/app/src/main/java/es/verdnatura/domain/SalixService.kt +++ b/app/src/main/java/es/verdnatura/domain/SalixService.kt @@ -155,4 +155,16 @@ interface SalixService { ): Call> +} + +interface SalixServiceSend { + + @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/presentation/view/feature/collection/adapter/SaleAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapter.kt index 203ed4bf..b4ff3136 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 @@ -111,7 +111,7 @@ class SaleAdapter( txtError.text = binding.root.context.getString(R.string.originalQuantity) + sale.originalQuantity if (sale.isPrepared == "1" || sale.isControlled == "1") - sale.pickedQuantity = sale.quantity + sale.pickedQuantity = sale.quantity.toString() } 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 81f5ead3..d8a657bf 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 @@ -74,14 +74,14 @@ class CollectionFragment( private var mistakeSale: SaleVO? = null private var positionIncreaseQuantity = 0 private var positionReject = 0 - private var quantityIncrease = "" + private var quantityIncrease:Int=0 private var quantityReject = "" private var typeCollectionMissing = "" private var positionCollectionMissing = 0 - private var quantityCollectionMissing = "" + private var quantityCollectionMissing:Int=0 private var isMarking = false private var positionCollectionSplit = 0 - private var quantityCollectionSplit = "" + private var quantityCollectionSplit:Int=0 private lateinit var ticketToParking: String private lateinit var ticketScanTxt: String @@ -865,7 +865,7 @@ class CollectionFragment( private fun responseSaleMoveSuccesful() { sales[positionCollectionSplit].quantity = quantityCollectionSplit - if (quantityCollectionSplit == "0") + if (quantityCollectionSplit == 0) markLine(positionCollectionSplit, type) saleAdapter!!.notifyDataSetChanged() @@ -947,7 +947,7 @@ class CollectionFragment( var observations = "" collection.tickets.forEach { ticket -> ticket.sales.forEach { saleVO -> - if (type == SACADOR && saleVO.quantity != "0") { + if (type == SACADOR && saleVO.quantity != 0) { salesList.add(saleVO) if (tickets.firstOrNull { it == saleVO.ticketFk }.isNullOrEmpty()) tickets.add(saleVO.ticketFk) @@ -1342,7 +1342,7 @@ 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].quantity + sales[position].pickedQuantity = sales[position].quantity.toString() } } else if (type == CONTROLADOR) @@ -1448,7 +1448,7 @@ class CollectionFragment( getData(USER), getData(PASSWORD), sales[position].saleFk, - sales[position].quantity + sales[position].quantity.toString() ) positionUnmarked = position @@ -1480,7 +1480,7 @@ class CollectionFragment( var quantityGet = "0" try { quantityGet = - (sales[position].quantity.toInt() - sales[position].pickedQuantity.toInt()).toString() + (sales[position].quantity!!.toInt() - sales[position].pickedQuantity.toInt()).toString() } catch (e: Exception) { } //Log.i("VERDNATURA:","Aparece para enviar") @@ -1543,7 +1543,7 @@ class CollectionFragment( mpok?.start() ReviewQuantityForRefreshingAndSorting( customDialogList.getValue().toInt(), - sales[storedPosition].quantity.toInt(), + sales[storedPosition].quantity!!.toInt(), sales[storedPosition].pickedQuantity.toInt() ) customDialogList.dismiss() @@ -1622,7 +1622,7 @@ class CollectionFragment( mpok?.start() ReviewQuantityForRefreshingAndSorting( customDialogList.getValue().toInt(), - sales[storedPosition].quantity.toInt(), + sales[storedPosition].quantity!!.toInt(), sales[storedPosition].pickedQuantity.toInt() ) // SalesSorter(sales) @@ -1785,7 +1785,7 @@ class CollectionFragment( //Tarea #4371 itemShelvingTracking_mark = itemShelvingFk - if (sales[storedPosition].pickedQuantity != sales[storedPosition].quantity) { + if (sales[storedPosition].pickedQuantity != sales[storedPosition].quantity.toString()) { sales[storedPosition].isPrepared = "1" markLine(storedPosition, OK) } else { @@ -2013,7 +2013,7 @@ class CollectionFragment( if (type == SACADOR) { if (it.isPrepared == "1" || it.isControlled == "1" || it.isPreviousPrepared == "1") { totalMark += 1 - } else if (it.quantity == "0") { + } else if (it.quantity == 0) { totalMark += 1 } } else if (type == CONTROLADOR) { @@ -2235,11 +2235,11 @@ class CollectionFragment( } else { when (action) { - getString(R.string.Agregar) -> increaseQuantity(position, value) - getString(R.string.BasuraRechazar) -> TrashMissingReject(position, value, "TRUE") - getString(R.string.titleFaults) -> TrashMissingReject(position, value, "FALSE") - getString(R.string.Reject) -> TrashMissingReject(position, value, "reject") - getString(R.string.Split) -> split(position, value) + getString(R.string.Agregar) -> increaseQuantity(position, value.toInt()) + getString(R.string.BasuraRechazar) -> TrashMissingReject(position, value.toInt(), "TRUE") + getString(R.string.titleFaults) -> TrashMissingReject(position, value.toInt(), "FALSE") + getString(R.string.Reject) -> TrashMissingReject(position, value.toInt(), "reject") + getString(R.string.Split) -> split(position, value.toInt()) } @@ -2248,7 +2248,7 @@ class CollectionFragment( } } - private fun split(position: Int, quantity: String) { + private fun split(position: Int, quantity: Int) { //sergio: SPLIT SALIX @@ -2257,7 +2257,7 @@ class CollectionFragment( var totalQuantity: Int = 0 try { - totalQuantity = sales[position].quantity.toInt() - quantity.toInt() + totalQuantity = sales[position].quantity!!.toInt() - quantity.toInt() } catch (e: Exception) { } @@ -2292,7 +2292,7 @@ class CollectionFragment( private fun TrashMissingReject( position: Int, - quantity: String, + quantity: Int, typeCollectionTrashMissingReject: String ) { typeCollectionMissing = typeCollectionTrashMissingReject @@ -2301,7 +2301,7 @@ class CollectionFragment( var totalQuantity: Int = 0 try { - totalQuantity = sales[position].quantity.toInt() - quantity.toInt() + totalQuantity = sales[position].quantity!!.toInt() - quantity.toInt() } catch (e: Exception) { } @@ -2312,7 +2312,7 @@ class CollectionFragment( quantity = totalQuantity.toString(), warehouseFk = getData(WAREHOUSEFK), type = typeCollectionTrashMissingReject, - originalQuantity = quantity + originalQuantity = quantity.toString() ) /* sales[position].quantity = quantity saleAdapter!!.notifyDataSetChanged() @@ -2440,13 +2440,13 @@ class CollectionFragment( sales[positionCollectionMissing].quantity = quantityCollectionMissing saleAdapter!!.notifyDataSetChanged() - if (quantityCollectionMissing == "0") + if (quantityCollectionMissing == 0) markLine(positionCollectionMissing, type) var totalQuantity: Int = 0 try { totalQuantity = - sales[positionCollectionMissing].originalQuantity.toInt() - quantityCollectionMissing.toInt() + sales[positionCollectionMissing].originalQuantity!!.toInt() - quantityCollectionMissing.toInt() } catch (e: Exception) { } @@ -2528,7 +2528,7 @@ class CollectionFragment( ) } - private fun increaseQuantity(position: Int, quantity: String) { + private fun increaseQuantity(position: Int, quantity: Int) { positionIncreaseQuantity = position quantityIncrease = quantity @@ -2546,7 +2546,7 @@ class CollectionFragment( viewModel.collectionIncreaseQuantitySalix( getData(TOKEN), saleFk = sales[position].saleFk, - quantity = quantity + quantity = quantity.toString() ) /* }*/ 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 fe0a8ea9..e0444f1d 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 @@ -28,17 +28,12 @@ fun CollectionVO.map(context: Context): CollectionVO { //Log.d("VERDNATURA::","quantity"+it.quantity) //Log.d("VERDNATURA::","quantity original"+it.originalQuantity) - it.quantity = if (it.quantity.indexOf(".") > 0) { - it.quantity.substring(0, it.quantity.indexOf(".")) - } else { - it.quantity - } + it.quantity = it.quantity!!.toInt() - it.originalQuantity = (if (it.originalQuantity.indexOf(".") > 0) { - it.originalQuantity.substring(0, it.originalQuantity.indexOf(".")) - } else it.originalQuantity) - if (it.originalQuantity.equals("-1")) it.originalQuantity = it.quantity + it.originalQuantity = it.originalQuantity!!.toInt() + + if (it.originalQuantity==-1) it.originalQuantity = it.quantity /* it.originalQuantity = if (it.originalQuantity != "-1") it.originalQuantity.substring( @@ -48,7 +43,7 @@ fun CollectionVO.map(context: Context): CollectionVO { it.pickedQuantity = - if (it.isPrepared == "1" || it.isPreviousPrepared == "1" || it.isControlled == "1") it.quantity else it.pickedQuantity + if (it.isPrepared == "1" || it.isPreviousPrepared == "1" || it.isControlled == "1") it.quantity.toString() else it.pickedQuantity if (!it.placements.isNullOrEmpty()) { it.placements.forEachIndexed { index, placement -> if (index == 0) { 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 10f674be..cf83792f 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 @@ -78,7 +78,7 @@ class PreSacadorAdapter ( onQuantityClick.onQuantityClick(sale) } - if (sale.quantity == sale.pickedQuantity){ + if (sale.quantity == sale.pickedQuantity.toInt()){ sale.isPreviousPrepared = "1" }else{ sale.isPreviousPrepared = "0" diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/mapper/SaleMapper.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/mapper/SaleMapper.kt index 3e9ee21b..a6a84fcc 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/mapper/SaleMapper.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/mapper/SaleMapper.kt @@ -9,14 +9,14 @@ fun PreSacadorItemVO.toSale() : SaleVO { level = "1", saleFk = idMovimiento, itemFk = itemFk, - quantity = saldo.toString(), + quantity = saldo, longName = if (longName != null) longName else "", isPreviousPrepared = if (quantity == picked) "1" else "0", line1 = longName, line2 = if (subName.isNullOrEmpty()) "" else subName,//sergio:cuando subida versiĆ³n de tarea #3510 se puede quitar isNullOrEmpty pickedQuantity = picked.toString(), workerFk = if (trabajador.isNullOrEmpty()) { "0" } else trabajador, - originalQuantity = quantity.toString(), + originalQuantity = quantity, placements = carros, agencyName = if (trabajador.isNullOrEmpty()) { "" } else trabajador, packingType=packingType, @@ -34,14 +34,14 @@ fun PreSacadorItemVO.toSaleReposicion() : SaleVO { level = "1", saleFk = idMovimiento, itemFk = itemFk, - quantity = quantity.toString(), + quantity = quantity, longName = if (longName != null) longName else "", isPreviousPrepared = if ((quantity - saldo) == 0) "1" else "0", line1 = longName, line2 = if (subName.isNullOrEmpty()) "" else subName, pickedQuantity = (quantity - saldo).toString(), workerFk = if (trabajador.isNullOrEmpty()) { "0" } else trabajador, - originalQuantity = quantity.toString(), + originalQuantity = quantity, placements = carros, agencyName = if (trabajador.isNullOrEmpty()) { "" } else trabajador, rgb=null diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/adapter/ReposicionAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/adapter/ReposicionAdapter.kt index 420e3667..95cbc91f 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/adapter/ReposicionAdapter.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/adapter/ReposicionAdapter.kt @@ -69,7 +69,7 @@ class ReposicionAdapter ( } - if (sale.quantity == sale.pickedQuantity){ + if (sale.quantity == sale.pickedQuantity.toInt()){ sale.isPreviousPrepared = "1" }else{ sale.isPreviousPrepared = "0" 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 616487ed..6b58d133 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 @@ -33,7 +33,7 @@ class SaleVO( var saleOrder: Int = 9999, var saleFk: String = "", var itemFk: String = "", - var quantity: String = "", + var quantity: Int?, var longName: String = "", var size: String = "", var reserved: String = "", @@ -49,7 +49,7 @@ class SaleVO( var category: String = "", var origin: String = "", var clientFk: String = "", - var originalQuantity: String = "", + var originalQuantity:Int?, var line1: String = "", var line2: String? = "", var line3: String = "", diff --git a/app/src/main/res/layout/item_article_row_fragment.xml b/app/src/main/res/layout/item_article_row_fragment.xml index 1308e19c..07b7a95a 100644 --- a/app/src/main/res/layout/item_article_row_fragment.xml +++ b/app/src/main/res/layout/item_article_row_fragment.xml @@ -252,7 +252,7 @@ android:paddingRight="10dp" android:visibility="gone" - android:text="@{sale.quantity}" + android:text="@{Integer.toString(sale.quantity)}" android:textColor="@color/verdnatura_white" android:textSize="@dimen/body1" android:textStyle="bold" @@ -365,7 +365,7 @@ android:paddingBottom="@dimen/layout_margin_minest" android:paddingLeft="@dimen/layout_margin_1" android:layout_height="wrap_content" - android:text="@{sale.quantity}" + android:text="@{Integer.toString(sale.quantity)}" android:textColor="@color/verdnatura_white" android:textSize="@dimen/body3" android:textStyle="bold" From f058f239ab92be2cabd3dcf7ef6021e48ff9f83a Mon Sep 17 00:00:00 2001 From: Sergio De la torre Date: Fri, 23 Sep 2022 16:33:23 +0200 Subject: [PATCH 2/2] Version 9.1Beta-Quantity_y_originalQuantity_view_to_Integer.toString --- .idea/misc.xml | 2 +- .../main/java/es/verdnatura/domain/GetLoginUserCase.kt | 4 ++-- app/src/main/java/es/verdnatura/domain/SalixService.kt | 9 ++++----- app/src/main/res/layout/item_article_row.xml | 2 +- app/src/main/res/layout/item_article_row_presacador.xml | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index cfb076e7..32bf13bc 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -207,7 +207,7 @@ - + diff --git a/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt index cb6ab34e..74f014db 100644 --- a/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt @@ -79,7 +79,7 @@ class GetLoginUserCase(context: Context) : RestClient(context) fun sendChekingPresence(token:String,workerId:Int,message:String) : Call{ - var working_in_test=false // Enviar a grupo test Android o a los usuarios + var working_in_test=true // Enviar a grupo test Android o a los usuarios if (!working_in_test) { return salixClient!!.sendChekingPresence( @@ -89,7 +89,7 @@ fun sendChekingPresence(token:String,workerId:Int,message:String) : Call - - } \ No newline at end of file diff --git a/app/src/main/res/layout/item_article_row.xml b/app/src/main/res/layout/item_article_row.xml index acd45c34..d56e44a5 100644 --- a/app/src/main/res/layout/item_article_row.xml +++ b/app/src/main/res/layout/item_article_row.xml @@ -224,7 +224,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="@dimen/layout_margin_1" - android:text="@{sale.quantity}" + android:text="@{Integer.toString(sale.quantity)}" tool:text="10" android:textColor="@color/verdnatura_white" android:textSize="@dimen/h6" diff --git a/app/src/main/res/layout/item_article_row_presacador.xml b/app/src/main/res/layout/item_article_row_presacador.xml index ab8b3aea..e5924343 100644 --- a/app/src/main/res/layout/item_article_row_presacador.xml +++ b/app/src/main/res/layout/item_article_row_presacador.xml @@ -191,7 +191,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="@dimen/layout_margin_min" - android:text="@{sale.quantity}" + android:text="@{Integer.toString(sale.quantity)}" tool:text="10" android:textColor="@color/verdnatura_white" android:textSize="@dimen/h6"