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 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.Train
|
||||
import retrofit2.Call
|
||||
|
||||
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> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(sectorFk)
|
||||
|
||||
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> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(labelerFk)
|
||||
|
@ -30,6 +34,25 @@ class GetAjustesUserCase(context: Context) : RestClient(context) {
|
|||
fun printer_get(usuario: String, password: String): Call<List<Printers>> {
|
||||
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(
|
||||
usuario: 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(
|
||||
|
|
|
@ -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.listSaleSalix
|
||||
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.SalixGrupo
|
||||
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"}}
|
||||
// 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("Departments")
|
||||
fun department_getHasMistake(
|
||||
|
@ -147,4 +147,12 @@ interface SalixService {
|
|||
):
|
||||
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 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.Train
|
||||
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.ItemProposal
|
||||
|
@ -127,6 +128,16 @@ interface VerdnaturaService {
|
|||
):
|
||||
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
|
||||
|
||||
fun worker_getPrinter(
|
||||
|
@ -160,6 +171,28 @@ interface VerdnaturaService {
|
|||
):
|
||||
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
|
||||
fun worker_getSector(
|
||||
@Header("aplicacion") aplicacion: String,
|
||||
|
@ -269,6 +302,46 @@ interface VerdnaturaService {
|
|||
):
|
||||
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
|
||||
fun sectorCollection_new(
|
||||
@Header("aplicacion") aplicacion: String,
|
||||
|
@ -391,16 +464,6 @@ interface VerdnaturaService {
|
|||
):
|
||||
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
|
||||
fun itemPlacementSupplyAiming(
|
||||
|
@ -424,6 +487,17 @@ interface VerdnaturaService {
|
|||
):
|
||||
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
|
||||
fun itemShelvingPlacementSupplyAdd(
|
||||
@Header("aplicacion") aplicacion: String,
|
||||
|
@ -1162,7 +1236,7 @@ interface VerdnaturaService {
|
|||
):
|
||||
Call<Void>
|
||||
|
||||
@POST("almacennew/cmrExpeditionPallet_add")//REVISADA
|
||||
@POST("almacennew/cmrPallet_add")//REVISADA
|
||||
fun cmrExpeditionPallet_add(
|
||||
@Header("aplicacion") aplicacion: String,
|
||||
@Header("version") version: String,
|
||||
|
|
|
@ -2,19 +2,20 @@ package es.verdnatura.domain
|
|||
|
||||
|
||||
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.historicoshelvinglog.model.ShelvingLog
|
||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalix
|
||||
import retrofit2.Call
|
||||
|
||||
class itemShelvingLogUSerCase(context: Context) : RestClient(context) {
|
||||
|
||||
|
||||
|
||||
fun itemShelvingLog_get(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vShelvingFk: String
|
||||
): Call<List<ItemShelvingLog>> {
|
||||
): Call<List<ItemShelvingLog>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vShelvingFk)
|
||||
return restClient!!.itemShelvingLog_get(
|
||||
|
@ -24,14 +25,14 @@ class itemShelvingLogUSerCase(context: Context) : RestClient(context) {
|
|||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fun shelvingLog_get(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vShelvingFk: String
|
||||
): Call<List<ShelvingLog>> {
|
||||
): Call<List<ShelvingLog>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vShelvingFk)
|
||||
return restClient!!.shelvingLog_get(
|
||||
|
@ -41,7 +42,26 @@ class itemShelvingLogUSerCase(context: Context) : RestClient(context) {
|
|||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
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 ANDROID_ID = "ANDROID_ID"
|
||||
protected val DEVICENAME = "devicename"
|
||||
protected val TRAINNAME = "trainName"
|
||||
protected val TRAINFK = "trainFk"
|
||||
|
||||
protected val ITEMPACKING = "itemPackingType"
|
||||
protected val ITEMPACKINGFK = "itemPackingTypeFk"
|
||||
//protected val VOZ = "voz"
|
||||
//nuevo campo número carros ajustes y campos para guardar el buyerid y buyernickname
|
||||
protected val BUYER = "buyernickname"
|
||||
|
@ -539,6 +544,10 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
|
|||
PRINTERFK->prefs.getInt(name,0).toString()
|
||||
PRINTERNAME->prefs.getString(name,getString(R.string.noprinter)).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"->{
|
||||
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.res.Resources
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.res.ResourcesCompat.getColor
|
||||
|
@ -53,6 +54,15 @@ class AjustesAdapter (
|
|||
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.SharedPreferences
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.appcompat.widget.TooltipCompat.setTooltipText
|
||||
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.Printers
|
||||
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
|
||||
|
||||
class AjustesFragment :
|
||||
|
@ -27,8 +30,11 @@ class AjustesFragment :
|
|||
private lateinit var customDialog: CustomDialog
|
||||
private var sectorListVO: List<SectorItemVO> = listOf()
|
||||
private var printersList: List<Printers> = listOf()
|
||||
private var trainsList: List<Train> = listOf()
|
||||
private var prefs: SharedPreferences? = null
|
||||
private var ajustesAdapter: AjustesAdapter? = null
|
||||
private var isWorkerAllowed:Boolean=false
|
||||
private var itemPackingList: List<ItemPackingType> = listOf()
|
||||
|
||||
//añadido
|
||||
private var wagonList: List<String> = listOf()
|
||||
|
@ -45,34 +51,17 @@ class AjustesFragment :
|
|||
prefs = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
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)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun init() {
|
||||
|
||||
binding.mainToolbar.toolbarTitle.text = getString(R.string.settings)
|
||||
// binding.splashProgress.visibility=View.VISIBLE
|
||||
binding.splashProgress.visibility=View.VISIBLE
|
||||
hideBackButton(binding.mainToolbar)
|
||||
viewModel.worker_isF11Allowed(getData(USER), getData(PASSWORD))
|
||||
|
||||
|
||||
binding.userText.setText(getData(USER))
|
||||
|
@ -104,47 +93,56 @@ class AjustesFragment :
|
|||
with(viewModel) {
|
||||
ajustesAdapter = AjustesAdapter(ajustesitem, object : OnAjustesItemClickListener {
|
||||
override fun onAjustesItemClickListener(item: AjustesItemVO) {
|
||||
if (item.id == 0) {
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
// viewModel.getSectors(getData(USER),getData(PASSWORD))
|
||||
viewModel.getSectorsSalix(getData(TOKEN))
|
||||
} else if (item.id == 5) {
|
||||
requireActivity().onBackPressed()
|
||||
} else if (item.id == 1) {
|
||||
//Tarea 4351 quitar parte de mostrar los carros y quitar del layout el ">" del final
|
||||
|
||||
ma.messageWithSound("El número de carros ahora solo se puede modificar por los encargados", true, true,"Información",false)
|
||||
/* val listCarros: ArrayList<String> = ArrayList()
|
||||
listCarros.add("1")
|
||||
listCarros.add("2")
|
||||
listCarros.add("3")
|
||||
listCarros.add("4")
|
||||
listCarros.add("5")
|
||||
listCarros.add("6")
|
||||
wagonList = listCarros
|
||||
if (item.action) {
|
||||
|
||||
val array = arrayOfNulls<String>(listCarros.size)
|
||||
if (item.id == 0) {
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
// viewModel.getSectors(getData(USER),getData(PASSWORD))
|
||||
viewModel.getSectorsSalix(getData(TOKEN))
|
||||
} else if (item.id == 5) {
|
||||
requireActivity().onBackPressed()
|
||||
} else if (item.id == 1) {
|
||||
//Tarea 4351 quitar parte de mostrar los carros y quitar del layout el ">" del final
|
||||
|
||||
showDialogCarros(array = listCarros.toArray(array))*/
|
||||
ma.messageWithSound("El número de carros ahora solo se puede modificar por los encargados", true, true,"Información",false)
|
||||
/* val listCarros: ArrayList<String> = ArrayList()
|
||||
listCarros.add("1")
|
||||
listCarros.add("2")
|
||||
listCarros.add("3")
|
||||
listCarros.add("4")
|
||||
listCarros.add("5")
|
||||
listCarros.add("6")
|
||||
wagonList = listCarros
|
||||
|
||||
} else if (item.id == 2) {
|
||||
viewModel.printer_get(getData(USER), getData(PASSWORD))
|
||||
val array = arrayOfNulls<String>(listCarros.size)
|
||||
|
||||
} else if (item.id == 3) {
|
||||
val listTagsType: ArrayList<String> = ArrayList()
|
||||
listTagsType.add(getString(R.string.stickers))
|
||||
// listTagsType.add(getString(R.string.smarttags))
|
||||
tagsList = listTagsType
|
||||
val array = arrayOfNulls<String>(listTagsType.size)
|
||||
showItemPickerType(array = listTagsType.toArray(array))
|
||||
} else if (item.id == 4) {
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = getString(R.string.titleUserControlVehicle)
|
||||
), getData(USERFK)
|
||||
)
|
||||
showDialogCarros(array = listCarros.toArray(array))*/
|
||||
|
||||
} else if (item.id == 2) {
|
||||
viewModel.printer_get(getData(USER), getData(PASSWORD))
|
||||
|
||||
} else if (item.id == 3) {
|
||||
val listTagsType: ArrayList<String> = ArrayList()
|
||||
listTagsType.add(getString(R.string.stickers))
|
||||
// listTagsType.add(getString(R.string.smarttags))
|
||||
tagsList = listTagsType
|
||||
val array = arrayOfNulls<String>(listTagsType.size)
|
||||
showItemPickerType(array = listTagsType.toArray(array))
|
||||
} else if (item.id == 4) {
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = getString(R.string.titleUserControlVehicle)
|
||||
), getData(USERFK)
|
||||
)
|
||||
|
||||
}else if (item.id==6){
|
||||
viewModel.train_get(getData(USER), getData(PASSWORD))
|
||||
}else if (item.id==7){
|
||||
viewModel.getItemPackingTypeSalix(getData(TOKEN))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -153,24 +151,66 @@ class AjustesFragment :
|
|||
|
||||
if (it.isError) {
|
||||
ma.messageWithSound(it.errorMessage, it.isError, true)
|
||||
setSettings()
|
||||
|
||||
} else {
|
||||
saveDataInt(NUMBEROFWAGONS, it.response!!)
|
||||
setSettings()
|
||||
}
|
||||
|
||||
}
|
||||
setSettings(isWorkerAllowed)
|
||||
}
|
||||
workerupdateSector.observe(viewLifecycleOwner, {
|
||||
|
||||
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
|
||||
|
||||
ma.messageWithSound(
|
||||
if (it.isError) it.errorMessage else {
|
||||
getString(R.string.sectorUpdated)
|
||||
getString(R.string.itemUpdated)
|
||||
}, it.isError, false
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
workerupdatePrinter.observe(viewLifecycleOwner, {
|
||||
workerupdatePrinter.observe(viewLifecycleOwner) {
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
|
||||
ma.messageWithSound(
|
||||
|
@ -178,7 +218,8 @@ class AjustesFragment :
|
|||
getString(R.string.printerUpdated)
|
||||
}, it.isError, false
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
binding.ajustessItems.adapter = ajustesAdapter
|
||||
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 {
|
||||
binding.splashProgress.visibility = View.INVISIBLE
|
||||
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()
|
||||
}
|
||||
|
||||
private fun setSettings() {
|
||||
private fun setSettings(actionIsAllowed:Boolean=false) {
|
||||
|
||||
//Tarea 4351 modificar el WAGON por NUMBEROFWAGONS
|
||||
viewModel.inititializeDefaultAjusts(
|
||||
getData(SECTORDESCRIP),
|
||||
getData(SECTORFK).toInt(),
|
||||
|
@ -261,7 +363,9 @@ class AjustesFragment :
|
|||
getData(TAGSTYPE),
|
||||
getData(PRINTERFK).toInt(),
|
||||
getData(PRINTERNAME),
|
||||
|
||||
getData(TRAINNAME),
|
||||
getData(ITEMPACKING),
|
||||
actionIsAllowed = actionIsAllowed
|
||||
|
||||
)
|
||||
}
|
||||
|
@ -287,6 +391,8 @@ class AjustesFragment :
|
|||
it.id.toString()
|
||||
)
|
||||
ajustesAdapter!!.notifyDataSetChanged()
|
||||
ajustesAdapter
|
||||
|
||||
|
||||
return@forEach
|
||||
}
|
||||
|
@ -297,6 +403,36 @@ class AjustesFragment :
|
|||
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>) {
|
||||
val builder = AlertDialog.Builder(this.context)
|
||||
|
||||
|
@ -331,34 +467,34 @@ class AjustesFragment :
|
|||
dialog.show()
|
||||
}
|
||||
|
||||
/* private fun showDialogVoz(array: Array<String>) {
|
||||
val builder = AlertDialog.Builder(this.context)
|
||||
private fun showDialog(array: Array<String>) {
|
||||
val builder = AlertDialog.Builder(this.context)
|
||||
|
||||
|
||||
builder.setTitle(getString(R.string.Seleccionaunsector))
|
||||
builder.setItems(array) { _, which ->
|
||||
val selected = array[which]
|
||||
vozList.forEach {
|
||||
if (it.equals(selected)) {
|
||||
val editor = prefs!!.edit()
|
||||
editor.putString(VOZ, it)
|
||||
editor.apply()
|
||||
builder.setTitle(getString(R.string.settingsTitleItemPacking))
|
||||
builder.setItems(array) { _, which ->
|
||||
val selected = array[which]
|
||||
itemPackingList.forEach {
|
||||
if (it.description.equals(selected)) {
|
||||
val editor = prefs!!.edit()
|
||||
editor.putString(ITEMPACKING, it.description)
|
||||
editor.apply()
|
||||
viewModel.ajustesitem[4].selected = it.description
|
||||
viewModel.operator_updateItemPackingType(
|
||||
getData(USER),
|
||||
getData(PASSWORD),
|
||||
it.code
|
||||
)
|
||||
ajustesAdapter!!.notifyDataSetChanged()
|
||||
|
||||
return@forEach
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.ajustesitem.get(2).selected = it
|
||||
|
||||
ajustesAdapter!!.notifyDataSetChanged()
|
||||
|
||||
return@forEach
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
val dialog = builder.create()
|
||||
dialog.show()
|
||||
}*/
|
||||
}
|
||||
val dialog = builder.create()
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
private fun showDialogCarros(array: Array<String>) {
|
||||
val builder = AlertDialog.Builder(this.context)
|
||||
|
|
|
@ -7,6 +7,7 @@ import androidx.lifecycle.MutableLiveData
|
|||
import androidx.lifecycle.Transformations
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.domain.GetAjustesUserCase
|
||||
import es.verdnatura.domain.GetItemCardUserCase
|
||||
import es.verdnatura.domain.GetLoginUserCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
|
@ -15,18 +16,20 @@ import es.verdnatura.presentation.common.Event
|
|||
import es.verdnatura.presentation.common.ResponseItemNumber
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
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.Callback
|
||||
import retrofit2.Response
|
||||
import timber.log.Timber.d
|
||||
|
||||
|
||||
class AjustesViewModel(context: Context) : BaseViewModel() {
|
||||
|
||||
private val contextApp=context
|
||||
|
||||
private val contextApp = context
|
||||
|
||||
private val getAjustesUserCase: GetAjustesUserCase = GetAjustesUserCase(context)
|
||||
private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase(context)
|
||||
private val getItemCardUserCase: GetItemCardUserCase = GetItemCardUserCase(context)
|
||||
|
||||
val version: String = "5.0.0"
|
||||
|
||||
|
@ -38,9 +41,9 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
|||
val sectorList: LiveData<SectorListVO>
|
||||
get() = _sectorList
|
||||
|
||||
private val _workerupdateSector by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val workerupdateSector: LiveData<ResponseItemVO>
|
||||
get() = _workerupdateSector
|
||||
private val _actionUpdate by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val actionUpdate: LiveData<ResponseItemVO>
|
||||
get() = _actionUpdate
|
||||
|
||||
private val _workerupdatePrinter by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val workerupdatePrinter: LiveData<ResponseItemVO>
|
||||
|
@ -48,17 +51,36 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
|||
|
||||
private val _printerList by lazy { MutableLiveData<PrintersList>() }
|
||||
val printerList: LiveData<PrintersList>
|
||||
get
|
||||
() = _printerList
|
||||
get() = _printerList
|
||||
|
||||
private val _operatorGetNumberOfWagons by lazy { MutableLiveData<ResponseItemNumber>() }
|
||||
val operatorGetNumberOfWagons: LiveData<ResponseItemNumber>
|
||||
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 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(
|
||||
sectorDescrip: String,
|
||||
|
@ -67,8 +89,12 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
|||
carroDescrip: String,
|
||||
TypeTags: String,
|
||||
printerFk: Int,
|
||||
printerSelected: String
|
||||
printerSelected: String,
|
||||
train: String?,
|
||||
itemPackingType: String?,
|
||||
actionIsAllowed: Boolean
|
||||
) {
|
||||
_ajustesitem.clear()
|
||||
_ajustesitem.add(
|
||||
AjustesItemVO(
|
||||
0,
|
||||
|
@ -77,7 +103,8 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
|||
sectorFk,
|
||||
warehouseFk,
|
||||
0,
|
||||
printerSelected
|
||||
printerSelected,
|
||||
true
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -89,7 +116,8 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
|||
carroDescrip,
|
||||
0,
|
||||
0,
|
||||
0, contextApp.getString(R.string.printerWithout)
|
||||
0, contextApp.getString(R.string.printerWithout),
|
||||
false
|
||||
)
|
||||
)
|
||||
_ajustesitem.add(
|
||||
|
@ -99,19 +127,43 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
|||
printerSelected,
|
||||
0,
|
||||
0,
|
||||
printerFk, printerSelected
|
||||
printerFk,
|
||||
printerSelected,
|
||||
true
|
||||
)
|
||||
)
|
||||
_ajustesitem.add(
|
||||
AjustesItemVO(
|
||||
3,
|
||||
contextApp.getString(R.string.labelType),
|
||||
TypeTags,
|
||||
6,
|
||||
contextApp.getString(R.string.settingsTitleTrain),
|
||||
train,
|
||||
0,
|
||||
0,
|
||||
0, contextApp.getString(R.string.printerWithout)
|
||||
0,
|
||||
action=actionIsAllowed
|
||||
)
|
||||
)
|
||||
_ajustesitem.add(
|
||||
AjustesItemVO(
|
||||
7,
|
||||
contextApp.getString(R.string.settingsTitleItemPacking),
|
||||
itemPackingType,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
action=actionIsAllowed
|
||||
)
|
||||
)
|
||||
/* _ajustesitem.add(
|
||||
AjustesItemVO(
|
||||
3,
|
||||
contextApp.getString(R.string.labelType),
|
||||
TypeTags,
|
||||
0,
|
||||
0,
|
||||
0, contextApp.getString(R.string.printerWithout)
|
||||
)
|
||||
)*/
|
||||
_ajustesitem.add(
|
||||
AjustesItemVO(
|
||||
4,
|
||||
|
@ -119,7 +171,8 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
|||
"",
|
||||
0,
|
||||
0,
|
||||
0, contextApp.getString(R.string.printerWithout)
|
||||
0, contextApp.getString(R.string.printerWithout),
|
||||
true
|
||||
)
|
||||
)
|
||||
_ajustesitem.add(
|
||||
|
@ -129,44 +182,84 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
|||
"",
|
||||
0,
|
||||
0,
|
||||
0, contextApp.getString(R.string.printerWithout)
|
||||
0, contextApp.getString(R.string.printerWithout),
|
||||
true
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
/* fun getSectors(user: String, password: String) {
|
||||
getAjustesUserCase.getSectors(user, password)
|
||||
.enqueue(object : Callback<List<SectorItemVO>> {
|
||||
override fun onFailure(call: Call<List<SectorItemVO>>, t: Throwable) {
|
||||
val listError: ArrayList<SectorItemVO> = ArrayList()
|
||||
listError.add(SectorItemVO(0, "", 0, true, t.message!!))
|
||||
_sectorList.value = SectorListVO(listError)
|
||||
}
|
||||
/* fun getSectors(user: String, password: String) {
|
||||
getAjustesUserCase.getSectors(user, password)
|
||||
.enqueue(object : Callback<List<SectorItemVO>> {
|
||||
override fun onFailure(call: Call<List<SectorItemVO>>, t: Throwable) {
|
||||
val listError: ArrayList<SectorItemVO> = ArrayList()
|
||||
listError.add(SectorItemVO(0, "", 0, true, t.message!!))
|
||||
_sectorList.value = SectorListVO(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<SectorItemVO>>,
|
||||
response: Response<List<SectorItemVO>>
|
||||
) {
|
||||
if (response.body() != null) {
|
||||
_sectorList.value = response.body()?.let { SectorListVO(it) }
|
||||
} else {
|
||||
val listError: ArrayList<SectorItemVO> = ArrayList()
|
||||
listError.add(
|
||||
SectorItemVO(
|
||||
0,
|
||||
"",
|
||||
0,
|
||||
true,
|
||||
"Error en la llamada sector_get"
|
||||
override fun onResponse(
|
||||
call: Call<List<SectorItemVO>>,
|
||||
response: Response<List<SectorItemVO>>
|
||||
) {
|
||||
if (response.body() != null) {
|
||||
_sectorList.value = response.body()?.let { SectorListVO(it) }
|
||||
} else {
|
||||
val listError: ArrayList<SectorItemVO> = ArrayList()
|
||||
listError.add(
|
||||
SectorItemVO(
|
||||
0,
|
||||
"",
|
||||
0,
|
||||
true,
|
||||
"Error en la llamada sector_get"
|
||||
)
|
||||
)
|
||||
_sectorList.value = SectorListVO(listError)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}*/
|
||||
|
||||
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()
|
||||
)
|
||||
)
|
||||
_sectorList.value = SectorListVO(listError)
|
||||
}
|
||||
)
|
||||
_itemspackinglist.value = ItemPackingTypeList(listError)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}*/
|
||||
})
|
||||
}
|
||||
|
||||
fun getSectorsSalix(token: String) {
|
||||
getAjustesUserCase.getSectorsSalix(token).enqueue(object : Callback<List<SectorItemVO>> {
|
||||
|
@ -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) {
|
||||
|
||||
getAjustesUserCase.worker_updateSector(user, password, sectorFk)
|
||||
.enqueue(object : Callback<Unit> {
|
||||
override fun onFailure(call: Call<Unit>, t: Throwable) {
|
||||
|
||||
_workerupdateSector.value = ResponseItemVO(
|
||||
_actionUpdate.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
|
@ -249,7 +374,7 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
|||
) {
|
||||
|
||||
if (!response.isSuccessful) {
|
||||
_workerupdateSector.value = ResponseItemVO(
|
||||
_actionUpdate.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
|
@ -257,7 +382,47 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
|||
)
|
||||
)
|
||||
} 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(),
|
||||
isError = false,
|
||||
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) {
|
||||
//d("La impresora marcada " + printerFk)
|
||||
getAjustesUserCase.worker_updatePrinter(user, password, printerFk)
|
||||
|
@ -340,7 +616,8 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
|||
_workerupdatePrinter.value = ResponseItemVO(
|
||||
response = response.message(),
|
||||
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
|
||||
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
||||
|
||||
class AjustesItemVO (
|
||||
var id: Int,
|
||||
var title: String = "",
|
||||
var selected: String = "",
|
||||
var selected: String? = "",
|
||||
var sectorFk : Int?,
|
||||
var warehouse: Int?,
|
||||
var printerFk:Int?,
|
||||
var printerSelected:String=""
|
||||
var printerSelected:String="",
|
||||
var action:Boolean
|
||||
)
|
||||
|
||||
class SectorItemVO (
|
||||
|
@ -36,3 +39,14 @@ class Printers(
|
|||
class WorkerPrintersList(
|
||||
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.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.google.gson.Gson
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentItemCardBinding
|
||||
import es.verdnatura.domain.toast
|
||||
|
@ -131,9 +132,11 @@ class ItemCardFragment(
|
|||
//getItemCard(itemFk)
|
||||
|
||||
// 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(
|
||||
PasillerosItemVO(title = getString(R.string.titleWebViewer),
|
||||
), entryPoint = itemInfoG!!.id)
|
||||
), entryPoint = entryPoint)
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ class BufferLoadFragment(
|
|||
// sergio: viene de la bbdd así
|
||||
if (it.response.equals(getString(R.string.registerAdded))){
|
||||
|
||||
ma.messageWithSound(it.response,false,true)
|
||||
it.response?.let { it1 -> ma.messageWithSound(it1,false,true) }
|
||||
}else{
|
||||
mperror?.start()
|
||||
it.response.toast(requireContext())
|
||||
|
|
|
@ -110,7 +110,9 @@ class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(Buyer
|
|||
sectorFk = 0,
|
||||
warehouse = 0,
|
||||
printerFk=0,
|
||||
printerSelected ="")
|
||||
printerSelected ="",
|
||||
action=false
|
||||
)
|
||||
)
|
||||
}catch (e:Exception){}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import android.net.Uri
|
|||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.speech.SpeechRecognizer
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.view.View.GONE
|
||||
import android.view.View.VISIBLE
|
||||
|
@ -17,6 +16,7 @@ import android.view.inputmethod.EditorInfo
|
|||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.ImageView
|
||||
import android.widget.Toast
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
|
@ -101,6 +101,8 @@ class CollectionFragment(
|
|||
private var originalItemScan: String = ""
|
||||
private var workerFkFromTicket = ""
|
||||
|
||||
private var itemShelvingTracking_mark:String=""
|
||||
|
||||
companion object {
|
||||
fun newInstance(collection: CollectionVO, type: String) =
|
||||
CollectionFragment(collection, type)
|
||||
|
@ -764,6 +766,7 @@ class CollectionFragment(
|
|||
})
|
||||
|
||||
responseSaleReplace.observe(viewLifecycleOwner, Observer {
|
||||
binding.splashProgress.visibility=GONE
|
||||
|
||||
if (it.isError) {
|
||||
|
||||
|
@ -775,15 +778,44 @@ class CollectionFragment(
|
|||
|
||||
|
||||
} else {
|
||||
/* viewModel.saleTrackingDel(
|
||||
getData(USER),
|
||||
getData(PASSWORD),
|
||||
saleFk = sales[positionUnmarked].saleFk
|
||||
)*/
|
||||
|
||||
saleAdapter!!.notifyDataSetChanged()
|
||||
setListPosition(storedPosition, 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 {
|
||||
|
||||
if (it.isError) {
|
||||
|
@ -1303,7 +1335,7 @@ class CollectionFragment(
|
|||
|
||||
}
|
||||
|
||||
|
||||
//Tarea #4371
|
||||
private fun markLine(position: Int, newType: String) {
|
||||
state = 0
|
||||
//////Log.i("VERDNATURA:","Marcamos linea y enviamos saleTracking")
|
||||
|
@ -1319,25 +1351,18 @@ class CollectionFragment(
|
|||
if (type == PRECHECKER) {
|
||||
sales[position].isPreControlled =
|
||||
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()
|
||||
setListPosition(position, false)
|
||||
|
||||
/* if (type != PRECHECKER) {
|
||||
saleTrackingReplace(position, newType)
|
||||
isMarking = true
|
||||
}
|
||||
*/
|
||||
// sergio
|
||||
/* if (type == PRECHECKER) {
|
||||
saleTrackingReplace(position, newType)
|
||||
}*/
|
||||
|
||||
saleTrackingReplace(position, newType)
|
||||
if (type==SACADOR){
|
||||
saleTracking_mark(position, newType)
|
||||
//saleTrackingReplace(position,newType)
|
||||
}else{
|
||||
saleTrackingReplace(position,newType)
|
||||
}
|
||||
isMarking = true
|
||||
setTotalLines()
|
||||
}
|
||||
|
@ -1368,7 +1393,9 @@ class CollectionFragment(
|
|||
|
||||
private fun saleTrackingReplace(position: Int, type: String) {
|
||||
|
||||
viewModel.saleTrackingReplace(
|
||||
//Tarea #4371 se quita para ver si funciona correctamente
|
||||
binding.splashProgress.visibility=VISIBLE
|
||||
viewModel.saleTrackingReplace(
|
||||
getData(USER),
|
||||
getData(PASSWORD),
|
||||
saleFk = sales[position].saleFk,
|
||||
|
@ -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) {
|
||||
state = 0
|
||||
if (sales[position].isPrepared == "1") {
|
||||
|
@ -1685,6 +1734,7 @@ class CollectionFragment(
|
|||
return false
|
||||
}
|
||||
|
||||
//Tarea #4371
|
||||
private fun onQuantityOfShelvingSelected(itemShelvingFk: String, quantity: String = "0") {
|
||||
//1 - MODIFICAR CANTIDAD DEL CARRO
|
||||
try {
|
||||
|
@ -1702,15 +1752,15 @@ class CollectionFragment(
|
|||
sales[storedPosition].placements[storedShelvingPosition].visible =
|
||||
"(" + (shelvingVisible.toInt() - quantity.toInt()).toString() + ")"
|
||||
}
|
||||
|
||||
viewModel.itemShelvingSaleSupplyAdd(
|
||||
//Tarea #4371 se quita para ver si funciona correctamente
|
||||
/*viewModel.itemShelvingSaleSupplyAdd(
|
||||
getData(USER),
|
||||
getData(PASSWORD),
|
||||
itemShelvingFk = itemShelvingFk,
|
||||
saleFk = sales[storedPosition].saleFk,
|
||||
quantity = if (quantity != "0") quantity else customDialogList.getValue()
|
||||
|
||||
)
|
||||
)*/
|
||||
|
||||
|
||||
} catch (e: Exception) {
|
||||
|
@ -1731,6 +1781,10 @@ class CollectionFragment(
|
|||
}
|
||||
|
||||
//3- MARCAR LINEA
|
||||
|
||||
//Tarea #4371
|
||||
itemShelvingTracking_mark = itemShelvingFk
|
||||
|
||||
if (sales[storedPosition].pickedQuantity != sales[storedPosition].quantity) {
|
||||
sales[storedPosition].isPrepared = "1"
|
||||
markLine(storedPosition, OK)
|
||||
|
|
|
@ -56,6 +56,9 @@ class CollectionViewModel(context: Context) : BaseViewModel() {
|
|||
val responseSaleReplace: LiveData<ResponseItemVO>
|
||||
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>() }
|
||||
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(
|
||||
usuario: String,
|
||||
|
@ -306,6 +354,7 @@ class CollectionViewModel(context: Context) : BaseViewModel() {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
fun collectionStickerPrint(
|
||||
usuario: String,
|
||||
password: String,
|
||||
|
|
|
@ -15,6 +15,7 @@ fun CollectionVO.map(context: Context): CollectionVO {
|
|||
ticket.sales.forEach {
|
||||
it.ticketFk = ticket.ticketFk
|
||||
it.level = ticket.level
|
||||
it.rgb = it.rgb
|
||||
it.salePersonFk = ticket.salesPersonFk
|
||||
it.agencyName = ticket.agencyName
|
||||
it.isNew = it.isAdded == "1"
|
||||
|
@ -66,6 +67,8 @@ fun CollectionVO.map(context: Context): CollectionVO {
|
|||
it.placements = listOf()
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.graphics.drawable.Drawable
|
|||
import android.os.Build
|
||||
import android.print.PrintAttributes
|
||||
import android.print.PrintManager
|
||||
import android.util.Log
|
||||
import android.webkit.WebChromeClient
|
||||
import android.webkit.WebView
|
||||
import android.widget.ImageView
|
||||
|
@ -18,6 +19,7 @@ import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
|||
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
import org.json.JSONObject
|
||||
|
||||
|
||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||
|
@ -58,20 +60,15 @@ class WebFragment(
|
|||
webSettings.setSupportZoom(true)
|
||||
//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() {
|
||||
|
||||
binding.mainToolbar.toolbarTitle.text = getString(R.string.item)+entryPoint
|
||||
// binding.splashProgress.visibility= View.GONE
|
||||
binding.mainToolbar.toolbarTitle.text = getString(R.string.item)+JSONObject(entryPoint).get("entryPoint").toString()
|
||||
|
||||
val listIcons: ArrayList<ImageView> = ArrayList()
|
||||
val iconPrint = ImageView(context)
|
||||
|
|
|
@ -35,6 +35,7 @@ class itemShelvingLogFragment(
|
|||
|
||||
customDialog = CustomDialog(requireContext())
|
||||
// customDialogList = CustomDialogList(requireContext())
|
||||
|
||||
setEvents()
|
||||
setToolBar(getString(R.string.itemShelvingLog))
|
||||
super.init()
|
||||
|
|
|
@ -1,25 +1,29 @@
|
|||
package es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment
|
||||
|
||||
import android.util.Base64.encodeToString
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.google.gson.Gson
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentShelvinglogBinding
|
||||
import es.verdnatura.domain.notNull
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
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.main.activity.MainActivity
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
import java.net.URLEncoder
|
||||
|
||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||
class shelvingLogFragment(
|
||||
var entryPoint: String = ""
|
||||
|
||||
) : BaseFragment<FragmentShelvinglogBinding, shelvingLogViewModel>(
|
||||
shelvingLogViewModel::class) {
|
||||
// private lateinit var customDialogList: CustomDialogList
|
||||
) : BaseFragment<FragmentShelvinglogBinding, shelvingLogViewModel>(
|
||||
shelvingLogViewModel::class
|
||||
) {
|
||||
// private lateinit var customDialogList: CustomDialogList
|
||||
private var adapter: ShelvingLogAdapter? = null
|
||||
private var itemScan = ""
|
||||
|
||||
|
@ -34,7 +38,8 @@ class shelvingLogFragment(
|
|||
override fun init() {
|
||||
|
||||
customDialog = CustomDialog(requireContext())
|
||||
// customDialogList = CustomDialogList(requireContext())
|
||||
// customDialogList = CustomDialogList(requireContext())
|
||||
binding.linearHeader.visibility=View.GONE
|
||||
setEvents()
|
||||
setToolBar(getString(R.string.shelvingLog))
|
||||
super.init()
|
||||
|
@ -45,7 +50,6 @@ class shelvingLogFragment(
|
|||
binding.mainToolbar.toolbarTitle.text = title
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun setEvents() {
|
||||
|
@ -72,11 +76,16 @@ class shelvingLogFragment(
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private fun shelvingLog_get(vShelvingFK: String) {
|
||||
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\"}}"
|
||||
|
||||
}
|
||||
|
||||
|
@ -84,23 +93,24 @@ class shelvingLogFragment(
|
|||
override fun observeViewModel() {
|
||||
with(viewModel) {
|
||||
|
||||
loadShelvingLogList.observe(viewLifecycleOwner, Observer{ event ->
|
||||
loadShelvingLogList.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)
|
||||
binding.itemshelvinglogRecyclerview.layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
setToolBar(getString(R.string.shelvingLog) + ":" + itemScan)
|
||||
|
||||
if (it.list.isEmpty()){
|
||||
if (it.list.isEmpty()) {
|
||||
customDialog.setTitle(getString(R.string.noResults))
|
||||
.setDescription(getString(R.string.noDataLabelScanned))
|
||||
.setOkButton(getString(R.string.close)) {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
}else{
|
||||
} else {
|
||||
|
||||
if (it.list.get(0).isError){
|
||||
if (it.list.get(0).isError) {
|
||||
customDialog.setTitle(getString(R.string.error))
|
||||
.setDescription(it.list.get(0).errorMessage)
|
||||
.setOkButton(getString(R.string.close)) {
|
||||
|
@ -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 androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
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.view.feature.historicoshelvinglog.model.ShelvingLog
|
||||
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.Callback
|
||||
import retrofit2.Response
|
||||
|
@ -21,33 +24,49 @@ class shelvingLogViewModel(context: Context) : BaseViewModel() {
|
|||
itemShelvingLogUSerCase(context)
|
||||
|
||||
private val _itemShelvingLogList by lazy { MutableLiveData<ShelvingLogList>() }
|
||||
|
||||
|
||||
val loadShelvingLogList = Transformations.map(_itemShelvingLogList) { Event(it) }
|
||||
|
||||
private val _itemShelvingLogSalixList by lazy { MutableLiveData<ShelvingLogSalixList>() }
|
||||
val loadShelvingLogSalixList = Transformations.map(_itemShelvingLogSalixList) { Event(it) }
|
||||
|
||||
fun shelvingLog_get(usuario:String,password:String,vShelvingFK: String){
|
||||
itemShelvingLogUSerCase.shelvingLog_get(usuario,password,vShelvingFK).enqueue(object :
|
||||
private val _shelvingResponse by lazy { MutableLiveData<ShelvingLogSalix>() }
|
||||
val shelvingResponse: LiveData<ShelvingLogSalix>
|
||||
get() = _shelvingResponse
|
||||
|
||||
fun shelvingLog_get(usuario: String, password: String, vShelvingFK: String) {
|
||||
itemShelvingLogUSerCase.shelvingLog_get(usuario, password, vShelvingFK).enqueue(object :
|
||||
Callback<List<ShelvingLog>> {
|
||||
override fun onFailure(call: Call<List<ShelvingLog>>, t: Throwable) {
|
||||
val listError:ArrayList<ShelvingLog> = ArrayList()
|
||||
listError.add(ShelvingLog(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
|
||||
val listError: ArrayList<ShelvingLog> = ArrayList()
|
||||
listError.add(
|
||||
ShelvingLog(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
)
|
||||
_itemShelvingLogList.value = ShelvingLogList(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<ShelvingLog>>,
|
||||
response: Response<List<ShelvingLog>>
|
||||
) {
|
||||
) {
|
||||
|
||||
if (!response.isSuccessful){
|
||||
val listError:ArrayList<ShelvingLog> = ArrayList()
|
||||
listError.add(ShelvingLog(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
|
||||
if (!response.isSuccessful) {
|
||||
val listError: ArrayList<ShelvingLog> = ArrayList()
|
||||
listError.add(
|
||||
ShelvingLog(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
)
|
||||
_itemShelvingLogList.value = ShelvingLogList(listError)
|
||||
}else{
|
||||
} else {
|
||||
|
||||
if (response.body() != null)
|
||||
{
|
||||
if (response.body() != null) {
|
||||
_itemShelvingLogList.value = response.body()?.let {
|
||||
ShelvingLogList(it)
|
||||
}
|
||||
|
@ -62,8 +81,55 @@ 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)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,16 +2,31 @@ package es.verdnatura.presentation.view.feature.historicoshelvinglog.model
|
|||
|
||||
|
||||
class ShelvingLog(
|
||||
var id:String = "",
|
||||
var originFk:String = "",
|
||||
var name:String = "",
|
||||
var creationDate:String = "",
|
||||
var description:String = "",
|
||||
var isError:Boolean = false,
|
||||
var errorMessage:String = ""
|
||||
)
|
||||
|
||||
var id: String = "",
|
||||
var originFk: String = "",
|
||||
var name: String = "",
|
||||
var creationDate: String = "",
|
||||
var description: String = "",
|
||||
var isError: Boolean = false,
|
||||
var errorMessage: String = ""
|
||||
)
|
||||
|
||||
|
||||
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) -> {
|
||||
// el entryPoint de WebFragment se le pasa un JSON del tipo {"entryPoint":"itemScanned","web":"www.google.com}
|
||||
addFragmentOnTop(WebFragment.newInstance(entryPoint))
|
||||
}
|
||||
//Menu qr
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
package es.verdnatura.presentation.view.feature.paletizador.fragment
|
||||
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentExpeditionscanSorterBinding
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.itemScanned
|
||||
import es.verdnatura.presentation.view.component.CustomDialogInputTwoValues
|
||||
import org.json.JSONObject
|
||||
|
||||
class CmrExpeditionPalletFragment(
|
||||
var title: String = ""
|
||||
|
@ -16,6 +19,7 @@ class CmrExpeditionPalletFragment(
|
|||
override fun getLayoutId(): Int = R.layout.fragment_expeditionscan_sorter
|
||||
private lateinit var customDialogList: CustomDialogInputTwoValues
|
||||
private var itemScaned: String = ""
|
||||
private lateinit var dataScanned: itemScanned
|
||||
|
||||
companion object {
|
||||
fun newInstance(title: String) = CmrExpeditionPalletFragment(title)
|
||||
|
@ -66,12 +70,17 @@ class CmrExpeditionPalletFragment(
|
|||
|
||||
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()
|
||||
|
||||
} else {
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
ma.messageWithSound(getString(R.string.added), false, true)
|
||||
ma.messageWithSound(getString(R.string.operationSuccess), false, true)
|
||||
showExpeditionPalletScan()
|
||||
|
||||
}
|
||||
|
@ -123,11 +132,20 @@ class CmrExpeditionPalletFragment(
|
|||
.isNotEmpty()
|
||||
) {
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
customDialogList.setValueTwo("")
|
||||
cmrExpeditionPallet_add(
|
||||
customDialogList.getValue(),
|
||||
customDialogList.getValueTwo()
|
||||
)
|
||||
|
||||
if (itemScanedIsCMR(customDialogList.getValueTwo())) {
|
||||
itemScaned = dataScanned.value
|
||||
customDialogList.setValueTwo("")
|
||||
cmrExpeditionPallet_add(
|
||||
customDialogList.getValue(),
|
||||
itemScaned
|
||||
)
|
||||
} else {
|
||||
customDialogList.setValueTwo("")
|
||||
ma.messageWithSound(getString(R.string.errorCmrNotScanned), true, true, isToasted = 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(
|
||||
8,
|
||||
R.drawable.ic_baseline_star_24,
|
||||
|
@ -247,7 +248,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
|
|||
R.string.titleQualityDescrip
|
||||
)
|
||||
)
|
||||
)
|
||||
)*/
|
||||
|
||||
}
|
||||
|
||||
|
@ -298,7 +299,8 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
|
|||
contextApp.getString(R.string.titleExpeditionDescrip)
|
||||
)
|
||||
)
|
||||
/*
|
||||
|
||||
//Tarea #3986
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
31,
|
||||
|
@ -307,7 +309,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
|
|||
R.string.titleCMRState,
|
||||
contextApp.getString(R.string.titleCMRDescrip)
|
||||
)
|
||||
)*/
|
||||
)
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
40,
|
||||
|
|
|
@ -7,4 +7,5 @@ class PasillerosItemVO(
|
|||
val titleToShow: Int = 0,
|
||||
val description: String = ""
|
||||
|
||||
|
||||
)
|
|
@ -21,6 +21,7 @@ fun PreSacadorItemVO.toSale() : SaleVO {
|
|||
agencyName = if (trabajador.isNullOrEmpty()) { "" } else trabajador,
|
||||
packingType=packingType,
|
||||
salePersonFk=if (salesPersonFk.isNullOrEmpty()){""}else salesPersonFk,
|
||||
rgb= ""
|
||||
|
||||
|
||||
)
|
||||
|
@ -42,7 +43,8 @@ fun PreSacadorItemVO.toSaleReposicion() : SaleVO {
|
|||
workerFk = if (trabajador.isNullOrEmpty()) { "0" } else trabajador,
|
||||
originalQuantity = quantity.toString(),
|
||||
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 pickingOrder: Int = 0,
|
||||
var salesPersonFk: String = "",
|
||||
var rgb:String?=null,
|
||||
|
||||
var reference: String = ""
|
||||
)
|
||||
|
|
|
@ -65,7 +65,7 @@ class SacadorFragment :
|
|||
)
|
||||
|
||||
} else {
|
||||
val working_in_test = false //sergio: Ok en app
|
||||
val working_in_test = true //sergio: Ok en app
|
||||
if (!working_in_test) {
|
||||
viewModel.collectionGetSalix(token = getData(TOKEN))
|
||||
} else {
|
||||
|
@ -139,12 +139,19 @@ class SacadorFragment :
|
|||
binding.splashProgress.visibility = View.VISIBLE
|
||||
// checkTagsMode()
|
||||
//Tarea 4351 cambiar getData(WAGON) por getData(NUMBEROFWAGONS)
|
||||
|
||||
//Tarea 4130
|
||||
viewModel.collectionNew(
|
||||
getData(USER),
|
||||
getData(PASSWORD),
|
||||
getData(SECTORFK),
|
||||
getData(NUMBEROFWAGONS)
|
||||
)
|
||||
/* viewModel.collection_assign(
|
||||
getData(USER),
|
||||
getData(PASSWORD),
|
||||
)*/
|
||||
|
||||
}
|
||||
iconVehicleIn.drawable -> ma.onVehicleSelected(SacadorFragment.TAG)
|
||||
}
|
||||
|
@ -234,7 +241,7 @@ class SacadorFragment :
|
|||
goBack = false
|
||||
//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) {
|
||||
viewModel.collectionGetSalix(token = getData(TOKEN))
|
||||
} 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){
|
||||
getSacadorControladorUserCase.collectionNewSmarttag(usuario, password, sectorFk, wagons,tagtype).enqueue(
|
||||
object :
|
||||
|
|
|
@ -10,21 +10,25 @@ class CollectionVO(
|
|||
var tickets: List<TicketVO> = listOf(),
|
||||
var isError: Boolean = false,
|
||||
var errorMessage: String = "",
|
||||
var itemPackingTypeFk: String = ""
|
||||
var itemPackingTypeFk: String = "",
|
||||
var rgb: String? = null
|
||||
)
|
||||
|
||||
class TicketVO(
|
||||
var ticketFk: String = "",
|
||||
var level: String = "",
|
||||
var rgb: String = "",
|
||||
var agencyName: String = "",
|
||||
var salesPersonFk: String = "",
|
||||
var sales: List<SaleVO> = listOf(),
|
||||
var observations: String = "",
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
class SaleVO(
|
||||
var ticketFk: String = "",
|
||||
var level: String = "",
|
||||
var rgb: String = "",
|
||||
var agencyName: String = "",
|
||||
var saleOrder: Int = 9999,
|
||||
var saleFk: String = "",
|
||||
|
@ -65,6 +69,7 @@ class SaleVO(
|
|||
|
||||
var picked: String = "",
|
||||
|
||||
|
||||
)
|
||||
|
||||
class PlacementVO(
|
||||
|
|
|
@ -41,54 +41,55 @@
|
|||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearHeader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="@dimen/layout_margin_min"
|
||||
android:layout_marginBottom="@dimen/layout_margin_1"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/layout_margin_min"
|
||||
android:paddingRight="@dimen/layout_margin_min">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Usuario"
|
||||
android:textSize="@dimen/body2"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="@dimen/layout_margin_min"
|
||||
android:text="Usuario"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
|
||||
android:gravity="center"/>
|
||||
android:textSize="@dimen/body2" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Fecha"
|
||||
android:textSize="@dimen/body2"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"/>
|
||||
android:gravity="center"
|
||||
android:text="Fecha"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/body2" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Parking"
|
||||
android:textSize="@dimen/body2"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:layout_weight="1.25"
|
||||
android:gravity="right"
|
||||
android:visibility="gone"/>
|
||||
android:text="Parking"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/body2"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="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: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>
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
<string name="Sinsector">Sin sector</string>
|
||||
<string name="Close">Cerrar</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="titleCorridors">Pasilleros</string>
|
||||
<string name="titleControllers">Controladores</string>
|
||||
|
@ -75,7 +76,7 @@
|
|||
<string name="Coleccióncompleta">Colección completa</string>
|
||||
<string name="Parking">Parking</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="updatemng">Existe una versión nueva, es recomendable actualizar.</string>
|
||||
<string name="Actualizar">Actualizar</string>
|
||||
|
@ -149,10 +150,11 @@
|
|||
<string name="buscarDepartamento">Buscar departamento</string>
|
||||
<string name="Noprinters">No hay 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="claims">Reclamaciones</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="itemCard">Artículo info</string>
|
||||
<string name="noResults">Sin resultados</string>
|
||||
|
@ -382,6 +384,8 @@
|
|||
<string name="wagoons">Carros</string>
|
||||
<string name="printerWithout">Sin impresora</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="vehicleControl">Control de vehículos</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="messageConfirm">¿Estás seguro que deseas eliminar?</string>
|
||||
<string name="itemFilter">Filtro ítem</string>
|
||||
<string name="itemUpdated">Actualizado</string>
|
||||
<string name="errorCmrNotScanned">CMR no escaneado</string>
|
||||
</resources>
|
||||
|
|
|
@ -292,7 +292,9 @@
|
|||
<string name="visible">Visible:</string>
|
||||
<string name="visibleTotal"> Total visible: </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="base_urlSalix">base_urlSalix</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="palletScanError">Repeat again. Pallet does not received:</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>
|
||||
|
|
Loading…
Reference in New Issue