Version 9.5Beta añadido inteceptor y modificado código worker_getId. Subida como 9.4.2Beta

This commit is contained in:
Sergio De la torre 2022-11-11 09:53:47 +01:00
parent e0ffa0f0ec
commit 96b4960358
33 changed files with 437 additions and 196 deletions

View File

@ -82,36 +82,39 @@
</select>
</component>
<component name="ChangeListManager">
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="Modificado control ubicación">
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="Version 9.3 Modificadas llamas #4696. Añadido posibilidad de revisar items. Añadido color rojo Salix. Borrados comentarios">
<change afterPath="$PROJECT_DIR$/app/release/vn-picking.apk" afterDir="false" />
<change afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SilexCallback.kt" afterDir="false" />
<change afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SilexInterceptor.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/app/build.gradle" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetItemCardUserCase.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetItemCardUserCase.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetPaletizadoresUserCase.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetPaletizadoresUserCase.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/release/output-metadata.json" beforeDir="false" afterPath="$PROJECT_DIR$/app/release/output-metadata.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/MobileApplication.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/MobileApplication.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/ApiUtils.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/ApiUtils.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/RestClient.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/RestClient.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SalixService.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SalixService.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/common/itemScanned.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/common/itemScanned.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardViewModel.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragmentViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragmentViewModel.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryViewModel.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/model/ItemInventaryVO.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/model/ItemInventaryVO.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/base/BaseViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/base/BaseViewModel.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/common/UICallbacks.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/common/UICallbacks.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogUbicador.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogUbicador.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/model/LoginItemVO.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/model/LoginItemVO.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/packaging/fragment/PackagingSummaryFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/packaging/fragment/PackagingSummaryFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/CmrExpeditionPalletFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/CmrExpeditionPalletFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/CmrExpeditionPalletViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/CmrExpeditionPalletViewModel.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/packaging/adapter/ItemSupplierAdapter.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/packaging/adapter/ItemSupplierAdapter.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/packaging/fragment/PackagingCountFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/packaging/fragment/PackagingCountFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/parking/fragment/ParkingFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/parking/fragment/ParkingFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/fragment/ReposicionFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/fragment/ReposicionFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/adapter/UbicadorAdapter.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/adapter/UbicadorAdapter.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemViewModel.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/layout/item_inventary_row.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/item_inventary_row.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/model/ItemUbicadorVO.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/model/ItemUbicadorVO.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/layout/fragment_packaging_count.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/fragment_packaging_count.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/layout/item_itemsupplier_row.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/item_itemsupplier_row.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/values-es/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values-es/strings.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/values/colors.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values/colors.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/values/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values/strings.xml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />

View File

@ -13,9 +13,10 @@ android {
applicationId "es.verdnatura"
minSdkVersion 21 //21
targetSdkVersion 30
versionCode 141
versionName = "9.3"
//versionName = "9.4.1Beta" 141
versionCode 143
versionName = "9.5Beta"
//versionName = "9.3.1" versionCode 142
//versionName = "9.4.2Beta" versionCode 142
//versionName = "9.4Beta" versionCode 140
//versionName = 9.2
//versionName = "9.3.2Beta" versionCode 139

View File

@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 141,
"versionName": "9.4.1Beta",
"versionCode": 142,
"versionName": "9.3.1",
"outputFile": "app-release.apk"
}
],

BIN
app/release/vn-picking.apk Normal file

Binary file not shown.

View File

@ -1,12 +1,22 @@
package es.verdnatura
import android.app.Application
import android.content.SharedPreferences
import es.verdnatura.di.viewModelModule
import es.verdnatura.domain.RestClient
import es.verdnatura.domain.SalixService
import es.verdnatura.domain.VerdnaturaService
import org.koin.android.ext.koin.androidContext
import org.koin.core.context.loadKoinModules
import org.koin.core.context.startKoin
class MobileApplication: Application() {
lateinit var silex: VerdnaturaService
lateinit var salix: SalixService
var userId: Int? = null
protected val PREFS_USER = "es.verdnatura.user.prefs"
override fun onCreate() {
super.onCreate()
@ -15,6 +25,13 @@ class MobileApplication: Application() {
loadKoinModules(moduleList)
}
var restClient = RestClient(this)
silex = restClient.restClient
salix = restClient.salixClient
}
fun getPrefs(): SharedPreferences.Editor {
val prefs: SharedPreferences = getSharedPreferences(PREFS_USER, 0)
return prefs.edit()
}
}

View File

@ -11,21 +11,23 @@ import java.util.concurrent.TimeUnit
class ApiUtils {
companion object {
//const val BASE_URL:String = "http://192.168.1.54:8009/"
//const val BASE_URL:String = "https://10.1.2.79/"
const val BASE_URL: String = "https://app.verdnatura.es/"
fun getApiService(context: Context): VerdnaturaService {
var client = OkHttpClient.Builder()
.addInterceptor(SilexInterceptor(context))
.connectTimeout(10, TimeUnit.SECONDS)
.writeTimeout(10, TimeUnit.SECONDS)
.readTimeout(40, TimeUnit.SECONDS)
.build()
val retrofit = Retrofit.Builder()
.baseUrl(getBaseUrlLocal(context))
.addConverterFactory(GsonConverterFactory.create())
.client(getRequestHeader()!!)
.client(client)
.build()
return retrofit.create(VerdnaturaService::class.java)
return retrofit.create(VerdnaturaService::class.java)
}
fun getBaseUrlLocal(context: Context): String {
@ -40,14 +42,6 @@ class ApiUtils {
return if (url.isNullOrEmpty()) BASE_URL else url
}
fun getRequestHeader(): OkHttpClient? {
return OkHttpClient.Builder()
.connectTimeout(10, TimeUnit.SECONDS)
.writeTimeout(10, TimeUnit.SECONDS)
.readTimeout(40, TimeUnit.SECONDS)
.build()
}
fun setDefaults(key: String?, value: String?, context: Context?) {
val preferences: SharedPreferences =
PreferenceManager.getDefaultSharedPreferences(context)

View File

@ -18,6 +18,7 @@ class GetLoginUserCase(context: Context) : RestClient(context)
val params: ArrayList<String> = ArrayList()
params.add(usuario)
params.add(android_id)
return restClient!!.device_checkLogin(
"json",
"1",
@ -28,12 +29,6 @@ class GetLoginUserCase(context: Context) : RestClient(context)
)
}
fun worker_getId(usuario: String, password: String): Call<String>
{
val params: ArrayList<String> = ArrayList()
return restClient!!.worker_getId("json", "1", usuario, password, "application/json", params)
}
fun deviceLog_add(
usuario: String,
password: String,

View File

@ -106,6 +106,45 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) {
)
}
fun itemShelving_addList(
usuario: String,
password: String,
shelving: String,
items: Any,
isChecking:Boolean,
warehouse: Int
): Call<Any> {
val params: ArrayList<Any> = ArrayList()
params.add(shelving)
params.add(items)
params.add(isChecking)
params.add(warehouse)
return restClient!!.itemShelving_addList(
"json",
"1",
usuario,
password,
"application/json",
params
)
}
/* fun itemShelving_addList(
usuario: String,
password: String,
item:itemShelvingListObject
): Call<Any> {
val params: itemShelvingListObject = item
return restClient!!.itemShelving_addList(
"json",
"1",
usuario,
password,
"application/json",
params
)
}*/
fun shelvingPriorityUpdate(
usuario: String,
password: String,

View File

@ -3,10 +3,10 @@ package es.verdnatura.domain
import android.content.Context
open class RestClient(context: Context) {
var restClient: VerdnaturaService? = null
var salixClient: SalixService? = null
var nodejsClient: NodeJsService? = null
var salixClientSend:SalixServiceSend?=null
var restClient: VerdnaturaService
var salixClient: SalixService
var nodejsClient: NodeJsService
var salixClientSend:SalixServiceSend
init {
restClient = ApiUtils.getApiService(context)
@ -14,5 +14,4 @@ open class RestClient(context: Context) {
nodejsClient = ApiNodeJsUtils.getApiService()
salixClientSend = ApiSalixUtilsSend.getApiService(context)
}
}

View File

@ -36,7 +36,6 @@ interface SalixService {
@Body params: SalixMessageVO
):
Call<Boolean>
@POST("chats/send")
fun sendGroup(
@Header("Content-Type") content_type: String,

View File

@ -0,0 +1,41 @@
package es.verdnatura.domain
import android.util.Log
import org.json.JSONObject
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
//Se crea interceptor para así generalizar las respuestas y llamadas,
//si hay respuesta de fallo 555 se llama onError que lanza un error para que se haga el catch() directamente,
//si no queremos que haga el catch tenemos que reescribir la llamada onError en la clase donde se llama o incluso
// lanzar un throw error de nuevo para que vuelva al catch y lo ejecute.
//-> sería válido en el caso que el catch fuera lo general para todos ( por ejemplo un Toast y después realizáramos
//otras acciones. Se reescribiria el método onError en LoginViewModel como:
// do_actions-> Haz acciones del fallo
// throw e -> De esta manera se consigue llegar al catch. El error se propaga a la llamada superior.
//Falta pasarle al CAllback el tipo que queramos y poder lanzar el toast
abstract class SilexCallback : Callback<Int> {
override fun onResponse(call: Call<Int>, response: Response<Int>) {
try {
if (response.isSuccessful) {
onSuccess(response)
} else if (response.code() == 555) {
var message = JSONObject(response.message()).getString("Message")
//Toast.makeText(context, message, Toast.LENGTH_LONG).show()
onError(Error(message))
}
} catch(err: Error) {
Log.d("VERDNATURA::", "onResponse" + err.message)
}
}
override fun onFailure(call: Call<Int>, t: Throwable) {
Log.d("VERDNATURA::", "onFailure" + t.message)
}
abstract fun onSuccess(response: Response<Int>)
open fun onError(err: Error) {
throw err
}
}

View File

@ -0,0 +1,39 @@
package es.verdnatura.domain
import android.content.Context
import android.content.SharedPreferences
import android.util.Log.d
import okhttp3.Interceptor
import okhttp3.Response
import java.io.IOException
class SilexInterceptor : Interceptor {
private var context: Context
constructor(context: Context) {
this.context = context
}
@Throws(IOException::class)
override fun intercept(chain: Interceptor.Chain): Response {
val prefs: SharedPreferences =
this.context.getSharedPreferences("es.verdnatura.user.prefs", 0)
val request = chain.request()
//sergio: condición para que añada o no headers según se vaya quitando de las llamadas
//no quitar condición hasta que estén quitados
if (request.headers().toString().isEmpty()) {
val newRequest = request.newBuilder()
.addHeader("aplicacion", "json")
.addHeader("version", "1")
.addHeader("user", prefs.getString("user", null))
.addHeader("pass", prefs.getString("password", null))
.addHeader("Content-Type", "application/json")
.build()
// d("VERDNATURA::", newRequest.headers().toString() + newRequest.url())
return chain.proceed(newRequest)
} else
return chain.proceed(request)
}
}

View File

@ -33,6 +33,7 @@ import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO
import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake
import es.verdnatura.presentation.view.feature.workermistake.model.MistakeWorkerType
import es.verdnatura.presentation.view.feature.workermistake.model.WorkerFromMistake
import org.json.JSONObject
import retrofit2.Call
import retrofit2.http.Body
import retrofit2.http.Header
@ -65,15 +66,7 @@ interface VerdnaturaService {
Call<LoginDevice>
@POST("almacennew/worker_getId")//REVISADA
fun worker_getId(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String,
@Body params: List<String>
):
Call<String>
fun worker_getId(@Body vararg params: Any): Call<Int>
@POST("almacennew/deviceLog_add")//REVISADA
fun deviceLog_add(
@ -1151,8 +1144,8 @@ interface VerdnaturaService {
):
Call<Any>
/* @POST("almacennew/saleParking_add")//REVISADA
fun saleParking_add(
@POST("almacennew/itemShelving_addList")//REVISADA
fun itemShelving_addList(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@ -1160,7 +1153,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String,
@Body params: List<Any>
):
Call<String>*/
Call<Any>
@POST("almacennew/shelvingPark")//REVISADA

View File

@ -1,10 +1,25 @@
package es.verdnatura.presentation.base
import android.content.Context
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.ViewModel
import es.verdnatura.MobileApplication
import es.verdnatura.domain.SalixService
import es.verdnatura.domain.VerdnaturaService
import org.json.JSONObject
abstract class BaseViewModel : ViewModel(), LifecycleObserver
abstract class BaseViewModel : ViewModel, LifecycleObserver {
var app: MobileApplication? = null
var silex: VerdnaturaService? = null
var salix: SalixService? = null
constructor(): super()
constructor(context: Context): super() {
app = context as MobileApplication
silex = app!!.silex
salix = app!!.salix
}
}
fun nameofFunction(function: Any): String {

View File

@ -67,6 +67,10 @@ interface OnImageTrashClickListener {
fun OnImageUpdateClickListener(item: Any)
}
interface OnEditSubQuantityListener {
fun OnEditSubQuantityListener(item: Any, text: String)
}
interface OnImageUpdateClickListener {
fun OnImageUpdateClickListener(item: Any)
}

View File

@ -52,9 +52,9 @@ class CustomDialogUbicador (context: Context) : Dialog(context, R.style.DialogT
}
fun setEtiquetaValue(value : String) : CustomDialogUbicador{
fun setEtiquetaValue(value : String?) : CustomDialogUbicador{
binding.customDialogEtiquetas.setText(value)
binding.customDialogEtiquetas.setText(value?:"")
binding.customDialogEtiquetas.visibility = View.VISIBLE
/* custom_dialog_etiquetas.setText(value)
custom_dialog_etiquetas.visibility = View.VISIBLE*/

View File

@ -329,11 +329,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
} else {
//sergio: se añade el log
viewModel.worker_getId(
binding.edittextUsername.text.toString(),
binding.edittextPassword.text.toString()
)
viewModel.worker_getId()
viewModel.worker_getSector(
binding.edittextUsername.text.toString(),
@ -401,15 +397,10 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
}
workerId.observe(viewLifecycleOwner) {
if (!it.isError) {
saveUserFkPref(it.Id.toString())
}
}
operatorAdd.observe(viewLifecycleOwner) {
@ -552,13 +543,6 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
editor.apply()
}
/* private fun saveUserFkPref(loginitem: LoginItemVO) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
val editor = prefs.edit()
editor.putString(USERFK, loginitem.id)
editor.apply()
}*/
private fun saveUserFkPref(workerId: String) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
val editor = prefs.edit()

View File

@ -1,14 +1,20 @@
package es.verdnatura.presentation.view.feature.login.fragment
import android.app.Activity
import android.content.Context
import android.content.SharedPreferences
import android.util.Log.d
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import com.google.gson.Gson
import com.google.gson.JsonObject
import com.google.gson.reflect.TypeToken
import es.verdnatura.MobileApplication
import es.verdnatura.domain.GetLoginUserCase
import es.verdnatura.domain.NodeJsService
import es.verdnatura.domain.RestClient
import es.verdnatura.domain.SilexCallback
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
@ -22,13 +28,15 @@ import es.verdnatura.presentation.view.feature.login.model.LoginDevice
import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO
import es.verdnatura.presentation.view.feature.login.model.versionApp
import es.verdnatura.presentation.view.feature.login.model.workerId
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.paletizador.model.itemsExpeditionDynamics
import org.json.JSONObject
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import java.lang.Error
class LoginViewModel(context: Context) : BaseViewModel() {
class LoginViewModel(context: Context) : BaseViewModel(context) {
private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase(context)
private val _loginsalixitem by lazy { MutableLiveData<LoginSalixVO>() }
@ -187,52 +195,21 @@ class LoginViewModel(context: Context) : BaseViewModel() {
})
}
fun worker_getId(user: String, password: String) {
getLoginUserCase.worker_getId(user, password)
.enqueue(object : Callback<String> {
override fun onResponse(call: Call<String>, response: Response<String>) {
val workerId: workerId?
if (response.body() != null) {
workerId = workerId(
response.body().toString(),
isError = false,
errorMessage = ""
)
} else {
workerId = workerId(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
)
)
fun worker_getId() {
silex!!.worker_getId().enqueue(object : SilexCallback() {
override fun onSuccess(response: Response<Int>) {
var prefs = app!!.getPrefs()
response.body()?.let { prefs.putInt("userFk", it) }
prefs.apply()
}
_workerId.value = workerId
override fun onError(err: Error) {
d("VERDNATURA::","Entramos al fallo"+err.message)
throw err
}
override fun onFailure(call: Call<String>, t: Throwable) {
val workerId =
workerId(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
t.message!!
)
)
_workerId.value = workerId
}
})
}
fun deviceLog_add(
user: String, password: String, app: String, versionApp: String, android_id: String
) {

View File

@ -51,8 +51,7 @@ class LoginDevice(
)
class workerId(
val Id: String? = "",
val Id: Int? = null,
var isError: Boolean = false,
var errorMessage: String = ""
)

View File

@ -445,7 +445,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
addFragmentOnTop(AutomaticAddItemFragment.newInstance(entryPoint,item.title))
}
getString(R.string.titlechecker) -> {
getString(R.string.titleChecker) -> {
addFragmentOnTop(AutomaticAddItemFragment.newInstance(entryPoint,item.title))
}

View File

@ -2,18 +2,17 @@ package es.verdnatura.presentation.view.feature.packaging.adapter
import android.view.LayoutInflater
import android.view.ViewGroup
import android.view.inputmethod.EditorInfo
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.R
import es.verdnatura.databinding.ItemItemsupplierRowBinding
import es.verdnatura.presentation.common.OnImageTrashClickListener
import es.verdnatura.presentation.common.OnImageUpdateClickListener
import es.verdnatura.presentation.common.*
import es.verdnatura.presentation.view.feature.packaging.model.ItemSupplier
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
class ItemSupplierAdapter(
private val items: List<ItemSupplier>,
private val onImageUpdateClickListener: OnImageUpdateClickListener,
private val onImageTrashClickListener: OnImageTrashClickListener,
private val onEditSubQuantityListener: OnEditSubQuantityListener
// private val OnGeneralItemRowClickListener: OnGeneralItemRowClickListener,
// private var showDelete: Boolean = false
) : RecyclerView.Adapter<ItemSupplierAdapter.ItemHolder>() {
@ -51,9 +50,21 @@ class ItemSupplierAdapter(
onImageTrashClickListener.OnImageUpdateClickListener(item)
}
}
itemSubquantity.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
onEditSubQuantityListener.OnEditSubQuantityListener(
item,
binding.itemSubquantity.text.toString()
)
v.clearFocus()
}
return@setOnEditorActionListener false
}
}
}
}
}
}

View File

@ -10,10 +10,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentPackagingCountBinding
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnImageTrashClickListener
import es.verdnatura.presentation.common.OnImageUpdateClickListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
import es.verdnatura.presentation.common.*
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.packaging.adapter.ItemSupplierAdapter
@ -93,10 +90,8 @@ class PackagingCountFragment(
)
}
}
}
})
@ -126,12 +121,16 @@ class PackagingCountFragment(
d("VERDNATURA::", "Seleccionado update" + (item as ItemSupplier).name)
}
}, object : OnImageTrashClickListener {
override fun OnImageUpdateClickListener(item: Any) {
d("VERDNATURA::", "Seleccionado trash" + (item as ItemSupplier).name)
}
}, object : OnEditSubQuantityListener {
override fun OnEditSubQuantityListener(item: Any, text: String) {
d("VERDNATURA::", "la subquantity es " + (item as ItemSupplier).name+"el valor es :"+text)
hideKeyboard()
}
})
binding.itemsupplierRecyclerview.adapter = adapteritemsupplier

View File

@ -82,7 +82,7 @@ class ParkingFragment (var menuOrigin:String): BaseFragment<FragmentParkingBindi
setList()
//Tarea #4711 Jordi parking canviat
requireActivity().onBackPressed()
//requireActivity().onBackPressed()
}
}

View File

@ -88,7 +88,7 @@ class UbicadorAdapter(
)
}
if (item.checked) {
/* if (item.checked) {
itemRowLayout.setBackgroundColor(
ContextCompat.getColor(
visibleText.context,
@ -109,7 +109,38 @@ class UbicadorAdapter(
visibleText.context,
R.color.verdnatura_red_salix
))
}*/
when (item.isChecked) {
1 -> {
itemRowLayout.setBackgroundColor(
ContextCompat.getColor(
visibleText.context,
R.color.verdnatura_dark_green_verdnatura
)
)
}
0 -> {
itemRowLayout.setBackgroundColor(
ContextCompat.getColor(
visibleText.context,
R.color.verdnatura_red_salix
)
)
}
null -> {
itemRowLayout.setBackgroundColor(
ContextCompat.getColor(
visibleText.context,
R.color.verdnatura_black_5
)
)
}
}
}
}

View File

@ -1,6 +1,5 @@
package es.verdnatura.presentation.view.feature.ubicador.fragment
import android.util.Log.d
import android.view.View
import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer
@ -11,6 +10,7 @@ import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnAutomaticItemClickListener
import es.verdnatura.presentation.view.feature.ubicador.adapter.AutomaticAdapter
import es.verdnatura.presentation.view.feature.ubicador.model.ItemEscanerVO
import java.lang.Boolean.TRUE
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
@ -27,7 +27,8 @@ class AutomaticAddItemFragment(
private var contador = 0
companion object {
fun newInstance(entryPoint: String,titleAction:String)= AutomaticAddItemFragment(entryPoint,titleAction)
fun newInstance(entryPoint: String, titleAction: String) =
AutomaticAddItemFragment(entryPoint, titleAction)
}
override fun getLayoutId(): Int = R.layout.fragment_automatic_add_item
@ -90,13 +91,25 @@ class AutomaticAddItemFragment(
binding.buttonFinalizar.setOnClickListener {
val listString: ArrayList<String> = ArrayList()
val listInt: ArrayList<Int> = ArrayList()
listItems.forEach {
listString.add(it.item)
listInt.add(it.item.toInt())
}
listItems = ArrayList()
binding.splashProgress.visibility = View.VISIBLE
if (binding.mainToolbar.toolbarTitle.text.equals(getString(R.string.titleChecker))) {
viewModel.itemShelving_addList(
getData(USER),
getData(PASSWORD),
shelvingFk,
"" + listInt + "",
TRUE,
getData(WAREHOUSEFK).toInt()
)
} else {
viewModel.itemShelvingMake_multi(
getData(USER),
getData(PASSWORD),
@ -105,6 +118,7 @@ class AutomaticAddItemFragment(
getData(WAREHOUSEFK)
)
}
}
binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed()

View File

@ -21,24 +21,84 @@ class AutomaticAddItemViewModel (context: Context): BaseViewModel() {
get() = _response
fun itemShelvingMake_multi(usuario:String,password:String,shelving:String,items:List<String>,warehouse:String){
getUbicadorUserCase.itemShelvingMake_multi(usuario,password,shelving,items,warehouse).enqueue(object :
fun itemShelvingMake_multi(
usuario: String,
password: String,
shelving: String,
items: List<String>,
warehouse: String
) {
getUbicadorUserCase.itemShelvingMake_multi(usuario, password, shelving, items, warehouse)
.enqueue(object :
Callback<Any> {
override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(
nameofFunction(this),t.message!!)
_response.value = ResponseItemVO(
isError = true, errorMessage = getMessageFromAllResponse(
nameofFunction(this), t.message!!
)
)
}
override fun onResponse(call: Call<Any>, response: Response<Any>) {
if (!response.isSuccessful) {
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()!!))
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()!!
)
)
} else {
_response.value = ResponseItemVO(isError = false,response = response.message()!!)
_response.value =
ResponseItemVO(isError = false, response = response.message()!!)
}
}
})
}
fun itemShelving_addList(
usuario: String,
password: String,
shelving: String,
items: Any,
isChecking: Boolean,
warehouse: Int
) {
getUbicadorUserCase.itemShelving_addList(
usuario,
password,
shelving,
items,
isChecking,
warehouse
).enqueue(object :
Callback<Any> {
override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(
isError = true, errorMessage = getMessageFromAllResponse(
nameofFunction(this), t.message!!
)
)
}
override fun onResponse(call: Call<Any>, response: Response<Any>) {
if (!response.isSuccessful) {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()!!
)
)
} else {
_response.value =
ResponseItemVO(isError = false, response = response.message()!!)
}
}
})
}
}

View File

@ -105,6 +105,7 @@ class UbicadorFragment(
val iconReload = ImageView(context)
iconReload.setImageResource(R.drawable.ic_autorenew_black_24dp)
binding.mainToolbar.switchButton.visibility = VISIBLE
binding.mainToolbar.switchButton.setOnCheckedChangeListener { buttonView, isChecked ->
if (binding.mainToolbar.toolbarTitle.text == getString(R.string.titleUbicator)) {
@ -135,6 +136,7 @@ class UbicadorFragment(
}
listIcons.add(iconAdd)
listIcons.add(iconReload)
// listIcons.add(iconChecker)
binding.mainToolbar.toolbarIcons.adapter =
@ -144,12 +146,33 @@ class UbicadorFragment(
when (item) {
iconAdd.drawable -> showAddItem("", "", "", "", false, ItemUbicadorVO(), "")
iconReload.drawable -> {
if (!shelvingFk.isNullOrEmpty()) {
binding.splashProgress.visibility = VISIBLE
viewModel.itemShelvingList(
getData(USER),
getData(PASSWORD),
shelvingFk
)
} else {
getString(R.string.scanShelving).toast(
requireActivity(),
Toast.LENGTH_SHORT
)
}
}
iconChecker.drawable -> {
if (!shelvingFk.isNullOrEmpty()) {
ma.onPasillerosItemClickListener(
PasillerosItemVO(title = getString(R.string.titleChecker)),
entryPoint = shelvingFk
)
} else {
getString(R.string.scanShelving).toast(
requireActivity(),
Toast.LENGTH_SHORT
)
}
}
}
@ -223,9 +246,10 @@ class UbicadorFragment(
binding.automaticImg.setOnClickListener {
if (!shelvingFk.isNullOrEmpty())
//Tarea #4696 Para llamar a Revisar items poner R.string.titleChecker
//Tarea #4778 Para llamar a Revisar items poner R.string.titleChecker
ma.onPasillerosItemClickListener(
PasillerosItemVO(title = getString(R.string.titleAuto)),
// PasillerosItemVO(title = getString(R.string.titleChecker)),
entryPoint = shelvingFk
)
else

View File

@ -15,7 +15,8 @@ class ItemUbicadorVO (
var isError: Boolean = false,
var errorMessage: String = "",
var checked: Boolean = false,
var isNew:Boolean = false
var isNew: Boolean = false,
var isChecked: Int? = null
)
class ItemEscanerVO(

View File

@ -19,7 +19,7 @@
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textinputlayout_username"
android:id="@+id/textinputlayout_data"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColorHint="@android:color/darker_gray">

View File

@ -46,7 +46,7 @@
android:visibility="visible"
android:layout_gravity="center"
tools:text="BB" />
<TextView
<EditText
android:id="@+id/item_subquantity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -56,6 +56,8 @@
android:textSize="@dimen/h8"
android:gravity="center_vertical"
android:visibility="visible"
android:imeOptions="actionDone"
android:singleLine="true"
android:layout_gravity="center"
tools:text="20" />

View File

@ -348,7 +348,7 @@
<string name="titleFaults">Faltas</string>
<string name="titleShelvingParking">Shelving Parking</string>
<string name="titleAuto">Añadir ítems</string>
<string name="titlechecker">Revisar ítems</string>
<string name="titleChecker">Revisar ítems</string>
<string name="titleQuality">Calidad</string>
<string name="titlePickers">Sacadores</string>
<string name="titleWebViewer">Visor web</string>

View File

@ -520,7 +520,7 @@
<string name="codeQrORPallet">Code QR or PALLET</string>
<string name="codeQrOrCMR">Code QR or CMR</string>
<string name="scanValues">Scan values : </string>
<string name="titlechecker">Check items</string>
<string name="titleChecker">Check items</string>
</resources>