diff --git a/.idea/misc.xml b/.idea/misc.xml index 59419ee4..44e00da1 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -194,7 +194,7 @@ - + diff --git a/app/build.gradle b/app/build.gradle index 87f71b08..e502277c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,8 +13,9 @@ android { applicationId "es.verdnatura" minSdkVersion 21 targetSdkVersion 30 - versionCode 120 - versionName = "8.4" + versionCode 121 + versionName = "8.5Beta" + //versionName = "8.4"// versionCode 120 //versionName "8.4.2Beta" versioncode 119 //versionName "8.4.1Beta" //versionCode 118: arreglat rocket a Alex i llevat callFunction,strings ok //versionName "8.4Beta" //versionCode 117: return i workerAppTester diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json index d256c404..1b567ecd 100644 --- a/app/release/output-metadata.json +++ b/app/release/output-metadata.json @@ -11,8 +11,8 @@ "type": "SINGLE", "filters": [], "attributes": [], - "versionCode": 120, - "versionName": "8.4", + "versionCode": 121, + "versionName": "8.5Beta", "outputFile": "app-release.apk" } ], diff --git a/app/release/vn-picking.apk b/app/release/vn-picking.apk deleted file mode 100644 index a5521c6c..00000000 Binary files a/app/release/vn-picking.apk and /dev/null differ diff --git a/app/src/main/java/es/verdnatura/domain/ApiNodeJsUtils.kt b/app/src/main/java/es/verdnatura/domain/ApiNodeJsUtils.kt index 7b069086..1ae9770c 100644 --- a/app/src/main/java/es/verdnatura/domain/ApiNodeJsUtils.kt +++ b/app/src/main/java/es/verdnatura/domain/ApiNodeJsUtils.kt @@ -5,7 +5,7 @@ import retrofit2.converter.gson.GsonConverterFactory class ApiNodeJsUtils { companion object { - const val BASE_URL:String = "http://10.1.2.24:7777/" + const val BASE_URL:String = "http://10.1.4.72:7777/" // const val BASE_URL:String = "https://smart-tag.verdnatura.es" fun getApiService():NodeJsService{ val nodeJsRetrofit = Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory( diff --git a/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt index e0b34983..4ca2a629 100644 --- a/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt @@ -1,16 +1,10 @@ package es.verdnatura.domain import android.content.Context -import com.google.gson.JsonObject -import es.verdnatura.presentation.view.feature.collection.SalesModified -import es.verdnatura.presentation.view.feature.collection.SalesModifiedList -import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity -import es.verdnatura.presentation.view.feature.collection.sales -import es.verdnatura.presentation.view.feature.login.model.workerId +import es.verdnatura.presentation.view.feature.collection.* import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO -import org.json.JSONObject import retrofit2.Call class GetSacadorControladorUserCase(context: Context) : RestClient(context) { @@ -492,6 +486,9 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) { ): Call { + var saleTransfer = listSaleSalix(mutableListOf()) + saleTransfer.sales.add(saleSalix(id = saleFk.toInt(), quantity = quantity.toInt())) + return salixClient!!.transferSalesSalix( "json", @@ -499,7 +496,7 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) { token, "application/json", ticketFk, - sales(saleId = saleFk.toInt(), quantity = quantity.toInt()) + saleTransfer ) } diff --git a/app/src/main/java/es/verdnatura/domain/SalixService.kt b/app/src/main/java/es/verdnatura/domain/SalixService.kt index bddbc3b1..9e23e35d 100644 --- a/app/src/main/java/es/verdnatura/domain/SalixService.kt +++ b/app/src/main/java/es/verdnatura/domain/SalixService.kt @@ -6,7 +6,8 @@ import es.verdnatura.presentation.common.itemPackingTypeSalix import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity -import es.verdnatura.presentation.view.feature.collection.sales +import es.verdnatura.presentation.view.feature.collection.listSaleSalix +import es.verdnatura.presentation.view.feature.collection.saleSalix import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO import es.verdnatura.presentation.view.feature.login.model.SalixGrupo import es.verdnatura.presentation.view.feature.login.model.SalixMessageVO @@ -73,14 +74,14 @@ interface SalixService { Call - @POST("tickets/{idTicket}/transferSales") + @POST("tickets/{idTicket}/transferSales") //-->saleMove en Silex fun transferSalesSalix( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("Authorization") authorization: String, @Header("Content-Type") content_type: String, @Path("idTicket") idTicket:String, - @Body params: sales + @Body params: listSaleSalix ): Call diff --git a/app/src/main/java/es/verdnatura/presentation/common/UIExtensions.kt b/app/src/main/java/es/verdnatura/presentation/common/UIExtensions.kt index faf37d61..8c6fce4f 100644 --- a/app/src/main/java/es/verdnatura/presentation/common/UIExtensions.kt +++ b/app/src/main/java/es/verdnatura/presentation/common/UIExtensions.kt @@ -8,13 +8,11 @@ import android.graphics.drawable.Drawable import android.media.AudioManager import android.os.Bundle import android.text.InputType -import android.util.Log import android.view.View import android.view.ViewGroup import android.view.ViewTreeObserver import android.view.inputmethod.InputMethodManager import android.widget.ImageView -import androidx.core.content.ContextCompat import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentManager @@ -23,7 +21,6 @@ import androidx.recyclerview.widget.RecyclerView import com.bumptech.glide.Glide import com.bumptech.glide.request.target.CustomTarget import com.bumptech.glide.request.transition.Transition -import es.verdnatura.BuildConfig import java.util.* @@ -69,6 +66,7 @@ fun View.setDimensions(width: Int, height: Int) { layoutParams?.height = height this.layoutParams = layoutParams } + fun View.setMargins(left: Int, top: Int, right: Int, bottom: Int) { val mlp = this.layoutParams as ViewGroup.MarginLayoutParams mlp.setMargins(left, top, right, bottom) @@ -77,12 +75,12 @@ fun View.setMargins(left: Int, top: Int, right: Int, bottom: Int) { fun ImageView.loadUrl(url: String) { Glide.with(context) .asBitmap() - .load(url) - .into(object : CustomTarget() { + .load(url) + .into(object : CustomTarget() { - override fun onLoadCleared(placeholder: Drawable?) {} + override fun onLoadCleared(placeholder: Drawable?) {} - override fun onResourceReady(resource: Bitmap, transition: Transition?) { + override fun onResourceReady(resource: Bitmap, transition: Transition?) { setImageBitmap(resource) } }) @@ -126,7 +124,8 @@ fun Calendar.convertToDateString(): String { fun RecyclerView.addViewObserver(function: () -> Unit) { val view = this - view.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener { + view.viewTreeObserver.addOnGlobalLayoutListener(object : + ViewTreeObserver.OnGlobalLayoutListener { override fun onGlobalLayout() { view.viewTreeObserver.removeOnGlobalLayoutListener(this) function.invoke() @@ -141,6 +140,7 @@ fun Fragment.hideKeyboard() { fun Activity.hideKeyboard() { hideKeyboard(currentFocus ?: View(this)) } + fun Activity.showKeyboardIn() { showKeyboardIn(currentFocus ?: View(this)) } @@ -150,20 +150,20 @@ fun Context.hideKeyboard(view: View) { inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0) } -fun Context.showKeyboard(){ +fun Context.showKeyboard() { val imm = getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager? imm!!.toggleSoftInput(InputType.TYPE_CLASS_NUMBER, 0) } -fun Context.showKeyboardIn(view:View){ +fun Context.showKeyboardIn(view: View) { val imm = getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager? imm!!.showSoftInput(view, 0) } // Extension function to change media volume programmatically -fun AudioManager.setMediaVolume(volumeIndex:Int) { +fun AudioManager.setMediaVolume(volumeIndex: Int) { // Set media volume level this.setStreamVolume( AudioManager.STREAM_MUSIC, // Stream type @@ -173,9 +173,9 @@ fun AudioManager.setMediaVolume(volumeIndex:Int) { } // Extension property to get media maximum volume index -val AudioManager.mediaMaxVolume:Int +val AudioManager.mediaMaxVolume: Int get() = this.getStreamMaxVolume(AudioManager.STREAM_MUSIC) // Extension property to get media/music current volume index -val AudioManager.mediaCurrentVolume:Int +val AudioManager.mediaCurrentVolume: Int get() = this.getStreamVolume(AudioManager.STREAM_MUSIC) diff --git a/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogHour.kt b/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogHour.kt index e23af840..71e41b75 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogHour.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogHour.kt @@ -1,5 +1,6 @@ package es.verdnatura.presentation.view.component +import android.annotation.SuppressLint import android.app.Dialog import android.app.TimePickerDialog import android.content.Context @@ -56,6 +57,7 @@ class CustomDialogHour(context: Context) : Dialog(context, R.style.DialogTheme) //return custom_dialog_hour_value.text.toString() } + @SuppressLint("SimpleDateFormat") fun setHoraValue(value: String): CustomDialogHour { binding.customDialogHourValue.setText(value) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesViewModel.kt index 5c816dfd..7c4b348e 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesViewModel.kt @@ -237,7 +237,7 @@ class AjustesViewModel(context: Context) : BaseViewModel() { response: Response ) { - if (!response.isSuccessful()) { + if (!response.isSuccessful) { _workerupdateSector.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse( @@ -283,7 +283,7 @@ class AjustesViewModel(context: Context) : BaseViewModel() { response: Response ) { - if (!response.isSuccessful()) { + if (!response.isSuccessful) { _workerupdatePrinter.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse( diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt index 66b27336..a53b1d76 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt @@ -61,12 +61,12 @@ class ItemCardFragment( @RequiresApi(Build.VERSION_CODES.O) override fun init() { - binding.itemcardLayout.visibility = View.GONE - ma.hideBottomNavigation(View.GONE) + binding.itemcardLayout.visibility =GONE + ma.hideBottomNavigation(GONE) setEvents() //toolbar_title.text = getString(R.string.ConsultarArticulo) - binding.mainToolbar.toolbarTitle.text = getString(R.string.ConsultarArticulo) + binding.mainToolbar.toolbarTitle.text = getString(R.string.titleItemConsult) //customDialog = CustomDialog(requireContext()) customDialogInput = CustomDialogInput(requireContext()) @@ -133,11 +133,11 @@ class ItemCardFragment( binding.splashProgress.visibility = View.VISIBLE //getItemCard(itemFk) - ma.openFragmentWeb(itemInfoG!!.id) - /* ma.onPasillerosItemClickListener( - PasillerosItemVO(title = getString(R.string.titleHistorical)), - itemInfoG!!.id - )*/ + // ma.openFragmentWeb(itemInfoG!!.id) + ma.onPasillerosItemClickListener( + PasillerosItemVO(title = getString(R.string.titleWebViewer), + ), entryPoint = itemInfoG!!.id) + } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardViewModel.kt index 011a51d5..c1f39d11 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardViewModel.kt @@ -206,23 +206,6 @@ class ItemCardViewModel(context: Context) : BaseViewModel() { }) } - /* fun itemStockUpdate(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String){ - getItemCardUserCase.itemStockUpdate(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada $callFunction."+t.message!!) - } - - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada $callFunction") - }else{ - _response.value = ResponseItemVO(isError = false,response = response.message()!!) - } - - } - - }) - }*/ fun itemTrash( itemFk: String, @@ -260,23 +243,6 @@ class ItemCardViewModel(context: Context) : BaseViewModel() { }) } - /* fun itemPlacementSave(itemFk:String,warehouseFk:String,user:String,password:String,value:String){ - getItemCardUserCase.itemPlacementSave(user,password,itemFk,warehouseFk,value).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)) - } - - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) - } - - } - - }) - }*/ fun updateGrouping( itemFk: String, @@ -296,7 +262,7 @@ class ItemCardViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { - if (!response.isSuccessful()) { + if (!response.isSuccessful) { _response.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse( @@ -351,25 +317,6 @@ class ItemCardViewModel(context: Context) : BaseViewModel() { } //sergio ver como solucionar el tema del "Finish" - /* fun updatePackingType(itemFk:String,user:String,password:String,itemPackingType:String){ - getItemCardUserCase.updatePackingType(user,password,itemFk,itemPackingType).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) - } - - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{ - //if (response.body()=="Finish"){ - // //Log.i("VERDNATURA:","Fisnih encontrado")} - _response.value = ResponseItemVO(isError = false,response = response.body()!!.toString()) - } - - } - - }) - }*/ fun updatePackingTypeSalix(token: String, itemFk: String, itemPackingType: String) { getItemCardUserCase.updatePackingTypeSalix(token, itemFk, itemPackingType) .enqueue(object : Callback { @@ -516,7 +463,7 @@ class ItemCardViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { - if (response.body() == null) { + if (!response.isSuccessful) { _response.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse( diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemProposalFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemProposalFragment.kt index df78d10d..86cb1023 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemProposalFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemProposalFragment.kt @@ -61,7 +61,7 @@ class ItemProposalFragment( private fun currentDay(): String { val calendar = Calendar.getInstance() - val format = SimpleDateFormat("yyyy-MM-dd",Locale.getDefault()) + val format = SimpleDateFormat(getString(R.string.dateFormat),Locale.getDefault()) return format.format(calendar.time) } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragment.kt index 4c4b3358..cde14f2d 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragment.kt @@ -58,11 +58,11 @@ class BufferFragment( when (entryPoint){ - getString(R.string.bufferempty)->entryPoint="UNLOADING" - getString(R.string.bufferfill)-> entryPoint="LOADING" - getString(R.string.bufferaccumulate)->entryPoint="ACCUMULATION" - getString(R.string.bufferoff)->entryPoint="DISABLED" - getString(R.string.bufferfstrapping)->entryPoint="STRAPPING" + getString(R.string.titleBufferEmpty)->entryPoint="UNLOADING" + getString(R.string.titleBufferFill)-> entryPoint="LOADING" + getString(R.string.titleBufferAccumulate)->entryPoint="ACCUMULATION" + getString(R.string.titleBufferOff)->entryPoint="DISABLED" + getString(R.string.titleBufferStrapping)->entryPoint="STRAPPING" } viewModel.buffer_setTypeByName( diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragmentViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragmentViewModel.kt index 61f85ec1..cad03ea1 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragmentViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragmentViewModel.kt @@ -45,8 +45,8 @@ class BufferFragmentViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { - - if (response.body() != null && response.body() == true) { + //sergio: espera respuesta en el body + if (response.body() == true) { _itembuffertype.value = ResponseItemVO( isError = false, diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferLoadFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferLoadFragment.kt index 2446a568..996fd91f 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferLoadFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferLoadFragment.kt @@ -110,7 +110,7 @@ class BufferLoadFragment( ma.messageWithSound(it.errorMessage,it.isError,true) } else { // sergio: viene de la bbdd así - if (it.response.equals("Registro añadido")){ + if (it.response.equals(getString(R.string.registerAdded))){ ma.messageWithSound(it.response,false,true) }else{ diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/adapter/LocationAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/adapter/LocationAdapter.kt index c9c26853..cc62b779 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/adapter/LocationAdapter.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/adapter/LocationAdapter.kt @@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.buscaritem.adapter import android.view.LayoutInflater import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView +import es.verdnatura.R import es.verdnatura.databinding.ItemLocationRowBinding import es.verdnatura.presentation.common.OnPasillerosItemClickListener import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO @@ -25,7 +26,8 @@ class LocationAdapter ( override fun onBindViewHolder(holder: ItemHolder, position: Int) { holder.bind(items[position]) holder.binding.root.setOnClickListener { - onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = "Ubicador"),items[position].Matricula) + onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = holder.binding.root.context.getString( + R.string.titleUbicator)),items[position].Matricula) } } @@ -33,7 +35,7 @@ class LocationAdapter ( class ItemHolder( val binding: ItemLocationRowBinding ) : RecyclerView.ViewHolder(binding.root){ - private val res = binding.root.context.resources + //private val res = binding.root.context.resources fun bind(item: ItemLocationVO) { binding.apply { this.item = item diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/adapter/ItemBuyersAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/adapter/ItemBuyersAdapter.kt index 978883fd..7ad5b9bd 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/adapter/ItemBuyersAdapter.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/adapter/ItemBuyersAdapter.kt @@ -4,30 +4,28 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView +import es.verdnatura.R import es.verdnatura.databinding.ItemBuyerRowBinding import es.verdnatura.presentation.common.OnPasillerosItemClickListener import es.verdnatura.presentation.common.OnStarSelectedListener -import es.verdnatura.presentation.common.convertToDateString import es.verdnatura.presentation.common.loadUrl import es.verdnatura.presentation.view.feature.calidad.model.ItemBuyerVO import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO -import java.text.SimpleDateFormat -import java.util.* -class ItemBuyersAdapter ( +class ItemBuyersAdapter( private val items: List, private val onPasillerosItemClickListener: OnPasillerosItemClickListener, private val onStarSelectedListener: OnStarSelectedListener -): RecyclerView.Adapter () { +) : RecyclerView.Adapter() { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BuyersItemHolder { return BuyersItemHolder( - ItemBuyerRowBinding.inflate(LayoutInflater.from(parent.context),parent,false) + ItemBuyerRowBinding.inflate(LayoutInflater.from(parent.context), parent, false) ) } - override fun getItemCount() =items.size + override fun getItemCount() = items.size override fun onBindViewHolder(holder: BuyersItemHolder, position: Int) { holder.bind(items[position]) @@ -37,17 +35,23 @@ class ItemBuyersAdapter ( inner class BuyersItemHolder( val binding: ItemBuyerRowBinding - ) : RecyclerView.ViewHolder(binding.root){ + ) : RecyclerView.ViewHolder(binding.root) { fun bind(item: ItemBuyerVO) { binding.apply { this.itemBuyer = item if (item.image != "") - imgItem.loadUrl("https://verdnatura.es/vn-image-data/catalog/200x200/"+item.image); + imgItem.loadUrl("https://verdnatura.es/vn-image-data/catalog/200x200/" + item.image) else - imgItem.loadUrl("https://verdnatura.es/vn-image-data/catalog/200x200/"+item.itemFk); + imgItem.loadUrl("https://verdnatura.es/vn-image-data/catalog/200x200/" + item.itemFk) imgItem.setOnClickListener { - onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = "Consultar artículo"),item.itemFk) + onPasillerosItemClickListener.onPasillerosItemClickListener( + PasillerosItemVO( + title = binding.root.context.getString( + R.string.titleItemConsult + ) + ), item.itemFk + ) } if (item.showStars) layoutStars.visibility = View.VISIBLE @@ -55,66 +59,67 @@ class ItemBuyersAdapter ( s1.setOnClickListener { - onStarSelectedListener.onStarSelected(item.id,"1") + onStarSelectedListener.onStarSelected(item.id, "1") } s2.setOnClickListener { - onStarSelectedListener.onStarSelected(item.id,"2") + onStarSelectedListener.onStarSelected(item.id, "2") } s3.setOnClickListener { - onStarSelectedListener.onStarSelected(item.id,"3") + onStarSelectedListener.onStarSelected(item.id, "3") } s4.setOnClickListener { - onStarSelectedListener.onStarSelected(item.id,"4") + onStarSelectedListener.onStarSelected(item.id, "4") } s5.setOnClickListener { - onStarSelectedListener.onStarSelected(item.id,"5") + onStarSelectedListener.onStarSelected(item.id, "5") } - if (item.stars != ""){ + if (item.stars != "") { try { val punt = item.stars.toInt() - if (punt == 1){ + if (punt == 1) { s1.setImageResource(item.iconResourceOk) s2.setImageResource(item.iconResourceKo) s3.setImageResource(item.iconResourceKo) s4.setImageResource(item.iconResourceKo) s5.setImageResource(item.iconResourceKo) - }else if (punt == 2){ + } else if (punt == 2) { s1.setImageResource(item.iconResourceOk) s2.setImageResource(item.iconResourceOk) s3.setImageResource(item.iconResourceKo) s4.setImageResource(item.iconResourceKo) s5.setImageResource(item.iconResourceKo) - }else if (punt == 3){ + } else if (punt == 3) { s1.setImageResource(item.iconResourceOk) s2.setImageResource(item.iconResourceOk) s3.setImageResource(item.iconResourceOk) s4.setImageResource(item.iconResourceKo) s5.setImageResource(item.iconResourceKo) - }else if (punt == 4){ + } else if (punt == 4) { s1.setImageResource(item.iconResourceOk) s2.setImageResource(item.iconResourceOk) s3.setImageResource(item.iconResourceOk) s4.setImageResource(item.iconResourceOk) s5.setImageResource(item.iconResourceKo) - }else if (punt == 5){ + } else if (punt == 5) { s1.setImageResource(item.iconResourceOk) s2.setImageResource(item.iconResourceOk) s3.setImageResource(item.iconResourceOk) s4.setImageResource(item.iconResourceOk) s5.setImageResource(item.iconResourceOk) - }else{ + } else { s1.setImageResource(item.iconResourceOk) s2.setImageResource(item.iconResourceOk) s3.setImageResource(item.iconResourceOk) s4.setImageResource(item.iconResourceOk) s5.setImageResource(item.iconResourceOk) } - }catch (e:Exception){} + } catch (e: Exception) { + } } } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityFragment.kt index 67af5186..e437736a 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityFragment.kt @@ -163,7 +163,7 @@ class QaualityFragment( } private fun getCalendarFromDate(date:String): Calendar { - val sdf = SimpleDateFormat("yyyy-MM-dd") + val sdf = SimpleDateFormat(getString(R.string.dateFormat)) val cal = Calendar.getInstance() cal.time = sdf.parse(date) return cal diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityViewModel.kt index 4515e638..536f7aa9 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityViewModel.kt @@ -61,7 +61,7 @@ class QaualityViewModel(context: Context) : BaseViewModel() { override fun onResponse(call: Call, response: Response) { - if (!response.isSuccessful()){ + if (!response.isSuccessful){ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) }else{ _response.value = ResponseItemVO(isError = false,response = response.message()) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/claim/fragment/ClaimFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/claim/fragment/ClaimFragment.kt index 926238f2..e7be14be 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/claim/fragment/ClaimFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/claim/fragment/ClaimFragment.kt @@ -117,11 +117,11 @@ class ClaimFragment( } else { customDialogList.dismiss() ma.messageWithSound( - "Reclamación ${listClaims.first().code} guardada con matrícula ${ + getString(R.string.claimLabel) +listClaims.first().code + getString(R.string.keepPlate) + listClaims.get( 1 ).code - }", false, true + , false, true ) listClaims.clear() claimAdapter!!.notifyDataSetChanged() diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/CollectionVO.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/CollectionVO.kt index 72df3716..d603f661 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/CollectionVO.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/CollectionVO.kt @@ -15,8 +15,11 @@ class SalixSaleQuantity( var quantity: Int = 0 ) -class sales( - var saleId : Int =0, +class listSaleSalix( + var sales: MutableList +) +class saleSalix( + var id : Int =0, var quantity: Int = 0 ) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/PlacementAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/PlacementAdapter.kt index 177dc498..414608db 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/PlacementAdapter.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/PlacementAdapter.kt @@ -4,6 +4,7 @@ import android.content.Context import android.view.LayoutInflater import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView +import es.verdnatura.R import es.verdnatura.databinding.ItemPlacementRowBinding import es.verdnatura.presentation.common.OnPasillerosItemClickListener import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO @@ -39,7 +40,8 @@ class PlacementAdapter ( this.item = placement itemRootLayout.setOnClickListener { - onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = "Ubicador"),placement.shelving) + onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = binding.root.context.getString( + R.string.titleUbicator)),placement.shelving) } } } 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 eabab596..ac72811c 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 @@ -74,7 +74,7 @@ class SaleAdapter( itemArticleItemFk.setOnClickListener { onPasillerosItemClickListener.onPasillerosItemClickListener( PasillerosItemVO( - title = "Consultar artículo" + title = binding.root.context.getString(R.string.titleItemConsult) ), sale.itemFk ) } @@ -96,7 +96,7 @@ class SaleAdapter( } contentLayout.setOnLongClickListener { - "Nueva funcionalidad en el icono de la derecha".toast(context!!) + //"Nueva funcionalidad en el icono de la derecha".toast(context!!) //onMistakeClickListener.onMistakeClickListener(sale) false } @@ -114,18 +114,18 @@ class SaleAdapter( //ERROR if (sale.originalQuantity != sale.quantity) { layoutError.visibility = View.VISIBLE - txtError.text = "Cantidad original: " + sale.originalQuantity + txtError.text = binding.root.context.getString(R.string.originalQuantity) + sale.originalQuantity if (sale.isPrepared == "1" || sale.isControlled == "1") sale.pickedQuantity = sale.quantity } if (sale.isNew) { layoutError.visibility = View.VISIBLE - txtError.text = "Artículo nuevo" + txtError.text = binding.root.context.getString(R.string.newItem) } - paintTicketcolor(sale.level, itemTicketColor) + paintTicketcolor(sale.level, itemTicketColor) paintTicketcolor(sale.color, itemColor) @@ -257,7 +257,7 @@ class SaleAdapter( } } - private fun paintTicketcolorOld(color: String, itemView: View) { + /* private fun paintTicketcolorOld(color: String, itemView: View) { when (color.uppercase()) { "ROJO" -> itemView.setBackgroundColor(Color.RED) "AMARILLO" -> itemView.setBackgroundColor(Color.YELLOW) @@ -292,7 +292,7 @@ class SaleAdapter( "MARFIL" -> itemView.setBackgroundColor(0xFFf7eada.toInt()) "CIAN" -> itemView.setBackgroundColor(0xFF00ffff.toInt()) "BEIGE" -> itemView.setBackgroundColor(0xFFf2e7bf.toInt()) - "trasparente" -> itemView.setBackgroundColor(0xFFf2e7bf.toInt()) + "transparente" -> itemView.setBackgroundColor(0xFFf2e7bf.toInt()) else -> { itemView.setBackgroundColor(Color.TRANSPARENT) @@ -300,7 +300,7 @@ class SaleAdapter( } } - } + }*/ private fun paintTicketcolor(color: String, itemView: View) { 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 b03a72e8..6f4159b3 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 @@ -9,7 +9,6 @@ import android.net.Uri import android.os.Build import android.os.Bundle import android.speech.SpeechRecognizer -import android.util.Log import android.view.View import android.view.View.GONE import android.view.View.VISIBLE @@ -36,13 +35,11 @@ import es.verdnatura.presentation.view.component.CustomDialogThreeButtons import es.verdnatura.presentation.view.feature.articulo.adapter.BarcodeAdapter import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO import es.verdnatura.presentation.view.feature.collection.ItemVO -import es.verdnatura.presentation.view.feature.collection.SalesModified import es.verdnatura.presentation.view.feature.collection.adapter.SaleAdapter import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO import es.verdnatura.presentation.view.feature.sacador.model.* import timber.log.Timber -import timber.log.Timber.d class CollectionFragment( @@ -158,10 +155,6 @@ class CollectionFragment( setEvents() setToolBar() - /* if (type == SACADOR && getData(VOZ) != "NO") { - setSpeak() - }*/ - if (collection.tickets.isNotEmpty()) { createCollectionList() } @@ -423,11 +416,12 @@ class CollectionFragment( it.errorMessage, it.isError, true ) - }else{ + } else { ma.messageWithSound( - "Split ok", - it.isError, false + getString(R.string.splitOk), + it.isError, true ) + responseSaleMoveSuccesful() } } @@ -541,7 +535,7 @@ class CollectionFragment( } else { customDialogList.setValueTwo("") //showErrorMessage("El resultado del procedimiento barcodeToItem de la etiqueta escaneada es: " +it.response) - showErrorMessage("La línea de compra de la etiqueta escaneada no existe.") + showErrorMessage(getString(R.string.lineNotExist)) if (mperror != null) mperror?.start() } } @@ -602,7 +596,7 @@ class CollectionFragment( if (it.isError) { if (!goBack) ma.messageWithSound( - it.errorMessage + "Usuario:" + workerFkFromTicket, + getString(R.string.noSIP) + it.errorMessage + getString(R.string.user) + workerFkFromTicket, isError = true, true ) @@ -636,13 +630,13 @@ class CollectionFragment( //sergio: devuelve false si no hay para revisar y <> false. if (it.response != "false") { - customDialog.setTitle("Aviso") - .setDescription("Pendiente de revisar : " + it.response) + customDialog.setTitle(getString(R.string.warning)) + .setDescription(getString(R.string.pendingReview) + it.response) .setOkButton(getString(R.string.accept)) { customDialog.dismiss() } - .setKoButton("Revisar") { + .setKoButton(getString(R.string.review)) { binding.splashProgress.visibility = View.VISIBLE viewModel.collectionTicketGet( getData(USER), @@ -711,15 +705,12 @@ class CollectionFragment( if (it.isError) { if (!goBack) { - ma.messageWithSound(it.errorMessage, it.isError, false) + ma.messageWithSound( getString(R.string.rocketKO) + it.errorMessage, it.isError, false) } else { goBack = false } - /*customDialog.setTitle(getString(R.string.error)).setDescription(it.errorMessage) - .setOkButton(getString(R.string.accept)) { - customDialog.dismiss() - }.show()*/ + } }) @@ -737,33 +728,12 @@ class CollectionFragment( val ticket = "[" + sales[positionCollectionSplit].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionCollectionSplit].ticketFk + "/summary)" val message = - "Se ha enviado a Split el articulo " + sales[positionCollectionSplit].itemFk + " del ticket " + ticket + getString(R.string.splitSent) + sales[positionCollectionSplit].itemFk + getString(R.string.fromTicket) + ticket sendSalixMessageNew(message, sales[positionCollectionSplit].salePersonFk) } - private fun sendRocketWithSalesModified(list: List) { - - - var message = "" - - for (sales in list) { - message = - message + "Se ha modificado la cantidad original del artículo ${sales.itemFk} de ${sales.originalQuantity} a ${sales.newQuantity} del ticket ${sales.ticketFk}" - message = message + "\r\n" - - } - //Log.d("VERDNATURA::","Persona a enviar "+collection.tickets.get(0).salesPersonFk) - //Log.d("VERDNATURA::","El message a enviar "+message) - viewModel.sendChekingPresence( - token = getData(TOKEN), - workerId = collection.tickets.get(0).salesPersonFk, - message = message, "sendChekingPresence" - ) - - } - private fun callPicker(extensionNumber: String) { @@ -774,7 +744,7 @@ class CollectionFragment( startActivity(intent) } catch (e: Exception) { - d("VERDNATURA::" + e.message) + // d("VERDNATURA::" + e.message) } @@ -801,7 +771,7 @@ class CollectionFragment( val ticket = "[" + ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + ticketFk + "/summary)" val message = - "Se ha añadido el articulo " + item + " con " + quantity + " unidad/es al ticket " + ticket + getString(R.string.itemAdded) + item + getString(R.string.with) + quantity + getString(R.string.unityTicket) + ticket /* d("VERDNATURA:","el comercial es " + salePerson) @@ -819,10 +789,10 @@ class CollectionFragment( //CREATE LIST private fun createCollectionList() { state = 0 - if (type == SACADOR && getData(VOZ) != "NO") { - // initialize() - speak("Colección cargada, diga listo para empezar.") - } + /* if (type == SACADOR && getData(VOZ) != "NO") { + // initialize() + speak("Colección cargada, diga listo para empezar.") + }*/ binding.mainToolbar.toolbarTitle.text = collection.collectionFk @@ -956,7 +926,7 @@ class CollectionFragment( private fun printObservations(observations: String) { if (observations.trim().isNotEmpty()) { - customDialog.setTitle("Observaciones").setDescription(observations) + customDialog.setTitle(getString(R.string.observations)).setDescription(observations) .setOkButton(getString(R.string.accept)) { customDialog.hide() customDialog.dismiss() @@ -978,7 +948,7 @@ class CollectionFragment( //sergio: pita si encuentra ticket o el saleGroupFk //Log.i("VERDNATURA:","SE busca en sales ${saleVO.ticketFk}") //canviar el titcket per salegroup i enviar a pako saleTracking_add (saleGroupFk) i refrescar pantalla. - d("El salegroup es " + saleVO.saleGroupFk) + //d("El salegroup es " + saleVO.saleGroupFk) if (saleVO.saleGroupFk == txtscan) { // if (saleVO.ticketFk == txtscan ) { isOk = true @@ -1361,7 +1331,7 @@ class CollectionFragment( if (isNumber(customDialogList.getValue()) && isNumber(total) && customDialogList.getValue() .toInt() > total.toInt() ) { - "La cantidad supera a la disponible".toast(requireContext()) + getString(R.string.quantityHigh).toast(requireContext()) } else if (isNumber(customDialogList.getValue())) { originalItemScan = customDialogList.getValueTwo() // Log.i("VERDATURA","Le pasamos el siguiente item $originalItemScan que es el escaneado") @@ -1399,19 +1369,20 @@ class CollectionFragment( scanRequest() hideKeyboards() } else { - "cantidad introducida erronea".toast(requireContext()) + getString(R.string.quantityError).toast(requireContext()) } } else { - "Escanea item para validar".toast(requireContext()) + getString(R.string.scanItemValidate).toast(requireContext()) } }.setKoButton(getString(R.string.close)) { scanRequest() hideKeyboards() customDialogList.dismiss() - }.setHintValue("Cantidad que coges:").setValue(total).setHintValueTwo("Escanea item") + }.setHintValue(getString(R.string.quantitySelect)).setValue(total) + .setHintValueTwo(getString(R.string.scanItem)) .setValueTwo("").show() } catch (e: Exception) { //////Log.i("VERDNATURA:","${e.message.toString()}") @@ -1441,7 +1412,7 @@ class CollectionFragment( if (isNumber(customDialogList.getValue()) && customDialogList.getValue() .toInt() > total.toInt() ) { - "La cantidad supera a la disponible".toast(requireContext()) + getString(R.string.quantityHigh).toast(requireContext()) } else if (isNumber(customDialogList.getValue())) { originalItemScan = customDialogList.getValueTwo() @@ -1478,7 +1449,7 @@ class CollectionFragment( scanRequest() } } else { - "cantidad introducida erronea".toast(requireContext()) + getString(R.string.quantityError).toast(requireContext()) } } catch (e: Exception) { @@ -1486,7 +1457,7 @@ class CollectionFragment( } } else { - "Escanea item para validar".toast(requireContext()) + getString(R.string.scanItemValidate).toast(requireContext()) } scanRequest() hideKeyboards() @@ -1632,10 +1603,10 @@ class CollectionFragment( } else { ma.messageWithSound( - "Falta seleccionar impresora.", + getString(R.string.printerFault), isError = true, true, - "Error al imprimir", + getString(R.string.printError), false ) @@ -1821,9 +1792,8 @@ class CollectionFragment( if (item.available.isNullOrEmpty()) { item.available = "0" } - - customDialog.setTitle("Artículo: " + item.id) - .setDescription("Disponible: " + item.available) + customDialog.setTitle(getString(R.string.itemPoints) + item.id) + .setDescription(getString(R.string.available)+":" + item.available) .setOkButton(getString(R.string.accept)) { scanRequest() customDialog.dismiss() @@ -1879,8 +1849,8 @@ class CollectionFragment( ) { - customDialogInput.setTitle("Número de baldas del ticket") - .setDescription("Indica el número de baldas que ocupa el ticket") + customDialogInput.setTitle(getString(R.string.shlevesNumber)) + .setDescription(getString(R.string.shlevesNumberTicket)) .setOkButton(getString(R.string.accept)) { if (!customDialogInput.getValue().isNullOrEmpty()) { @@ -1943,8 +1913,8 @@ class CollectionFragment( isMarking = false - customDialogInput.setTitle("Número de paquetes en balda") - .setDescription("Indica el número de paquetes que caben en una balda") + customDialogInput.setTitle(getString(R.string.packetNumberShelves)) + .setDescription(getString(R.string.packetIndicate)) .setOkButton(getString(R.string.accept)) { if (!customDialogInput.getValue().isNullOrEmpty()) { @@ -2006,11 +1976,11 @@ class CollectionFragment( //FALTAS / BASURA / SPLIT private fun showQuantityDialog(position: Int) { customDialogThreeButtons.setDescription(getString(R.string.txtnuevacantidad)).setValue("") - .setOkButton(getString(R.string.Faltas)) { + .setOkButton(getString(R.string.titleFaults)) { checkAndCall( position, customDialogThreeButtons.getValue(), - getString(R.string.Faltas) + getString(R.string.titleFaults) ) }.setOkButtonTwo(getString(R.string.BasuraRechazar)) { @@ -2057,7 +2027,7 @@ class CollectionFragment( when (action) { getString(R.string.Agregar) -> increaseQuantity(position, value) getString(R.string.BasuraRechazar) -> TrashMissingReject(position, value, "TRUE") - getString(R.string.Faltas) -> TrashMissingReject(position, value, "FALSE") + getString(R.string.titleFaults) -> TrashMissingReject(position, value, "FALSE") getString(R.string.Reject) -> TrashMissingReject(position, value, "reject") getString(R.string.Split) -> split(position, value) @@ -2071,50 +2041,42 @@ class CollectionFragment( private fun split(position: Int, quantity: String) { //sergio: SPLIT SALIX - /* Log.d("VERDNATURA::", "split") - Log.d( - "VERDNATURA::", - "IdTicket-" + sales[position].ticketFk + "-saleFk-" + sales[position].saleFk + "-quant-" + sales[position].quantity - ) + + quantityCollectionSplit = quantity + positionCollectionSplit = position + + var totalQuantity: Int = 0 + try { + totalQuantity = sales[position].quantity.toInt() - quantity.toInt() + } catch (e: Exception) { + } + + //var working_in_test = true + viewModel.transferSalesSalix( getData(TOKEN), ticketFk = sales[position].ticketFk, saleFk = sales[position].saleFk, - quantity = quantity - )*/ + quantity = totalQuantity.toString() + ) - quantityCollectionSplit = quantity - positionCollectionSplit = position - var totalQuantity: Int = 0 - try { - totalQuantity = sales[position].quantity.toInt() - quantity.toInt() - } catch (e: Exception) { - } - viewModel.saleMove( - getData(USER), - getData(PASSWORD), - saleFk = sales[position].saleFk, - quantity = totalQuantity.toString(), - originalQuantity = sales[position].quantity - ) + /* sales[position].quantity = quantity - /* sales[position].quantity = quantity + if (quantity == "0") + markLine(position, type) + saleAdapter!!.notifyDataSetChanged() - if (quantity == "0") - markLine(position, type) - saleAdapter!!.notifyDataSetChanged() - - //enviar mensaje a salix - val ticket = - "[" + sales[position].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].ticketFk + "/summary)" - val message = - "Se ha enviado a Split el articulo " + sales[position].itemFk + " del ticket " + ticket - viewModel.sendChekingPresence( - token = getData(TOKEN), - workerId = sales[position].salePersonFk, - message = message, "sendChekingPresence" - )*/ + //enviar mensaje a salix + val ticket = + "[" + sales[position].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].ticketFk + "/summary)" + val message = + "Se ha enviado a Split el articulo " + sales[position].itemFk + " del ticket " + ticket + viewModel.sendChekingPresence( + token = getData(TOKEN), + workerId = sales[position].salePersonFk, + message = message, "sendChekingPresence" + )*/ } @@ -2303,7 +2265,7 @@ class CollectionFragment( } } - //sergio:ahora desde encajado + //sergio:ahora desde encajado // sendSalixMessageNew(message, sales[positionCollectionMissing].salePersonFk) binding.splashProgress.visibility = VISIBLE @@ -2337,7 +2299,7 @@ class CollectionFragment( "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 + //sergio: ahora desde encajadores // sendSalixMessageNew(message, sales[positionIncreaseQuantity].salePersonFk) sales[positionIncreaseQuantity].originalQuantity = quantityIncrease @@ -2443,7 +2405,7 @@ class CollectionFragment( //Timber.d("VERDNATURA-Entrant en el show scanner al punxar sobre la sale") customDialogInput.setTitle("" + sale.itemFk) - .setDescription(getString(R.string.Escaneaelcarroparaelitemseleccionado)) + .setDescription(getString(R.string.scanWagonForItem)) .setOkButton(getString(R.string.accept)) { if (!customDialogInput.getValue().isNullOrEmpty()) { findSale(customDialogInput.getValue(), index) @@ -2473,7 +2435,7 @@ class CollectionFragment( } private fun showErrorMessage(text: String) { - customDialog.setTitle("Error al marcar la linea").setDescription(text) + customDialog.setTitle(getString(R.string.errorMarkLine)).setDescription(text) .setKoButton(getString(R.string.close)) { customDialog.dismiss() }.show() @@ -2487,11 +2449,12 @@ class CollectionFragment( } - customDialogList.setTitle("Causa de error").setKoButton(getString(R.string.cancel)) { - scanRequest() - hideKeyboards() - customDialogList.dismiss() - }.hideDialog().show() + customDialogList.setTitle(getString(R.string.errorCause)) + .setKoButton(getString(R.string.cancel)) { + scanRequest() + hideKeyboards() + customDialogList.dismiss() + }.hideDialog().show() placementSupplyAdapter = @@ -2564,19 +2527,19 @@ class CollectionFragment( speakOrder() } OTRO -> { - speak("Orden no registrada") + // speak("Orden no registrada") } FALTA -> { - speak("Orden no registrada") + // speak("Orden no registrada") } - else -> speak("Orden no registrada") + //else -> speak("Orden no registrada") } } private fun speakOrder() { if (type == SACADOR) { if (state == 0) { - speak("Colección cargada.") + //speak("Colección cargada.") } else { var index = 0 for (sale in sales) { @@ -2619,12 +2582,12 @@ class CollectionFragment( if (lastPlacementPicked == null || lastPlacementPicked!!.placement != placement.placement) { lastPlacementPicked = placement try { - speak("Pasillo " + pasillo.toInt() + ", Sector " + sector.toInt() + ", " + carroSeparate.toString()) + // speak("Pasillo " + pasillo.toInt() + ", Sector " + sector.toInt() + ", " + carroSeparate.toString()) } catch (e: Exception) { - speak("Pasillo " + pasillo + " Sector " + sector + " Carro " + carro) + // speak("Pasillo " + pasillo + " Sector " + sector + " Carro " + carro) } } else if (lastPlacementPicked != null && lastPlacementPicked!!.shelving != placement.shelving) { - speak(" Carro " + carro) + // speak(" Carro " + carro) } else { state = 2 speakOrder() @@ -2637,14 +2600,15 @@ class CollectionFragment( } } else { - speak("El item " + sale.itemFk + " no se encuentra disponible. Se necesita actuación manual.") + // speak("El item " + sale.itemFk + " no se encuentra disponible. Se necesita actuación manual.") } } else if (state == 2) { //cantar articulo try { val item = sale.itemFk - val cantidad = sale.quantity.toInt() - sale.pickedQuantity.toInt() + val cantidad = + sale.quantity.toInt() - sale.pickedQuantity.toInt() val listtext = sale.longName.split(" ") var nombre: String if (listtext.isNotEmpty()) { @@ -2653,9 +2617,9 @@ class CollectionFragment( nombre = sale.longName + " " + sale.color } - speak("Item " + item.toInt() + " " + nombre + " , Cantidad: " + cantidad) + //speak("Item " + item.toInt() + " " + nombre + " , Cantidad: " + cantidad) } catch (e: Exception) { - speak("Se necesita actuación manual") + //speak("Se necesita actuación manual") } } else if (state == 3) { //marcar linea @@ -2689,7 +2653,7 @@ class CollectionFragment( state = 0 //speak("Acción registrada. Diga listo para continuar") - speak("Registrada") + // speak("Registrada") } @@ -2701,7 +2665,7 @@ class CollectionFragment( } if (index >= sales.size) { - speak("Colección completada.") + //speak("Colección completada.") } } } 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 d33ab31f..7e872769 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 @@ -12,7 +12,6 @@ import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.view.feature.collection.ItemVO -import es.verdnatura.presentation.view.feature.collection.SalesModified import es.verdnatura.presentation.view.feature.collection.SalesModifiedList import es.verdnatura.presentation.view.feature.collection.mapper.map import es.verdnatura.presentation.view.feature.sacador.model.* @@ -190,7 +189,7 @@ class CollectionViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { - if (response.body() == null) { + if (!response.isSuccessful) { _response.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse( @@ -276,7 +275,7 @@ class CollectionViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { - if (response.body() == null) { + if (!response.isSuccessful) { _response.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse( @@ -471,17 +470,6 @@ class CollectionViewModel(context: Context) : BaseViewModel() { } - /* if (response.body() == null) - { - _responseNew.value = ResponseItemVO( - isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) - ) - } else - { - _responseNew.value = - ResponseItemVO(isError = false, response = response.body()!!) - }*/ } }) } @@ -551,6 +539,7 @@ class CollectionViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { + //sergio: salix devuelve id if (response.body() == null) { _responseSplit.value = ResponseItemVO( isError = true, @@ -593,7 +582,7 @@ class CollectionViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { - if (response.body() == null) { + if (!response.isSuccessful) { _responseMissingTrash.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse( @@ -733,7 +722,7 @@ class CollectionViewModel(context: Context) : BaseViewModel() { ) } else { _response.value = - ResponseItemVO(isError = false, response = "Cambiado estado") + ResponseItemVO(isError = false, response = "") } } }) @@ -752,6 +741,7 @@ class CollectionViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { + //sergio:devuelve item if (response.body() == null) { _responseCode.value = ResponseItemVO( isError = true, @@ -779,7 +769,7 @@ class CollectionViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { - if (response.body() == null) { + if (!response.isSuccessful) { _responseCode.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse( @@ -821,7 +811,7 @@ class CollectionViewModel(context: Context) : BaseViewModel() { override fun onResponse(call: Call, response: Response) { - if (response.body() == null) + if (!response.isSuccessful) ) { _responseIncQuantity.value = ResponseItemVO( isError = true, @@ -886,7 +876,7 @@ class CollectionViewModel(context: Context) : BaseViewModel() { if (!response.isSuccessful || response.message() == "false") { _responseSalixMessage.value = ResponseItemVO( isError = true, - errorMessage = "Error al enviar mensaje rocket." + getMessageFromAllResponse( + errorMessage = getMessageFromAllResponse( nameofFunction(this), response.message() ) ) @@ -897,7 +887,7 @@ class CollectionViewModel(context: Context) : BaseViewModel() { override fun onFailure(call: Call, t: Throwable) { _responseSalixMessage.value = ResponseItemVO( isError = true, - errorMessage = "Error al enviar mensaje rocket." + getMessageFromAllResponse( + errorMessage = getMessageFromAllResponse( nameofFunction(this), t.message!! ) ) @@ -931,7 +921,7 @@ class CollectionViewModel(context: Context) : BaseViewModel() { call: Call, response: Response ) { - if (response.body() == null) { + if (!response.isSuccessful) { _response.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse( @@ -1006,7 +996,7 @@ class CollectionViewModel(context: Context) : BaseViewModel() { _responseGetExtensionFromUserId.value = ResponseItemVO( isError = true, response = response.body()!!, - errorMessage = "No se puede realizar la llamada. El usuario no tiene la extensión configurada. Solicítelo a informática." + errorMessage = "" ) } } @@ -1063,8 +1053,8 @@ class CollectionViewModel(context: Context) : BaseViewModel() { } else { _responseGetExtensionFromUserId.value = ResponseItemVO( isError = true, - response = response.message()!!, - errorMessage = "No se puede realizar la llamada. El usuario no tiene la extensión configurada. Solicítelo a informática." + response = "", + errorMessage = response.message()!! ) } } 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 17f13a23..edb278c8 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 @@ -21,6 +21,11 @@ fun CollectionVO.map(): CollectionVO { // sergio: OBLIGAR A ACTUALIZAR VERSIÓN PARA SUBIR DESPUÉS FICHEROS DEL BACK collection_getTickets al mismo tiempo") //it.quantity = it.quantity.substring(0, it.quantity.indexOf(".")) + + //Solución Tarea #3420 + //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 { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoFragment.kt index 5da00bad..5484686f 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoFragment.kt @@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.controlvehiculo.fragment import android.content.Context import android.graphics.drawable.Drawable import android.os.Build +import android.util.Log import android.util.TypedValue import android.view.View.GONE import android.view.View.VISIBLE @@ -53,11 +54,6 @@ class ControlVehiculoFragment( binding.splashProgress.visibility = GONE - /* if (getWagons() < 2 && !tagName.equals(SacadorFragment.TAG)) - { - ma.openFragmentPickers() - }*/ - if (tagName.equals(HistoricoVehiculoFragment.TAG)) { setToolBar("HISTORY") @@ -191,8 +187,10 @@ class ControlVehiculoFragment( private fun insertControlTimeVehicle(plateNumber: String, direction: String) { if (direction.equals("HISTORY")) { + + ma.onPasillerosItemClickListener( - PasillerosItemVO(title = "Historico Vehículo"), + PasillerosItemVO(title = getString(R.string.titleHistoricalHide)), plateNumber ) } else if (direction.equals("IN")) { @@ -277,7 +275,7 @@ class ControlVehiculoFragment( insertControlTimeVehicle(customDialogThreeButtons.getValue(), "OUT") } } - }.setOkButtonFour("HISTÓRICO") { + }.setOkButtonFour(getString(R.string.historical)) { if (customDialogThreeButtons.getValue().trim().isEmpty()) { getString(R.string.returnScan).toast(requireContext()) } else { @@ -300,7 +298,7 @@ class ControlVehiculoFragment( .setValue(plate) - .setOkButtonFour("HISTÓRICO") { + .setOkButtonFour(getString(R.string.historical)) { if (customDialogThreeButtons.getValue().trim().isEmpty()) { getString(R.string.returnScan).toast(requireContext()) } else { @@ -323,10 +321,7 @@ class ControlVehiculoFragment( if (it.isError) { ma.messageWithSound(it.errorMessage, true, false) - /*customDialog.setTitle(getString(R.string.error)).setDescription(it.errorMessage) - .setOkButton(getString(R.string.close)) { - customDialog.dismiss() - }.show()*/ + } else { if (it.response == "false") { @@ -338,8 +333,7 @@ class ControlVehiculoFragment( } else { if (it.response == "true") { - - ma.openFragmentPickers(true) + ma.openFragmentPickers(false) //ma.onPasillerosItemClickListener( PasillerosItemVO(title = "Sacadores"),"CONTROL") //checkControlTimeVehicle() } @@ -351,42 +345,24 @@ class ControlVehiculoFragment( responsecontrol.observe(viewLifecycleOwner, { binding.splashProgress.visibility = GONE - // Log.i("VERDNATURA:","${it.response}") + if (it.isError) { ma.messageWithSound(it.errorMessage, true, false) - /*customDialog.setTitle(getString(R.string.error)).setDescription(it.errorMessage) - .setOkButton(getString(R.string.close)) { - customDialog.dismiss() - }.show()*/ + } else { if (it.response.equals("1")) { isWorkedTimed = "REGISTERED" setToolBar("OUT") - /* customDialog.setTitle("Control de vehículos") - .setDescription("SI Tienes coche asignado") - .setOkButton(getString(R.string.close)) { - customDialog.dismiss() - }.show()*/ + if (!tagName.equals(SacadorFragment.TAG)) { - ma.openFragmentPickers(true) + ma.openFragmentPickers(false) } } else { if (it.response.equals("0")) { setToolBar("IN") - /* customDialog.setTitle("Control de vehículos") - .setDescription("Escanea la matrícula del vehículo o elige sin vehículo") - .setOkButton("Escanear vehículo") { - customDialog.dismiss() - showScanner("Escanea matrícula del vehículo", "IN") - } - .setKoButton("SIN VEHÍCULO") { - customDialog.dismiss() - saveData(DATENOVEHICLE, SimpleDateFormat("yyyy-MM-dd",Locale.getDefault()).format(Date()).toString()) - ma.openFragmentPickers(true) - }.show()*/ customDialogInput.setTitle(getString(R.string.vehiclecontrol)) .setDescription(getString(R.string.scanPlate)) .setOkButton(getString(R.string.takeVehicle)) { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoUsuarioFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoUsuarioFragment.kt index 61253013..da7f290e 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoUsuarioFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoUsuarioFragment.kt @@ -88,10 +88,7 @@ class ControlVehiculoUsuarioFragment( binding.splashProgress.visibility = GONE if (it.isError) { ma.messageWithSound(it.errorMessage,true,false) - /*customDialog.setTitle(getString(R.string.error)).setDescription(it.errorMessage) - .setOkButton(getString(R.string.close)) { - customDialog.dismiss() - }.show()*/ + } else { //sergio: se modifica el response = null. En casi todas las llamadas se utilizaba para ver si había error. // Ahora ya no. diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoViewModel.kt index fcc4d9bc..adc1c4d8 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoViewModel.kt @@ -45,17 +45,25 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { - if (response.body() == null || response.body().toString() == "false") { - _responseinsert.value = ResponseItemVO( - isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) - ) - } else { + //sergio_devuelve true o false + if (response.isSuccessful){ + if (response.body().toString() == "false") { + _responseinsert.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) + ) + } else { - _responseinsert.value = - ResponseItemVO(isError = false, response = response.body()!!.toString()) + _responseinsert.value = + ResponseItemVO(isError = false, response = response.body()!!.toString()) - } + } + }else{ + _responseinsert.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) + ) + } } @@ -77,18 +85,27 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { - if (response.body() == null || response.body().toString() == "false") { + //sergio devuelve true o false + if (response.isSuccessful){ + + if (response.body().toString() == "false") { _responseinsert.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) ) } else { - //_response.value = ResponseItemVO(isError = false,response = response.body()!!) + _responseinsert.value = ResponseItemVO(isError = false, response = response.body()!!.toString()) - //Log.i("VERDNATURA:","Respuesta call vehicle_insert ${response.body()}") + } + }else{ + _responseinsert.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) + ) + } } }) @@ -107,7 +124,8 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { - if (response.body() == null) { + + if (!response.isSuccessful) { _responsecontrol.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) @@ -115,9 +133,10 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() { } else { _responsecontrol.value = ResponseItemVO(isError = false, response = response.body()!!) - } } + } + }) } @@ -131,7 +150,6 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() { android_id ).enqueue(object : Callback { override fun onFailure(call: Call, t: Throwable) { - // Log.i("VERDNATURA::","${t.message}") _responsemachine.value = ResponseItemMachineControl( isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!), @@ -140,14 +158,8 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { - if (response.body() == null) { + if (response.body() != null) { - /*_responsemachine.value = ResponseItemMachineControl( - isError = true, - errorMessage = "Error al comprobar el nombre del dispositivo", - type = "" - )*/ - } else { _responsemachine.value = ResponseItemMachineControl( isError = false, @@ -176,20 +188,19 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { - if (response.body() == null) { + if (response.body() != null) { /* _responsemachine.value = ResponseItemMachineControl( isError = true, errorMessage = "Error al comprobar usuario del dispositivo", type = "" )*/ - } else { + _responsemachine.value = ResponseItemMachineControl( isError = false, response = response.body()!!, type = "getWorker" - ) - } + )} } @@ -214,19 +225,14 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { + //sergio: devuelve en el body if (response.body() == null) { ResponseItemMachineControl( isError = false, response = response.body()!!, type = "getWorkerPlate" ) - //sergio: se modifica el response = null. En casi todas las llamadas se utilizaba para ver si había error. - // Ahora ya no. - /* _responsemachine.value = ResponseItemMachineControl( - isError = true, - errorMessage = "Error al comprobar el trabajador si ha cogido el vehículo", - type = "" - )*/ + } else { _responsemachine.value = ResponseItemMachineControl( diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/adapter/DayOfSaleAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/adapter/DayOfSaleAdapter.kt index 5795ef62..2bbd9b60 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/adapter/DayOfSaleAdapter.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/adapter/DayOfSaleAdapter.kt @@ -34,7 +34,7 @@ class DayOfSaleAdapter ( fun bind(item: ItemShelvingSaleDate) { binding.apply { this.item = item - val sdf = SimpleDateFormat("yyyy-MM-dd") + val sdf = SimpleDateFormat(res.getString(R.string.dateFormat)) val currentDate = sdf.format(Date()) if (currentDate == item.dated){ saledate.setBackgroundColor( diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/fragment/DayOfSaleFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/fragment/DayOfSaleFragment.kt index 357d43a1..0aabf7f0 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/fragment/DayOfSaleFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/fragment/DayOfSaleFragment.kt @@ -40,7 +40,7 @@ class DayOfSaleFragment( customDialog = CustomDialog(requireContext()) customDialogList = CustomDialogList(requireContext()) setEvents() - setToolBar(getString(R.string.dayofSale)) + setToolBar(entryPoint) super.init() } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/fragment/DayOfSaleViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/fragment/DayOfSaleViewModel.kt index 5b1728bc..c0bbe7c6 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/fragment/DayOfSaleViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/fragment/DayOfSaleViewModel.kt @@ -122,26 +122,6 @@ class DayOfSaleViewModel(context: Context) : BaseViewModel() { return list }*/ - - /* fun itemShelving_updateSpam(user: String, password: String,vShelvingFK:String){ - GetDayOfSaleUSerCase.itemShelving_updateSpam(user,password,vShelvingFK).enqueue(object : Callback{ - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelving_updateSpam."+t.message!!) - } - - override fun onResponse(call: Call, response: Response) { - - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelving_updateSpam") - }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!.toString()) - } - - } - - }) - }*/ - fun parking(usuario: String,password: String,scanItem: String,parking:String){ GetDayOfSaleUSerCase.shelvingPark(usuario,password,scanItem,parking).enqueue(object : diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/adapter/FaltasAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/adapter/FaltasAdapter.kt index 2e9a0d60..a34db1b7 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/adapter/FaltasAdapter.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/adapter/FaltasAdapter.kt @@ -4,6 +4,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView +import es.verdnatura.R import es.verdnatura.databinding.ItemFaltasRowBinding import es.verdnatura.presentation.common.OnFaltasNichoClickListener import es.verdnatura.presentation.common.OnFaltasReviewClickListener @@ -50,13 +51,14 @@ class FaltasAdapter ( onFaltasReviewClickListener.onFaltasReviewClickListener(item) } itemFk.setOnClickListener { - onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = "Consultar artículo"),item.itemFk) + onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = res.getString( + R.string.titleItemConsult)),item.itemFk) } itemUp.setOnClickListener { - onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = "Buscar item"),item.itemFk) + onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = res.getString(R.string.titleItemSearch)),item.itemFk) } itemDown.setOnClickListener { - onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = "Buscar item"),item.itemFk) + onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = res.getString(R.string.titleItemSearch)),item.itemFk) } } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasViewModel.kt index 617de408..37cd9f94 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasViewModel.kt @@ -91,7 +91,7 @@ class FaltasViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { - if (response.isSuccessful()) { + if (!response.isSuccessful) { _response.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse( diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/historicoarticulo/adapter/HistoricoAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/historicoarticulo/adapter/HistoricoAdapter.kt index ed8e7953..2fca8c78 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/historicoarticulo/adapter/HistoricoAdapter.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/historicoarticulo/adapter/HistoricoAdapter.kt @@ -36,7 +36,7 @@ class HistoricoAdapter ( binding.apply { this.item = item - val sdf = SimpleDateFormat("yyyy-MM-dd") + val sdf = SimpleDateFormat(res.getString(R.string.dateFormat)) val currentDate = sdf.format(Date()) if (currentDate == item.shipped){ // historicoDate.setBackgroundColor(res.getColor(R.color.verdnatura_pumpkin_orange)) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/historicoarticulo/fragment/HistoricoArticuloFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/historicoarticulo/fragment/HistoricoArticuloFragment.kt index cb1ce148..ac741577 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/historicoarticulo/fragment/HistoricoArticuloFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/historicoarticulo/fragment/HistoricoArticuloFragment.kt @@ -198,7 +198,7 @@ class HistoricoArticuloFragment( private fun navigateToToday(it: ItemHistoricoListVO) { var positionToday = 0 - val sdf = SimpleDateFormat("yyyy-MM-dd") + val sdf = SimpleDateFormat(getString(R.string.dateFormat)) val currentDate = sdf.format(Date()) for (item in it.list) { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/historicovehiculo/fragment/HistoricoVehiculoFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/historicovehiculo/fragment/HistoricoVehiculoFragment.kt index 3af9c8d4..62a5fb6a 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/historicovehiculo/fragment/HistoricoVehiculoFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/historicovehiculo/fragment/HistoricoVehiculoFragment.kt @@ -1,5 +1,6 @@ package es.verdnatura.presentation.view.feature.historicovehiculo.fragment +import android.util.Log import android.view.View import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager @@ -7,88 +8,91 @@ import es.verdnatura.R import es.verdnatura.databinding.FragmentHistoricovehiculoBinding import es.verdnatura.domain.notNull import es.verdnatura.presentation.base.BaseFragment -import es.verdnatura.presentation.view.component.CustomDialog -import es.verdnatura.presentation.view.component.CustomDialogInput import es.verdnatura.presentation.view.feature.historicovehiculo.adapter.HistoricoVehiculoAdapter import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculoList -import es.verdnatura.presentation.view.feature.main.activity.MainActivity -import timber.log.Timber.d import java.text.SimpleDateFormat import java.util.* -class HistoricoVehiculoFragment ( - var numberPlate:String = "" - ) : BaseFragment( - HistoricoVehiculoViewModel::class) { +class HistoricoVehiculoFragment( + var numberPlate: String = "" +) : BaseFragment( + HistoricoVehiculoViewModel::class +) { - private var adapter : HistoricoVehiculoAdapter? = null + private var adapter: HistoricoVehiculoAdapter? = null - companion object { - fun newInstance(entryPoint:String) = HistoricoVehiculoFragment(entryPoint) + companion object { + fun newInstance(entryPoint: String) = HistoricoVehiculoFragment(entryPoint) + } + + override fun getLayoutId(): Int = R.layout.fragment_historicovehiculo + + + override fun init() { + + ma.hideBottomNavigation(View.GONE) + + viewModel.machineWorker_getHistorical(getData(USER), getData(PASSWORD), numberPlate) + binding.mainToolbar.toolbarTitle.text = getString(R.string.vehiclediary) + setEvents() + super.init() + } + + + private fun setEvents() { + binding.mainToolbar.backButton.setOnClickListener { + requireActivity().onBackPressed() } + } - override fun getLayoutId(): Int = R.layout.fragment_historicovehiculo + override fun observeViewModel() { + with(viewModel) { + loadHistoricoVehiculoList.observe(viewLifecycleOwner, Observer { event -> + event.getContentIfNotHandled().notNull { + binding.splashProgress.visibility = View.GONE + adapter = HistoricoVehiculoAdapter(it.list) + binding.historicovehiculoRecyclerview.adapter = adapter + binding.historicovehiculoRecyclerview.layoutManager = + LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) + navigateToToday(it) + if (it.list.isEmpty()) { + ma.messageWithSound( + getString(R.string.lookWithpermission), true, true, getString( + R.string.info + ) + ) + } else { + if (it.list[0].isError) { + ma.messageWithSound( + it.list[0].errorMessage, true, true, getString( + R.string.info + ) + ) - override fun init() - { - - ma.hideBottomNavigation(View.GONE) - - viewModel.machineWorker_getHistorical(getData(USER),getData(PASSWORD),numberPlate) - binding.mainToolbar.toolbarTitle.text = getString(R.string.vehiclediary) - setEvents() - super.init() - } - - - private fun setEvents(){ - binding.mainToolbar.backButton.setOnClickListener { - requireActivity().onBackPressed() - } - } - - override fun observeViewModel() { - with(viewModel){ - loadHistoricoVehiculoList.observe(viewLifecycleOwner, Observer{ event -> - event.getContentIfNotHandled().notNull { - binding.splashProgress.visibility = View.GONE - adapter = HistoricoVehiculoAdapter(it.list) - binding.historicovehiculoRecyclerview.adapter = adapter - binding.historicovehiculoRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) - navigateToToday(it) - - if (it.list.isEmpty()){ - ma.messageWithSound(getString(R.string.lookWithpermission),true,true,getString( - R.string.info)) - }else{ - if (it.list[0].isError){ - ma.messageWithSound(it.list[0].errorMessage,true,true,getString( - R.string.info)) - - } } - } - }) - } - } - private fun navigateToToday(it: ItemHistoricoVehiculoList){ - var positionToday = 0 - val sdf = SimpleDateFormat("yyyy-MM-dd") - val currentDate = sdf.format(Date()) - - for (item in it.list){ - if (currentDate == item.inTimed){ - break } - positionToday += 1 - } - - binding.historicovehiculoRecyclerview.scrollToPosition(positionToday) + }) } + } + + private fun navigateToToday(it: ItemHistoricoVehiculoList) { + var positionToday = 0 + val sdf = SimpleDateFormat(getString(R.string.dateFormat)) + val currentDate = sdf.format(Date()) + + for (item in it.list) { + if (currentDate == item.inTimed) { + break + } + positionToday += 1 + } + + binding.historicovehiculoRecyclerview.scrollToPosition(positionToday) + } } \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/imageview/activity/ImageViewActivity.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/imageview/activity/ImageViewActivity.kt index 90368ca5..104aa2c7 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/imageview/activity/ImageViewActivity.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/imageview/activity/ImageViewActivity.kt @@ -11,7 +11,7 @@ class ImageViewActivity : BaseActivity(){ override fun init() { - binding.mainToolbar.toolbarTitle.text = (intent.getStringExtra("title")) + binding.mainToolbar.toolbarTitle.text = intent.getStringExtra("title") binding.imgView.loadUrl(intent.getStringExtra("url")!!) binding.mainToolbar.backButton.setOnClickListener { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/adapter/InventoryAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/adapter/InventoryAdapter.kt index b9bdf6ca..02aa0931 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/adapter/InventoryAdapter.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/adapter/InventoryAdapter.kt @@ -4,6 +4,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView +import es.verdnatura.R import es.verdnatura.databinding.ItemInventaryRowBinding import es.verdnatura.presentation.common.OnInvetoryNichoClickListener import es.verdnatura.presentation.common.OnPasillerosItemClickListener @@ -45,13 +46,16 @@ class InventoryAdapter ( onInvetoryNichoClickListener.onInvetoryNichoClickListener(item) } itemFk.setOnClickListener { - onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = "Consultar artículo"),item.itemFk) + onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = res.getString( + R.string.titleItemConsult)),item.itemFk) } itemUp.setOnClickListener { - onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = "Buscar item"),item.itemFk) + onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = res.getString( + R.string.titleItemSearch)),item.itemFk) } itemDown.setOnClickListener { - onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = "Buscar item"),item.itemFk) + onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = res.getString( + R.string.titleItemSearch)),item.itemFk) } } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryViewModel.kt index 9c6ccbd4..c3d2d99e 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryViewModel.kt @@ -174,27 +174,6 @@ class InventaryViewModel(context: Context) : BaseViewModel() { } - /*fun itemStockUpdate(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String){ - //sergio: se modifica por CAU a itemTrash - // https://cau.verdnatura.es/scp/tickets.php?id=21043 al nuevo procedimiento itemTrash - getItemCardUserCase.itemStockUpdate(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : Callback{ - //getItemCardUserCase.itemTrash(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : Callback{ - - override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar STOCK "+itemFk+ " Respuesta:"+t.message!!) - } - - override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemStockUpdate") - }else{ - _response.value = ResponseItemVO(isError = false,response = response.body()!!) - } - - } - - }) - }*/ //sergio: se modifica por CAU a itemTrash fun itemTrash( @@ -408,7 +387,7 @@ class InventaryViewModel(context: Context) : BaseViewModel() { .enqueue(object : Callback { override fun onFailure(call: Call, t: Throwable) { - d("Error message " + t.message) + // d("Error message " + t.message) _responseAddMistake.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) @@ -429,7 +408,7 @@ class InventaryViewModel(context: Context) : BaseViewModel() { ) ) } else { - d("Error message:" + { response.errorBody() } + "-" + response.message() + "-" + response.raw()) + //d("Error message:" + { response.errorBody() } + "-" + response.message() + "-" + response.raw()) _responseAddMistake.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse( @@ -444,8 +423,7 @@ class InventaryViewModel(context: Context) : BaseViewModel() { _responseAddMistake.value = ResponseItemVO( isError = false, - response = "Causa del error registrada", - errorMessage = "Causa del error registrada" + response = response.message() ) } } 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 77e57022..0d9e9882 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 @@ -69,14 +69,14 @@ class LoginFragment : BaseFragment(LoginVi if (binding.edittextServer.text!!.contains("test-app.verdnatura.es")) { saveData( "base_urlSalix", - "https://salix.verdnatura.es/api/" + "https://test-salix.verdnatura.es/api/" ) } else { saveData( "base_urlSalix", /*working_in_test*/ - "https://test-salix.verdnatura.es/api/" + "https://salix.verdnatura.es/api/" ) } @@ -332,14 +332,13 @@ class LoginFragment : BaseFragment(LoginVi binding.splashProgress.visibility = View.GONE saveTokenPref("") customDialog.setTitle(getString(R.string.error)) - // .setDescription(it.errorMessage + ". Puedes continuar pero algunas funcionalidades no estarán disponibles.") - .setDescription(it.errorMessage) + + .setDescription(if (it.errorMessage.contains("Unauthorized")){"Revisa tu usuario y contraseña. En caso de no poder acceder contacta co Informática"}else{it.errorMessage}) .setOkButton( getString(R.string.accept) ) { customDialog.dismiss() - //getVersion() - //exitProcess(0) + }.show() } else { saveTokenPref(it.token) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt index c9b94f9a..d88c99b8 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt @@ -103,8 +103,8 @@ class LoginViewModel(context: Context) : BaseViewModel() user, password, isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),if (response.message()=="Unauthorized"){"Revisa tu usuario y contraseña. En caso de no poder acceder contacta co Informática"}else{response.message() - })) + errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message() + )) } @@ -410,7 +410,7 @@ class LoginViewModel(context: Context) : BaseViewModel() response: Response ) { - if (!response.isSuccessful()){ + if (!response.isSuccessful){ d("El sector is not successfull") _workergetSector.value= SectorItemVO(0,"",0, isError = true, 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 828932c6..a1ab55aa 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 @@ -3,7 +3,6 @@ package es.verdnatura.presentation.view.feature.main.activity import android.content.SharedPreferences import android.media.MediaPlayer -import android.util.Log.d import android.view.Menu import android.widget.Toast import androidx.core.content.ContextCompat @@ -63,6 +62,7 @@ import es.verdnatura.presentation.view.feature.smarttag.sacador.fragment.Associa 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 +import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch @@ -77,7 +77,8 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL private lateinit var customDialog: CustomDialogMainActivity var firstItem: ItemMenuVO? = null var fm = supportFragmentManager - var TAG = "MainActivity" + + //var TAG = "MainActivity" var mperror: MediaPlayer? = null var mpok: MediaPlayer? = null override fun getLayoutId(): Int = R.layout.activity_main @@ -85,17 +86,13 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL mperror = MediaPlayer.create((this), R.raw.error) mpok = MediaPlayer.create((this), R.raw.ok) - customDialog = CustomDialogMainActivity(this) - // working_in_design = para nuevo diseño y test de app - //SetisWorkingInDesign(true) setBottomMenuFragment() - if (haveSector() && havePrinter()) addFragment( - PasilleroFragment.newInstance("Main",true), + PasilleroFragment.newInstance("Main", true), R.id.main_frame_layout, PasilleroFragment.TAG, false @@ -122,24 +119,24 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL } - /* fun isWorkingInDesign():Boolean{ - val prefs: SharedPreferences = getSharedPreferences("es.verdnatura.user.prefs", 0) - val working= prefs.getInt("working_in_design", -1) - return working != -1 - } - fun SetisWorkingInDesign(isWorkingIn: Boolean) { - val prefs: SharedPreferences = getSharedPreferences("es.verdnatura.user.prefs", 0) - val editor = prefs.edit() - if (isWorkingIn){ - editor.putInt("working_in_design", 0) - editor.apply() - }else{ - editor.putInt("working_in_design", -1) - editor.apply() - } + /* fun isWorkingInDesign():Boolean{ + val prefs: SharedPreferences = getSharedPreferences("es.verdnatura.user.prefs", 0) + val working= prefs.getInt("working_in_design", -1) + return working != -1 + } + fun SetisWorkingInDesign(isWorkingIn: Boolean) { + val prefs: SharedPreferences = getSharedPreferences("es.verdnatura.user.prefs", 0) + val editor = prefs.edit() + if (isWorkingIn){ + editor.putInt("working_in_design", 0) + editor.apply() + }else{ + editor.putInt("working_in_design", -1) + editor.apply() + } - }*/ + }*/ fun havePrinter(): Boolean { val prefs: SharedPreferences = getSharedPreferences("es.verdnatura.user.prefs", 0) @@ -148,6 +145,7 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL } + @DelicateCoroutinesApi fun setBottomMenuFragment() { val bottomMenu = binding.mainBottomNavigation //iconos abajo sin texto @@ -258,10 +256,10 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL } getString(R.string.verticket) -> { - fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE) - delete_Fragments() + fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE) + delete_Fragments() addFragment( - ShowTicketFragment.newInstance("main"), + ShowTicketFragment.newInstance("Main"), R.id.main_frame_layout, MAINACTIVITY.TAG, false @@ -272,7 +270,7 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE) delete_Fragments() addFragment( - ParkingFragment.newInstance("main"), + ParkingFragment.newInstance("Main"), R.id.main_frame_layout, MAINACTIVITY.TAG, false @@ -297,22 +295,22 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL true } /* sergio: de esta manera no repinta el icono del menu seleccionado */ - bottomMenu.setOnNavigationItemReselectedListener { + bottomMenu.setOnNavigationItemReselectedListener { - when (it.title){ + when (it.title) { - getString(R.string.Pasilleros) -> { - fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE) - delete_Fragments() - addFragment( - PasilleroFragment.newInstance("Main",true), - R.id.main_frame_layout, - PasilleroFragment.TAG, - false - ) + getString(R.string.Pasilleros) -> { + fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE) + delete_Fragments() + addFragment( + PasilleroFragment.newInstance("Main", true), + R.id.main_frame_layout, + PasilleroFragment.TAG, + false + ) - } - } + } + } } @@ -321,7 +319,7 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL private fun delete_Fragments() { fm.getFragments().forEach { - var fragment: Fragment? = supportFragmentManager.findFragmentByTag(it.tag.toString()) + val fragment: Fragment? = supportFragmentManager.findFragmentByTag(it.tag.toString()) if (fragment != null) supportFragmentManager .beginTransaction().remove(fragment) .commit() @@ -330,28 +328,32 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL override fun onPasillerosItemClickListener(item: PasillerosItemVO, entryPoint: String) { - /* d("VERDNATURA::","El title es "+item.title) - d("VERDNATURA::","El titleTOsHOW es "+item.titleToShow) - d("VERDNATURA::","El entryPoint es "+entryPoint)*/ + /* d("VERDNATURA::","El title es "+item.title) + d("VERDNATURA::","El titleTOsHOW es "+item.titleToShow) + d("VERDNATURA::","El entryPoint es "+entryPoint)*/ when (item.title) { - "Asociar Sacador SmartTags" -> { + getString(R.string.titleSmarttagPickerAssociate) -> { addFragmentOnTop(AssociateSmartTagsFragment.newInstance(getString(R.string.SmarttagAssociate))) } - "Registrar SmartTags" -> { + getString(R.string.titleSmarttagsRegister) -> { addFragmentOnTop(RegisterSmartTagsFragment.newInstance(item.title)) } //BUFFERS - "Paletizar" -> { + getString(R.string.titlePalletizar) -> { addFragmentOnTop(ExpeditionTruckListFragment.newInstance()) } getString(R.string.Paletizadores) -> { - addFragmentOnTop(PasilleroFragment.newInstance(getString(R.string.Paletizadores), - isInitMenu = false)) + addFragmentOnTop( + PasilleroFragment.newInstance( + getString(R.string.Paletizadores), + isInitMenu = false + ) + ) } @@ -362,7 +364,8 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL } getString(R.string.Pasilleros) -> { - addFragmentOnTop(PasilleroFragment.newInstance("Pasilleros", isInitMenu = false), + addFragmentOnTop( + PasilleroFragment.newInstance(item.title, isInitMenu = false), ) } @@ -371,145 +374,146 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL // addFragment(ExpeditionStateFragment.newInstance(entryPoint),R.id.main_frame_layout, ExpeditionTruckListFragment.TAG,false) addFragmentOnTop(ExpeditionStateFragment.newInstance(item.title)) } - "Escanear expedición" -> { + getString(R.string.titleScanExpedition) -> { addFragmentOnTop(ExpeditionScanSorterFragment.newInstance(item.title)) } - "Gestión de buffers" -> { + getString(R.string.titleBufferManegement) -> { addFragmentOnTop( PasilleroFragment.newInstance( - "Gestión de buffer", + item.title, isInitMenu = false ) ) } - "Reclamaciones"->{ + getString(R.string.titleClaims) -> { addFragmentOnTop( PasilleroFragment.newInstance( - "Reclamaciones", + item.title, isInitMenu = false ) ) } - "Control de usuario de vehículo" -> { + getString(R.string.titleUserControlVehicle) -> { addFragmentOnTop(ControlVehiculoUsuarioFragment.newInstance(entryPoint)) } - "Pre Sacador" -> { + getString(R.string.titlePrePicker) -> { addFragmentOnTop(PreSacadorFragment.newInstance()) } - "Día de venta" -> { - addFragmentOnTop(DayOfSaleFragment("diadeventa")) + getString(R.string.titleDayOfSale) -> { + addFragmentOnTop(DayOfSaleFragment(item.title)) } - "Ver Ticket" -> { - - addFragmentOnTop(ShowTicketFragment.newInstance("main")) + getString(R.string.titleShowTicket) -> { + addFragmentOnTop(ShowTicketFragment.newInstance(getString(R.string.Pasilleros))) } - "Historial del vehículo" -> { + getString(R.string.titleHistoricalVehicle) -> { addFragmentOnTop(ControlVehiculoFragment.newInstance(HistoricoVehiculoFragment.TAG)) // fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE) // addFragment(HistoricoVehiculoFragment.newInstance(entryPoint),R.id.main_frame_layout, ControladorFragment.TAG,false) } - "Reposición" -> { + getString(R.string.titleReplacement) -> { addFragmentOnTop(ReposicionFragment.newInstance()) } - "Consultar artículo" -> { + getString(R.string.titleItemConsult) -> { addFragmentOnTop(ItemCardFragment.newInstance(entryPoint)) } //sergio:no visible desde el menú inicio - "Buscar artículos similares" -> { + getString(R.string.titleSearchSimilarItems) -> { addFragmentOnTop(ItemProposalFragment.newInstance(entryPoint)) } - "Parking" -> { + //segio: esta opción no se muestra, solo es accesible para añadir fragmentos de otras partes. + getString(R.string.titleHistoricalHide) -> { + addFragmentOnTop(HistoricoVehiculoFragment.newInstance(entryPoint)) + } + + getString(R.string.Parking) -> { addFragmentOnTop(ParkingFragment.newInstance("")) } - - "Buscar item" -> { + getString(R.string.titleItemSearch) -> { addFragmentOnTop(BuscarItemFragment.newInstance(entryPoint)) } - "Historico" -> { + getString(R.string.titleHistorical) -> { addFragmentOnTop(HistoricoArticuloFragment.newInstance(entryPoint)) } - //segio: esta opción no se muestra, solo es accesible para añadir fragmentos de otras partes. - "Historico Vehículo" -> { - addFragmentOnTop(HistoricoVehiculoFragment.newInstance(entryPoint)) - } - "Inventario" -> { + + getString(R.string.titleInventory) -> { addFragmentOnTop(InventaryFragment.newInstance()) } - "Faltas" -> { + getString(R.string.titleFaults) -> { addFragmentOnTop(FaltasFragment.newInstance()) } - "Shelving Parking" -> { + getString(R.string.titleShelvingParking) -> { addFragmentOnTop(ShelvingParkingFragment.newInstance()) } - "Ubicador" -> { + getString(R.string.titleUbicator) -> { addFragmentOnTop(UbicadorFragment.newInstance(entryPoint)) } - "Automatic" -> { + getString(R.string.titleAuto) -> { addFragmentOnTop(AutomaticAddItemFragment.newInstance(entryPoint)) } - "Calidad" -> { + + getString(R.string.titleQuality) -> { addFragmentOnTop(BuyersFragment.newInstance()) } - "Sacadores" -> { - addFragmentOnTop(SacadorFragment.newInstance()) + getString(R.string.titlePickers) -> { + //addFragmentOnTop(SacadorFragment.newInstance()) + addFragmentOnTop(ControlVehiculoFragment.newInstance("")) } - //Web fragment - "Visor web" -> { - addFragmentOnTop(WebFragment.newInstance(item.title)) + getString(R.string.titleWebViewer) -> { + addFragmentOnTop(WebFragment.newInstance(entryPoint)) } //Menu qr - "Lector Qr" -> { + getString(R.string.titleQrReader) -> { addFragmentOnTop(QrFragment.newInstance(item.title)) } //Menu buffer - "Vaciado buffer" -> { + getString(R.string.titleBufferEmpty) -> { addFragmentOnTop(BufferFragment.newInstance(item.title)) } - "Llenado buffer" -> { + getString(R.string.titleBufferFill) -> { addFragmentOnTop(BufferFragment.newInstance(item.title)) } - getString(R.string.bufferaccumulate).toString()-> { + getString(R.string.titleBufferAccumulate) -> { addFragmentOnTop(BufferFragment.newInstance(item.title)) } - "Desactivado buffer" -> { + getString(R.string.titleBufferOff) -> { addFragmentOnTop(BufferFragment.newInstance(item.title)) } - "Cargar expedición en buffer" -> { - addFragmentOnTop(BufferLoadFragment.newInstance("Cargar expedición en buffer")) + getString(R.string.titleBufferload) -> { + addFragmentOnTop(BufferLoadFragment.newInstance(item.title)) } - "Flejado buffer" -> { + getString(R.string.titleBufferStrapping) -> { addFragmentOnTop(BufferFragment.newInstance(item.title)) } - "Pre Control" -> { + getString(R.string.titlePreControl) -> { addFragmentOnTop(PreControladorFragment.newInstance()) } - "Histórico Shelving" -> { - addFragmentOnTop(itemShelvingLogFragment.newInstance("Histórico Shelving")) - Timber.tag("VERDNATURA::").d("es el historico ") + getString(R.string.titleShelvingHistorical) -> { + addFragmentOnTop(itemShelvingLogFragment.newInstance(item.title)) + } - "Log Shelving" -> { - addFragmentOnTop(shelvingLogFragment.newInstance("Log Shelving")) + getString(R.string.titleLogShelving) -> { + addFragmentOnTop(shelvingLogFragment.newInstance(item.title)) } - "Fallo del trabajador" -> { + getString(R.string.titleWorkerMistake) -> { addFragmentOnTop(WorkermistakeFragment.newInstance(item.title)) } - "Obtener colección previa" -> { + getString(R.string.titlePrePicker) -> { addFragmentOnTop(InitPreSacadorFragment.newInstance(item.title)) } - "Ubicación de Reclamación" -> { + getString(R.string.titleClaimUbication) -> { addFragmentOnTop(ClaimFragment.newInstance(item.title)) } @@ -538,16 +542,16 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL fm.popBackStackImmediate() - } - else { - customDialog.setTitle(getString(R.string.closeSession)) - .setDescription("¿Estás seguro de cerrar la sesión?").setOkButton("Salir") { - customDialog.dismiss() - finish() + } else { + customDialog.setTitle(getString(R.string.closeSession)) + .setDescription(getString(R.string.sureCloseSession)) + .setOkButton(getString(R.string.exit)) { + customDialog.dismiss() + finish() - }.setKoButton(getString(R.string.cancel)) { - customDialog.dismiss() - }.show() + }.setKoButton(getString(R.string.cancel)) { + customDialog.dismiss() + }.show() } } @@ -627,7 +631,7 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL SacadorFragment.newInstance(), R.id.main_frame_layout, SacadorFragment.TAG, - false + true ) @@ -640,12 +644,7 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL // fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE) // addFragment(ExpeditionStateFragment.newInstance("main"),R.id.main_frame_layout, ExpeditionStateFragment.TAG,false) - addFragmentOnTop(ExpeditionStateFragment.newInstance("Consultar estado expedición")) - - } - fun openFragmentWeb(url:String) { - - addFragmentOnTop(WebFragment.newInstance(url)) + addFragmentOnTop(ExpeditionStateFragment.newInstance(getString(R.string.ExpeditionState))) } @@ -653,10 +652,6 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL binding.mainBottomNavigation.visibility = visible } - fun hideBottomNavigationFragment(visible: Int) { - binding.mainBottomNavigationFragment.visibility = visible - } - fun messageWithSound( message: String, @@ -669,7 +664,7 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL if (!isError) { if (isPlayed == true) (mpok?.start()) - message.toast(this, Toast.LENGTH_SHORT) + if (isToasted!!) message.toast(this, Toast.LENGTH_SHORT) } else { if (isPlayed == true) (mperror?.start()) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailFragment.kt index 4c7c9608..313589f9 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailFragment.kt @@ -53,10 +53,8 @@ class ExpeditionPalletDetailFragment( override fun init() { customDialog = CustomDialog(requireContext()) - //customDialogList = CustomDialogList(requireContext()) - binding.expeditionPalletDetailPallet.text = "Pallet "+itemPallet!!.Pallet + binding.expeditionPalletDetailPallet.text = getString(R.string.pallet)+itemPallet!!.Pallet binding.splashProgress.visibility = View.VISIBLE - //requireActivity().main_bottom_navigation.visibility = View.GONE ma.hideBottomNavigation(View.GONE) binding.mainToolbar.toolbarTitle.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino @@ -117,7 +115,7 @@ class ExpeditionPalletDetailFragment( getData(SECTORFK) ) }else{ - ma.messageWithSound("Falta seleccionar impresora",isError = true,true,"Error al imprimir",false) + ma.messageWithSound(getString(R.string.printerFault),isError = true,true,getString(R.string.printError),false) } } } @@ -154,8 +152,7 @@ class ExpeditionPalletDetailFragment( }else{ binding.splashProgress.visibility=View.VISIBLE - Log.d("VERDNATURA::","Cambiando estado a paletizado") - viewModel.expeditionState_addByPallet( getData(USER),getData(PASSWORD),itemPallet!!.Pallet,"PALLETIZED","expeditionState_addByPallet") + viewModel.expeditionState_addByPallet( getData(USER),getData(PASSWORD),itemPallet!!.Pallet,"PALLETIZED") } }) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailViewModel.kt index cd8b76d8..ea0cdfc1 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailViewModel.kt @@ -99,7 +99,7 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel() { password: String, vPalletFk: String, vStateCode:String, - callFunction:String){ + ){ getPaletizadoresUserCase.expeditionState_addByPallet(usuario,password,vPalletFk,vStateCode).enqueue(object : Callback{ override fun onFailure(call: Call, t: Throwable) { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletFragment.kt index 0f398204..380c0440 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletFragment.kt @@ -179,7 +179,6 @@ class ExpeditionPalletFragment( private fun showScanExpeditions(it:ItemScanList){ - //Log.i("VERDNATURA:","VA A ESCANEAR EN PALLETFRAGMENT") binding.splashProgress.visibility = View.GONE listExpeditions = ArrayList() @@ -189,7 +188,8 @@ class ExpeditionPalletFragment( listExpeditions.add(BarcodeVO(code = it.expeditionFk)) } - customDialogList.setTitle("Expedition ("+binding.mainToolbar.toolbarTitle.text+")").setOkButton("Comprobar"){ + customDialogList.setTitle(getString(R.string.expeditionP)+binding.mainToolbar.toolbarTitle.text+")").setOkButton(getString( + R.string.test)){ ma.hideKeyboard(customDialogList.getEditText()) @@ -197,7 +197,7 @@ class ExpeditionPalletFragment( onComprobarPalletViewClickListener!!.onComprobarPalletViewClickListener(itemExpeditionTruckVO!!, ItemPalletVO(Pallet = it.list.get(0).palletFk)) }else{ - customDialog.setTitle("Atención").setDescription("No ha escaneado expediciones").setOkButton("Ok"){ + customDialog.setTitle(getString(R.string.info)).setDescription(getString(R.string.expeditionsError)).setOkButton(getString(R.string.accept)){ customDialog.dismiss() }.show() } @@ -224,7 +224,7 @@ class ExpeditionPalletFragment( // val numExpedition = customDialogList.getValue().toDouble() if(customDialogList.getValue().length >= 7){ listExpeditions.add(0,BarcodeVO(code = customDialogList.getValue())) - customDialogList.setDescription("Total: "+listExpeditions.size) + customDialogList.setDescription(getString(R.string.total)+listExpeditions.size) viewModel.expeditionScanPut(getData(USER), getData(PASSWORD),it.list.get(0).palletFk,customDialogList.getValue()) ////Log.i("VERDNATURA:"," palletizando ${it.list.get(0).palletFk} expedi: ${customDialogList.getValue()}") diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletViewModel.kt index 7cb183d9..08e97fd6 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletViewModel.kt @@ -113,6 +113,7 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() { _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) } override fun onResponse(call: Call, response: Response) { + //sergio: espera repuesta en el body if (response.body() == null){ _responseCheckexpeditionScanPut.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) }else{ diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanFragment.kt index e1097b3f..4d938dc9 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanFragment.kt @@ -165,7 +165,7 @@ class ExpeditionScanFragment ( override fun onScanLongClickListener(itemExpeditionScanVO: ItemExpeditionScanVO) { customDialogTwoButtons.setTitle("Ticket: "+itemExpeditionScanVO.Ticket+" Pallet: "+itemPalletVO!!.Pallet) .setDescription("Expedition: "+itemExpeditionScanVO!!.expeditionFk) - .setOkButton("Borrar"){ + .setOkButton(getString(R.string.delete)){ binding.splashProgress.visibility = View.VISIBLE viewModel.expeditionScanDel(getData(USER), getData(PASSWORD),itemExpeditionScanVO.id) @@ -197,7 +197,7 @@ class ExpeditionScanFragment ( if(it.expeditionFk != "0") listExpeditions.add(BarcodeVO(code = it.expeditionFk)) } - customDialogList.setTitle("Pallet"+itemPalletVO!!.Pallet+" ("+binding.mainToolbar.toolbarTitle.text+")").setOkButton("Comprobar"){ + customDialogList.setTitle("Pallet"+itemPalletVO!!.Pallet+" ("+binding.mainToolbar.toolbarTitle.text+")").setOkButton(getString(R.string.test)){ ma.hideKeyboard(customDialogList.getEditText()) @@ -207,7 +207,7 @@ class ExpeditionScanFragment ( ItemPalletVO(Pallet = it.list.get(0).palletFk) ) }else{ - customDialog.setTitle("Atención").setDescription("No ha escaneado expediciones").setOkButton("Ok"){ + customDialog.setTitle(getString(R.string.info)).setDescription(getString(R.string.expeditionsError)).setOkButton("Ok"){ customDialog.dismiss() }.show() } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanSorterFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanSorterFragment.kt index 338b2d9c..bf10bf18 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanSorterFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanSorterFragment.kt @@ -72,10 +72,10 @@ class ExpeditionScanSorterFragment( } else { listExpeditionScan.add(GeneralItem(itemScaned, itemScaned)) - customDialogList.setDescription("Total:" + listExpeditionScan.size) + customDialogList.setDescription(getString(R.string.total) + listExpeditionScan.size) expeditionScanAdapter!!.notifyItemInserted(listExpeditionScan.size-1) customDialogList.setValue("") - ma.messageWithSound("Añadida",false,true) + ma.messageWithSound(getString(R.string.added),false,true) } }) @@ -86,7 +86,7 @@ class ExpeditionScanSorterFragment( private fun showExpeditionScan() { - customDialogList.setTitle("Escanea expediciones que no han pasado por el Sorter") + customDialogList.setTitle(getString(R.string.expeditionNoSorter)) .setOkButton(getString(R.string.end)) { ma.hideKeyboard(customDialogList.getEditText()) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanViewModel.kt index 53b781dc..c8b3bf1b 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanViewModel.kt @@ -115,11 +115,12 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel() { _response.value = ResponseItemVO(isError = true,errorMessage = "Error al lamar expedition_checkRoute "+vExpeditionFk+ " Respuesta:"+t.message!!) } override fun onResponse(call: Call, response: Response) { + //sergio:se devuelve en el body if (response.body() == null){ _responseCheckexpeditionScanPut.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada expedition_checkRoute") }else{ _responseCheckexpeditionScanPut.value = ResponseItemVO(isError = false,response = response.body()!!) - // ////Log.i("VERDNATURA:","Resultado checkExpeditionScan ${_responseCheckexpeditionScanPut.value}") + } } }) @@ -130,11 +131,13 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel() { fun expeditionScanDel(usuario:String,password:String,vScanFk:String){ getPaletizadoresUserCase.expeditionScanDel(usuario,password,vScanFk).enqueue(object : Callback{ override fun onFailure(call: Call, t: Throwable) { - _responseDeleteScan.value = ResponseItemVO(isError = true,errorMessage = "Error al llamar expeditionScan_Del."+t.message!!) + _responseDeleteScan.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse( + nameofFunction(this),t.message!!)) } override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ - _responseDeleteScan.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada expeditionScan_Del") + if (!response.isSuccessful){ + _responseDeleteScan.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse( + nameofFunction(this),response.message()!!)) }else{ _responseDeleteScan.value = ResponseItemVO(isError = false,response = response.message()) } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionStateFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionStateFragment.kt index df9e6b3b..1fdafe7d 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionStateFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionStateFragment.kt @@ -12,7 +12,7 @@ import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionS import es.verdnatura.presentation.view.feature.paletizador.model.itemExpedetionState class ExpeditionStateFragment( - var title: String = "" + var entryPoint: String = "" ) : BaseFragment(ExpeditionStateViewModel::class) { @@ -28,7 +28,7 @@ class ExpeditionStateFragment( override fun init() { setEvents() - setToolBar(title) + setToolBar(entryPoint) super.init() } @@ -72,7 +72,7 @@ class ExpeditionStateFragment( binding.splashProgress.visibility = View.GONE if (it.isError) { binding.itemcardLayout.visibility = View.GONE - binding.mainToolbar.toolbarTitle.text = title + binding.mainToolbar.toolbarTitle.text = entryPoint ma.messageWithSound(getString(R.string.noDataLabelScanned),true,false,getString(R.string.noResults)) } else { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionTruckListFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionTruckListFragment.kt index a173f687..96b3843b 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionTruckListFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionTruckListFragment.kt @@ -1,6 +1,7 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment +import android.annotation.SuppressLint import android.content.Context import android.graphics.drawable.Drawable import android.view.View @@ -15,12 +16,10 @@ import es.verdnatura.presentation.common.OnOptionsSelectedListener import es.verdnatura.presentation.common.OnTruckClickListener import es.verdnatura.presentation.view.component.CustomDialogHour import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter -import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.paletizador.adapter.ExpeditionListAdapter import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckList import java.text.SimpleDateFormat import java.util.* -import kotlin.collections.ArrayList import java.util.Calendar.getInstance as getInstance1 @@ -43,13 +42,17 @@ class ExpeditionTruckListFragment : BaseFragment if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { - if (!customDialogHor.getDestinoValue().isNullOrEmpty() && !customDialogHor.getHoraValue().isNullOrEmpty()){ + if (customDialogHor.getDestinoValue().isNotEmpty() && customDialogHor.getHoraValue() + .isNotEmpty()){ viewModel.expeditionTruckAdd(getData(USER), getData(PASSWORD),customDialogHor.getHoraValue(),customDialogHor.getDestinoValue()) binding.splashProgress.visibility = View.VISIBLE diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/parking/fragment/ParkingFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/parking/fragment/ParkingFragment.kt index 50554a51..fdd50635 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/parking/fragment/ParkingFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/parking/fragment/ParkingFragment.kt @@ -37,7 +37,7 @@ class ParkingFragment (var menuOrigin:String): BaseFragment, response: Response) { ProgressLoading(GONE) - /*if (response.body() == null){ - _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) - }else{*/ + if (response.isSuccessful) _response.value = ResponseItemVO(isError = false,response = response.message()) else diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/parkingSale/fragment/ParkingViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/parkingSale/fragment/ParkingViewModel.kt index e95f2709..cd08233c 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/parkingSale/fragment/ParkingViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/parkingSale/fragment/ParkingViewModel.kt @@ -63,34 +63,6 @@ class ParkingSaleViewModel(context: Context) : BaseViewModel() { } }) } - /* fun saleParking_add(usuario: String, password: String, sales:List,parking: String) - { - getUbicadorUserCase.saleParking_add(usuario, password, sales, parking) - .enqueue(object : Callback - { - override fun onFailure(call: Call, t: Throwable) - { - _responseParkingAdd.value = ResponseItemVO( - isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) - ) - } - override fun onResponse(call: Call, response: Response) - { - if (response.body() == null) - { - _responseParkingAdd.value = ResponseItemVO( - isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) - ) - } else - { - _responseParkingAdd.value = - ResponseItemVO(isError = false, response = response.body()!!) - } - } - }) - }*/ } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroFragment.kt index 7f143a2c..29e13f12 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroFragment.kt @@ -38,7 +38,7 @@ class PasilleroFragment( "Main" -> { binding.mainToolbarDesign.imageViewMenu.visibility = View.VISIBLE binding.mainToolbarDesign.backButton.visibility = View.GONE - //binding.mainToolbar.backButton.visibility = View.GONE + } @@ -71,13 +71,10 @@ class PasilleroFragment( "Pasilleros" -> { viewModel.inititializeDefaultData() } - /*"Verdnatura" -> { - viewModel.inititializeDefaultData() - }*/ + "Paletizadores" -> viewModel.inititializeDefaultPallet() - "Gestión de buffer" -> viewModel.inititializeDefaultBuffer() + getString(R.string.titleBufferManegement) -> viewModel.inititializeDefaultBuffer() "Main" -> viewModel.inititializeDefaultDataInit() - //"Verdnatura_design" -> viewModel.inititializeDefaultDataInit() "Reclamaciones" -> viewModel.inititializeDefaultClaim() } 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 1cbe8f0c..539fe6f9 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 @@ -21,12 +21,12 @@ class PasilleroViewModel : BaseViewModel() { R.drawable.barcode_scan, "Asociar Sacador SmartTags",R.string.SmarttagAssociate) ) */ - _pasillerositem.add( + /* _pasillerositem.add( PasillerosItemVO(21, R.drawable.barcode_scan, "Registrar SmartTags",R.string.SmarttagRegister) ) - +*/ //sergio para que aparezca el nuevo menu @@ -34,14 +34,14 @@ class PasilleroViewModel : BaseViewModel() { PasillerosItemVO( 7, R.drawable.ic_streetview_black_24dp, - "Obtener colección previa", R.string.PreSacador,"Obtiene colecciones para sacar en previa" + "Pre Sacador", R.string.titlePrePicker,"Obtiene colecciones para sacar en previa" ) ) //precontrol _pasillerositem.add( PasillerosItemVO(7, R.drawable.ic_verified_user_black_24dp_selected, - "Pre Control",R.string.precontrolprevious,"Sirve para revisar un ticket de previa" + "Pre Control",R.string.titlePreControl,"Sirve para revisar un ticket de previa" ) ) @@ -58,7 +58,7 @@ class PasilleroViewModel : BaseViewModel() { PasillerosItemVO( 0, R.drawable.ic_loyalty_black_24dp, - "Consultar artículo", R.string.ConsultarArticulo,"Busca información de un ítem" + "Consultar artículo", R.string.titleItemConsult,"Busca información de un ítem" ) ) @@ -80,13 +80,13 @@ class PasilleroViewModel : BaseViewModel() { ) ) - _pasillerositem.add( + /* _pasillerositem.add( PasillerosItemVO( 2, R.drawable.ic_claims, "Ubicación de Reclamación", R.string.claim,"Ubicación de Reclamación" ) - ) + )*/ //sergio: pruebas cau item buscar /* _pasillerositem.add( @@ -99,7 +99,7 @@ class PasilleroViewModel : BaseViewModel() { PasillerosItemVO( 1, R.drawable.ic_dashboard_black_24dp, - "Ubicador", R.string.Ubicador,"Permite ubicar/saber los ítems de un carro" + "Ubicador", R.string.titleUbicator,"Permite ubicar/saber los ítems de un carro" ) ) @@ -107,7 +107,7 @@ class PasilleroViewModel : BaseViewModel() { PasillerosItemVO( 3, R.drawable.ic_spa_black_24dp, - "Inventario", R.string.Inventario, "Visualiza que falta o está desubicado" + "Inventario", R.string.titleInventory, "Visualiza que falta o está desubicado" ) ) @@ -115,7 +115,7 @@ class PasilleroViewModel : BaseViewModel() { PasillerosItemVO( 7, R.drawable.worker_mistake, - "Fallo del trabajador", R.string.workermistake,"Permite añadir fallos a un trabajador" + "Fallo del trabajador", R.string.titleWorkerMistake,"Permite añadir fallos a un trabajador" ) ) @@ -161,7 +161,7 @@ class PasilleroViewModel : BaseViewModel() { PasillerosItemVO( 4, R.drawable.ic_move_to_inbox_black_24dp, - "Faltas", R.string.Faltas,"Visualiza las faltas en almacén" + "Faltas", R.string.titleFaults,"Visualiza las faltas en almacén" ) ) @@ -169,7 +169,7 @@ class PasilleroViewModel : BaseViewModel() { PasillerosItemVO( 5, R.drawable.ic_send_black_24dp, - "Shelving Parking", R.string.ShelvingParking,"" + "Shelving Parking", R.string.titleShelvingParking,"" ) ) @@ -177,7 +177,7 @@ class PasilleroViewModel : BaseViewModel() { PasillerosItemVO( 8, R.drawable.ic_baseline_star_24, - "Calidad", R.string.Calidad,"Permite conocer la calidad de algunos productos por comprador" + "Calidad", R.string.titleQuality,"Permite conocer la calidad de algunos productos por comprador" ) ) @@ -213,7 +213,7 @@ class PasilleroViewModel : BaseViewModel() { PasillerosItemVO( 32, R.drawable.buffer_outline, - "Gestión de buffers", R.string.BuffersManegement,"Se accede al menú de operaciones con los buffers del sorter" + "Gestión de buffers", R.string.titleBufferManegement,"Se accede al menú de operaciones con los buffers del sorter" ) ) @@ -222,7 +222,7 @@ class PasilleroViewModel : BaseViewModel() { PasillerosItemVO( 33, R.drawable.qrcode_scan, - "Lector Qr", R.string.QrReader,"Permite leer información en un qr" + "Lector Qr", R.string.titleQrReader,"Permite leer información en un qr" ) ) @@ -234,7 +234,7 @@ class PasilleroViewModel : BaseViewModel() { PasillerosItemVO( 30, R.drawable.buffer_empty, - "Vaciado buffer", R.string.bufferempty, "Pone en modo vaciado un buffer" + "Vaciado buffer", R.string.titleBufferEmpty, "Pone en modo vaciado un buffer" ) ) @@ -243,7 +243,7 @@ class PasilleroViewModel : BaseViewModel() { PasillerosItemVO( 31, R.drawable.buffer_fill, - "Llenado buffer", R.string.bufferfill,"Pone en modo llenado un buffer" + "Llenado buffer", R.string.titleBufferFill,"Pone en modo llenado un buffer" ) ) @@ -252,7 +252,7 @@ class PasilleroViewModel : BaseViewModel() { PasillerosItemVO( 32, R.drawable.buffer_accumulation, - "Acumulación buffer", R.string.bufferaccumulate,"Pone en modo acumulación un buffer" + "Acumulación buffer", R.string.titleBufferAccumulate,"Pone en modo acumulación un buffer" ) ) @@ -260,7 +260,7 @@ class PasilleroViewModel : BaseViewModel() { PasillerosItemVO( 31, R.drawable.buffer_off, - "Desactivado buffer", R.string.bufferoff,"Pone en modo desactivado un buffer" + "Desactivado buffer", R.string.titleBufferOff,"Pone en modo desactivado un buffer" ) ) @@ -268,7 +268,7 @@ class PasilleroViewModel : BaseViewModel() { PasillerosItemVO( 31, R.drawable.buffer_flejado, - "Flejado buffer", R.string.bufferfstrapping,"Pone en modo flejado un buffer" + "Flejado buffer", R.string.titleBufferStrapping,"Pone en modo flejado un buffer" ) ) @@ -277,7 +277,7 @@ class PasilleroViewModel : BaseViewModel() { PasillerosItemVO( 45, R.drawable.buffer_load, - "Cargar expedición en buffer", R.string.bufferload, "Pone en modo cargar un buffer" + "Cargar expedición en buffer", R.string.titleBufferload, "Pone en modo cargar un buffer" ) ) } @@ -294,7 +294,7 @@ class PasilleroViewModel : BaseViewModel() { _pasillerositem.add( PasillerosItemVO(7, R.drawable.ic_picker_ui, - "Sacadores",R.string.Sacadores,"Accede a sacar pedidos" + "Sacadores",R.string.titlePickers,"Accede a sacar pedidos" ) ) @@ -321,7 +321,7 @@ class PasilleroViewModel : BaseViewModel() { PasillerosItemVO( 6, R.drawable.ic_claim_ui, - "Reclamaciones", R.string.claims,"Accede al menú de reclamaciones" + "Reclamaciones", R.string.titleClaims,"Accede al menú de reclamaciones" ) ) @@ -336,7 +336,7 @@ class PasilleroViewModel : BaseViewModel() { PasillerosItemVO( 30, R.drawable.ic_claims, - "Ubicación de Reclamación", R.string.claim, "Ubicación de reclamaciones" + "Ubicación de Reclamación", R.string.titleClaimUbication, "Ubicación de reclamaciones" ) ) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/precontrol/PreControladorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/precontrol/PreControladorFragment.kt index dd0bfc75..a77a96d3 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/precontrol/PreControladorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/precontrol/PreControladorFragment.kt @@ -10,8 +10,6 @@ import es.verdnatura.databinding.FragmentControladorBinding import es.verdnatura.domain.ConstAndValues import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.common.OnCollectionSelectedListener -import es.verdnatura.presentation.view.component.CustomDialog -import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO @@ -35,7 +33,7 @@ class PreControladorFragment: BaseFragment increaseQuantity(position, value) getString(R.string.BasuraRechazar) -> TrashMissingReject(position, value, "TRUE") - getString(R.string.Faltas) -> TrashMissingReject(position, value, "FALSE") + getString(R.string.titleFaults) -> TrashMissingReject(position, value, "FALSE") getString(R.string.Reject) -> TrashMissingReject(position, value, "reject") getString(R.string.Split) -> split(position, value) @@ -1317,7 +1329,7 @@ class EndSacadorFragment( //FALTAS / BASURA / SPLIT private fun showQuantityDialogOld(position: Int) { customDialogThreeButtons.setDescription(getString(R.string.txtnuevacantidad)).setValue("") - .setOkButton(getString(R.string.Faltas)) { + .setOkButton(getString(R.string.titleFaults)) { if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) { getString(R.string.Indicanuevacantidad).toast(requireContext()) } else { @@ -1375,14 +1387,16 @@ class EndSacadorFragment( totalQuantity = sales[position].saldo.toInt() - quantity.toInt() } catch (e: Exception) { } - viewModel.saleMove( - usuario = getData(USER), - password = getData(PASSWORD), - saleFk = sales[position].idMovimiento, - quantity = totalQuantity.toString(), - originalQuantity = sales[position].quantity.toString() - ) - Log.d("VERDNATURA::", "responseSaleMove enviando") + + binding.splashProgress.visibility=VISIBLE + + viewModel.transferSalesSalix( + getData(TOKEN), + ticketFk = sales[position].id, + saleFk = sales[position].idMovimiento, + quantity = totalQuantity.toString() + ) + /* try { sales[position].saldo = quantity.toInt() diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorFragment.kt index 2173cd10..28137bff 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorFragment.kt @@ -177,11 +177,8 @@ class PreSacadorFragment : responseSalixMessage.observe(viewLifecycleOwner, Observer { if (it.isError) { - ma.messageWithSound(it.errorMessage,true,false) - /* customDialog.setTitle(getString(R.string.error)).setDescription(it.errorMessage) - .setOkButton(getString(R.string.accept)) { - customDialog.dismiss() - }.show()*/ + ma.messageWithSound( getString(R.string.rocketKO) + it.errorMessage, it.isError, false) + } }) @@ -294,7 +291,7 @@ class PreSacadorFragment : val ticket = "[" + sales[positionCollectionSplit].id + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionCollectionSplit].id + "/summary)" val message = - "Se ha enviado a Split el articulo " + sales[positionCollectionSplit].itemFk + " del ticket " + ticket + getString(R.string.splitSent) + sales[positionCollectionSplit].itemFk + " getString(R.string.fromTicket) " + ticket /* viewModel.sendChekingPresence( token = getData(TOKEN), workerId = sales[positionCollectionSplit].salesPersonFk, @@ -714,7 +711,7 @@ class PreSacadorFragment : scanRequest() hideKeyboards() } else { - "Escanea item para validar".toast(requireContext()) + "getString(R.string.scanItemValidate) validar".toast(requireContext()) } @@ -722,7 +719,7 @@ class PreSacadorFragment : scanRequest() hideKeyboards() customDialogList.dismiss() - }.setHintValue("Cantidad que coges:").setValue(total).setHintValueTwo("Escanea item") + }.setHintValue("Cantidad que coges:").setValue(total).setHintValueTwo(getString(R.string.scanItem)) .setValueTwo("").show() @@ -759,7 +756,7 @@ class PreSacadorFragment : customDialogList.dismiss() } } else { - "Escanea item para validar".toast(requireContext()) + "getString(R.string.scanItemValidate) validar".toast(requireContext()) } scanRequest() hideKeyboards() @@ -1009,7 +1006,7 @@ class PreSacadorFragment : } private fun showErrorMessage(text: String) { - customDialog.setTitle("Error al marcar la linea").setDescription(text) + customDialog.setTitle(getString(R.string.errorMarkLine)).setDescription(text) .setKoButton(getString(R.string.close)) { customDialog.dismiss() }.show() @@ -1018,11 +1015,11 @@ class PreSacadorFragment : private fun showQuantityDialog(position: Int) { customDialogThreeButtons.setDescription(getString(R.string.txtnuevacantidad)).setValue("") - .setOkButton(getString(R.string.Faltas)) { + .setOkButton(getString(R.string.titleFaults)) { checkAndCall( position, customDialogThreeButtons.getValue(), - getString(R.string.Faltas) + getString(R.string.titleFaults) ) }.setOkButtonTwo(getString(R.string.BasuraRechazar)) { @@ -1069,7 +1066,7 @@ class PreSacadorFragment : when (action) { getString(R.string.Agregar) -> increaseQuantity(position, value) getString(R.string.BasuraRechazar) -> TrashMissingReject(position, value,"TRUE") - getString(R.string.Faltas) -> TrashMissingReject(position, value,"FALSE") + getString(R.string.titleFaults) -> TrashMissingReject(position, value,"FALSE") getString(R.string.Reject) -> TrashMissingReject(position, value,"reject") getString(R.string.Split) -> split(position, value) @@ -1109,7 +1106,7 @@ class PreSacadorFragment : //FALTAS / BASURA / SPLIT private fun showQuantityDialogOld(position: Int) { customDialogThreeButtons.setDescription(getString(R.string.txtnuevacantidad)).setValue("") - .setOkButton(getString(R.string.Faltas)) { + .setOkButton(getString(R.string.titleFaults)) { if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) { getString(R.string.Indicanuevacantidad).toast(requireContext()) } else { 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 a7604464..6c2718c0 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 @@ -13,6 +13,8 @@ import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.common.ResponseItemVO +import es.verdnatura.presentation.view.feature.collection.listSaleSalix +import es.verdnatura.presentation.view.feature.collection.saleSalix import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO import es.verdnatura.presentation.view.feature.sacador.mapper.toDateFormat import es.verdnatura.presentation.view.feature.sacador.model.CollectionListVO @@ -80,6 +82,9 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() { val responseItemShelvingUpdate: LiveData get() = _responseItemShelvingUpdate + private val _responseSplit by lazy { MutableLiveData() } + val responseSplit: LiveData + get() = _responseSplit //sergio: previa nuevo private val _collectionList by lazy { MutableLiveData() } @@ -117,10 +122,8 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() { response: Response> ) { if (response.body() != null) { - //d("VERDNATURA::", "entra con lineas") _salesList.value = response.body()?.let { it } } else { - // d("VERDNATURA::", "ES NULO") _salesList.value = listOf() } } @@ -147,7 +150,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { - if (response.body() == null) { + if (!response.isSuccessful) { _response.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse( @@ -211,7 +214,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() { override fun onResponse(call: Call, response: Response) { - if (response.body() == null) + if (!response.isSuccessfull) { _responseParkingAdd.value = ResponseItemVO( isError = true, @@ -297,7 +300,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { - if (!response.isSuccessful()) { + if (!response.isSuccessful) { _responseItemShelvingSaleSupplyAdd.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse( @@ -313,6 +316,8 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() { }) } + + fun saleTrackingReplace( usuario: String, password: String, @@ -342,7 +347,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { - if (response.body() == null) { + if (!response.isSuccessful) { _response.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse( @@ -368,6 +373,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { + //sergio: espera item en el body if (response.body() == null) { _responseCode.value = ResponseItemVO( isError = true, @@ -396,7 +402,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { - if (response.body() == null) { + if (!response.isSuccessful) { _response.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse( @@ -434,7 +440,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { - if (!!response.isSuccessful) { + if (!response.isSuccessful) { _responseSaleMove.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse( @@ -694,7 +700,6 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() { response: Response> ) { if (response.body() != null) { - //Timber.d("entra con lineas") _salesList.value = response.body()?.let { it } } else { d("VERDNATURA::", "ES NULO") @@ -896,4 +901,44 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() { }) } + fun transferSalesSalix( + token:String, + ticketFk:String, + saleFk: String, + quantity: String, + + ) { + getSacadorControladorUserCase.transferSalesSalix( + token, + ticketFk, + saleFk, + quantity + + ).enqueue(object : Callback { + override fun onFailure(call: Call, t: Throwable) { + _responseSplit.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) + } + + override fun onResponse(call: Call, response: Response) { + //segio: salix devuelve id + if (response.body() == null) { + _responseSplit.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } else { + _responseSplit.value = + ResponseItemVO(isError = false, response = response.message()) + } + } + }) + } + + } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/qr/QrFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/qr/QrFragment.kt index 03975d6b..6182a285 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/qr/QrFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/qr/QrFragment.kt @@ -82,16 +82,13 @@ class QrFragment( binding.splashProgress.visibility = View.GONE if (it.isError) { - // getMessageFromJSON(it.errorMessage) ma.messageWithSound(it.errorMessage+ " "+itemscaned,true,false) - /*customDialog.setTitle(getString(R.string.error)).setDescription( it.errorMessage+ " "+itemscaned) - .setOkButton(getString(R.string.accept)) { - customDialog.dismiss() - }.show()*/ + } else { customDialog.setTitle(getString(R.string.info)) - .setDescription(getString(R.string.operation) + itemscaned + ". " + it.response) + .setDescription(getString(R.string.operation) + itemscaned + "." + getString( + R.string.answer) +it.response) .setOkButton(getString(R.string.accept)) { customDialog.dismiss() binding.mainToolbar.backButton.performClick() diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/qr/QrFragmentViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/qr/QrFragmentViewModel.kt index 995c15ee..e020f1fe 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/qr/QrFragmentViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/qr/QrFragmentViewModel.kt @@ -46,26 +46,25 @@ class QrFragmentViewModel(context: Context) : BaseViewModel() { _qrresponse.value = ResponseItemVO( response = "", isError = true, - errorMessage = "Usuario sin permisos para realizar la acción" + errorMessage ="Usuario sin permisos para realizar la acción" ) } else if (response.body() != null) { _qrresponse.value = ResponseItemVO( - response = "La respuesta es: " + response.body().toString(), + response = response.body().toString(), isError = false, errorMessage = "" ) } else { - if (response.body() == null) { _qrresponse.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) ) - } + } } 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 70732b56..420e3667 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 @@ -65,7 +65,7 @@ class ReposicionAdapter ( } itemArticleItemFk.setOnClickListener { - onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = "Consultar artículo"),sale.itemFk) + onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = binding.root.context.resources.getString(R.string.titleItemConsult)),sale.itemFk) } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/fragment/ReposicionFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/fragment/ReposicionFragment.kt index 3ba81078..cc5ccd6f 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/fragment/ReposicionFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/fragment/ReposicionFragment.kt @@ -140,7 +140,7 @@ class ReposicionFragment : BaseFragment 0 && sales[0].saldo == 0) { - "Pedido completado".toast(requireContext()) + getString(R.string.orderCompleted).toast(requireContext()) } else { findSale(binding.scanInput.text.toString()) } @@ -206,7 +206,7 @@ class ReposicionFragment : BaseFragment) { binding.splashProgress.visibility = View.GONE if (salesList.isNullOrEmpty()) { - customDialog.setTitle("Reposición").setDescription("No existen pedidos para reponer") + customDialog.setTitle(getString(R.string.titleReplacement)).setDescription(getString(R.string.NotOrderReplacement)) .setKoButton(getString(R.string.cancel)) { if (sales.count() > 0) { sales.clear() @@ -242,7 +242,7 @@ class ReposicionFragment : BaseFragment 0 && salesList[0].saldo == 0) { - "Pedido completado".toast(requireContext()) + getString(R.string.orderCompleted).toast(requireContext()) binding.scanInput.visibility = View.GONE binding.btnCancelar.visibility = View.GONE } else { @@ -304,7 +304,7 @@ class ReposicionFragment : BaseFragment pasillerosItemClickListener?.onPasillerosItemClickListener( - PasillerosItemVO(title = "Parking"), + PasillerosItemVO(title = getString(R.string.Parking)), "" ) } @@ -545,7 +545,7 @@ class ReposicionFragment : BaseFragment, response: Response) { + //sergio:espera item en el body if (response.body() == null) { _responseCode.value = ResponseItemVO( isError = true, @@ -235,7 +236,7 @@ class ReposicionViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { - if (!response.isSuccessful()) { + if (!response.isSuccessful) { _responseClose.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse( 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 ac0f0062..c3b76310 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 @@ -49,7 +49,6 @@ class SacadorFragment : override fun init() { - //viewModel.smartTagInsertTicket("577387") customDialog = CustomDialog(requireContext()) binding.splashProgress.visibility = View.VISIBLE binding.splashProgressTwo.visibility = View.GONE @@ -178,7 +177,7 @@ class SacadorFragment : getData(WAGON) ) } else if (getCollections) { - Log.d("VERDNATURA::","getCollections sobrevive") + //Log.d("VERDNATURA::","getCollections sobrevive") viewModel.collection_new_smart( getData(USER), getData(PASSWORD), @@ -248,17 +247,18 @@ class SacadorFragment : binding.splashProgress.visibility = View.GONE getCollections=false - + if (!goBack) { if (it.isError) { ma.messageWithSound(it.errorMessage, true, false) // viewModel.smartTagInsertTicket(it.response) } else { - ma.messageWithSound(it.errorMessage, false, false) + //ma.messageWithSound(it.errorMessage, false, false) viewModel.smartTagInsertTicket(it.response) goBack = false } + } }) @@ -302,14 +302,13 @@ class SacadorFragment : } } if (isNew) { - collectionsList.add(CollectionVO(collectionFk = collection, created = "Nuevo")) - //Log.d("VERDNATURA::","llamada nodejs insert") - //viewModel.smartTagInsertTicket(collection) + collectionsList.add(CollectionVO(collectionFk = collection, created = getString(R.string.newCreated))) + adapter?.notifyDataSetChanged() } else { - customDialog.setTitle("Atención") - .setDescription("La colección " + collection + " sigue pendiente de preparar") + customDialog.setTitle(getString(R.string.info)) + .setDescription(getString(R.string.collectionPending) + collection) .setOkButton(getString(R.string.accept)) { customDialog.dismiss() }.show() 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 48ca7998..f20c9cc6 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 @@ -17,6 +17,7 @@ import es.verdnatura.presentation.view.feature.sacador.mapper.toDateFormat import es.verdnatura.presentation.view.feature.sacador.model.CollectionListVO import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO import es.verdnatura.presentation.view.feature.smarttag.sacador.model.SmartTagRegister +import org.json.JSONObject import retrofit2.Call import retrofit2.Callback import retrofit2.Response @@ -141,11 +142,9 @@ class SacadorViewModel(context: Context) : BaseViewModel() { ) { if (response.body() != null) { - Log.d("VERDNATURA::","Entramos y formamos _responseCollectionSmarttag:"+response.body()) _responseCollectionSmart.value = ResponseItemVO(isError = false, response = response.body()!!) } else { - Log.d("VERDNATURA::","Entramos y formamos _responseCollectionSmarttag") _responseCollectionSmart.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) @@ -270,8 +269,7 @@ class SacadorViewModel(context: Context) : BaseViewModel() { val responseSmart: SmartTagRegister - if (response.isSuccessful()){ - //Log.i("VERDNATURA::","El mensaje es "+response.message()) + if (response.isSuccessful){ responseSmart = SmartTagRegister( message="Ticket insertado OK.", isError = false, @@ -279,9 +277,12 @@ class SacadorViewModel(context: Context) : BaseViewModel() { ) }else{ + var text = JSONObject(response.errorBody()!!.string()).get("error") + var message = JSONObject(text.toString()).get("message") + responseSmart = SmartTagRegister( isError = true, - errorMessage = response.message() + errorMessage = message.toString() ) } @@ -294,8 +295,6 @@ class SacadorViewModel(context: Context) : BaseViewModel() { val responseSmart = SmartTagRegister(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) - //Log.i("VERDNATURA::","el error nodejs es "+t.message+"--"+t.cause.toString()+"--"+t.stackTrace.toString()) - _registerSmarttagInsert.value = responseSmart } 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/showticket/ShowTicketFragment.kt index ed107a8f..2bf20478 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/showticket/ShowTicketFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/showticket/ShowTicketFragment.kt @@ -4,7 +4,6 @@ import android.content.Context import android.os.Bundle import android.view.View import android.view.inputmethod.EditorInfo -import androidx.lifecycle.Observer import es.verdnatura.R import es.verdnatura.databinding.FragmentControladorBinding import es.verdnatura.domain.ConstAndValues @@ -37,7 +36,8 @@ class ShowTicketFragment(var menuOrigin: String) : binding.splashProgress.visibility = View.GONE binding.mainToolbar.toolbarTitle.text = getString(R.string.verticket) - if (menuOrigin == "main") { + + if (menuOrigin == "Main") { hideBackButton(binding.mainToolbar) } @@ -89,7 +89,7 @@ class ShowTicketFragment(var menuOrigin: String) : override fun observeViewModel() { with(viewModel) { - collectionTicketList.observe(viewLifecycleOwner, Observer { + collectionTicketList.observe(viewLifecycleOwner) { binding.splashProgress.visibility = View.GONE if (it.isError) { ma.messageWithSound(it.errorMessage, true, false) @@ -98,7 +98,7 @@ class ShowTicketFragment(var menuOrigin: String) : goBack = false } - }) + } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/smarttag/register/RegisterSmartTagsFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/smarttag/register/RegisterSmartTagsFragment.kt index b37d608f..137eea2e 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/smarttag/register/RegisterSmartTagsFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/smarttag/register/RegisterSmartTagsFragment.kt @@ -2,21 +2,17 @@ package es.verdnatura.presentation.view.feature.smarttag.register import android.content.Context -import android.util.Log -import android.view.View -import android.view.View.* +import android.view.View.GONE +import android.view.View.VISIBLE import android.view.inputmethod.EditorInfo import androidx.activity.OnBackPressedCallback -import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import es.verdnatura.R import es.verdnatura.databinding.FragmentSacadorAssociatesmarttagBinding -import es.verdnatura.domain.toast import es.verdnatura.presentation.base.BaseFragment -import es.verdnatura.presentation.common.* +import es.verdnatura.presentation.common.OnSmartTagRowClickListener import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialogList -import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.smarttag.adapter.SmartTagAdapter import es.verdnatura.presentation.view.feature.smarttag.model.SmartTag import es.verdnatura.presentation.view.feature.smarttag.sacador.fragment.SmartTagsViewModel @@ -44,21 +40,20 @@ class RegisterSmartTagsFragment( override fun onAttach(context: Context) { super.onAttach(context) - // sergio: en test: Log.i("VERDNATURA:","attached") - val callback: OnBackPressedCallback = - object : OnBackPressedCallback(true) - { - override fun handleOnBackPressed() { - // Leave empty do disable back press or - // write your code which you want - // Log.i("VERDNATURA:","PULSADO") + // sergio: en test: Log.i("VERDNATURA:","attached") + val callback: OnBackPressedCallback = + object : OnBackPressedCallback(true) { + override fun handleOnBackPressed() { + // Leave empty do disable back press or + // write your code which you want + // Log.i("VERDNATURA:","PULSADO") - } } - requireActivity().onBackPressedDispatcher.addCallback( - this, - callback - ) + } + requireActivity().onBackPressedDispatcher.addCallback( + this, + callback + ) //if (context is OnCollectionSelectedListener) onCollectionSelectedListener = context } @@ -69,7 +64,7 @@ class RegisterSmartTagsFragment( customDialog = CustomDialog(requireContext()) customDialogList = CustomDialogList(requireContext()) goBack = false - ma.hideBottomNavigation(View.GONE) + ma.hideBottomNavigation(GONE) binding.splashProgress.visibility = GONE setEvents() @@ -87,36 +82,41 @@ class RegisterSmartTagsFragment( private fun setToolBar() { - // Log.d("VERDNATURA::","Title"+entryPoint) + // Log.d("VERDNATURA::","Title"+entryPoint) binding.mainToolbar.toolbarTitle.text = entryPoint + binding.splashProgress.visibility = GONE } private fun bindShelving_add(shelvingOrSmarttag: String) { - binding.splashProgress.visibility = VISIBLE - - // Log.d("VERDNATURA::","El selvingORSmarttag es "+shelvingOrSmarttag) - if (listSmartTags.size < 1) { - - } else { - /* ("https://smart-tag.verdnatura.es/bindShelving/$shelvingOrSmarttag&${listSmartTags.first().code}&${listSmartTags.size}").toast( - requireContext() - )*/ - viewModel.smartTagRegister(shelvingOrSmarttag,listSmartTags.first().code!!,listSmartTags.size.toString()) - - // Log.d("VERDNATURA::","https://smart-tag.verdnatura.es/bindShelving/$shelvingOrSmarttag&${listSmartTags.first().code}&${listSmartTags.size}") - } - - itemScaned = shelvingOrSmarttag - add_item() + if (listSmartTags.size > 0) { + binding.splashProgress.visibility = VISIBLE + viewModel.smartTagRegister( + shelvingOrSmarttag, + listSmartTags.first().code!!, + listSmartTags.size.toString() + ) + customDialogList.dismiss() + } + + if (listSmartTags.isEmpty()) { + val nameSmartTagwithWagon = + getTextScaned(listSmartTags.size + 1) + itemScaned + customDialogList.setTitle(getTextToPosition(listSmartTags.size + 1)) + + + listSmartTags.add(SmartTag(itemScaned, nameSmartTagwithWagon)) + smartAdapter!!.notifyDataSetChanged() + customDialogList.setValue("") + } } - private fun add_item(){ - var nameSmartTagwithWagon: String + private fun add_item() { + val nameSmartTagwithWagon: String nameSmartTagwithWagon = getTextScaned(listSmartTags.size + 1) + itemScaned @@ -129,19 +129,19 @@ class RegisterSmartTagsFragment( } - private fun scanRequest() { - if (binding.scanInput != null) { - binding.scanInput.requestFocus() - } - hideKeyboards() - } + /* private fun scanRequest() { + if (binding.scanInput != null) { + binding.scanInput.requestFocus() + } + hideKeyboards() + }*/ - private fun hideKeyboards() { - try { - requireActivity().hideKeyboard() - } catch (e: Exception) { - } - } + /* private fun hideKeyboards() { + try { + requireActivity().hideKeyboard() + } catch (e: Exception) { + } + }*/ private fun setEvents() { @@ -161,38 +161,62 @@ class RegisterSmartTagsFragment( with(viewModel) { binding.splashProgress.visibility = GONE - registerSmarttagNode.observe(viewLifecycleOwner, Observer { - - if (it.isError){ - ma.messageWithSound(it.errorMessage,true,false) - }else{ - ma.messageWithSound(it.message,false,false) - } - }) - - - responseadd.observe(viewLifecycleOwner, Observer { - // Log.i("VERDNATURA", "Revisar llamada de las etiquetas smarttags : ${it.response}") - + registerSmarttagNode.observe(viewLifecycleOwner) { if (it.isError) { - ma.messageWithSound(it.errorMessage,true,false) - + //listSmartTags.clear() + showScanSmartTags() + binding.splashProgress.visibility = GONE + ma.messageWithSound(it.errorMessage, true, false) } else { - var nameSmartTagwithWagon: String + add_item() + if (listSmartTags.size > 3) { - nameSmartTagwithWagon = - getTextScaned(listSmartTags.size + 1) + itemScaned - customDialogList.setTitle(getTextToPosition(listSmartTags.size + 1)) + customDialog.setTitle(getString(R.string.info)) + .setDescription(getString(R.string.registerOneWagoon)) + .setOkButton(getString(R.string.accept)) + { + listSmartTags.clear() + customDialog.dismiss() + showScanSmartTags() + } + .setKoButton(getString(R.string.exit)) { + customDialog.dismiss() + customDialogList.dismiss() + requireActivity().onBackPressed() - listSmartTags.add(SmartTag(itemScaned, nameSmartTagwithWagon)) - smartAdapter!!.notifyDataSetChanged() - customDialogList.setValue("") + } + .show() + } else { + showScanSmartTags() + } + ma.messageWithSound(it.message, false, false) } - binding.splashProgress.visibility = GONE - }) + } + + + /* responseadd.observe(viewLifecycleOwner) { + + if (it.isError) { + ma.messageWithSound(it.errorMessage, true, false) + + } else { + val nameSmartTagwithWagon: String + + nameSmartTagwithWagon = + getTextScaned(listSmartTags.size + 1) + itemScaned + customDialogList.setTitle(getTextToPosition(listSmartTags.size + 1)) + + + listSmartTags.add(SmartTag(itemScaned, nameSmartTagwithWagon)) + smartAdapter!!.notifyDataSetChanged() + customDialogList.setValue("") + + } + binding.splashProgress.visibility = GONE + }*/ } @@ -202,6 +226,7 @@ class RegisterSmartTagsFragment( var message = "" when (TagsScaned) { + 0 -> message = getString(R.string.scanUpToDown) 1 -> message = getString(R.string.scanHighLabel) 2 -> message = getString(R.string.scanMedLabel) 3 -> message = getString(R.string.scanLowLabel) @@ -217,9 +242,9 @@ class RegisterSmartTagsFragment( when (TagScaned) { 1 -> message = "Carro:" - 2 -> message = "Etiqueta superior:" - 3 -> message = "Escanea del medio:" - 4 -> message = "Etiqueta inferior:" + 2 -> message = getString(R.string.highLabel) + 3 -> message = getString(R.string.midLabel) + 4 -> message = getString(R.string.lowLabel) } return message @@ -228,43 +253,38 @@ class RegisterSmartTagsFragment( private fun showScanSmartTags() { - customDialogList.setTitle(getString(R.string.scanUpToDown)) + + customDialogList.setTitle(getTextToPosition(listSmartTags.size)) .setOkButton(getString(R.string.end)) { ma.hideKeyboard(customDialogList.getEditText()) if (listSmartTags.size > 0) { - // setFragmentResult("requestkey", bundleOf("tagMode" to "SmartTag")) + customDialogList.dismiss() requireActivity().onBackPressed() - // ma.openFragmentPickers() - /*listSmartTags.forEach { - Log.i("VERDNATURA:","El codigo es :${it.code}") - } - workerShelving_add(userFk, it.code!!)*/ + } else { - /* customDialog.setTitle("Atención").setDescription("No ha escaneado Smartags") - .setOkButton("Ok") - {*/ - customDialogList.dismiss() - requireActivity().onBackPressed() - /* }.show()*/ + customDialogList.dismiss() + requireActivity().onBackPressed() + + } - /* }.setKoButton("Deshacer") { - ma.hideKeyboard(customDialogList.getEditText()) + /* }.setKoButton("Deshacer") { + ma.hideKeyboard(customDialogList.getEditText()) - if (!listSmartTags.isEmpty()) { + if (!listSmartTags.isEmpty()) { - bindShelving_remove() + bindShelving_remove() - } else { - customDialogList.dismiss() - requireActivity().onBackPressed() + } else { + customDialogList.dismiss() + requireActivity().onBackPressed() - }*/ + }*/ // @@ -275,7 +295,7 @@ class RegisterSmartTagsFragment( customDialogList.getEditText().setOnEditorActionListener { v, actionId, event -> if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) { - if (!customDialogList.getValue().isNullOrEmpty()) { + if (!customDialogList.getValue().isEmpty()) { // Log.i("VERDNATURA:", "scan valor ${customDialogList.getValue()}") if (listSmartTags.size > 3) { @@ -302,9 +322,6 @@ class RegisterSmartTagsFragment( bindShelving_add(customDialogList.getValue().uppercase()) } - // showScanSmartTags(SmartTag(customDialogList.getValue())) - // listSmartTags.add(SmartTag(customDialogList.getValue())) - // smartAdapter!!.notifyDataSetChanged() } customDialogList.setValue("") diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/smarttag/sacador/fragment/AssociateSmartTagsFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/smarttag/sacador/fragment/AssociateSmartTagsFragment.kt index ec1c8dfb..9f017acd 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/smarttag/sacador/fragment/AssociateSmartTagsFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/smarttag/sacador/fragment/AssociateSmartTagsFragment.kt @@ -49,7 +49,7 @@ class AssociateSmartTagsFragment( override fun onAttach(context: Context) { super.onAttach(context) - Timber.i("VERDNATURA:attached") + // Timber.i("VERDNATURA:attached") val callback: OnBackPressedCallback = object : OnBackPressedCallback(true) { override fun handleOnBackPressed() { @@ -152,7 +152,7 @@ class AssociateSmartTagsFragment( // Log.i("VERDNATURA::", "Revisar llamada de las etiquetas smarttags : ${it.response}") if (it.isError) { - ma.messageWithSound("Asegúrate de escanear una matrícula."+it.errorMessage,true,false) + ma.messageWithSound(getString(R.string.shelvingSure)+it.errorMessage,true,false) } else { @@ -243,9 +243,6 @@ class AssociateSmartTagsFragment( if (listSmartTags.size > 0) { // setFragmentResult("requestkey", bundleOf("tagMode" to "SmartTag")) customDialogList.dismiss() - - - //Log.d("VERDNATURA::","Vamos a abrrir Sacadores") val result = "complete" setFragmentResult("requestKey", bundleOf("tagMode" to result)) ma.openFragmentPickers(true) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/smarttag/sacador/fragment/SmartTagsViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/smarttag/sacador/fragment/SmartTagsViewModel.kt index 14c61b3b..cf1a94a5 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/smarttag/sacador/fragment/SmartTagsViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/smarttag/sacador/fragment/SmartTagsViewModel.kt @@ -65,11 +65,6 @@ class SmartTagsViewModel(context: Context) : BaseViewModel() { }else{ _responseadd.value = ResponseItemVO(isError = false,response = response.message()!!) } - /*if (response.body() == null){ - _responseadd.value = ResponseItemVO(isError = true,errorMessage = "Error al escanear matrícula o etiqueta") - }else{ - _responseadd.value = ResponseItemVO(isError = false,response = response.body()!!) - }*/ } @@ -90,13 +85,13 @@ class SmartTagsViewModel(context: Context) : BaseViewModel() { GetSmarttagsUserCase.workerShelving_delete(usuario,password,vBarcode).enqueue(object : Callback{ override fun onFailure(call: Call, t: Throwable) { //_responseremove.value = ResponseItemVO(isError = true,errorMessage = "Error al llamar a workerShelving_remove") - _responseremove.value = messageError(t.message!!,"workerShelving_delete") + _responseremove.value = messageError(t.message!!,nameofFunction(this)) } override fun onResponse(call: Call, response: Response) { if (!response.isSuccessful){ - _responseremove.value = messageError(response.message(),"workerShelving_delete") + _responseremove.value = messageError(response.message(),nameofFunction(this)) }else{ _responseremove.value = ResponseItemVO(isError = false,response = response.message()!!) } @@ -120,8 +115,7 @@ class SmartTagsViewModel(context: Context) : BaseViewModel() { val responseSmart: SmartTagRegister - if (response.isSuccessful()){ - Log.d("VERDNATURA::","El mensaje es "+response.errorBody()) + if (response.isSuccessful){ responseSmart = SmartTagRegister( message="Registrada smartTag.", isError = false, @@ -150,7 +144,7 @@ class SmartTagsViewModel(context: Context) : BaseViewModel() { val responseSmart = SmartTagRegister(isError = true, errorMessage = t.message!!) - Log.d("VERDNATURA::","el error nodejs es "+t.message+"--"+t.cause.toString()+"--"+t.stackTrace.toString()) + //Log.d("VERDNATURA::","el error nodejs es "+t.message+"--"+t.cause.toString()+"--"+t.stackTrace.toString()) _registerSmarttagNode.value = responseSmart } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/transferencia/fragment/TransferenciaViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/transferencia/fragment/TransferenciaViewModel.kt index b89bde4d..bacd7873 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/transferencia/fragment/TransferenciaViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/transferencia/fragment/TransferenciaViewModel.kt @@ -25,7 +25,7 @@ class TransferenciaViewModel(context: Context) : BaseViewModel() { _response.value = ResponseItemVO(isError = true,errorMessage ="Error en llamada itemShelvingTransfer."+t.message!!) } override fun onResponse(call: Call, response: Response) { - if (response.body() == null){ + if (!response.isSuccessul == null){ _response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemShelvingTransfer") }else{ _response.value = ResponseItemVO(isError = false,response = response.message()!!) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/adapter/UbicadorAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/adapter/UbicadorAdapter.kt index 4ebd3d8e..487b6316 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/adapter/UbicadorAdapter.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/adapter/UbicadorAdapter.kt @@ -1,5 +1,6 @@ package es.verdnatura.presentation.view.feature.ubicador.adapter +import android.annotation.SuppressLint import android.provider.Settings.Global.getString import android.view.LayoutInflater import android.view.ViewGroup @@ -38,6 +39,7 @@ class UbicadorAdapter ( val binding: ItemUbicationRowBinding ) : RecyclerView.ViewHolder(binding.root){ private val res = binding.root.context.resources + @SuppressLint("SetTextI18n") fun bind(item: ItemUbicadorVO) { binding.apply { this.item = item 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 506064dd..a4b9edac 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 @@ -180,7 +180,7 @@ class UbicadorFragment( binding.automaticImg.setOnClickListener { if (!shelvingFk.isNullOrEmpty()) ma.onPasillerosItemClickListener( - PasillerosItemVO(title = "Automatic"), + PasillerosItemVO(title = getString(R.string.titleAuto)), entryPoint = shelvingFk ) else @@ -376,13 +376,10 @@ class UbicadorFragment( if (it.isError) { ma.messageWithSound(it.errorMessage, it.isError, false) - /* mperror!!.start() - customDialog.setTitle(getString(R.string.error)).setDescription(it.errorMessage) - .setOkButton(getString(R.string.close)) { - customDialog.dismiss() - }.show()*/ + }else{ - ma.messageWithSound(getString(R.string.Aparcado), it.isError, true) + ma.messageWithSound("", it.isError, true) + } }) @@ -507,7 +504,6 @@ class UbicadorFragment( packing, getData(WAREHOUSEFK), "1", - "itemShelvingMake", groupingPack ) changeOfflineValue( @@ -535,7 +531,6 @@ class UbicadorFragment( packing, getData(WAREHOUSEFK), "1", - "itemShelvingMake", groupingPack ) changeOfflineValue( diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt index 433699bf..ceb035c5 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt @@ -134,7 +134,6 @@ class UbicadorViewModel(context: Context) : BaseViewModel() { packing: String, warehouse: String, level: String, - callFunction: String, grouping: String ) { getUbicadorUserCase.itemShelvingMake( @@ -273,7 +272,7 @@ class UbicadorViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { - if (response.body() == null) { + if (!response.isSuccessful) { _response.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse( @@ -338,7 +337,7 @@ class UbicadorViewModel(context: Context) : BaseViewModel() { } override fun onResponse(call: Call, response: Response) { - if (response.body() == null) { + if (!response.isSuccessful) { _response.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse( diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/workermistake/fragment/WorkermistakeFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/workermistake/fragment/WorkermistakeFragment.kt index ed239c8d..9c4e22a9 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/workermistake/fragment/WorkermistakeFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/workermistake/fragment/WorkermistakeFragment.kt @@ -188,7 +188,7 @@ class WorkermistakeFragment( var entryPoint: String = "" responseAddMistake.observe(viewLifecycleOwner, { - ma.messageWithSound(it.errorMessage,it.isError,true) + ma.messageWithSound(if (it.isError){it.errorMessage}else{getString(R.string.errorCauseRegistered)},it.isError,true, isToasted = true) }) diff --git a/app/src/main/res/layout/fragment_faltas.xml b/app/src/main/res/layout/fragment_faltas.xml index 2bd5a00f..db8ae165 100644 --- a/app/src/main/res/layout/fragment_faltas.xml +++ b/app/src/main/res/layout/fragment_faltas.xml @@ -72,7 +72,7 @@ - + - + android:textColorHint="@color/verdnatura_white" + /> + - ' - + - + android:textColorHint="@color/verdnatura_white" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="@+id/main_toolbar"/> - ' Borrar datos de acceso Bienvenido Recordar usuario y contraseña - Faltas Versión Usuario Escanear etiqueta @@ -47,15 +46,12 @@ No existes sectores. Selecciona un sector Pasilleros - Sacadores Controladores Paletizadores Ajustes - Pre Sacador - Consultar artículo + Consultar artículo Buscar Item - Ubicador - Inventario + Ubicador Disponible Ubicado Sin ubicar @@ -72,13 +68,12 @@ Artículo Cantidad Artículo para Ticket - Escanea el carro para el item seleccionado + Escanea el carro para el item seleccionado Indica la nueva cantidad y la acción que quieres realizar con el resto. Basura Indica nueva cantidad Colección completa Parking - Shelving Parking Rechazar Existe una versión nueva, es recomendable actualizar. Actualizar @@ -132,14 +127,9 @@ Consultar estado expedición Gestión de buffers Paletizar - Vaciado buffer - Llenado buffer - Acumulación buffer - Desactivado buffer - Lector Qr Expedición : Artículos similares - Se necesario actualizar la app para que funcione correctamente. + Es necesario actualizar la app para que funcione correctamente. Disponible Cantidad mín. Productor @@ -148,17 +138,16 @@ Día de venta Carro Referencia - Control Previa Historico de ítems del carro Histórico del carro - Cargar expedición en buffer - Flejado buffer + Cargar expedición en buffer + Flejado buffer Split - Fallo del trabajador + Fallo del trabajador Buscar departamento No hay impresora Selecciona impresora - Ubicación de reclamación + Ubicación de reclamación Reclamaciones Escáner paletizar Realizado correctamente @@ -240,7 +229,7 @@ Escanea etiqueta de la expedición. Buffer: Packing guardado - Previa recogida + "\"Calidad\" " Disponibilidad Desmarcar línea Vas a desmarcar la línea: @@ -276,7 +265,7 @@ Buscar artículos similares Indica la causa de eliminar stock: Indica la cantidad a dar de alta - \"Indica la cantidad a dar de baja \" + "Indica la cantidad a dar de baja " Falta Basura El elemento introducido no es un número @@ -305,7 +294,83 @@ Revisar llamada del registro de vehículos Coger vehículo Sin vehículo - \"No hay nada vendido para el carro escaneado. \" + No hay nada vendido para el carro escaneado. Parking ok Escanea el parking + La línea de compra de la etiqueta escaneada no existe. + Pendiente de revisar : + Revisar + Se ha enviado a Split el articulo + del ticket + "Se ha añadido el articulo " + unidad/es al ticket + " con " + La cantidad supera a la disponible + cantidad introducida erronea + Escanea item para validar + Cantidad que coges: + Error al marcar la línea + Error al imprimir + Número de baldas del ticket + Indica el número de baldas que ocupa el ticket + Número de paquetes en balda + Indica el número de paquetes que caben en una balda + Comprobar + No ha escaneado expediciones + Escanea expediciones que no han pasado por el Sorter + Añadida + Registro añadido + " guardada con matrícula " + Split ok + Usuario: + Aviso + Error al enviar mensaje rocket. + HISTÓRICO + Asociar Sacador SmartTags + Registrar SmartTags + Paletizar + Escanear expedición + Gestión de buffers + Reclamaciones + Control de usuario de vehículo + Pre Sacador + Día de venta + Ver Ticket + Historial del vehículo + Reposición + Inventario + Faltas + Shelving Parking + Automatic + Origen + Sacadores + Visor web + Vaciado buffer + Llenado buffer + Acumulación buffer + Lector Qr + Desactivado buffer + Pre Control + Histórico Shelving + Log Shelving + Elemento escaneado no encontrado: + No existen pedidos para reponer + Pedido completado + Asegúrate de escanear una matrícula. + Etiqueta superior: + Etiqueta del medio: + Etiqueta inferior: + Nuevo + La siguiente colección sigue pendiente de preparar: + La respuesta es: + Previa OK + Colección sin tickets. Escanea tickets para añadirlos + "Pallet " + Expedition ( + ¿Estás seguro de cerrar la sesión? + Causa del error registada + "Artículo: " + "Cantidad original: " + No se puede realizar la llamada. El usuario no tiene la extensión configurada. Solicítelo a informática. + Historico Vehículo diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 694e6ef7..827479e6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -26,7 +26,7 @@ Clear access data Welcome Remember username and password - Fouls + Fouls Version User Scan label @@ -48,15 +48,11 @@ Select a sector Select a printer Corridors - Punch Controller Palletizers Setting - Pre Punch - Consult Article Search item - Locator - Inventory + Inventory Available Located Unlocated @@ -73,13 +69,12 @@ Article Quantity Ticket Item - Scan the cart for the selected item Indicate the new quantity and the action you want to take with the rest. Garbage Indicates new quantity Complete collection Parking - Shelving Parking + Shelving Parking Reject There is a new version, it is recommended to update. Update @@ -102,7 +97,7 @@ Packing Barcode Tipo de encajado - Total + Total: Select packing type zone : Item diary Get collection @@ -130,15 +125,15 @@ Device name : User assigned to device name Scan plate or smartag - Expedtion state + Expedition state Buffer Management Pallet make Scan pallet - Buffer empty - Buffer fill - Buffer Acumulate - Buffer off - Qr Reader + Buffer empty + Buffer fill + Buffer Acumulate + Buffer off + Qr Reader Expedition : Similar Articles It needs to be updated for it to work properly @@ -150,15 +145,14 @@ Day of sale Wagon Reference - Control previous Item Log Shelving Log - Load buffer - Buffer strapping + Load buffer + Buffer strapping Split - Worker mistaker + Worker mistaker Find department - Claim Ubication + Claim Ubication Claims done successful Settings @@ -269,13 +263,13 @@ Cantidad real( Tirar Buscar item - Historico + Histórico Artículos similares - \"Valor actual: \" + "Valor actual: " Buscar artículos similares Indica la causa de eliminar stock: Indica la cantidad a dar de alta - \"Indica la cantidad a dar de baja \" + "Indica la cantidad a dar de baja " Falta Basura El elemento introducido no es un número @@ -304,9 +298,80 @@ Revisar llamada del registro de vehículos Coger vehículo Sin vehículo - \"No hay nada vendido para el carro escaneado. \" - Parking ok + No hay nada vendido para el carro escaneado. + Parking OK Escanea el parking + La línea de compra de la etiqueta escaneada no existe. + Pendiente de revisar : + Revisar + Se ha enviado a Split el articulo + "del ticket " + Se ha añadido el articulo + unidad/es al ticket + " con " + La cantidad supera a la disponible + cantidad introducida erronea + Escanea item para validar + Cantidad que coges: + Error al marcar la linea + Error al imprimir + Número de baldas del ticket + Indica el número de baldas que ocupa el ticket + Número de paquetes en balda + Indica el número de paquetes que caben en una balda + Comprobar + No ha escaneado expediciones + Escanea expediciones que no han pasado por el Sorter + Añadida + Registro añadido + " guardada con matrícula " + Split OK + Usuario: + Aviso + Error al enviar mensaje rocket. + HISTÓRICO + Asociar Sacador SmartTags + Registrar SmartTags + Paletizar + Escanear expedición + Gestión de buffers + Reclamaciones + Control de usuario de vehículo + Pre Sacador + Día de venta + Ver Ticket + Historial del vehículo + Reposición + Consultar artículo + Ubicator + Automatic + Quality + Visor web + Pre Control + Histórico Shelving + Log Shelving + Sacadores + Elemento escaneado no encontrado: + No existen pedidos para reponer + Pedido completado + Asegúrate de escanear una matrícula. + Etiqueta superior: + Etiqueta del medio: + Etiqueta inferior: + Nuevo + La siguiente colección sigue pendiente de preparar: + Scan wagoon for item selected + La respuesta es: + Previa OK + Colección sin tickets. Escanea tickets para añadirlos + "Pallet " + Expedition ( + ¿Estás seguro de cerrar la sesión? + Causa del error registada + "Artículo: " + "Cantidad original: " + No se puede realizar la llamada. El usuario no tiene la extensión configurada. Solicítelo a informática. + Historico Vehículo