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/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> +} + +interface SalixServiceSend { + + @POST("chats/send") + fun sendGroup( + @Header("Content-Type") content_type: String, + @Header("Authorization") authorization: String, + @Body params: SalixGrupo + ): + 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 b906116d..04c6430c 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 @@ -113,7 +113,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 d24ceb9e..55dff078 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 @@ -933,7 +933,7 @@ class CollectionFragment( private fun responseSaleMoveSuccesful() { sales[positionCollectionSplit].quantity = quantityCollectionSplit - if (quantityCollectionSplit == "0") + if (quantityCollectionSplit == 0) markLine(positionCollectionSplit, type) saleAdapter!!.notifyDataSetChanged() @@ -1015,7 +1015,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) @@ -1409,7 +1409,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) @@ -1518,7 +1518,7 @@ class CollectionFragment( getData(USER), getData(PASSWORD), sales[position].saleFk, - sales[position].quantity + sales[position].quantity.toString() ) positionUnmarked = position @@ -1550,7 +1550,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") @@ -1613,7 +1613,7 @@ class CollectionFragment( mpok?.start() ReviewQuantityForRefreshingAndSorting( customDialogList.getValue().toInt(), - sales[storedPosition].quantity.toInt(), + sales[storedPosition].quantity!!.toInt(), sales[storedPosition].pickedQuantity.toInt() ) customDialogList.dismiss() @@ -1692,7 +1692,7 @@ class CollectionFragment( mpok?.start() ReviewQuantityForRefreshingAndSorting( customDialogList.getValue().toInt(), - sales[storedPosition].quantity.toInt(), + sales[storedPosition].quantity!!.toInt(), sales[storedPosition].pickedQuantity.toInt() ) // SalesSorter(sales) @@ -1855,7 +1855,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 { @@ -2083,7 +2083,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) { @@ -2305,11 +2305,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()) } @@ -2318,7 +2318,7 @@ class CollectionFragment( } } - private fun split(position: Int, quantity: String) { + private fun split(position: Int, quantity: Int) { //sergio: SPLIT SALIX @@ -2327,7 +2327,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) { } @@ -2362,7 +2362,7 @@ class CollectionFragment( private fun TrashMissingReject( position: Int, - quantity: String, + quantity: Int, typeCollectionTrashMissingReject: String ) { typeCollectionMissing = typeCollectionTrashMissingReject @@ -2371,7 +2371,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) { } @@ -2382,7 +2382,7 @@ class CollectionFragment( quantity = totalQuantity.toString(), warehouseFk = getData(WAREHOUSEFK), type = typeCollectionTrashMissingReject, - originalQuantity = quantity + originalQuantity = quantity.toString() ) /* sales[position].quantity = quantity saleAdapter!!.notifyDataSetChanged() @@ -2510,13 +2510,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) { } @@ -2598,7 +2598,7 @@ class CollectionFragment( ) } - private fun increaseQuantity(position: Int, quantity: String) { + private fun increaseQuantity(position: Int, quantity: Int) { positionIncreaseQuantity = position quantityIncrease = quantity @@ -2616,7 +2616,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.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_fragment.xml b/app/src/main/res/layout/item_article_row_fragment.xml index 11828ebd..daf7bde4 100644 --- a/app/src/main/res/layout/item_article_row_fragment.xml +++ b/app/src/main/res/layout/item_article_row_fragment.xml @@ -257,7 +257,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" @@ -370,7 +370,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" 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"