Version 9.1Beta- Rgb,trasaccion marcar lineas, new collection,shelvingLog, y ajustes
This commit is contained in:
parent
c54191f12b
commit
3bc1d9d757
|
@ -3,6 +3,7 @@ package es.verdnatura.domain
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.Printers
|
import es.verdnatura.presentation.view.feature.ajustes.model.Printers
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||||
|
import es.verdnatura.presentation.view.feature.ajustes.model.Train
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
|
|
||||||
class GetAjustesUserCase(context: Context) : RestClient(context) {
|
class GetAjustesUserCase(context: Context) : RestClient(context) {
|
||||||
|
@ -17,10 +18,13 @@ class GetAjustesUserCase(context: Context) : RestClient(context) {
|
||||||
fun worker_updateSector(usuario: String, password: String,sectorFk:String): Call<Unit> {
|
fun worker_updateSector(usuario: String, password: String,sectorFk:String): Call<Unit> {
|
||||||
val params: ArrayList<String> = ArrayList()
|
val params: ArrayList<String> = ArrayList()
|
||||||
params.add(sectorFk)
|
params.add(sectorFk)
|
||||||
|
|
||||||
return restClient!!.worker_updateSector("json", "1", usuario, password, "application/json",params)
|
return restClient!!.worker_updateSector("json", "1", usuario, password, "application/json",params)
|
||||||
}
|
}
|
||||||
|
fun operator_updateItemPackingType(usuario: String, password: String,itemPackingTypeFk:String): Call<Unit> {
|
||||||
|
val params: ArrayList<String> = ArrayList()
|
||||||
|
params.add(itemPackingTypeFk)
|
||||||
|
return restClient!!.operator_updateItemPackingType("json", "1", usuario, password, "application/json",params)
|
||||||
|
}
|
||||||
fun worker_updatePrinter(usuario: String, password: String,labelerFk:String): Call<Unit> {
|
fun worker_updatePrinter(usuario: String, password: String,labelerFk:String): Call<Unit> {
|
||||||
val params: ArrayList<String> = ArrayList()
|
val params: ArrayList<String> = ArrayList()
|
||||||
params.add(labelerFk)
|
params.add(labelerFk)
|
||||||
|
@ -30,6 +34,25 @@ class GetAjustesUserCase(context: Context) : RestClient(context) {
|
||||||
fun printer_get(usuario: String, password: String): Call<List<Printers>> {
|
fun printer_get(usuario: String, password: String): Call<List<Printers>> {
|
||||||
return restClient!!.printer_get("json", "1", usuario, password, "application/json")
|
return restClient!!.printer_get("json", "1", usuario, password, "application/json")
|
||||||
}
|
}
|
||||||
|
fun train_get(usuario: String, password: String): Call<List<Train>> {
|
||||||
|
return restClient!!.train_get("json", "1", usuario, password, "application/json")
|
||||||
|
}
|
||||||
|
fun operator_getTrain(usuario: String, password: String): Call<String?> {
|
||||||
|
|
||||||
|
return restClient!!.operator_getTrain("json", "1", usuario, password, "application/json")
|
||||||
|
}
|
||||||
|
fun operator_getItemPackingType(usuario: String, password: String): Call<String?> {
|
||||||
|
|
||||||
|
return restClient!!.operator_getItemPackingType("json", "1", usuario, password, "application/json")
|
||||||
|
}
|
||||||
|
fun worker_isF11Allowed(usuario: String, password: String): Call<Boolean> {
|
||||||
|
|
||||||
|
return restClient!!.worker_isF11Allowed("json", "1", usuario, password, "application/json")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun operator_updateTrain(usuario: String, password: String,trainFk:String): Call<Unit> {
|
||||||
|
val params: ArrayList<String> = ArrayList()
|
||||||
|
params.add(trainFk)
|
||||||
|
return restClient!!.operator_updateTrain("json", "1", usuario, password, "application/json",params)
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -108,6 +108,22 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun collection_assign(
|
||||||
|
usuario: String,
|
||||||
|
password: String
|
||||||
|
): Call<String> {
|
||||||
|
|
||||||
|
return restClient!!.collection_assign(
|
||||||
|
"json",
|
||||||
|
"1",
|
||||||
|
usuario,
|
||||||
|
password,
|
||||||
|
"application/json"
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fun collectionNew(
|
fun collectionNew(
|
||||||
usuario: String,
|
usuario: String,
|
||||||
password: String,
|
password: String,
|
||||||
|
@ -187,6 +203,34 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun saleTracking_mark(
|
||||||
|
usuario: String,
|
||||||
|
password: String,
|
||||||
|
saleFk: String,
|
||||||
|
vOriginalQuantity: String,
|
||||||
|
vStateFk: String,
|
||||||
|
vIsChecked: String,
|
||||||
|
vBuyFk: String,
|
||||||
|
vItemShelvingFk:String,
|
||||||
|
vQuantity:String
|
||||||
|
): Call<Any> {
|
||||||
|
val params: ArrayList<String> = ArrayList()
|
||||||
|
params.add(saleFk)
|
||||||
|
params.add(vOriginalQuantity)
|
||||||
|
params.add(vStateFk)
|
||||||
|
params.add(vIsChecked)
|
||||||
|
params.add(vBuyFk)
|
||||||
|
params.add(vItemShelvingFk) //Tarea #4371 Se añade para transaccionar los dos proced asociados
|
||||||
|
params.add(vQuantity)
|
||||||
|
return restClient!!.saleTracking_mark(
|
||||||
|
"json",
|
||||||
|
"1",
|
||||||
|
usuario,
|
||||||
|
password,
|
||||||
|
"application/json",
|
||||||
|
params
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fun itemPlacementSupplyAiming(
|
fun itemPlacementSupplyAiming(
|
||||||
|
|
|
@ -8,6 +8,7 @@ import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
||||||
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
||||||
import es.verdnatura.presentation.view.feature.collection.listSaleSalix
|
import es.verdnatura.presentation.view.feature.collection.listSaleSalix
|
||||||
import es.verdnatura.presentation.view.feature.collection.saleSalix
|
import es.verdnatura.presentation.view.feature.collection.saleSalix
|
||||||
|
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalix
|
||||||
import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO
|
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.SalixGrupo
|
||||||
import es.verdnatura.presentation.view.feature.login.model.SalixMessageVO
|
import es.verdnatura.presentation.view.feature.login.model.SalixMessageVO
|
||||||
|
@ -89,7 +90,6 @@ interface SalixService {
|
||||||
//https://test-salix.verdnatura.es/api/Departments?filter={"fields": {"id": true, "name": true},"where": {"name": "COMPRAS"}}
|
//https://test-salix.verdnatura.es/api/Departments?filter={"fields": {"id": true, "name": true},"where": {"name": "COMPRAS"}}
|
||||||
// http://test-salix.verdnatura.es/api/Departments?filter={"fields": {"id": true, "name": true},"where": {"hasToMistake": "FALSE"}}
|
// http://test-salix.verdnatura.es/api/Departments?filter={"fields": {"id": true, "name": true},"where": {"hasToMistake": "FALSE"}}
|
||||||
|
|
||||||
|
|
||||||
// @GET("api/Departments?filter={\"fields\": {\"id\": true, \"name\": true},\"where\": {\"hasToMistake\": \"FALSE\"}}")
|
// @GET("api/Departments?filter={\"fields\": {\"id\": true, \"name\": true},\"where\": {\"hasToMistake\": \"FALSE\"}}")
|
||||||
@GET("Departments")
|
@GET("Departments")
|
||||||
fun department_getHasMistake(
|
fun department_getHasMistake(
|
||||||
|
@ -147,4 +147,12 @@ interface SalixService {
|
||||||
):
|
):
|
||||||
Call<String>
|
Call<String>
|
||||||
|
|
||||||
|
@GET("Shelvings")
|
||||||
|
fun Shelvings(
|
||||||
|
@Header("Content-Type") content_type: String,
|
||||||
|
@Header("Authorization") authorization: String,
|
||||||
|
@Query("filter") filter:String
|
||||||
|
|
||||||
|
):
|
||||||
|
Call<List<ShelvingLogSalix>>
|
||||||
}
|
}
|
|
@ -4,6 +4,7 @@ package es.verdnatura.domain
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.Printers
|
import es.verdnatura.presentation.view.feature.ajustes.model.Printers
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||||
|
import es.verdnatura.presentation.view.feature.ajustes.model.Train
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemProposal
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemProposal
|
||||||
|
@ -127,6 +128,16 @@ interface VerdnaturaService {
|
||||||
):
|
):
|
||||||
Call<List<Printers>>
|
Call<List<Printers>>
|
||||||
|
|
||||||
|
@POST("almacennew/train_get")//NO SALIX
|
||||||
|
fun train_get(
|
||||||
|
@Header("aplicacion") aplicacion: String,
|
||||||
|
@Header("version") version: String,
|
||||||
|
@Header("user") user: String,
|
||||||
|
@Header("pass") pass: String,
|
||||||
|
@Header("Content-Type") content_type: String
|
||||||
|
):
|
||||||
|
Call<List<Train>>
|
||||||
|
|
||||||
@POST("almacennew/worker_getPrinter")//NO SALIX
|
@POST("almacennew/worker_getPrinter")//NO SALIX
|
||||||
|
|
||||||
fun worker_getPrinter(
|
fun worker_getPrinter(
|
||||||
|
@ -160,6 +171,28 @@ interface VerdnaturaService {
|
||||||
):
|
):
|
||||||
Call<Unit>
|
Call<Unit>
|
||||||
|
|
||||||
|
@POST("almacennew/operator_updateItemPackingType")//NO SALIX
|
||||||
|
fun operator_updateItemPackingType(
|
||||||
|
@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<Unit>
|
||||||
|
|
||||||
|
@POST("almacennew/operator_updateTrain")//NO SALIX
|
||||||
|
fun operator_updateTrain(
|
||||||
|
@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<Unit>
|
||||||
|
|
||||||
@POST("almacennew/worker_getSector")//NO SALIX
|
@POST("almacennew/worker_getSector")//NO SALIX
|
||||||
fun worker_getSector(
|
fun worker_getSector(
|
||||||
@Header("aplicacion") aplicacion: String,
|
@Header("aplicacion") aplicacion: String,
|
||||||
|
@ -269,6 +302,46 @@ interface VerdnaturaService {
|
||||||
):
|
):
|
||||||
Call<String>
|
Call<String>
|
||||||
|
|
||||||
|
@POST("almacennew/collection_assign")//NO SALIX
|
||||||
|
fun collection_assign(
|
||||||
|
@Header("aplicacion") aplicacion: String,
|
||||||
|
@Header("version") version: String,
|
||||||
|
@Header("user") user: String,
|
||||||
|
@Header("pass") pass: String,
|
||||||
|
@Header("Content-Type") content_type: String
|
||||||
|
):
|
||||||
|
Call<String>
|
||||||
|
|
||||||
|
@POST("almacennew/operator_getItemPackingType")//NO SALIX
|
||||||
|
fun operator_getItemPackingType(
|
||||||
|
@Header("aplicacion") aplicacion: String,
|
||||||
|
@Header("version") version: String,
|
||||||
|
@Header("user") user: String,
|
||||||
|
@Header("pass") pass: String,
|
||||||
|
@Header("Content-Type") content_type: String
|
||||||
|
):
|
||||||
|
Call<String?>
|
||||||
|
|
||||||
|
@POST("almacennew/worker_isF11Allowed")//NO SALIX
|
||||||
|
fun worker_isF11Allowed(
|
||||||
|
@Header("aplicacion") aplicacion: String,
|
||||||
|
@Header("version") version: String,
|
||||||
|
@Header("user") user: String,
|
||||||
|
@Header("pass") pass: String,
|
||||||
|
@Header("Content-Type") content_type: String
|
||||||
|
):
|
||||||
|
Call<Boolean>
|
||||||
|
|
||||||
|
@POST("almacennew/operator_getTrain")//NO SALIX
|
||||||
|
fun operator_getTrain(
|
||||||
|
@Header("aplicacion") aplicacion: String,
|
||||||
|
@Header("version") version: String,
|
||||||
|
@Header("user") user: String,
|
||||||
|
@Header("pass") pass: String,
|
||||||
|
@Header("Content-Type") content_type: String
|
||||||
|
):
|
||||||
|
Call<String?>
|
||||||
|
|
||||||
@POST("almacennew/sectorCollection_new")//NO SALIX
|
@POST("almacennew/sectorCollection_new")//NO SALIX
|
||||||
fun sectorCollection_new(
|
fun sectorCollection_new(
|
||||||
@Header("aplicacion") aplicacion: String,
|
@Header("aplicacion") aplicacion: String,
|
||||||
|
@ -391,16 +464,6 @@ interface VerdnaturaService {
|
||||||
):
|
):
|
||||||
Call<Any>
|
Call<Any>
|
||||||
|
|
||||||
/* @POST("almacennew/saleTracking_update")//REVISADA
|
|
||||||
fun saleTracking_update(
|
|
||||||
@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<Unit>*/
|
|
||||||
|
|
||||||
@POST("almacennew/itemPlacementSupplyAiming")//REVISADA
|
@POST("almacennew/itemPlacementSupplyAiming")//REVISADA
|
||||||
fun itemPlacementSupplyAiming(
|
fun itemPlacementSupplyAiming(
|
||||||
|
@ -424,6 +487,17 @@ interface VerdnaturaService {
|
||||||
):
|
):
|
||||||
Call<Any>
|
Call<Any>
|
||||||
|
|
||||||
|
@POST("almacennew/saleTracking_mark")//REVISADA
|
||||||
|
fun saleTracking_mark(
|
||||||
|
@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<Any>
|
||||||
|
|
||||||
@POST("almacennew/itemShelvingPlacementSupplyAdd")//REVISADA
|
@POST("almacennew/itemShelvingPlacementSupplyAdd")//REVISADA
|
||||||
fun itemShelvingPlacementSupplyAdd(
|
fun itemShelvingPlacementSupplyAdd(
|
||||||
@Header("aplicacion") aplicacion: String,
|
@Header("aplicacion") aplicacion: String,
|
||||||
|
@ -1162,7 +1236,7 @@ interface VerdnaturaService {
|
||||||
):
|
):
|
||||||
Call<Void>
|
Call<Void>
|
||||||
|
|
||||||
@POST("almacennew/cmrExpeditionPallet_add")//REVISADA
|
@POST("almacennew/cmrPallet_add")//REVISADA
|
||||||
fun cmrExpeditionPallet_add(
|
fun cmrExpeditionPallet_add(
|
||||||
@Header("aplicacion") aplicacion: String,
|
@Header("aplicacion") aplicacion: String,
|
||||||
@Header("version") version: String,
|
@Header("version") version: String,
|
||||||
|
|
|
@ -2,14 +2,15 @@ package es.verdnatura.domain
|
||||||
|
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||||
import es.verdnatura.presentation.view.feature.historicoshelving.model.ItemShelvingLog
|
import es.verdnatura.presentation.view.feature.historicoshelving.model.ItemShelvingLog
|
||||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLog
|
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLog
|
||||||
|
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalix
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
|
|
||||||
class itemShelvingLogUSerCase(context: Context) : RestClient(context) {
|
class itemShelvingLogUSerCase(context: Context) : RestClient(context) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fun itemShelvingLog_get(
|
fun itemShelvingLog_get(
|
||||||
usuario: String,
|
usuario: String,
|
||||||
password: String,
|
password: String,
|
||||||
|
@ -44,4 +45,23 @@ class itemShelvingLogUSerCase(context: Context) : RestClient(context) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun Shelvings(
|
||||||
|
token: String,
|
||||||
|
vShelvingFilter: String,
|
||||||
|
): Call<List<ShelvingLogSalix>> {
|
||||||
|
return salixClient!!.Shelvings(
|
||||||
|
content_type = "application/json",
|
||||||
|
authorization = token,
|
||||||
|
filter = vShelvingFilter
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getSectorsSalix(token: String): Call<List<SectorItemVO>> {
|
||||||
|
return salixClient!!.getSectorsSalix(
|
||||||
|
content_type = "application/json",
|
||||||
|
authorization = token
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -59,6 +59,11 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
||||||
protected val REMEMBER = "recordar"
|
protected val REMEMBER = "recordar"
|
||||||
protected val ANDROID_ID = "ANDROID_ID"
|
protected val ANDROID_ID = "ANDROID_ID"
|
||||||
protected val DEVICENAME = "devicename"
|
protected val DEVICENAME = "devicename"
|
||||||
|
protected val TRAINNAME = "trainName"
|
||||||
|
protected val TRAINFK = "trainFk"
|
||||||
|
|
||||||
|
protected val ITEMPACKING = "itemPackingType"
|
||||||
|
protected val ITEMPACKINGFK = "itemPackingTypeFk"
|
||||||
//protected val VOZ = "voz"
|
//protected val VOZ = "voz"
|
||||||
//nuevo campo número carros ajustes y campos para guardar el buyerid y buyernickname
|
//nuevo campo número carros ajustes y campos para guardar el buyerid y buyernickname
|
||||||
protected val BUYER = "buyernickname"
|
protected val BUYER = "buyernickname"
|
||||||
|
@ -539,6 +544,10 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
|
||||||
PRINTERFK->prefs.getInt(name,0).toString()
|
PRINTERFK->prefs.getInt(name,0).toString()
|
||||||
PRINTERNAME->prefs.getString(name,getString(R.string.noprinter)).toString()
|
PRINTERNAME->prefs.getString(name,getString(R.string.noprinter)).toString()
|
||||||
NUMBEROFWAGONS->prefs.getInt(name,1).toString()
|
NUMBEROFWAGONS->prefs.getInt(name,1).toString()
|
||||||
|
TRAINFK->prefs.getString(name,"").toString()
|
||||||
|
TRAINNAME->prefs.getString(name,"").toString()
|
||||||
|
ITEMPACKING->prefs.getString(name,"").toString()
|
||||||
|
ITEMPACKINGFK->prefs.getString(name,"").toString()
|
||||||
|
|
||||||
"base_url"->{
|
"base_url"->{
|
||||||
val preferences = PreferenceManager.getDefaultSharedPreferences(context)
|
val preferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
|
@ -677,7 +686,6 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package es.verdnatura.presentation.common
|
||||||
|
|
||||||
|
import org.json.JSONObject
|
||||||
|
|
||||||
|
data class itemScanned(var scanned: JSONObject) {
|
||||||
|
// var schema: String = scanned!!.get("schema").toString()
|
||||||
|
var table: String = scanned!!.get("table").toString()
|
||||||
|
var field: String = scanned!!.get("field").toString()
|
||||||
|
var value: String = scanned!!.get("value").toString()
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.ajustes.adapter
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.content.res.ResourcesCompat.getColor
|
import androidx.core.content.res.ResourcesCompat.getColor
|
||||||
|
@ -53,6 +54,15 @@ class AjustesAdapter (
|
||||||
R.color.verdnatura_pumpkin_orange
|
R.color.verdnatura_pumpkin_orange
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
}else{
|
||||||
|
binding.itemTitle.setTextColor(
|
||||||
|
ContextCompat.getColor(
|
||||||
|
context!!,
|
||||||
|
R.color.verdnatura_white))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!item.action){
|
||||||
|
binding.itemImage.visibility= View.INVISIBLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.content.ClipboardManager
|
||||||
import android.content.Context.CLIPBOARD_SERVICE
|
import android.content.Context.CLIPBOARD_SERVICE
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.appcompat.widget.TooltipCompat.setTooltipText
|
import androidx.appcompat.widget.TooltipCompat.setTooltipText
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
@ -19,6 +20,8 @@ import es.verdnatura.presentation.view.feature.ajustes.adapter.AjustesAdapter
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO
|
import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.Printers
|
import es.verdnatura.presentation.view.feature.ajustes.model.Printers
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||||
|
import es.verdnatura.presentation.view.feature.ajustes.model.Train
|
||||||
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
|
|
||||||
class AjustesFragment :
|
class AjustesFragment :
|
||||||
|
@ -27,8 +30,11 @@ class AjustesFragment :
|
||||||
private lateinit var customDialog: CustomDialog
|
private lateinit var customDialog: CustomDialog
|
||||||
private var sectorListVO: List<SectorItemVO> = listOf()
|
private var sectorListVO: List<SectorItemVO> = listOf()
|
||||||
private var printersList: List<Printers> = listOf()
|
private var printersList: List<Printers> = listOf()
|
||||||
|
private var trainsList: List<Train> = listOf()
|
||||||
private var prefs: SharedPreferences? = null
|
private var prefs: SharedPreferences? = null
|
||||||
private var ajustesAdapter: AjustesAdapter? = null
|
private var ajustesAdapter: AjustesAdapter? = null
|
||||||
|
private var isWorkerAllowed:Boolean=false
|
||||||
|
private var itemPackingList: List<ItemPackingType> = listOf()
|
||||||
|
|
||||||
//añadido
|
//añadido
|
||||||
private var wagonList: List<String> = listOf()
|
private var wagonList: List<String> = listOf()
|
||||||
|
@ -45,34 +51,17 @@ class AjustesFragment :
|
||||||
prefs = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
prefs = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
|
|
||||||
//Tarea 4351 quitar if y dejar viewModel.operator solamente ( ya se encarga el viewmodel de hacer el initializeDefault y el WAGON POR NUMBEROFWAGONS)
|
|
||||||
|
|
||||||
|
|
||||||
viewModel.operator_getNumberOfWagons(getData(USER), getData(PASSWORD))
|
|
||||||
// }else{
|
|
||||||
/* viewModel.inititializeDefaultAjusts(
|
|
||||||
getData(SECTORDESCRIP),
|
|
||||||
getData(SECTORFK).toInt(),
|
|
||||||
getData(WAREHOUSEFK).toInt(),
|
|
||||||
getData(NUMBEROFWAGONS),
|
|
||||||
getData(TAGSTYPE),
|
|
||||||
getData(PRINTERFK).toInt(),
|
|
||||||
getData(PRINTERNAME),
|
|
||||||
|
|
||||||
|
|
||||||
)*/
|
|
||||||
//}
|
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
|
|
||||||
binding.mainToolbar.toolbarTitle.text = getString(R.string.settings)
|
binding.mainToolbar.toolbarTitle.text = getString(R.string.settings)
|
||||||
// binding.splashProgress.visibility=View.VISIBLE
|
binding.splashProgress.visibility=View.VISIBLE
|
||||||
hideBackButton(binding.mainToolbar)
|
hideBackButton(binding.mainToolbar)
|
||||||
|
viewModel.worker_isF11Allowed(getData(USER), getData(PASSWORD))
|
||||||
|
|
||||||
|
|
||||||
binding.userText.setText(getData(USER))
|
binding.userText.setText(getData(USER))
|
||||||
|
@ -104,6 +93,9 @@ class AjustesFragment :
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
ajustesAdapter = AjustesAdapter(ajustesitem, object : OnAjustesItemClickListener {
|
ajustesAdapter = AjustesAdapter(ajustesitem, object : OnAjustesItemClickListener {
|
||||||
override fun onAjustesItemClickListener(item: AjustesItemVO) {
|
override fun onAjustesItemClickListener(item: AjustesItemVO) {
|
||||||
|
|
||||||
|
if (item.action) {
|
||||||
|
|
||||||
if (item.id == 0) {
|
if (item.id == 0) {
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
// viewModel.getSectors(getData(USER),getData(PASSWORD))
|
// viewModel.getSectors(getData(USER),getData(PASSWORD))
|
||||||
|
@ -144,8 +136,14 @@ class AjustesFragment :
|
||||||
), getData(USERFK)
|
), getData(USERFK)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
}else if (item.id==6){
|
||||||
|
viewModel.train_get(getData(USER), getData(PASSWORD))
|
||||||
|
}else if (item.id==7){
|
||||||
|
viewModel.getItemPackingTypeSalix(getData(TOKEN))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
operatorGetNumberOfWagons.observe(viewLifecycleOwner) {
|
operatorGetNumberOfWagons.observe(viewLifecycleOwner) {
|
||||||
|
@ -153,24 +151,66 @@ class AjustesFragment :
|
||||||
|
|
||||||
if (it.isError) {
|
if (it.isError) {
|
||||||
ma.messageWithSound(it.errorMessage, it.isError, true)
|
ma.messageWithSound(it.errorMessage, it.isError, true)
|
||||||
setSettings()
|
|
||||||
} else {
|
} else {
|
||||||
saveDataInt(NUMBEROFWAGONS, it.response!!)
|
saveDataInt(NUMBEROFWAGONS, it.response!!)
|
||||||
setSettings()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
workerupdateSector.observe(viewLifecycleOwner, {
|
setSettings(isWorkerAllowed)
|
||||||
|
}
|
||||||
|
|
||||||
|
operatorGetTrainResponse.observe(viewLifecycleOwner) {
|
||||||
|
binding.splashProgress.visibility = View.GONE
|
||||||
|
|
||||||
|
if (it.isError) {
|
||||||
|
ma.messageWithSound(it.errorMessage, it.isError, true)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
saveData(TRAINNAME, it.response!!)
|
||||||
|
|
||||||
|
}
|
||||||
|
setSettings(isWorkerAllowed)
|
||||||
|
}
|
||||||
|
|
||||||
|
operatorGetItemPackingType.observe(viewLifecycleOwner) {
|
||||||
|
binding.splashProgress.visibility = View.GONE
|
||||||
|
|
||||||
|
if (it.isError) {
|
||||||
|
ma.messageWithSound(it.errorMessage, it.isError, true)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
saveData(ITEMPACKING, it.response!!)
|
||||||
|
|
||||||
|
}
|
||||||
|
setSettings(isWorkerAllowed)
|
||||||
|
}
|
||||||
|
|
||||||
|
workerAllowedResponse.observe(viewLifecycleOwner) {
|
||||||
|
binding.splashProgress.visibility = View.GONE
|
||||||
|
viewModel.operator_getNumberOfWagons(getData(USER), getData(PASSWORD))
|
||||||
|
viewModel.operator_getTrain(getData(USER), getData(PASSWORD))
|
||||||
|
viewModel.operator_getItemPackingType(getData(USER), getData(PASSWORD))
|
||||||
|
if (it.isError) {
|
||||||
|
ma.messageWithSound(it.errorMessage, it.isError, true)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
isWorkerAllowed=it.response.toBoolean()
|
||||||
|
|
||||||
|
}
|
||||||
|
setSettings(isWorkerAllowed)
|
||||||
|
}
|
||||||
|
|
||||||
|
actionUpdate.observe(viewLifecycleOwner) {
|
||||||
binding.splashProgress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
|
|
||||||
ma.messageWithSound(
|
ma.messageWithSound(
|
||||||
if (it.isError) it.errorMessage else {
|
if (it.isError) it.errorMessage else {
|
||||||
getString(R.string.sectorUpdated)
|
getString(R.string.itemUpdated)
|
||||||
}, it.isError, false
|
}, it.isError, false
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
|
||||||
workerupdatePrinter.observe(viewLifecycleOwner, {
|
workerupdatePrinter.observe(viewLifecycleOwner) {
|
||||||
binding.splashProgress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
|
|
||||||
ma.messageWithSound(
|
ma.messageWithSound(
|
||||||
|
@ -178,7 +218,8 @@ class AjustesFragment :
|
||||||
getString(R.string.printerUpdated)
|
getString(R.string.printerUpdated)
|
||||||
}, it.isError, false
|
}, it.isError, false
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
|
||||||
|
|
||||||
binding.ajustessItems.adapter = ajustesAdapter
|
binding.ajustessItems.adapter = ajustesAdapter
|
||||||
binding.ajustessItems.layoutManager =
|
binding.ajustessItems.layoutManager =
|
||||||
|
@ -215,7 +256,38 @@ class AjustesFragment :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadprintersList.observe(viewLifecycleOwner) { event ->
|
loadItemPackingList.observe(viewLifecycleOwner) { event ->
|
||||||
|
event.getContentIfNotHandled().notNull {
|
||||||
|
binding.splashProgress.visibility = View.INVISIBLE
|
||||||
|
if (it.list.isNotEmpty() && it.list.get(0).isError) {
|
||||||
|
customDialog.setTitle(getString(R.string.error))
|
||||||
|
.setDescription(it.list.get(0).errorMessage)
|
||||||
|
.setOkButton(getString(R.string.Close)) {
|
||||||
|
customDialog.dismiss()
|
||||||
|
}.show()
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (it.list.size > 0) {
|
||||||
|
val listItemsPacking: ArrayList<String> = ArrayList()
|
||||||
|
it.list.forEach {
|
||||||
|
listItemsPacking.add(it.description)
|
||||||
|
}
|
||||||
|
val array = arrayOfNulls<String>(listItemsPacking.size)
|
||||||
|
itemPackingList = it.list
|
||||||
|
showDialog(listItemsPacking.toArray(array))
|
||||||
|
|
||||||
|
} else {
|
||||||
|
customDialog.setTitle(getString(R.string.settingsTitleItemPacking))
|
||||||
|
.setDescription(getString(R.string.NoItemPackingType))
|
||||||
|
.setOkButton(getString(R.string.Close)) {
|
||||||
|
customDialog.dismiss()
|
||||||
|
}.show()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
loadPrintersList.observe(viewLifecycleOwner) { event ->
|
||||||
event.getContentIfNotHandled().notNull {
|
event.getContentIfNotHandled().notNull {
|
||||||
binding.splashProgress.visibility = View.INVISIBLE
|
binding.splashProgress.visibility = View.INVISIBLE
|
||||||
if (it.list.isNotEmpty() && it.list.get(0).isError) {
|
if (it.list.isNotEmpty() && it.list.get(0).isError) {
|
||||||
|
@ -246,13 +318,43 @@ class AjustesFragment :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
loadTrainList.observe(viewLifecycleOwner) { event ->
|
||||||
|
event.getContentIfNotHandled().notNull {
|
||||||
|
binding.splashProgress.visibility = View.INVISIBLE
|
||||||
|
if (it.list.isNotEmpty() && it.list.get(0).isError) {
|
||||||
|
customDialog.setTitle(getString(R.string.error))
|
||||||
|
.setDescription(it.list.get(0).errorMessage)
|
||||||
|
.setOkButton(getString(R.string.Close)) {
|
||||||
|
customDialog.dismiss()
|
||||||
|
}.show()
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (it.list.size > 0) {
|
||||||
|
val listTrain: ArrayList<String> = ArrayList()
|
||||||
|
it.list.forEach {
|
||||||
|
listTrain.add(it.name)
|
||||||
|
}
|
||||||
|
val array = arrayOfNulls<String>(listTrain.size)
|
||||||
|
trainsList = it.list
|
||||||
|
showDialogTrains(listTrain.toArray(array))
|
||||||
|
|
||||||
|
} else {
|
||||||
|
customDialog.setTitle(getString(R.string.printers))
|
||||||
|
.setDescription(getString(R.string.Noprinters))
|
||||||
|
.setOkButton(getString(R.string.Close)) {
|
||||||
|
customDialog.dismiss()
|
||||||
|
}.show()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
super.observeViewModel()
|
super.observeViewModel()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setSettings() {
|
private fun setSettings(actionIsAllowed:Boolean=false) {
|
||||||
|
|
||||||
//Tarea 4351 modificar el WAGON por NUMBEROFWAGONS
|
|
||||||
viewModel.inititializeDefaultAjusts(
|
viewModel.inititializeDefaultAjusts(
|
||||||
getData(SECTORDESCRIP),
|
getData(SECTORDESCRIP),
|
||||||
getData(SECTORFK).toInt(),
|
getData(SECTORFK).toInt(),
|
||||||
|
@ -261,7 +363,9 @@ class AjustesFragment :
|
||||||
getData(TAGSTYPE),
|
getData(TAGSTYPE),
|
||||||
getData(PRINTERFK).toInt(),
|
getData(PRINTERFK).toInt(),
|
||||||
getData(PRINTERNAME),
|
getData(PRINTERNAME),
|
||||||
|
getData(TRAINNAME),
|
||||||
|
getData(ITEMPACKING),
|
||||||
|
actionIsAllowed = actionIsAllowed
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -287,6 +391,8 @@ class AjustesFragment :
|
||||||
it.id.toString()
|
it.id.toString()
|
||||||
)
|
)
|
||||||
ajustesAdapter!!.notifyDataSetChanged()
|
ajustesAdapter!!.notifyDataSetChanged()
|
||||||
|
ajustesAdapter
|
||||||
|
|
||||||
|
|
||||||
return@forEach
|
return@forEach
|
||||||
}
|
}
|
||||||
|
@ -297,6 +403,36 @@ class AjustesFragment :
|
||||||
dialog.show()
|
dialog.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun showDialogTrains(array: Array<String>) {
|
||||||
|
val builder = AlertDialog.Builder(this.context)
|
||||||
|
|
||||||
|
|
||||||
|
builder.setTitle(getString(R.string.selectTrain))
|
||||||
|
builder.setItems(array) { _, which ->
|
||||||
|
val selected = array[which]
|
||||||
|
trainsList.forEach {
|
||||||
|
if (it.name.equals(selected)) {
|
||||||
|
val editor = prefs!!.edit()
|
||||||
|
editor.putString(TRAINNAME, it.name)
|
||||||
|
editor.putInt(TRAINFK, it.id!!)
|
||||||
|
editor.apply()
|
||||||
|
|
||||||
|
viewModel.ajustesitem[3].selected = it.name
|
||||||
|
viewModel.operator_updateTrain(
|
||||||
|
getData(USER),
|
||||||
|
getData(PASSWORD),
|
||||||
|
it.id.toString()
|
||||||
|
)
|
||||||
|
ajustesAdapter!!.notifyDataSetChanged()
|
||||||
|
|
||||||
|
return@forEach
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
val dialog = builder.create()
|
||||||
|
dialog.show()
|
||||||
|
}
|
||||||
private fun showDialogSector(array: Array<String>) {
|
private fun showDialogSector(array: Array<String>) {
|
||||||
val builder = AlertDialog.Builder(this.context)
|
val builder = AlertDialog.Builder(this.context)
|
||||||
|
|
||||||
|
@ -331,34 +467,34 @@ class AjustesFragment :
|
||||||
dialog.show()
|
dialog.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* private fun showDialogVoz(array: Array<String>) {
|
private fun showDialog(array: Array<String>) {
|
||||||
val builder = AlertDialog.Builder(this.context)
|
val builder = AlertDialog.Builder(this.context)
|
||||||
|
|
||||||
|
|
||||||
builder.setTitle(getString(R.string.Seleccionaunsector))
|
builder.setTitle(getString(R.string.settingsTitleItemPacking))
|
||||||
builder.setItems(array) { _, which ->
|
builder.setItems(array) { _, which ->
|
||||||
val selected = array[which]
|
val selected = array[which]
|
||||||
vozList.forEach {
|
itemPackingList.forEach {
|
||||||
if (it.equals(selected)) {
|
if (it.description.equals(selected)) {
|
||||||
val editor = prefs!!.edit()
|
val editor = prefs!!.edit()
|
||||||
editor.putString(VOZ, it)
|
editor.putString(ITEMPACKING, it.description)
|
||||||
editor.apply()
|
editor.apply()
|
||||||
|
viewModel.ajustesitem[4].selected = it.description
|
||||||
|
viewModel.operator_updateItemPackingType(
|
||||||
viewModel.ajustesitem.get(2).selected = it
|
getData(USER),
|
||||||
|
getData(PASSWORD),
|
||||||
|
it.code
|
||||||
|
)
|
||||||
ajustesAdapter!!.notifyDataSetChanged()
|
ajustesAdapter!!.notifyDataSetChanged()
|
||||||
|
|
||||||
return@forEach
|
return@forEach
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val dialog = builder.create()
|
val dialog = builder.create()
|
||||||
dialog.show()
|
dialog.show()
|
||||||
}*/
|
}
|
||||||
|
|
||||||
private fun showDialogCarros(array: Array<String>) {
|
private fun showDialogCarros(array: Array<String>) {
|
||||||
val builder = AlertDialog.Builder(this.context)
|
val builder = AlertDialog.Builder(this.context)
|
||||||
|
|
|
@ -7,6 +7,7 @@ import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
import androidx.lifecycle.Transformations
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.domain.GetAjustesUserCase
|
import es.verdnatura.domain.GetAjustesUserCase
|
||||||
|
import es.verdnatura.domain.GetItemCardUserCase
|
||||||
import es.verdnatura.domain.GetLoginUserCase
|
import es.verdnatura.domain.GetLoginUserCase
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
|
@ -15,10 +16,11 @@ import es.verdnatura.presentation.common.Event
|
||||||
import es.verdnatura.presentation.common.ResponseItemNumber
|
import es.verdnatura.presentation.common.ResponseItemNumber
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.*
|
import es.verdnatura.presentation.view.feature.ajustes.model.*
|
||||||
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
||||||
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingTypeList
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
import timber.log.Timber.d
|
|
||||||
|
|
||||||
|
|
||||||
class AjustesViewModel(context: Context) : BaseViewModel() {
|
class AjustesViewModel(context: Context) : BaseViewModel() {
|
||||||
|
@ -27,6 +29,7 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
||||||
|
|
||||||
private val getAjustesUserCase: GetAjustesUserCase = GetAjustesUserCase(context)
|
private val getAjustesUserCase: GetAjustesUserCase = GetAjustesUserCase(context)
|
||||||
private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase(context)
|
private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase(context)
|
||||||
|
private val getItemCardUserCase: GetItemCardUserCase = GetItemCardUserCase(context)
|
||||||
|
|
||||||
val version: String = "5.0.0"
|
val version: String = "5.0.0"
|
||||||
|
|
||||||
|
@ -38,9 +41,9 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
||||||
val sectorList: LiveData<SectorListVO>
|
val sectorList: LiveData<SectorListVO>
|
||||||
get() = _sectorList
|
get() = _sectorList
|
||||||
|
|
||||||
private val _workerupdateSector by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _actionUpdate by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
val workerupdateSector: LiveData<ResponseItemVO>
|
val actionUpdate: LiveData<ResponseItemVO>
|
||||||
get() = _workerupdateSector
|
get() = _actionUpdate
|
||||||
|
|
||||||
private val _workerupdatePrinter by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _workerupdatePrinter by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
val workerupdatePrinter: LiveData<ResponseItemVO>
|
val workerupdatePrinter: LiveData<ResponseItemVO>
|
||||||
|
@ -48,17 +51,36 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
||||||
|
|
||||||
private val _printerList by lazy { MutableLiveData<PrintersList>() }
|
private val _printerList by lazy { MutableLiveData<PrintersList>() }
|
||||||
val printerList: LiveData<PrintersList>
|
val printerList: LiveData<PrintersList>
|
||||||
get
|
get() = _printerList
|
||||||
() = _printerList
|
|
||||||
|
|
||||||
private val _operatorGetNumberOfWagons by lazy { MutableLiveData<ResponseItemNumber>() }
|
private val _operatorGetNumberOfWagons by lazy { MutableLiveData<ResponseItemNumber>() }
|
||||||
val operatorGetNumberOfWagons: LiveData<ResponseItemNumber>
|
val operatorGetNumberOfWagons: LiveData<ResponseItemNumber>
|
||||||
get() = _operatorGetNumberOfWagons
|
get() = _operatorGetNumberOfWagons
|
||||||
|
|
||||||
|
private val _operatorGetTrainResponse by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
|
val operatorGetTrainResponse: LiveData<ResponseItemVO>
|
||||||
|
get() = _operatorGetTrainResponse
|
||||||
|
|
||||||
|
private val _operatorGetItemPackingType by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
|
val operatorGetItemPackingType: LiveData<ResponseItemVO>
|
||||||
|
get() = _operatorGetItemPackingType
|
||||||
|
|
||||||
|
private val _workerAllowedResponse by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
|
val workerAllowedResponse: LiveData<ResponseItemVO>
|
||||||
|
get() = _workerAllowedResponse
|
||||||
|
|
||||||
|
private val _itemspackinglist by lazy { MutableLiveData<ItemPackingTypeList>() }
|
||||||
|
val itemspackinglist: LiveData<ItemPackingTypeList>
|
||||||
|
get() = _itemspackinglist
|
||||||
|
|
||||||
|
private val _trainList by lazy { MutableLiveData<TrainList>() }
|
||||||
|
val trainList: LiveData<TrainList>
|
||||||
|
get() = _trainList
|
||||||
|
|
||||||
val loadSectorList = Transformations.map(_sectorList) { Event(it) }
|
val loadSectorList = Transformations.map(_sectorList) { Event(it) }
|
||||||
val loadprintersList = Transformations.map(_printerList) { Event(it) }
|
val loadPrintersList = Transformations.map(_printerList) { Event(it) }
|
||||||
|
val loadItemPackingList = Transformations.map(_itemspackinglist) { Event(it) }
|
||||||
|
val loadTrainList = Transformations.map(_trainList) { Event(it) }
|
||||||
|
|
||||||
fun inititializeDefaultAjusts(
|
fun inititializeDefaultAjusts(
|
||||||
sectorDescrip: String,
|
sectorDescrip: String,
|
||||||
|
@ -67,8 +89,12 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
||||||
carroDescrip: String,
|
carroDescrip: String,
|
||||||
TypeTags: String,
|
TypeTags: String,
|
||||||
printerFk: Int,
|
printerFk: Int,
|
||||||
printerSelected: String
|
printerSelected: String,
|
||||||
|
train: String?,
|
||||||
|
itemPackingType: String?,
|
||||||
|
actionIsAllowed: Boolean
|
||||||
) {
|
) {
|
||||||
|
_ajustesitem.clear()
|
||||||
_ajustesitem.add(
|
_ajustesitem.add(
|
||||||
AjustesItemVO(
|
AjustesItemVO(
|
||||||
0,
|
0,
|
||||||
|
@ -77,7 +103,8 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
||||||
sectorFk,
|
sectorFk,
|
||||||
warehouseFk,
|
warehouseFk,
|
||||||
0,
|
0,
|
||||||
printerSelected
|
printerSelected,
|
||||||
|
true
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -89,7 +116,8 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
||||||
carroDescrip,
|
carroDescrip,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0, contextApp.getString(R.string.printerWithout)
|
0, contextApp.getString(R.string.printerWithout),
|
||||||
|
false
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
_ajustesitem.add(
|
_ajustesitem.add(
|
||||||
|
@ -99,10 +127,34 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
||||||
printerSelected,
|
printerSelected,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
printerFk, printerSelected
|
printerFk,
|
||||||
|
printerSelected,
|
||||||
|
true
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
_ajustesitem.add(
|
_ajustesitem.add(
|
||||||
|
AjustesItemVO(
|
||||||
|
6,
|
||||||
|
contextApp.getString(R.string.settingsTitleTrain),
|
||||||
|
train,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
action=actionIsAllowed
|
||||||
|
)
|
||||||
|
)
|
||||||
|
_ajustesitem.add(
|
||||||
|
AjustesItemVO(
|
||||||
|
7,
|
||||||
|
contextApp.getString(R.string.settingsTitleItemPacking),
|
||||||
|
itemPackingType,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
action=actionIsAllowed
|
||||||
|
)
|
||||||
|
)
|
||||||
|
/* _ajustesitem.add(
|
||||||
AjustesItemVO(
|
AjustesItemVO(
|
||||||
3,
|
3,
|
||||||
contextApp.getString(R.string.labelType),
|
contextApp.getString(R.string.labelType),
|
||||||
|
@ -111,7 +163,7 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
||||||
0,
|
0,
|
||||||
0, contextApp.getString(R.string.printerWithout)
|
0, contextApp.getString(R.string.printerWithout)
|
||||||
)
|
)
|
||||||
)
|
)*/
|
||||||
_ajustesitem.add(
|
_ajustesitem.add(
|
||||||
AjustesItemVO(
|
AjustesItemVO(
|
||||||
4,
|
4,
|
||||||
|
@ -119,7 +171,8 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
||||||
"",
|
"",
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0, contextApp.getString(R.string.printerWithout)
|
0, contextApp.getString(R.string.printerWithout),
|
||||||
|
true
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
_ajustesitem.add(
|
_ajustesitem.add(
|
||||||
|
@ -129,7 +182,8 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
||||||
"",
|
"",
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0, contextApp.getString(R.string.printerWithout)
|
0, contextApp.getString(R.string.printerWithout),
|
||||||
|
true
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -168,6 +222,45 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
||||||
})
|
})
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
fun getItemPackingTypeSalix(token: String) {
|
||||||
|
getItemCardUserCase.getItemPackingTypeSalix(token).enqueue(object :
|
||||||
|
Callback<List<ItemPackingType>> {
|
||||||
|
override fun onFailure(call: Call<List<ItemPackingType>>, t: Throwable) {
|
||||||
|
val listError: ArrayList<ItemPackingType> = ArrayList()
|
||||||
|
listError.add(
|
||||||
|
ItemPackingType(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
_itemspackinglist.value = ItemPackingTypeList(listError)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResponse(
|
||||||
|
call: Call<List<ItemPackingType>>,
|
||||||
|
response: Response<List<ItemPackingType>>
|
||||||
|
) {
|
||||||
|
if (response.body() != null) {
|
||||||
|
_itemspackinglist.value = response.body()?.let { ItemPackingTypeList(it) }
|
||||||
|
|
||||||
|
} else {
|
||||||
|
val listError: ArrayList<ItemPackingType> = ArrayList()
|
||||||
|
listError.add(
|
||||||
|
ItemPackingType(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
nameofFunction(this),
|
||||||
|
response.message()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
_itemspackinglist.value = ItemPackingTypeList(listError)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fun getSectorsSalix(token: String) {
|
fun getSectorsSalix(token: String) {
|
||||||
getAjustesUserCase.getSectorsSalix(token).enqueue(object : Callback<List<SectorItemVO>> {
|
getAjustesUserCase.getSectorsSalix(token).enqueue(object : Callback<List<SectorItemVO>> {
|
||||||
override fun onFailure(call: Call<List<SectorItemVO>>, t: Throwable) {
|
override fun onFailure(call: Call<List<SectorItemVO>>, t: Throwable) {
|
||||||
|
@ -231,13 +324,45 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun train_get(user: String, password: String) {
|
||||||
|
getAjustesUserCase.train_get(user, password).enqueue(object : Callback<List<Train>> {
|
||||||
|
override fun onFailure(call: Call<List<Train>>, t: Throwable) {
|
||||||
|
val listError: ArrayList<Train> = ArrayList()
|
||||||
|
listError.add(Train(0, "", true, t.message!!))
|
||||||
|
_trainList.value = TrainList(listError)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResponse(
|
||||||
|
call: Call<List<Train>>,
|
||||||
|
response: Response<List<Train>>
|
||||||
|
) {
|
||||||
|
|
||||||
|
|
||||||
|
if (response.body() != null) {
|
||||||
|
_trainList.value = response.body()?.let { TrainList(it) }
|
||||||
|
} else {
|
||||||
|
val listError: ArrayList<Train> = ArrayList()
|
||||||
|
listError.add(
|
||||||
|
Train(
|
||||||
|
0, "", true,
|
||||||
|
getMessageFromAllResponse(nameofFunction(this), response.message())
|
||||||
|
)
|
||||||
|
)
|
||||||
|
_trainList.value = TrainList(listError)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fun worker_updateSector(user: String, password: String, sectorFk: String) {
|
fun worker_updateSector(user: String, password: String, sectorFk: String) {
|
||||||
|
|
||||||
getAjustesUserCase.worker_updateSector(user, password, sectorFk)
|
getAjustesUserCase.worker_updateSector(user, password, sectorFk)
|
||||||
.enqueue(object : Callback<Unit> {
|
.enqueue(object : Callback<Unit> {
|
||||||
override fun onFailure(call: Call<Unit>, t: Throwable) {
|
override fun onFailure(call: Call<Unit>, t: Throwable) {
|
||||||
|
|
||||||
_workerupdateSector.value = ResponseItemVO(
|
_actionUpdate.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
)
|
)
|
||||||
|
@ -249,7 +374,7 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (!response.isSuccessful) {
|
if (!response.isSuccessful) {
|
||||||
_workerupdateSector.value = ResponseItemVO(
|
_actionUpdate.value = ResponseItemVO(
|
||||||
isError = true,
|
isError = true,
|
||||||
errorMessage = getMessageFromAllResponse(
|
errorMessage = getMessageFromAllResponse(
|
||||||
nameofFunction(this),
|
nameofFunction(this),
|
||||||
|
@ -257,7 +382,47 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
_workerupdateSector.value = ResponseItemVO(
|
_actionUpdate.value = ResponseItemVO(
|
||||||
|
response = response.message(),
|
||||||
|
isError = false,
|
||||||
|
errorMessage = ""
|
||||||
|
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun operator_updateItemPackingType(user: String, password: String, sectorFk: String) {
|
||||||
|
|
||||||
|
getAjustesUserCase.operator_updateItemPackingType(user, password, sectorFk)
|
||||||
|
.enqueue(object : Callback<Unit> {
|
||||||
|
override fun onFailure(call: Call<Unit>, t: Throwable) {
|
||||||
|
|
||||||
|
_actionUpdate.value = ResponseItemVO(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResponse(
|
||||||
|
call: Call<Unit>,
|
||||||
|
response: Response<Unit>
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (!response.isSuccessful) {
|
||||||
|
_actionUpdate.value = ResponseItemVO(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
nameofFunction(this),
|
||||||
|
response.message()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
_actionUpdate.value = ResponseItemVO(
|
||||||
response = response.message(),
|
response = response.message(),
|
||||||
isError = false,
|
isError = false,
|
||||||
errorMessage = ""
|
errorMessage = ""
|
||||||
|
@ -311,6 +476,117 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun operator_getTrain(user: String, password: String) {
|
||||||
|
|
||||||
|
getAjustesUserCase.operator_getTrain(user, password)
|
||||||
|
.enqueue(object : Callback<String?> {
|
||||||
|
override fun onFailure(call: Call<String?>, t: Throwable) {
|
||||||
|
|
||||||
|
_operatorGetTrainResponse.value = ResponseItemVO(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResponse(
|
||||||
|
call: Call<String?>,
|
||||||
|
response: Response<String?>
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (!response.isSuccessful) {
|
||||||
|
_operatorGetTrainResponse.value = ResponseItemVO(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
nameofFunction(this),
|
||||||
|
response.message()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
_operatorGetTrainResponse.value =
|
||||||
|
ResponseItemVO(response.body().toString(), false)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun operator_getItemPackingType(user: String, password: String) {
|
||||||
|
|
||||||
|
getAjustesUserCase.operator_getItemPackingType(user, password)
|
||||||
|
.enqueue(object : Callback<String?> {
|
||||||
|
override fun onFailure(call: Call<String?>, t: Throwable) {
|
||||||
|
|
||||||
|
_operatorGetItemPackingType.value = ResponseItemVO(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResponse(
|
||||||
|
call: Call<String?>,
|
||||||
|
response: Response<String?>
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (!response.isSuccessful) {
|
||||||
|
_operatorGetItemPackingType.value = ResponseItemVO(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
nameofFunction(this),
|
||||||
|
response.message()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
_operatorGetItemPackingType.value =
|
||||||
|
ResponseItemVO(response.body().toString(), false)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun worker_isF11Allowed(user: String, password: String) {
|
||||||
|
|
||||||
|
getAjustesUserCase.worker_isF11Allowed(user, password)
|
||||||
|
.enqueue(object : Callback<Boolean> {
|
||||||
|
override fun onFailure(call: Call<Boolean>, t: Throwable) {
|
||||||
|
|
||||||
|
_workerAllowedResponse.value = ResponseItemVO(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResponse(
|
||||||
|
call: Call<Boolean>,
|
||||||
|
response: Response<Boolean>
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (!response.isSuccessful) {
|
||||||
|
_workerAllowedResponse.value = ResponseItemVO(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
nameofFunction(this),
|
||||||
|
response.message()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
_workerAllowedResponse.value =
|
||||||
|
ResponseItemVO(response.body().toString(), false)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fun worker_updatePrinter(user: String, password: String, printerFk: String) {
|
fun worker_updatePrinter(user: String, password: String, printerFk: String) {
|
||||||
//d("La impresora marcada " + printerFk)
|
//d("La impresora marcada " + printerFk)
|
||||||
getAjustesUserCase.worker_updatePrinter(user, password, printerFk)
|
getAjustesUserCase.worker_updatePrinter(user, password, printerFk)
|
||||||
|
@ -340,7 +616,8 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
||||||
_workerupdatePrinter.value = ResponseItemVO(
|
_workerupdatePrinter.value = ResponseItemVO(
|
||||||
response = response.message(),
|
response = response.message(),
|
||||||
isError = false,
|
isError = false,
|
||||||
errorMessage = "")
|
errorMessage = ""
|
||||||
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,4 +625,44 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun operator_updateTrain(user: String, password: String, trainFk: String) {
|
||||||
|
|
||||||
|
getAjustesUserCase.operator_updateTrain(user, password, trainFk)
|
||||||
|
.enqueue(object : Callback<Unit> {
|
||||||
|
override fun onFailure(call: Call<Unit>, t: Throwable) {
|
||||||
|
|
||||||
|
_actionUpdate.value = ResponseItemVO(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResponse(
|
||||||
|
call: Call<Unit>,
|
||||||
|
response: Response<Unit>
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (!response.isSuccessful) {
|
||||||
|
_actionUpdate.value = ResponseItemVO(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
nameofFunction(this),
|
||||||
|
response.message()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
_actionUpdate.value = ResponseItemVO(
|
||||||
|
response = response.message(),
|
||||||
|
isError = false,
|
||||||
|
errorMessage = ""
|
||||||
|
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
package es.verdnatura.presentation.view.feature.ajustes.model
|
package es.verdnatura.presentation.view.feature.ajustes.model
|
||||||
|
|
||||||
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
||||||
|
|
||||||
class AjustesItemVO (
|
class AjustesItemVO (
|
||||||
var id: Int,
|
var id: Int,
|
||||||
var title: String = "",
|
var title: String = "",
|
||||||
var selected: String = "",
|
var selected: String? = "",
|
||||||
var sectorFk : Int?,
|
var sectorFk : Int?,
|
||||||
var warehouse: Int?,
|
var warehouse: Int?,
|
||||||
var printerFk:Int?,
|
var printerFk:Int?,
|
||||||
var printerSelected:String=""
|
var printerSelected:String="",
|
||||||
|
var action:Boolean
|
||||||
)
|
)
|
||||||
|
|
||||||
class SectorItemVO (
|
class SectorItemVO (
|
||||||
|
@ -36,3 +39,14 @@ class Printers(
|
||||||
class WorkerPrintersList(
|
class WorkerPrintersList(
|
||||||
var list:List<Printers> = listOf()
|
var list:List<Printers> = listOf()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class Train(
|
||||||
|
var id: Int?=null,
|
||||||
|
var name: String="",
|
||||||
|
val isError : Boolean = false,
|
||||||
|
var errorMessage : String = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
class TrainList (
|
||||||
|
var list: List<Train> = listOf()
|
||||||
|
)
|
|
@ -11,6 +11,7 @@ import android.widget.ImageView
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.google.gson.Gson
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentItemCardBinding
|
import es.verdnatura.databinding.FragmentItemCardBinding
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
|
@ -131,9 +132,11 @@ class ItemCardFragment(
|
||||||
//getItemCard(itemFk)
|
//getItemCard(itemFk)
|
||||||
|
|
||||||
// ma.openFragmentWeb(itemInfoG!!.id)
|
// ma.openFragmentWeb(itemInfoG!!.id)
|
||||||
|
var itemId=itemInfoG!!.id
|
||||||
|
var entryPoint = Gson().toJson(mutableMapOf("entryPoint" to itemId, "web" to "https://salix.verdnatura.es/#!/item/$itemId/summary"))
|
||||||
ma.onPasillerosItemClickListener(
|
ma.onPasillerosItemClickListener(
|
||||||
PasillerosItemVO(title = getString(R.string.titleWebViewer),
|
PasillerosItemVO(title = getString(R.string.titleWebViewer),
|
||||||
), entryPoint = itemInfoG!!.id)
|
), entryPoint = entryPoint)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ class BufferLoadFragment(
|
||||||
// sergio: viene de la bbdd así
|
// sergio: viene de la bbdd así
|
||||||
if (it.response.equals(getString(R.string.registerAdded))){
|
if (it.response.equals(getString(R.string.registerAdded))){
|
||||||
|
|
||||||
ma.messageWithSound(it.response,false,true)
|
it.response?.let { it1 -> ma.messageWithSound(it1,false,true) }
|
||||||
}else{
|
}else{
|
||||||
mperror?.start()
|
mperror?.start()
|
||||||
it.response.toast(requireContext())
|
it.response.toast(requireContext())
|
||||||
|
|
|
@ -110,7 +110,9 @@ class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(Buyer
|
||||||
sectorFk = 0,
|
sectorFk = 0,
|
||||||
warehouse = 0,
|
warehouse = 0,
|
||||||
printerFk=0,
|
printerFk=0,
|
||||||
printerSelected ="")
|
printerSelected ="",
|
||||||
|
action=false
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}catch (e:Exception){}
|
}catch (e:Exception){}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import android.net.Uri
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.speech.SpeechRecognizer
|
import android.speech.SpeechRecognizer
|
||||||
import android.util.Log
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.View.GONE
|
import android.view.View.GONE
|
||||||
import android.view.View.VISIBLE
|
import android.view.View.VISIBLE
|
||||||
|
@ -17,6 +16,7 @@ import android.view.inputmethod.EditorInfo
|
||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
import androidx.core.view.isVisible
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
@ -101,6 +101,8 @@ class CollectionFragment(
|
||||||
private var originalItemScan: String = ""
|
private var originalItemScan: String = ""
|
||||||
private var workerFkFromTicket = ""
|
private var workerFkFromTicket = ""
|
||||||
|
|
||||||
|
private var itemShelvingTracking_mark:String=""
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(collection: CollectionVO, type: String) =
|
fun newInstance(collection: CollectionVO, type: String) =
|
||||||
CollectionFragment(collection, type)
|
CollectionFragment(collection, type)
|
||||||
|
@ -764,6 +766,7 @@ class CollectionFragment(
|
||||||
})
|
})
|
||||||
|
|
||||||
responseSaleReplace.observe(viewLifecycleOwner, Observer {
|
responseSaleReplace.observe(viewLifecycleOwner, Observer {
|
||||||
|
binding.splashProgress.visibility=GONE
|
||||||
|
|
||||||
if (it.isError) {
|
if (it.isError) {
|
||||||
|
|
||||||
|
@ -775,15 +778,44 @@ class CollectionFragment(
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* viewModel.saleTrackingDel(
|
|
||||||
getData(USER),
|
saleAdapter!!.notifyDataSetChanged()
|
||||||
getData(PASSWORD),
|
setListPosition(storedPosition, false)
|
||||||
saleFk = sales[positionUnmarked].saleFk
|
|
||||||
)*/
|
|
||||||
|
|
||||||
goBack = false
|
goBack = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
////Tarea #4371
|
||||||
|
responseSaleTracking_mark.observe(viewLifecycleOwner, Observer {
|
||||||
|
binding.splashProgress.visibility = GONE
|
||||||
|
if (it.isError) {
|
||||||
|
|
||||||
|
if (!goBack) {
|
||||||
|
|
||||||
|
ma.messageWithSound(it.errorMessage, it.isError, true)
|
||||||
|
|
||||||
|
binding.splashProgress.visibility=VISIBLE
|
||||||
|
|
||||||
|
viewModel.collectionTicketGet(
|
||||||
|
getData(USER),
|
||||||
|
getData(PASSWORD),
|
||||||
|
collection.collectionFk,
|
||||||
|
getData(SECTORFK),
|
||||||
|
type
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// pintar línea
|
||||||
|
saleAdapter!!.notifyDataSetChanged()
|
||||||
|
setListPosition(storedPosition, false)
|
||||||
|
|
||||||
|
goBack = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
responseItemShelvingSaleSupplyAdd.observe(viewLifecycleOwner, Observer {
|
responseItemShelvingSaleSupplyAdd.observe(viewLifecycleOwner, Observer {
|
||||||
|
|
||||||
if (it.isError) {
|
if (it.isError) {
|
||||||
|
@ -1303,7 +1335,7 @@ class CollectionFragment(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Tarea #4371
|
||||||
private fun markLine(position: Int, newType: String) {
|
private fun markLine(position: Int, newType: String) {
|
||||||
state = 0
|
state = 0
|
||||||
//////Log.i("VERDNATURA:","Marcamos linea y enviamos saleTracking")
|
//////Log.i("VERDNATURA:","Marcamos linea y enviamos saleTracking")
|
||||||
|
@ -1319,25 +1351,18 @@ class CollectionFragment(
|
||||||
if (type == PRECHECKER) {
|
if (type == PRECHECKER) {
|
||||||
sales[position].isPreControlled =
|
sales[position].isPreControlled =
|
||||||
if (sales[position].isPreControlled == "1") "0" else "1"
|
if (sales[position].isPreControlled == "1") "0" else "1"
|
||||||
/* sales[position].isControlled =
|
|
||||||
//if (sales[position].isControlled == "2") "0" else "2" //sergio: para diferenciar precontrol en previa
|
|
||||||
if (sales[position].isControlled == "1") "0" else "1"//sergio: para diferenciar precontrol en previa*/
|
|
||||||
}
|
}
|
||||||
|
//Tarea #4371 se quita y se deja en el response de viewmodel saleTracking_mark
|
||||||
|
//saleAdapter!!.notifyDataSetChanged()
|
||||||
|
//setListPosition(position, false)
|
||||||
|
|
||||||
saleAdapter!!.notifyDataSetChanged()
|
if (type==SACADOR){
|
||||||
setListPosition(position, false)
|
saleTracking_mark(position, newType)
|
||||||
|
//saleTrackingReplace(position,newType)
|
||||||
/* if (type != PRECHECKER) {
|
}else{
|
||||||
saleTrackingReplace(position,newType)
|
saleTrackingReplace(position,newType)
|
||||||
isMarking = true
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
// sergio
|
|
||||||
/* if (type == PRECHECKER) {
|
|
||||||
saleTrackingReplace(position, newType)
|
|
||||||
}*/
|
|
||||||
|
|
||||||
saleTrackingReplace(position, newType)
|
|
||||||
isMarking = true
|
isMarking = true
|
||||||
setTotalLines()
|
setTotalLines()
|
||||||
}
|
}
|
||||||
|
@ -1368,6 +1393,8 @@ class CollectionFragment(
|
||||||
|
|
||||||
private fun saleTrackingReplace(position: Int, type: String) {
|
private fun saleTrackingReplace(position: Int, type: String) {
|
||||||
|
|
||||||
|
//Tarea #4371 se quita para ver si funciona correctamente
|
||||||
|
binding.splashProgress.visibility=VISIBLE
|
||||||
viewModel.saleTrackingReplace(
|
viewModel.saleTrackingReplace(
|
||||||
getData(USER),
|
getData(USER),
|
||||||
getData(PASSWORD),
|
getData(PASSWORD),
|
||||||
|
@ -1381,6 +1408,28 @@ class CollectionFragment(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Tarea #4371 se quita para ver si funciona correctamente
|
||||||
|
private fun saleTracking_mark(position: Int, type: String) {
|
||||||
|
|
||||||
|
binding.splashProgress.visibility= VISIBLE
|
||||||
|
|
||||||
|
viewModel.saleTracking_mark(
|
||||||
|
getData(USER),
|
||||||
|
getData(PASSWORD),
|
||||||
|
saleFk = sales[position].saleFk,
|
||||||
|
vIsChecked = if (type == SACADOR) sales[position].isPrepared else if (type == CONTROLADOR) sales[position].isControlled else if (type == "PRECHECKER") sales[position].isPreControlled else "1",
|
||||||
|
vOriginalQuantity = sales[position].pickedQuantity,
|
||||||
|
vStateFk = if (type == CONTROLADOR) "CHECKED" else if (type == "PRECHECKER") "PREVIOUS_CONTROL" else type,//type.toString(),
|
||||||
|
vBuyFk = originalItemScan,
|
||||||
|
vItemShelvingFk = itemShelvingTracking_mark,
|
||||||
|
vQuantity=customDialogList.getValue()
|
||||||
|
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
private fun unMarkLine(position: Int, newType: String) {
|
private fun unMarkLine(position: Int, newType: String) {
|
||||||
state = 0
|
state = 0
|
||||||
if (sales[position].isPrepared == "1") {
|
if (sales[position].isPrepared == "1") {
|
||||||
|
@ -1685,6 +1734,7 @@ class CollectionFragment(
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Tarea #4371
|
||||||
private fun onQuantityOfShelvingSelected(itemShelvingFk: String, quantity: String = "0") {
|
private fun onQuantityOfShelvingSelected(itemShelvingFk: String, quantity: String = "0") {
|
||||||
//1 - MODIFICAR CANTIDAD DEL CARRO
|
//1 - MODIFICAR CANTIDAD DEL CARRO
|
||||||
try {
|
try {
|
||||||
|
@ -1702,15 +1752,15 @@ class CollectionFragment(
|
||||||
sales[storedPosition].placements[storedShelvingPosition].visible =
|
sales[storedPosition].placements[storedShelvingPosition].visible =
|
||||||
"(" + (shelvingVisible.toInt() - quantity.toInt()).toString() + ")"
|
"(" + (shelvingVisible.toInt() - quantity.toInt()).toString() + ")"
|
||||||
}
|
}
|
||||||
|
//Tarea #4371 se quita para ver si funciona correctamente
|
||||||
viewModel.itemShelvingSaleSupplyAdd(
|
/*viewModel.itemShelvingSaleSupplyAdd(
|
||||||
getData(USER),
|
getData(USER),
|
||||||
getData(PASSWORD),
|
getData(PASSWORD),
|
||||||
itemShelvingFk = itemShelvingFk,
|
itemShelvingFk = itemShelvingFk,
|
||||||
saleFk = sales[storedPosition].saleFk,
|
saleFk = sales[storedPosition].saleFk,
|
||||||
quantity = if (quantity != "0") quantity else customDialogList.getValue()
|
quantity = if (quantity != "0") quantity else customDialogList.getValue()
|
||||||
|
|
||||||
)
|
)*/
|
||||||
|
|
||||||
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
@ -1731,6 +1781,10 @@ class CollectionFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
//3- MARCAR LINEA
|
//3- MARCAR LINEA
|
||||||
|
|
||||||
|
//Tarea #4371
|
||||||
|
itemShelvingTracking_mark = itemShelvingFk
|
||||||
|
|
||||||
if (sales[storedPosition].pickedQuantity != sales[storedPosition].quantity) {
|
if (sales[storedPosition].pickedQuantity != sales[storedPosition].quantity) {
|
||||||
sales[storedPosition].isPrepared = "1"
|
sales[storedPosition].isPrepared = "1"
|
||||||
markLine(storedPosition, OK)
|
markLine(storedPosition, OK)
|
||||||
|
|
|
@ -56,6 +56,9 @@ class CollectionViewModel(context: Context) : BaseViewModel() {
|
||||||
val responseSaleReplace: LiveData<ResponseItemVO>
|
val responseSaleReplace: LiveData<ResponseItemVO>
|
||||||
get() = _responseSaleReplace
|
get() = _responseSaleReplace
|
||||||
|
|
||||||
|
private val _responseSaleTracking_mark by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
|
val responseSaleTracking_mark: LiveData<ResponseItemVO>
|
||||||
|
get() = _responseSaleTracking_mark
|
||||||
|
|
||||||
private val _responseParking by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _responseParking by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
val responseParking: LiveData<ResponseItemVO>
|
val responseParking: LiveData<ResponseItemVO>
|
||||||
|
@ -219,6 +222,51 @@ class CollectionViewModel(context: Context) : BaseViewModel() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
fun saleTracking_mark(
|
||||||
|
usuario: String,
|
||||||
|
password: String,
|
||||||
|
saleFk: String,
|
||||||
|
vOriginalQuantity: String,
|
||||||
|
vStateFk: String,
|
||||||
|
vIsChecked: String,
|
||||||
|
vBuyFk: String,
|
||||||
|
vItemShelvingFk:String,
|
||||||
|
vQuantity:String
|
||||||
|
) {
|
||||||
|
getSacadorControladorUserCase.saleTracking_mark(
|
||||||
|
usuario,
|
||||||
|
password,
|
||||||
|
saleFk,
|
||||||
|
vOriginalQuantity,
|
||||||
|
vStateFk,
|
||||||
|
vIsChecked,
|
||||||
|
vBuyFk,
|
||||||
|
vItemShelvingFk,
|
||||||
|
vQuantity
|
||||||
|
).enqueue(object : Callback<Any> {
|
||||||
|
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||||
|
_responseSaleTracking_mark.value = ResponseItemVO(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||||
|
if (!response.isSuccessful) {
|
||||||
|
_responseSaleTracking_mark.value = ResponseItemVO(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
nameofFunction(this),
|
||||||
|
response.message()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
_responseSaleTracking_mark.value = ResponseItemVO(isError = false, response = "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fun itemPlacementSupplyAiming(
|
fun itemPlacementSupplyAiming(
|
||||||
usuario: String,
|
usuario: String,
|
||||||
|
@ -306,6 +354,7 @@ class CollectionViewModel(context: Context) : BaseViewModel() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun collectionStickerPrint(
|
fun collectionStickerPrint(
|
||||||
usuario: String,
|
usuario: String,
|
||||||
password: String,
|
password: String,
|
||||||
|
|
|
@ -15,6 +15,7 @@ fun CollectionVO.map(context: Context): CollectionVO {
|
||||||
ticket.sales.forEach {
|
ticket.sales.forEach {
|
||||||
it.ticketFk = ticket.ticketFk
|
it.ticketFk = ticket.ticketFk
|
||||||
it.level = ticket.level
|
it.level = ticket.level
|
||||||
|
it.rgb = it.rgb
|
||||||
it.salePersonFk = ticket.salesPersonFk
|
it.salePersonFk = ticket.salesPersonFk
|
||||||
it.agencyName = ticket.agencyName
|
it.agencyName = ticket.agencyName
|
||||||
it.isNew = it.isAdded == "1"
|
it.isNew = it.isAdded == "1"
|
||||||
|
@ -66,6 +67,8 @@ fun CollectionVO.map(context: Context): CollectionVO {
|
||||||
it.placements = listOf()
|
it.placements = listOf()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.graphics.drawable.Drawable
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.print.PrintAttributes
|
import android.print.PrintAttributes
|
||||||
import android.print.PrintManager
|
import android.print.PrintManager
|
||||||
|
import android.util.Log
|
||||||
import android.webkit.WebChromeClient
|
import android.webkit.WebChromeClient
|
||||||
import android.webkit.WebView
|
import android.webkit.WebView
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
|
@ -18,6 +19,7 @@ import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||||
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||||
import es.verdnatura.presentation.view.component.CustomDialog
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
|
import org.json.JSONObject
|
||||||
|
|
||||||
|
|
||||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||||
|
@ -58,20 +60,15 @@ class WebFragment(
|
||||||
webSettings.setSupportZoom(true)
|
webSettings.setSupportZoom(true)
|
||||||
//webSettings.defaultTextEncodingName = "utf-8"
|
//webSettings.defaultTextEncodingName = "utf-8"
|
||||||
|
|
||||||
|
var dataScanned = JSONObject(entryPoint)
|
||||||
|
binding.webView.loadUrl(dataScanned.get("web").toString())
|
||||||
|
|
||||||
binding.webView.loadUrl ("https://salix.verdnatura.es/#!/item/$entryPoint/summary")
|
|
||||||
|
|
||||||
// val openURL = Intent(Intent.ACTION_VIEW)
|
|
||||||
// openURL.data = Uri.parse("https://salix.verdnatura.es/#!/ticket/3271614/tracking/index")
|
|
||||||
// openURL.data = Uri.parse("https://salix.verdnatura.es/#!/item/index")
|
|
||||||
// startActivity(openURL)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setToolbar() {
|
private fun setToolbar() {
|
||||||
|
|
||||||
binding.mainToolbar.toolbarTitle.text = getString(R.string.item)+entryPoint
|
binding.mainToolbar.toolbarTitle.text = getString(R.string.item)+JSONObject(entryPoint).get("entryPoint").toString()
|
||||||
// binding.splashProgress.visibility= View.GONE
|
|
||||||
|
|
||||||
val listIcons: ArrayList<ImageView> = ArrayList()
|
val listIcons: ArrayList<ImageView> = ArrayList()
|
||||||
val iconPrint = ImageView(context)
|
val iconPrint = ImageView(context)
|
||||||
|
|
|
@ -35,6 +35,7 @@ class itemShelvingLogFragment(
|
||||||
|
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
// customDialogList = CustomDialogList(requireContext())
|
// customDialogList = CustomDialogList(requireContext())
|
||||||
|
|
||||||
setEvents()
|
setEvents()
|
||||||
setToolBar(getString(R.string.itemShelvingLog))
|
setToolBar(getString(R.string.itemShelvingLog))
|
||||||
super.init()
|
super.init()
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment
|
package es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment
|
||||||
|
|
||||||
|
import android.util.Base64.encodeToString
|
||||||
|
import android.util.Log
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.google.gson.Gson
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentShelvinglogBinding
|
import es.verdnatura.databinding.FragmentShelvinglogBinding
|
||||||
import es.verdnatura.domain.notNull
|
import es.verdnatura.domain.notNull
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.view.component.CustomDialog
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogList
|
|
||||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.adapter.ShelvingLogAdapter
|
import es.verdnatura.presentation.view.feature.historicoshelvinglog.adapter.ShelvingLogAdapter
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
|
import java.net.URLEncoder
|
||||||
|
|
||||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||||
class shelvingLogFragment(
|
class shelvingLogFragment(
|
||||||
var entryPoint: String = ""
|
var entryPoint: String = ""
|
||||||
|
|
||||||
) : BaseFragment<FragmentShelvinglogBinding, shelvingLogViewModel>(
|
) : BaseFragment<FragmentShelvinglogBinding, shelvingLogViewModel>(
|
||||||
shelvingLogViewModel::class) {
|
shelvingLogViewModel::class
|
||||||
|
) {
|
||||||
// private lateinit var customDialogList: CustomDialogList
|
// private lateinit var customDialogList: CustomDialogList
|
||||||
private var adapter: ShelvingLogAdapter? = null
|
private var adapter: ShelvingLogAdapter? = null
|
||||||
private var itemScan = ""
|
private var itemScan = ""
|
||||||
|
@ -35,6 +39,7 @@ class shelvingLogFragment(
|
||||||
|
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
// customDialogList = CustomDialogList(requireContext())
|
// customDialogList = CustomDialogList(requireContext())
|
||||||
|
binding.linearHeader.visibility=View.GONE
|
||||||
setEvents()
|
setEvents()
|
||||||
setToolBar(getString(R.string.shelvingLog))
|
setToolBar(getString(R.string.shelvingLog))
|
||||||
super.init()
|
super.init()
|
||||||
|
@ -45,7 +50,6 @@ class shelvingLogFragment(
|
||||||
binding.mainToolbar.toolbarTitle.text = title
|
binding.mainToolbar.toolbarTitle.text = title
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setEvents() {
|
private fun setEvents() {
|
||||||
|
@ -72,11 +76,16 @@ class shelvingLogFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private fun shelvingLog_get(vShelvingFK: String) {
|
private fun shelvingLog_get(vShelvingFK: String) {
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
viewModel.shelvingLog_get(getData(USER), getData(PASSWORD),vShelvingFK)
|
// viewModel.shelvingLog_get(getData(USER), getData(PASSWORD),vShelvingFK)
|
||||||
|
viewModel.Shelvings(getData(TOKEN), setFilter(vShelvingFK))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setFilter(vShlevingFK: String): String {
|
||||||
|
|
||||||
|
return "{\"where\": {\"code\": \"$vShlevingFK\"}}"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +98,8 @@ class shelvingLogFragment(
|
||||||
binding.splashProgress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
adapter = ShelvingLogAdapter(it.list)
|
adapter = ShelvingLogAdapter(it.list)
|
||||||
binding.itemshelvinglogRecyclerview.adapter = adapter
|
binding.itemshelvinglogRecyclerview.adapter = adapter
|
||||||
binding.itemshelvinglogRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
binding.itemshelvinglogRecyclerview.layoutManager =
|
||||||
|
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
setToolBar(getString(R.string.shelvingLog) + ":" + itemScan)
|
setToolBar(getString(R.string.shelvingLog) + ":" + itemScan)
|
||||||
|
|
||||||
if (it.list.isEmpty()) {
|
if (it.list.isEmpty()) {
|
||||||
|
@ -109,6 +119,48 @@ class shelvingLogFragment(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
loadShelvingLogSalixList.observe(viewLifecycleOwner, Observer { event ->
|
||||||
|
event.getContentIfNotHandled().notNull {
|
||||||
|
binding.splashProgress.visibility = View.GONE
|
||||||
|
//adapter = ShelvingLogAdapter(it.list)
|
||||||
|
binding.itemshelvinglogRecyclerview.adapter = adapter
|
||||||
|
binding.itemshelvinglogRecyclerview.layoutManager =
|
||||||
|
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
|
setToolBar(getString(R.string.shelvingLog) + ":" + itemScan)
|
||||||
|
|
||||||
|
if (it.list.isEmpty()) {
|
||||||
|
customDialog.setTitle(getString(R.string.noResults))
|
||||||
|
.setDescription(getString(R.string.noDataLabelScanned))
|
||||||
|
.setOkButton(getString(R.string.close)) {
|
||||||
|
customDialog.dismiss()
|
||||||
|
}.show()
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (it.list.get(0).isError == true) {
|
||||||
|
it.list.get(0).errorMessage?.let { it1 ->
|
||||||
|
customDialog.setTitle(getString(R.string.error))
|
||||||
|
.setDescription(it1)
|
||||||
|
.setOkButton(getString(R.string.close)) {
|
||||||
|
customDialog.dismiss()
|
||||||
|
}.show()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
var itemId= it.list[0].id
|
||||||
|
//val entrypoint = mutableMapOf("entryPoint" to itemScan, "web" to "https://test-salix.verdnatura.es/#!/shelving/$itemId/log")
|
||||||
|
ma.onPasillerosItemClickListener(
|
||||||
|
PasillerosItemVO(
|
||||||
|
title = getString(R.string.titleWebViewer),
|
||||||
|
), entryPoint = Gson().toJson(mutableMapOf("entryPoint" to itemId, "web" to "https://salix.verdnatura.es/#!/shelving/$itemId/log"))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -117,5 +169,4 @@ class shelvingLogFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment
|
||||||
|
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
import androidx.lifecycle.Transformations
|
||||||
import es.verdnatura.domain.itemShelvingLogUSerCase
|
import es.verdnatura.domain.itemShelvingLogUSerCase
|
||||||
|
@ -11,6 +12,8 @@ import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.common.Event
|
import es.verdnatura.presentation.common.Event
|
||||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLog
|
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLog
|
||||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogList
|
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogList
|
||||||
|
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalix
|
||||||
|
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalixList
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
@ -21,17 +24,26 @@ class shelvingLogViewModel(context: Context) : BaseViewModel() {
|
||||||
itemShelvingLogUSerCase(context)
|
itemShelvingLogUSerCase(context)
|
||||||
|
|
||||||
private val _itemShelvingLogList by lazy { MutableLiveData<ShelvingLogList>() }
|
private val _itemShelvingLogList by lazy { MutableLiveData<ShelvingLogList>() }
|
||||||
|
|
||||||
|
|
||||||
val loadShelvingLogList = Transformations.map(_itemShelvingLogList) { Event(it) }
|
val loadShelvingLogList = Transformations.map(_itemShelvingLogList) { Event(it) }
|
||||||
|
|
||||||
|
private val _itemShelvingLogSalixList by lazy { MutableLiveData<ShelvingLogSalixList>() }
|
||||||
|
val loadShelvingLogSalixList = Transformations.map(_itemShelvingLogSalixList) { Event(it) }
|
||||||
|
|
||||||
|
private val _shelvingResponse by lazy { MutableLiveData<ShelvingLogSalix>() }
|
||||||
|
val shelvingResponse: LiveData<ShelvingLogSalix>
|
||||||
|
get() = _shelvingResponse
|
||||||
|
|
||||||
fun shelvingLog_get(usuario: String, password: String, vShelvingFK: String) {
|
fun shelvingLog_get(usuario: String, password: String, vShelvingFK: String) {
|
||||||
itemShelvingLogUSerCase.shelvingLog_get(usuario, password, vShelvingFK).enqueue(object :
|
itemShelvingLogUSerCase.shelvingLog_get(usuario, password, vShelvingFK).enqueue(object :
|
||||||
Callback<List<ShelvingLog>> {
|
Callback<List<ShelvingLog>> {
|
||||||
override fun onFailure(call: Call<List<ShelvingLog>>, t: Throwable) {
|
override fun onFailure(call: Call<List<ShelvingLog>>, t: Throwable) {
|
||||||
val listError: ArrayList<ShelvingLog> = ArrayList()
|
val listError: ArrayList<ShelvingLog> = ArrayList()
|
||||||
listError.add(ShelvingLog(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
|
listError.add(
|
||||||
|
ShelvingLog(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
|
)
|
||||||
|
)
|
||||||
_itemShelvingLogList.value = ShelvingLogList(listError)
|
_itemShelvingLogList.value = ShelvingLogList(listError)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,12 +54,19 @@ class shelvingLogViewModel(context: Context) : BaseViewModel() {
|
||||||
|
|
||||||
if (!response.isSuccessful) {
|
if (!response.isSuccessful) {
|
||||||
val listError: ArrayList<ShelvingLog> = ArrayList()
|
val listError: ArrayList<ShelvingLog> = ArrayList()
|
||||||
listError.add(ShelvingLog(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
|
listError.add(
|
||||||
|
ShelvingLog(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
nameofFunction(this),
|
||||||
|
response.message()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
_itemShelvingLogList.value = ShelvingLogList(listError)
|
_itemShelvingLogList.value = ShelvingLogList(listError)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (response.body() != null)
|
if (response.body() != null) {
|
||||||
{
|
|
||||||
_itemShelvingLogList.value = response.body()?.let {
|
_itemShelvingLogList.value = response.body()?.let {
|
||||||
ShelvingLogList(it)
|
ShelvingLogList(it)
|
||||||
}
|
}
|
||||||
|
@ -62,10 +81,57 @@ class shelvingLogViewModel(context: Context) : BaseViewModel() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun Shelvings(token: String, vShelvingFK: String) {
|
||||||
|
itemShelvingLogUSerCase.Shelvings(token, vShelvingFK).enqueue(object :
|
||||||
|
Callback<List<ShelvingLogSalix>> {
|
||||||
|
override fun onFailure(call: Call<List<ShelvingLogSalix>>, t: Throwable) {
|
||||||
|
val listError: ArrayList<ShelvingLogSalix> = ArrayList()
|
||||||
|
listError.add(
|
||||||
|
ShelvingLogSalix(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
_itemShelvingLogSalixList.value = ShelvingLogSalixList(listError)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResponse(
|
||||||
|
call: Call<List<ShelvingLogSalix>>,
|
||||||
|
response: Response<List<ShelvingLogSalix>>
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (!response.isSuccessful) {
|
||||||
|
val listError: ArrayList<ShelvingLogSalix> = ArrayList()
|
||||||
|
listError.add(
|
||||||
|
ShelvingLogSalix(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(
|
||||||
|
nameofFunction(this),
|
||||||
|
response.message()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
_itemShelvingLogSalixList.value = ShelvingLogSalixList(listError)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (response.body() != null) {
|
||||||
|
_itemShelvingLogSalixList.value = response.body()?.let {
|
||||||
|
ShelvingLogSalixList(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,21 @@ class ShelvingLog(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ShelvingLogList(
|
class ShelvingLogList(
|
||||||
var list:List<ShelvingLog> = listOf())
|
var list: List<ShelvingLog> = listOf()
|
||||||
|
)
|
||||||
|
|
||||||
|
class ShelvingLogSalixList(
|
||||||
|
var list: List<ShelvingLogSalix> = listOf()
|
||||||
|
)
|
||||||
|
class ShelvingLogSalix(
|
||||||
|
var id: Int?=null,
|
||||||
|
var code: String?=null,
|
||||||
|
var parkingFk: Int?=null,
|
||||||
|
var isPrinted: Boolean?=null,
|
||||||
|
var priority: Int?=null,
|
||||||
|
var userFk: Int?=null,
|
||||||
|
var isRecyclable: Boolean?=null,
|
||||||
|
var isError:Boolean?=null,
|
||||||
|
var errorMessage: String?=null
|
||||||
|
)
|
|
@ -454,6 +454,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.titleWebViewer) -> {
|
getString(R.string.titleWebViewer) -> {
|
||||||
|
// el entryPoint de WebFragment se le pasa un JSON del tipo {"entryPoint":"itemScanned","web":"www.google.com}
|
||||||
addFragmentOnTop(WebFragment.newInstance(entryPoint))
|
addFragmentOnTop(WebFragment.newInstance(entryPoint))
|
||||||
}
|
}
|
||||||
//Menu qr
|
//Menu qr
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
package es.verdnatura.presentation.view.feature.paletizador.fragment
|
package es.verdnatura.presentation.view.feature.paletizador.fragment
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentExpeditionscanSorterBinding
|
import es.verdnatura.databinding.FragmentExpeditionscanSorterBinding
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
|
import es.verdnatura.presentation.common.itemScanned
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogInputTwoValues
|
import es.verdnatura.presentation.view.component.CustomDialogInputTwoValues
|
||||||
|
import org.json.JSONObject
|
||||||
|
|
||||||
class CmrExpeditionPalletFragment(
|
class CmrExpeditionPalletFragment(
|
||||||
var title: String = ""
|
var title: String = ""
|
||||||
|
@ -16,6 +19,7 @@ class CmrExpeditionPalletFragment(
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_expeditionscan_sorter
|
override fun getLayoutId(): Int = R.layout.fragment_expeditionscan_sorter
|
||||||
private lateinit var customDialogList: CustomDialogInputTwoValues
|
private lateinit var customDialogList: CustomDialogInputTwoValues
|
||||||
private var itemScaned: String = ""
|
private var itemScaned: String = ""
|
||||||
|
private lateinit var dataScanned: itemScanned
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(title: String) = CmrExpeditionPalletFragment(title)
|
fun newInstance(title: String) = CmrExpeditionPalletFragment(title)
|
||||||
|
@ -66,12 +70,17 @@ class CmrExpeditionPalletFragment(
|
||||||
|
|
||||||
if (it.isError) {
|
if (it.isError) {
|
||||||
|
|
||||||
ma.messageWithSound(getString(R.string.cmrError)+it.errorMessage, true, true, isToasted =true)
|
ma.messageWithSound(
|
||||||
|
getString(R.string.cmrError) + it.errorMessage,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
isToasted = true
|
||||||
|
)
|
||||||
showExpeditionPalletScan()
|
showExpeditionPalletScan()
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
binding.splashProgress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
ma.messageWithSound(getString(R.string.added), false, true)
|
ma.messageWithSound(getString(R.string.operationSuccess), false, true)
|
||||||
showExpeditionPalletScan()
|
showExpeditionPalletScan()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -123,11 +132,20 @@ class CmrExpeditionPalletFragment(
|
||||||
.isNotEmpty()
|
.isNotEmpty()
|
||||||
) {
|
) {
|
||||||
ma.hideKeyboard(customDialogList.getEditText())
|
ma.hideKeyboard(customDialogList.getEditText())
|
||||||
|
|
||||||
|
if (itemScanedIsCMR(customDialogList.getValueTwo())) {
|
||||||
|
itemScaned = dataScanned.value
|
||||||
customDialogList.setValueTwo("")
|
customDialogList.setValueTwo("")
|
||||||
cmrExpeditionPallet_add(
|
cmrExpeditionPallet_add(
|
||||||
customDialogList.getValue(),
|
customDialogList.getValue(),
|
||||||
customDialogList.getValueTwo()
|
itemScaned
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
customDialogList.setValueTwo("")
|
||||||
|
ma.messageWithSound(getString(R.string.errorCmrNotScanned), true, true, isToasted = true)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return@setOnEditorActionListener true
|
return@setOnEditorActionListener true
|
||||||
|
@ -136,5 +154,18 @@ class CmrExpeditionPalletFragment(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun itemScanedIsCMR(valueTwo: String): Boolean {
|
||||||
|
|
||||||
|
return try {
|
||||||
|
dataScanned = itemScanned(JSONObject(valueTwo))
|
||||||
|
dataScanned.table == "cmr"
|
||||||
|
|
||||||
|
} catch (Ex: Exception) {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -237,7 +237,8 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
_pasillerositem.add(
|
//Tarea 3335 Borrat proced(Carles)
|
||||||
|
/* _pasillerositem.add(
|
||||||
PasillerosItemVO(
|
PasillerosItemVO(
|
||||||
8,
|
8,
|
||||||
R.drawable.ic_baseline_star_24,
|
R.drawable.ic_baseline_star_24,
|
||||||
|
@ -247,7 +248,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
|
||||||
R.string.titleQualityDescrip
|
R.string.titleQualityDescrip
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,7 +299,8 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
|
||||||
contextApp.getString(R.string.titleExpeditionDescrip)
|
contextApp.getString(R.string.titleExpeditionDescrip)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
/*
|
|
||||||
|
//Tarea #3986
|
||||||
_pasillerositem.add(
|
_pasillerositem.add(
|
||||||
PasillerosItemVO(
|
PasillerosItemVO(
|
||||||
31,
|
31,
|
||||||
|
@ -307,7 +309,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
|
||||||
R.string.titleCMRState,
|
R.string.titleCMRState,
|
||||||
contextApp.getString(R.string.titleCMRDescrip)
|
contextApp.getString(R.string.titleCMRDescrip)
|
||||||
)
|
)
|
||||||
)*/
|
)
|
||||||
_pasillerositem.add(
|
_pasillerositem.add(
|
||||||
PasillerosItemVO(
|
PasillerosItemVO(
|
||||||
40,
|
40,
|
||||||
|
|
|
@ -7,4 +7,5 @@ class PasillerosItemVO(
|
||||||
val titleToShow: Int = 0,
|
val titleToShow: Int = 0,
|
||||||
val description: String = ""
|
val description: String = ""
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
|
@ -21,6 +21,7 @@ fun PreSacadorItemVO.toSale() : SaleVO {
|
||||||
agencyName = if (trabajador.isNullOrEmpty()) { "" } else trabajador,
|
agencyName = if (trabajador.isNullOrEmpty()) { "" } else trabajador,
|
||||||
packingType=packingType,
|
packingType=packingType,
|
||||||
salePersonFk=if (salesPersonFk.isNullOrEmpty()){""}else salesPersonFk,
|
salePersonFk=if (salesPersonFk.isNullOrEmpty()){""}else salesPersonFk,
|
||||||
|
rgb= ""
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
||||||
|
@ -42,7 +43,8 @@ fun PreSacadorItemVO.toSaleReposicion() : SaleVO {
|
||||||
workerFk = if (trabajador.isNullOrEmpty()) { "0" } else trabajador,
|
workerFk = if (trabajador.isNullOrEmpty()) { "0" } else trabajador,
|
||||||
originalQuantity = quantity.toString(),
|
originalQuantity = quantity.toString(),
|
||||||
placements = carros,
|
placements = carros,
|
||||||
agencyName = if (trabajador.isNullOrEmpty()) { "" } else trabajador
|
agencyName = if (trabajador.isNullOrEmpty()) { "" } else trabajador,
|
||||||
|
rgb=""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ class PreSacadorItemVO(
|
||||||
//var priority:Int =0, 7-1-2022
|
//var priority:Int =0, 7-1-2022
|
||||||
var pickingOrder: Int = 0,
|
var pickingOrder: Int = 0,
|
||||||
var salesPersonFk: String = "",
|
var salesPersonFk: String = "",
|
||||||
|
var rgb:String?=null,
|
||||||
|
|
||||||
var reference: String = ""
|
var reference: String = ""
|
||||||
)
|
)
|
||||||
|
|
|
@ -65,7 +65,7 @@ class SacadorFragment :
|
||||||
)
|
)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
val working_in_test = false //sergio: Ok en app
|
val working_in_test = true //sergio: Ok en app
|
||||||
if (!working_in_test) {
|
if (!working_in_test) {
|
||||||
viewModel.collectionGetSalix(token = getData(TOKEN))
|
viewModel.collectionGetSalix(token = getData(TOKEN))
|
||||||
} else {
|
} else {
|
||||||
|
@ -139,12 +139,19 @@ class SacadorFragment :
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
// checkTagsMode()
|
// checkTagsMode()
|
||||||
//Tarea 4351 cambiar getData(WAGON) por getData(NUMBEROFWAGONS)
|
//Tarea 4351 cambiar getData(WAGON) por getData(NUMBEROFWAGONS)
|
||||||
|
|
||||||
|
//Tarea 4130
|
||||||
viewModel.collectionNew(
|
viewModel.collectionNew(
|
||||||
getData(USER),
|
getData(USER),
|
||||||
getData(PASSWORD),
|
getData(PASSWORD),
|
||||||
getData(SECTORFK),
|
getData(SECTORFK),
|
||||||
getData(NUMBEROFWAGONS)
|
getData(NUMBEROFWAGONS)
|
||||||
)
|
)
|
||||||
|
/* viewModel.collection_assign(
|
||||||
|
getData(USER),
|
||||||
|
getData(PASSWORD),
|
||||||
|
)*/
|
||||||
|
|
||||||
}
|
}
|
||||||
iconVehicleIn.drawable -> ma.onVehicleSelected(SacadorFragment.TAG)
|
iconVehicleIn.drawable -> ma.onVehicleSelected(SacadorFragment.TAG)
|
||||||
}
|
}
|
||||||
|
@ -234,7 +241,7 @@ class SacadorFragment :
|
||||||
goBack = false
|
goBack = false
|
||||||
//sergio:para asegurarnos que aparece en pantalla.
|
//sergio:para asegurarnos que aparece en pantalla.
|
||||||
|
|
||||||
val working_in_test = false //sergio: ok en app SACADOR
|
val working_in_test = true //sergio: ok en app SACADOR
|
||||||
if (!working_in_test) {
|
if (!working_in_test) {
|
||||||
viewModel.collectionGetSalix(token = getData(TOKEN))
|
viewModel.collectionGetSalix(token = getData(TOKEN))
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -127,6 +127,37 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun collection_assign(usuario: String, password: String){
|
||||||
|
getSacadorControladorUserCase.collection_assign(usuario, password).enqueue(
|
||||||
|
object :
|
||||||
|
Callback<String> {
|
||||||
|
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||||
|
_response.value =
|
||||||
|
ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResponse(
|
||||||
|
call: Call<String>,
|
||||||
|
response: Response<String>
|
||||||
|
) {
|
||||||
|
if (response.body() != null) {
|
||||||
|
_response.value =
|
||||||
|
ResponseItemVO(isError = false, response = response.body()!!)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
_response.value = ResponseItemVO(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fun collection_new_smart(usuario: String, password: String, sectorFk: String, wagons: String,tagtype:String){
|
fun collection_new_smart(usuario: String, password: String, sectorFk: String, wagons: String,tagtype:String){
|
||||||
getSacadorControladorUserCase.collectionNewSmarttag(usuario, password, sectorFk, wagons,tagtype).enqueue(
|
getSacadorControladorUserCase.collectionNewSmarttag(usuario, password, sectorFk, wagons,tagtype).enqueue(
|
||||||
object :
|
object :
|
||||||
|
|
|
@ -10,21 +10,25 @@ class CollectionVO(
|
||||||
var tickets: List<TicketVO> = listOf(),
|
var tickets: List<TicketVO> = listOf(),
|
||||||
var isError: Boolean = false,
|
var isError: Boolean = false,
|
||||||
var errorMessage: String = "",
|
var errorMessage: String = "",
|
||||||
var itemPackingTypeFk: String = ""
|
var itemPackingTypeFk: String = "",
|
||||||
|
var rgb: String? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
class TicketVO(
|
class TicketVO(
|
||||||
var ticketFk: String = "",
|
var ticketFk: String = "",
|
||||||
var level: String = "",
|
var level: String = "",
|
||||||
|
var rgb: String = "",
|
||||||
var agencyName: String = "",
|
var agencyName: String = "",
|
||||||
var salesPersonFk: String = "",
|
var salesPersonFk: String = "",
|
||||||
var sales: List<SaleVO> = listOf(),
|
var sales: List<SaleVO> = listOf(),
|
||||||
var observations: String = "",
|
var observations: String = "",
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
class SaleVO(
|
class SaleVO(
|
||||||
var ticketFk: String = "",
|
var ticketFk: String = "",
|
||||||
var level: String = "",
|
var level: String = "",
|
||||||
|
var rgb: String = "",
|
||||||
var agencyName: String = "",
|
var agencyName: String = "",
|
||||||
var saleOrder: Int = 9999,
|
var saleOrder: Int = 9999,
|
||||||
var saleFk: String = "",
|
var saleFk: String = "",
|
||||||
|
@ -65,6 +69,7 @@ class SaleVO(
|
||||||
|
|
||||||
var picked: String = "",
|
var picked: String = "",
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
class PlacementVO(
|
class PlacementVO(
|
||||||
|
|
|
@ -41,54 +41,55 @@
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/linearHeader"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_marginTop="@dimen/layout_margin_min"
|
android:layout_marginTop="@dimen/layout_margin_min"
|
||||||
android:layout_marginBottom="@dimen/layout_margin_1"
|
android:layout_marginBottom="@dimen/layout_margin_1"
|
||||||
|
android:orientation="horizontal"
|
||||||
android:paddingLeft="@dimen/layout_margin_min"
|
android:paddingLeft="@dimen/layout_margin_min"
|
||||||
android:paddingRight="@dimen/layout_margin_min">
|
android:paddingRight="@dimen/layout_margin_min">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Usuario"
|
android:gravity="center"
|
||||||
android:textSize="@dimen/body2"
|
|
||||||
android:textColor="@color/verdnatura_white"
|
|
||||||
android:paddingLeft="@dimen/layout_margin_min"
|
android:paddingLeft="@dimen/layout_margin_min"
|
||||||
|
android:text="Usuario"
|
||||||
|
android:textColor="@color/verdnatura_white"
|
||||||
|
|
||||||
android:gravity="center"/>
|
android:textSize="@dimen/body2" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Fecha"
|
|
||||||
android:textSize="@dimen/body2"
|
|
||||||
android:textColor="@color/verdnatura_white"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center"/>
|
android:gravity="center"
|
||||||
|
android:text="Fecha"
|
||||||
|
android:textColor="@color/verdnatura_white"
|
||||||
|
android:textSize="@dimen/body2" />
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Parking"
|
|
||||||
android:textSize="@dimen/body2"
|
|
||||||
android:textColor="@color/verdnatura_white"
|
|
||||||
android:layout_weight="1.25"
|
android:layout_weight="1.25"
|
||||||
android:gravity="right"
|
android:gravity="right"
|
||||||
|
android:text="Parking"
|
||||||
|
android:textColor="@color/verdnatura_white"
|
||||||
|
android:textSize="@dimen/body2"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Acción"
|
|
||||||
android:textSize="@dimen/body2"
|
|
||||||
android:textColor="@color/verdnatura_white"
|
|
||||||
android:visibility="gone"
|
|
||||||
|
|
||||||
android:gravity="right"
|
android:gravity="right"
|
||||||
android:paddingRight="@dimen/layout_margin_min"/>
|
android:paddingRight="@dimen/layout_margin_min"
|
||||||
|
android:text="Acción"
|
||||||
|
android:textColor="@color/verdnatura_white"
|
||||||
|
|
||||||
|
android:textSize="@dimen/body2"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
<string name="Sinsector">Sin sector</string>
|
<string name="Sinsector">Sin sector</string>
|
||||||
<string name="Close">Cerrar</string>
|
<string name="Close">Cerrar</string>
|
||||||
<string name="Noexistessectores">No existes sectores.</string>
|
<string name="Noexistessectores">No existes sectores.</string>
|
||||||
|
<string name="NoItemPackingType">No hay tipos de encajado</string>
|
||||||
<string name="Seleccionaunsector">Selecciona un sector</string>
|
<string name="Seleccionaunsector">Selecciona un sector</string>
|
||||||
<string name="titleCorridors">Pasilleros</string>
|
<string name="titleCorridors">Pasilleros</string>
|
||||||
<string name="titleControllers">Controladores</string>
|
<string name="titleControllers">Controladores</string>
|
||||||
|
@ -75,7 +76,7 @@
|
||||||
<string name="Coleccióncompleta">Colección completa</string>
|
<string name="Coleccióncompleta">Colección completa</string>
|
||||||
<string name="Parking">Parking</string>
|
<string name="Parking">Parking</string>
|
||||||
<string name="Reject">Rechazar</string>
|
<string name="Reject">Rechazar</string>
|
||||||
<string name="cmrError">No se ha podido guardar.Revisa el código del Pallet y del CMR.</string>
|
<string name="cmrError">No se ha podido asociar el pallet al CMR.</string>
|
||||||
<string name="palletScanError">Vuelva a intentarlo. No se ha podido recepcionar pallet:</string>
|
<string name="palletScanError">Vuelva a intentarlo. No se ha podido recepcionar pallet:</string>
|
||||||
<string name="updatemng">Existe una versión nueva, es recomendable actualizar.</string>
|
<string name="updatemng">Existe una versión nueva, es recomendable actualizar.</string>
|
||||||
<string name="Actualizar">Actualizar</string>
|
<string name="Actualizar">Actualizar</string>
|
||||||
|
@ -149,10 +150,11 @@
|
||||||
<string name="buscarDepartamento">Buscar departamento</string>
|
<string name="buscarDepartamento">Buscar departamento</string>
|
||||||
<string name="Noprinters">No hay impresora</string>
|
<string name="Noprinters">No hay impresora</string>
|
||||||
<string name="Selecccionaimpresoara">Selecciona impresora</string>
|
<string name="Selecccionaimpresoara">Selecciona impresora</string>
|
||||||
|
<string name="selectTrain">Selecciona tipo de ticket</string>
|
||||||
<string name="titleClaimUbication">Ubicación de reclamación</string>
|
<string name="titleClaimUbication">Ubicación de reclamación</string>
|
||||||
<string name="claims">Reclamaciones</string>
|
<string name="claims">Reclamaciones</string>
|
||||||
<string name="scanPallet">Escáner paletizar</string>
|
<string name="scanPallet">Escáner paletizar</string>
|
||||||
<string name="operationSuccess">Realizado correctamente</string>
|
<string name="operationSuccess">Operación Realizada correctamente</string>
|
||||||
<string name="settings">Configuración</string>
|
<string name="settings">Configuración</string>
|
||||||
<string name="itemCard">Artículo info</string>
|
<string name="itemCard">Artículo info</string>
|
||||||
<string name="noResults">Sin resultados</string>
|
<string name="noResults">Sin resultados</string>
|
||||||
|
@ -382,6 +384,8 @@
|
||||||
<string name="wagoons">Carros</string>
|
<string name="wagoons">Carros</string>
|
||||||
<string name="printerWithout">Sin impresora</string>
|
<string name="printerWithout">Sin impresora</string>
|
||||||
<string name="printerLabel">Impresora etiquetas</string>
|
<string name="printerLabel">Impresora etiquetas</string>
|
||||||
|
<string name="settingsTitleTrain">Tipo de tickets</string>
|
||||||
|
<string name="settingsTitleItemPacking">Tipo encajado</string>
|
||||||
<string name="labelType">Tipo etiqueta</string>
|
<string name="labelType">Tipo etiqueta</string>
|
||||||
<string name="vehicleControl">Control de vehículos</string>
|
<string name="vehicleControl">Control de vehículos</string>
|
||||||
<string name="userNotPermission">Usuario sin permisos para realizar la acción</string>
|
<string name="userNotPermission">Usuario sin permisos para realizar la acción</string>
|
||||||
|
@ -473,4 +477,6 @@
|
||||||
<string name="palletScanAdd">Escanea pallet para añadir expediciones</string>
|
<string name="palletScanAdd">Escanea pallet para añadir expediciones</string>
|
||||||
<string name="messageConfirm">¿Estás seguro que deseas eliminar?</string>
|
<string name="messageConfirm">¿Estás seguro que deseas eliminar?</string>
|
||||||
<string name="itemFilter">Filtro ítem</string>
|
<string name="itemFilter">Filtro ítem</string>
|
||||||
|
<string name="itemUpdated">Actualizado</string>
|
||||||
|
<string name="errorCmrNotScanned">CMR no escaneado</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -292,7 +292,9 @@
|
||||||
<string name="visible">Visible:</string>
|
<string name="visible">Visible:</string>
|
||||||
<string name="visibleTotal"> Total visible: </string>
|
<string name="visibleTotal"> Total visible: </string>
|
||||||
<string name="printerUpdated">Printer registered</string>
|
<string name="printerUpdated">Printer registered</string>
|
||||||
<string name="sectorUpdated">sector registered</string>
|
<string name="sectorUpdated">sector updated</string>
|
||||||
|
<string name="errorCmrNotScanned">CMR not scanned</string>
|
||||||
|
<string name="itemUpdated">Item updated</string>
|
||||||
<string name="logAppName">warehouse</string>
|
<string name="logAppName">warehouse</string>
|
||||||
<string name="base_urlSalix">base_urlSalix</string>
|
<string name="base_urlSalix">base_urlSalix</string>
|
||||||
<string name="serverSalix">Ponting to server Salix (</string>
|
<string name="serverSalix">Ponting to server Salix (</string>
|
||||||
|
@ -473,6 +475,10 @@
|
||||||
<string name="cmrError">It\'s not saved. Please review pallet and CMR</string>
|
<string name="cmrError">It\'s not saved. Please review pallet and CMR</string>
|
||||||
<string name="palletScanError">Repeat again. Pallet does not received:</string>
|
<string name="palletScanError">Repeat again. Pallet does not received:</string>
|
||||||
<string name="lineNotExists">Buy line of scanned label do not exist.</string>
|
<string name="lineNotExists">Buy line of scanned label do not exist.</string>
|
||||||
|
<string name="settingsTitleTrain">Ticket type</string>
|
||||||
|
<string name="settingsTitleItemPacking">Packing type</string>
|
||||||
|
<string name="NoItemPackingType">No item packing type</string>
|
||||||
|
<string name="selectTrain">Select ticket type</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue