Version 8, impresora obligatoria, controlador se desplaza al pulsar, Ubicar Reclamación y líneas controlador = orden saca el sacador

This commit is contained in:
Sergio De la torre 2022-04-06 10:51:00 +02:00
parent 212879f340
commit f0ba03db3d
36 changed files with 368 additions and 113 deletions

View File

@ -48,6 +48,7 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_baseline_star_24.xml" value="0.1775" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_build_black_24dp.xml" value="0.22708333333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_chevron_right_black_24dp.xml" value="0.1775" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_claims.xml" value="0.2425" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_dashboard_black_24dp.xml" value="0.1775" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_delete_black_24dp.xml" value="0.15052083333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_delete_forever_black_24dp.xml" value="0.15052083333333333" />
@ -122,6 +123,7 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_expeditionscan_sorter.xml" value="0.196875" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_expeditionstate.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_faltas.xml" value="0.1793478260869565" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_general_black.xml" value="0.20878623188405798" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_historico.xml" value="0.1734375" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_historicovehiculo.xml" value="0.23052536231884058" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_inventary.xml" value="0.11271529888551166" />

View File

@ -14,11 +14,8 @@ android {
applicationId "es.verdnatura"
minSdkVersion 21
targetSdkVersion 30
versionCode 107
versionName "7.9" //VERSION CODE 107 Seleccionar impresora para imprimir
//versionName "7.8" //VERSION CODE 106 Previa final,tiene en cuenta si hay varios carros donde coger,,
//versionName "7.7.2" //VERSION CODE 105 Previa final , si se pone a 0 un artículo se revisa el total de líneas
versionCode 109 //para pruebas sacadores
versionName "8" //VERSION CODE 109, obligado seleccionar impresora, controlador sube el recyclerViewer, controlador ordenado por picked, mensaje error a collectioNew
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 107,
"versionName": "7.9",
"versionCode": 109,
"versionName": "8",
"outputFile": "app-release.apk"
}
],

Binary file not shown.

View File

@ -6,6 +6,7 @@ import es.verdnatura.presentation.view.feature.buffer.fragment.BufferFragmentVie
import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemViewModel
import es.verdnatura.presentation.view.feature.calidad.fragment.BuyersViewModel
import es.verdnatura.presentation.view.feature.calidad.fragment.QaualityViewModel
import es.verdnatura.presentation.view.feature.claim.fragment.ClaimViewModel
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionViewModel
import es.verdnatura.presentation.view.feature.controlador.fragment.ControladorViewModel
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoViewModel
@ -48,7 +49,7 @@ val viewModelModule = module {
// Pasilleros
viewModel {
PasilleroViewModel(androidContext())
PasilleroViewModel()
}
//Pasilleros Dia de venta
viewModel {
@ -187,5 +188,8 @@ val viewModelModule = module {
viewModel {
shelvingLogViewModel(androidContext())
}
viewModel {
ClaimViewModel(androidContext())
}
}

View File

@ -4,10 +4,10 @@ import retrofit2.converter.gson.GsonConverterFactory
class ApiNodeJsUtils {
companion object {
//const val BASE_URL:String = "http://192.168.1.108:8000/"
const val BASE_URL:String = "https://smart-tag.verdnatura.es"
const val BASE_URL:String = "https://smart-tag.verdnatura.es"
//const val BASE_URL:String = "http://192.168.1.154:7777"
fun getApiService():NodeJsService{
val nodeJsRetrofit = Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(
GsonConverterFactory.create()).build()

View File

@ -6,7 +6,7 @@ import retrofit2.converter.gson.GsonConverterFactory
class ApiSalixUtils {
companion object {
//const val BASE_URL:String = "http://192.168.1.155:9009/"
// const val BASE_URL: String = "https://test-salix.verdnatura.es/api/"
//const val BASE_URL: String = "https://test-salix.verdnatura.es/api/"
const val BASE_URL: String = "https://salix.verdnatura.es/api/"
fun getApiService(): SalixService {
val salixRetrofit = Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(

View File

@ -1,6 +1,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.login.model.*
import retrofit2.Call
@ -113,8 +114,13 @@ params.add(nameApp)
return restClient!!.getVersion("json", "1", usuario, password, "application/json", params)
}
fun worker_getSector(usuario: String, password: String): Call<SectorItemVO> {
//val params: ArrayList<String> = ArrayList()
return restClient!!.worker_getSector("json", "1", usuario, password, "application/json")
}
fun worker_getPrinter(usuario: String, password: String): Call<List<Printers>> {
return restClient!!.worker_getPrinter("json", "1", usuario, password, "application/json")
}
}

View File

@ -254,6 +254,30 @@ class GetPaletizadoresUserCase(context: Context) : RestClient(context) {
params
)
}
fun expeditionState_addByPallet(
usuario: String,
password: String,
vPalletFk: String,
vStateCode:String
): Call<Unit> {
val params: ArrayList<String> = ArrayList()
params.add(vPalletFk)
params.add(vStateCode)
return restClient!!.expeditionState_addByPallet(
"json",
"1",
usuario,
password,
"application/json",
params
)
}
fun expeditionLoading_add(
usuario: String,
password: String,

View File

@ -49,6 +49,10 @@ class GetWokerMistakeUSerCase(context: Context) : RestClient(context) {
fun department_getHasMistake(usuario: String, password: String): Call<List<DepartmentMistake>> {
return restClient!!.department_getHasMistake("json", "1", usuario, password, "application/json")
}
fun department_getHasMistakeSalix(usuario: String, password: String): Call<List<DepartmentMistake>> {
return salixClient!!.department_getHasMistake("json", "1", usuario, password, "application/json")
}
fun worker_getFromHasMistake(usuario: String, password: String, department:String): Call<List<WorkerFromMistake>> {
val params: ArrayList<String> = ArrayList()

View File

@ -13,7 +13,6 @@ interface NodeJsService {
//NODEJS TEST
//@FormUrlEncoded
@GET("/bindShelving/{smarttag}&{shelvingFK}&{height}")
fun bindShelving(
@Header("Content-Type") content_type: String,

View File

@ -5,6 +5,7 @@ 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
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake
import retrofit2.Call
import retrofit2.http.Body
import retrofit2.http.GET
@ -56,4 +57,20 @@ interface SalixService {
):
Call<List<CollectionVO>>
//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("api/Departments")
fun department_getHasMistake(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String,
):
Call<List<DepartmentMistake>>
}

View File

@ -125,6 +125,17 @@ interface VerdnaturaService {
):
Call<List<Printers>>
@POST("almacennew/worker_getPrinter")//REVISADA
fun worker_getPrinter(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String
):
Call<List<Printers>>
@POST("almacennew/worker_updatePrinter")//REVISADA
fun worker_updatePrinter(
@Header("aplicacion") aplicacion: String,
@ -1262,6 +1273,18 @@ interface VerdnaturaService {
):
Call<String>
@POST("almacennew/expeditionState_addByPallet")//REVISADA
fun expeditionState_addByPallet(
@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/expeditionLoading_add")//REVISADA
fun expeditionLoading_add(
@Header("aplicacion") aplicacion: String,
@ -1318,6 +1341,17 @@ interface VerdnaturaService {
):
Call<Void>
@POST("almacennew/itemShelving_addByClaim")//REVISADA
fun itemShelving_addByClaim(
@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<Void>
@POST("almacennew/workerShelving_delete")//REVISADA
fun workerShelving_delete(
@Header("aplicacion") aplicacion: String,

View File

@ -638,6 +638,8 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
return list
}
}

View File

@ -9,7 +9,7 @@ import es.verdnatura.databinding.ItemGeneralRowBinding
class GeneralAdapter(
private val items: List<GeneralItem>,
private val OnGeneralItemRowClickListener: OnGeneralItemRowClickListener,
// private var showDelete: Boolean = true
// private var showDelete: Boolean = false
): RecyclerView.Adapter<GeneralAdapter.ItemHolder> () {
@ -38,9 +38,10 @@ class GeneralAdapter(
fun bind(item: GeneralItem) {
binding.apply {
this.item = item
/* if (showDelete) itemImage.visibility = View.VISIBLE
/*if (showDelete) itemImage.visibility = View.VISIBLE
else itemImage.visibility = View.GONE*/
itemTitle.visibility=View.GONE
itemCode.visibility=View.GONE
}
}
}

View File

@ -241,7 +241,7 @@ class AjustesFragment :
if (it.name.equals(selected)) {
val editor = prefs!!.edit()
editor.putString(PRINTERNAME, it.name)
editor.putInt(PRINTERFK, it.id)
editor.putInt(PRINTERFK, it.id!!)
editor.apply()
viewModel.ajustesitem.get(2).selected = it.name

View File

@ -1,5 +1,7 @@
package es.verdnatura.presentation.view.feature.ajustes.model
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
class AjustesItemVO (
var id: Int,
var title: String = "",
@ -26,9 +28,13 @@ class PrintersList (
)
class Printers(
var id: Int,
var id: Int?=null,
var name: String="",
val isError : Boolean = false,
var errorMessage : String = ""
)
)
class WorkerPrintersList(
var list:List<Printers> = listOf()
)

View File

@ -495,7 +495,8 @@ class CollectionFragment(
ma.messageWithSound(it.errorMessage, isError = true,true)
} else {
if (!goBack){ incresaseSuccesful()}else{goBack=false}
if (!goBack){ incresaseSuccesful()}else{
goBack=false}
}
})
@ -696,6 +697,12 @@ class CollectionFragment(
sales = salesList.sortedWith(compareBy({ it.saleOrder }))
if (type==CONTROLADOR){
sales = salesList.sortedWith(compareBy({ it.picked }))
/* for (s in sales){
Log.d("VERDNATURA::","El item es ${s.itemFk} y su picked ${s.picked} y saleorder ${s.saleOrder}")
}*/
}
//pruebas sergio
// sales = salesList.sortedWith(compareBy({it.placements.get(0).created}))
//sales = salesList.sortedWith(compareBy({it.placements.get(0).placement}))
@ -1056,7 +1063,7 @@ class CollectionFragment(
private fun setListPosition(position: Int, isFromBack: Boolean) {
storedPosition = position
if (type == SACADOR) {
if (type == SACADOR || type == CONTROLADOR) {
if (binding.fragmentSacadorCollections != null) {
binding.fragmentSacadorCollections.addViewObserver {
lm!!.scrollToPositionWithOffset(position, 0)
@ -1413,16 +1420,22 @@ class CollectionFragment(
//OPTIONS
private fun print() {
viewModel.collectionStickerPrint(
getData(USER),
getData(PASSWORD),
collectionFk = collection.collectionFk,
sectorFk = getData(SECTORFK),
"collectionStickerPrint"
)
if (ma.havePrinter()){
viewModel.collectionStickerPrint(
getData(USER),
getData(PASSWORD),
collectionFk = collection.collectionFk,
sectorFk = getData(SECTORFK),
"collectionStickerPrint"
)
(getString(R.string.Imprimiendo) + getData(PRINTERNAME)).toast(requireContext())
}else{
ma.messageWithSound("Falta seleccionar impresora.",isError = true,true,"Error al imprimir",false)
}
(getString(R.string.Imprimiendo) + " por " + getData(PRINTERNAME)).toast(requireContext())
}
private fun addItem() {

View File

@ -105,17 +105,23 @@ class CollectionShowTicketFragment(
}
private fun print() {
viewModel.collectionStickerPrint(
usuario = getData(USER),
password = getData(PASSWORD),
collectionFk = collection.collectionFk,
sectorFk = getData(SECTORFK),
"collectionStickerPrint"
)
(getString(R.string.Imprimiendo) + " por " + getData(PRINTERNAME)).toast(requireContext())
if (ma.havePrinter()) {
viewModel.collectionStickerPrint(
usuario = getData(USER),
password = getData(PASSWORD),
collectionFk = collection.collectionFk,
sectorFk = getData(SECTORFK),
"collectionStickerPrint"
)
(getString(R.string.Imprimiendo) + getData(PRINTERNAME)).toast(requireContext())
}else{
ma.messageWithSound("Falta seleccionar impresora",isError = true,true,"Error al imprimir",false)
}
}
private fun setEvents() {
binding.mainToolbar.backButton.setOnClickListener {

View File

@ -18,7 +18,6 @@ fun CollectionVO.map(): CollectionVO {
it.agencyName = ticket.agencyName
it.isNew = it.isAdded == "1"
// sergio: OBLIGAR A ACTUALIZAR VERSIÓN PARA SUBIR DESPUÉS FICHEROS DEL BACK collection_getTickets al mismo tiempo")
//it.quantity = it.quantity.substring(0, it.quantity.indexOf("."))

View File

@ -198,6 +198,9 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
fun department_getHasMistake(usuario: String, password: String)
{
var working_in_test=false
//getWorkerMistakeUserCase.department_getHasMistakeSalix(usuario, password)
getWorkerMistakeUserCase.department_getHasMistake(usuario, password)
.enqueue(object : Callback<List<DepartmentMistake>>
{

View File

@ -10,13 +10,15 @@ import android.net.Uri
import android.provider.Settings
import android.view.KeyEvent
import android.view.View
import androidx.lifecycle.Observer
import es.verdnatura.R
import es.verdnatura.databinding.FragmentLoginBinding
import es.verdnatura.domain.notNull
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.hideKeyboard
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import timber.log.Timber.d
import java.lang.Boolean.TRUE
import kotlin.system.exitProcess
@ -35,22 +37,16 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
customDialog = CustomDialog(requireContext())
saveIdentifiers()
checkUser()
binding.buttonLogin.setOnClickListener({
binding.buttonLogin.setOnClickListener {
binding.splashProgress.visibility = View.VISIBLE
/* viewModel.device_checkLogin(
binding.edittextUsername.text.toString(),
binding.edittextPassword.text.toString(),
getData(ANDROID_ID), callFunction = "device_checkLogin"
)
*/
viewModel.loginSalix(
user = binding.edittextUsername.text.toString(),
password = binding.edittextPassword.text.toString(),
callFunction = "login de Salix"
)
user = binding.edittextUsername.text.toString(),
password = binding.edittextPassword.text.toString(),
callFunction = "login de Salix"
)
})
}
binding.textviewRememberPassword.setOnClickListener {
binding.edittextUsername.setText("")
@ -110,7 +106,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
override fun observeViewModel() {
with(viewModel) {
versionappitem.observe(viewLifecycleOwner, {
versionappitem.observe(viewLifecycleOwner) {
if (it.isError) {
binding.splashProgress.visibility = View.GONE
@ -150,8 +146,8 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
}
})
logindevice.observe(viewLifecycleOwner, {
}
logindevice.observe(viewLifecycleOwner) {
if (it.isError) {
binding.splashProgress.visibility = View.GONE
@ -179,7 +175,14 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
viewModel.worker_getSector(
binding.edittextUsername.text.toString(),
binding.edittextPassword.text.toString())
binding.edittextPassword.text.toString()
)
viewModel.worker_getPrinter(
binding.edittextUsername.text.toString(),
binding.edittextPassword.text.toString()
)
deviceLog_add(
binding.edittextUsername.text.toString(),
@ -189,11 +192,11 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
getData(ANDROID_ID), "deviceLog_add"
)
if (binding.switchRemember.isChecked) {
saveRemember(true)
} else {
saveRemember(false)
}
if (binding.switchRemember.isChecked) {
saveRemember(true)
} else {
saveRemember(false)
}
saveUserAccesPref(
binding.edittextUsername.text.toString(),
@ -211,12 +214,12 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
customDialog.setTitle("Mensaje").setDescription(it.vMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
/* binding.splashProgress.visibility = View.VISIBLE
loginSalix(
user = binding.edittextUsername.text.toString(),
password = binding.edittextPassword.text.toString(),
"login de Salix"
)*/
/* binding.splashProgress.visibility = View.VISIBLE
loginSalix(
user = binding.edittextUsername.text.toString(),
password = binding.edittextPassword.text.toString(),
"login de Salix"
)*/
getVersion()
}.show()
@ -226,21 +229,21 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
}
})
}
workerId.observe(viewLifecycleOwner, {
workerId.observe(viewLifecycleOwner) {
if (!it.isError) {
saveUserFkPref(it.Id.toString())
}
})
}
devicelogresponse.observe(viewLifecycleOwner, {
devicelogresponse.observe(viewLifecycleOwner) {
if (it.isError) {
customDialog.setTitle("Error")
@ -252,29 +255,47 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
getVersion()
}.show()
}
})
}
workergetSector.observe(viewLifecycleOwner, {
workergetSector.observe(viewLifecycleOwner) {
binding.splashProgress.visibility = View.GONE
if (it.id!=0){
d("El sector guardado es"+it.id)
d("El sector description es"+it.description.toString())
d("El sector warehouse es"+it.warehouseFk.toString())
saveDataInt("sectorFk",it.id)
saveData("sectordescrip",it.description)
if (it.id != 0) {
saveDataInt("sectorFk", it.id)
saveData("sectordescrip", it.description)
it.warehouseFk?.let { it1 -> saveDataInt("warehouseFk", it1) }
}
})
}
loadWorkerPrintList.observe(viewLifecycleOwner, Observer{ event ->
binding.splashProgress.visibility = View.GONE
event.getContentIfNotHandled().notNull {
if (it.list.isEmpty()){
"Tiene que seleccionar impresora.".toast(context)
}else{
if (!it.list.get(0).isError){
saveDataInt(PRINTERFK, it.list.get(0).id!!)
saveData(PRINTERNAME, it.list.get(0).name!!)
}else{
it.list.get(0).errorMessage.toast(context)
}
}
}
})
loginsalixitem.observe(viewLifecycleOwner, {
loginsalixitem.observe(viewLifecycleOwner) {
if (it.isError) {
binding.splashProgress.visibility = View.GONE
saveTokenPref("")
customDialog.setTitle("Error")
// .setDescription(it.errorMessage + ". Puedes continuar pero algunas funcionalidades no estarán disponibles.")
// .setDescription(it.errorMessage + ". Puedes continuar pero algunas funcionalidades no estarán disponibles.")
.setDescription(it.errorMessage)
.setOkButton(
"Entendido"
@ -292,7 +313,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
)
}
})
}
}
super.observeViewModel()

View File

@ -4,16 +4,23 @@ import android.content.Context
import android.util.Log
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import com.google.gson.Gson
import com.google.gson.JsonObject
import com.google.gson.reflect.TypeToken
import es.verdnatura.domain.GetAjustesUserCase
import es.verdnatura.domain.GetLoginUserCase
import es.verdnatura.domain.NodeJsService
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
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.WorkerPrintersList
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculoList
import es.verdnatura.presentation.view.feature.login.model.LoginDevice
import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO
import es.verdnatura.presentation.view.feature.login.model.versionApp
@ -60,6 +67,15 @@ class LoginViewModel(context: Context) : BaseViewModel()
val workergetSector: LiveData<SectorItemVO>
get() = _workergetSector
private val _workergetPrinter by lazy { MutableLiveData<Printers>() }
val workergetPrinter: LiveData<Printers>
get() = _workergetPrinter
private val _workerPrintList by lazy { MutableLiveData<WorkerPrintersList>() }
val loadWorkerPrintList = Transformations.map(_workerPrintList) { Event(it) }
fun loginSalix(user: String, password: String,callFunction:String)
{
getLoginUserCase.salixLogin(user, password).enqueue(object : Callback<LoginSalixVO>
@ -217,6 +233,8 @@ class LoginViewModel(context: Context) : BaseViewModel()
})
}
fun deviceLog_add(
user: String, password: String, app: String, versionApp: String, android_id: String,callFunction: String
)
@ -410,4 +428,35 @@ class LoginViewModel(context: Context) : BaseViewModel()
})
}
fun worker_getPrinter(user:String,password:String){
getLoginUserCase.worker_getPrinter(user,password).enqueue(object : Callback<List<Printers>>{
override fun onFailure(call: Call<List<Printers>>, t: Throwable) {
val listError:ArrayList<Printers> = ArrayList()
listError.add(Printers(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_workerPrintList.value = WorkerPrintersList(listError)
}
override fun onResponse(
call: Call<List<Printers>>,
response: Response<List<Printers>>
) {
if (response.body() != null){
_workerPrintList.value = response.body()?.let { WorkerPrintersList(it)
}
}else{
val listError:ArrayList<Printers> = ArrayList()
listError.add(Printers(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_workerPrintList.value = WorkerPrintersList(listError)
}
}
})
}
}

View File

@ -26,6 +26,7 @@ import es.verdnatura.presentation.view.feature.buffer.fragment.BufferLoadFragmen
import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemFragment
import es.verdnatura.presentation.view.feature.calidad.fragment.BuyersFragment
import es.verdnatura.presentation.view.feature.calidad.fragment.QaualityFragment
import es.verdnatura.presentation.view.feature.claim.fragment.ClaimFragment
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragment
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionShowTicketFragment
import es.verdnatura.presentation.view.feature.controlador.fragment.ControladorFragment
@ -145,7 +146,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
return sectorFk != -1
}
private fun havePrinter(): Boolean {
fun havePrinter(): Boolean {
val prefs: SharedPreferences = getSharedPreferences("es.verdnatura.user.prefs", 0)
val printerFk = prefs.getInt("printerFk", -1)
return printerFk != -1
@ -440,11 +441,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
//Web fragment
"Visor web" -> {
addFragmentOnTop(WebFragment.newInstance("Visor web"))
addFragmentOnTop(WebFragment.newInstance(item.title))
}
//Menu qr
"Lector Qr" -> {
addFragmentOnTop(QrFragment.newInstance("Lector Qr"))
addFragmentOnTop(QrFragment.newInstance(item.title))
}
//Menu buffer
@ -480,10 +481,16 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
"Fallo del trabajador" -> {
addFragmentOnTop(WorkermistakeFragment.newInstance(item.title))
}
// sergio: previa nuevo
"Obtener colección previa"->{
addFragmentOnTop(InitPreSacadorFragment.newInstance(item.title))
}
"Ubicación de Reclamación" -> {
addFragmentOnTop(ClaimFragment.newInstance(item.title))
}
}
}

View File

@ -105,10 +105,20 @@ class ExpeditionPalletDetailFragment(
}else if(item == iconPrint){
binding.splashProgress.visibility = View.VISIBLE
(getString(R.string.Imprimiendo)+" por " +getData(PRINTERNAME)).toast(requireContext())
viewModel.expeditionPalletPrintSet(getData(USER),
getData(PASSWORD),itemPallet!!.Pallet,getData(SECTORFK),"expeditionPallet_PrintSet")
if (ma.havePrinter()) {
(getString(R.string.Imprimiendo) + getData(PRINTERNAME)).toast(
requireContext()
)
viewModel.expeditionPalletPrintSet(
getData(USER),
getData(PASSWORD),
itemPallet!!.Pallet,
getData(SECTORFK),
"expeditionPallet_PrintSet"
)
}else{
ma.messageWithSound("Falta seleccionar impresora",isError = true,true,"Error al imprimir",false)
}
}
}
})
@ -132,11 +142,20 @@ class ExpeditionPalletDetailFragment(
response.observe(viewLifecycleOwner, Observer {
if (it.isError){
ma.messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()*/
}else{
requireActivity().onBackPressed()
}
})
responsePrintPallet.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility=View.GONE
if (it.isError){
ma.messageWithSound(it.errorMessage,true,false)
}else{
binding.splashProgress.visibility=View.VISIBLE
viewModel.expeditionState_addByPallet( getData(USER),getData(PASSWORD),itemPallet!!.Pallet,"PALLETIZED","expeditionState_addByPallet")
}
})
}

View File

@ -28,6 +28,12 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel() {
val response: LiveData<ResponseItemVO>
get() = _response
private val _responsePrintPallet by lazy { MutableLiveData<ResponseItemVO>() }
val responsePrintPallet: LiveData<ResponseItemVO>
get() = _responsePrintPallet
fun expeditionPallet_List(usuario:String,password:String,vPalletFk:String,callFunction:String){
getPaletizadoresUserCase.expeditionPalletView(usuario,password,vPalletFk).enqueue(object :
Callback<List<ItemPalletViewVO>> {
@ -76,17 +82,37 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel() {
getPaletizadoresUserCase.expeditionPalletPrintSet(usuario,password,vPalletFk,vSectorFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))
_responsePrintPallet.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 = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
_responsePrintPallet.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
_responsePrintPallet.value = ResponseItemVO(isError = false,response = response.body()!!)
}
}
})
}
fun expeditionState_addByPallet(
usuario: String,
password: String,
vPalletFk: String,
vStateCode:String,
callFunction:String){
getPaletizadoresUserCase.expeditionState_addByPallet(usuario,password,vPalletFk,vStateCode).enqueue(object : Callback<Unit>{
override fun onFailure(call: Call<Unit>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call<Unit>, response: Response<Unit>) {
if (!response.isSuccessful){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.message())
}
}
})
}
}

View File

@ -1,11 +1,10 @@
package es.verdnatura.presentation.view.feature.pasillero.fragment
import android.content.Context
import es.verdnatura.R
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
class PasilleroViewModel(context: Context) : BaseViewModel() {
class PasilleroViewModel : BaseViewModel() {
private val _pasillerositem by lazy { ArrayList<PasillerosItemVO>() }
val pasillerositem: List<PasillerosItemVO>
get() = _pasillerositem
@ -17,7 +16,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
R.drawable.barcode_scan,
"Visor web",R.string.SmarttagAssociate)
*/
/* _pasillerositem.add(
/* _pasillerositem.add(
PasillerosItemVO(20,
R.drawable.barcode_scan,
"Asociar Sacador SmartTags",R.string.SmarttagAssociate)
@ -81,6 +80,14 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
)
)
_pasillerositem.add(
PasillerosItemVO(
2,
R.drawable.ic_claims,
"Ubicación de Reclamación", R.string.claim,"Ubicación de Reclamación"
)
)
//sergio: pruebas cau item buscar
/* _pasillerositem.add(
PasillerosItemVO(9,

View File

@ -1045,7 +1045,7 @@ class EndSacadorFragment (
sectorFk = sectorFk,"collectionSticker_print"
)
////Log.i("VERDNATURA:","La collection es $ticket, sectorFk $sectorFk, user $user i pass $password")
(getString(R.string.Imprimiendo) + " por " + SectorDescription).toast(requireContext())*/
(getString(R.string.Imprimiendo) + SectorDescription).toast(requireContext())*/
}
@ -1447,16 +1447,16 @@ class EndSacadorFragment (
)
//enviar mensaje a salix
val ticket =
/* val ticket =
"[" + ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + ticketFk + "/summary)"
val message =
"Se ha modificado la cantidad original " + sales[position].saldo + " del artículo " + sales[position].itemFk + " a nueva cantidad: " + quantity + " del ticket " + ticket
"Se ha modificado la cantidad original desde previa" + sales[position].saldo + " del artículo " + sales[position].itemFk + " a nueva cantidad: " + quantity + " del ticket " + ticket
viewModel.sendChekingPresence(
token = getData(TOKEN),
workerId = sales[position].salesPersonFk,
message = message,
"sendChekingPresence"
)
)*/
try {
sales[position].saldo = quantity.toInt()

View File

@ -929,7 +929,7 @@ class PreSacadorFragment :
sectorFk = sectorFk,"collectionSticker_print"
)
////Log.i("VERDNATURA:","La collection es $ticket, sectorFk $sectorFk, user $user i pass $password")
(getString(R.string.Imprimiendo) + " por " + SectorDescription).toast(requireContext())*/
(getString(R.string.Imprimiendo) + SectorDescription).toast(requireContext())*/
}

View File

@ -126,7 +126,7 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value =
ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)+".Es posible que tengas colecciones pendientes, falle bbdd o Internet")
}

View File

@ -1,5 +1,7 @@
package es.verdnatura.presentation.view.feature.sacador.model
import java.util.*
class CollectionListVO(
var list: List<CollectionVO> = listOf()
)
@ -19,7 +21,7 @@ class TicketVO(
var agencyName: String = "",
var salesPersonFk: String = "",
var sales: List<SaleVO> = listOf(),
var observations: String = ""
var observations: String = "",
)
class SaleVO(
@ -61,8 +63,9 @@ class SaleVO(
var cel2: String = "",
var cel3: String = "",
var saleGroupFk: String = "",
var packingShelve:String=""
var packingShelve:String="",
var picked:String=""
)
@ -84,6 +87,7 @@ class PlacementVO(
var ticketFk: String = "",
var id: String = "",
var pickingOrder:Int=0
)
class PlacementSupplyVO(

View File

@ -92,9 +92,7 @@ class AssociateSmartTagsFragment(
private fun setToolBar() {
// toolbar_title.text = getString(R.string.SmarttagAssociate)
binding.mainToolbar.toolbarTitle.text = entryPoint
Timber.i("VERDNATURA:el entrypoint es ${entryPoint}")
}

View File

@ -133,7 +133,10 @@ class SmartTagsViewModel(context: Context) : BaseViewModel() {
isError = true,
errorMessage = response.message()
)
}
Log.d("VERDNATURA::","El mensaje es el error nodejs es ${response.errorBody()} "+response.raw()+ "-"+ response.message())
}
_registerSmarttagNode.value = responseSmart

View File

@ -29,6 +29,7 @@
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/h7"
android:gravity="center_vertical"
android:visibility="visible"
android:layout_marginLeft="@dimen/pasilleros_margin_main_menu"
android:textStyle="bold"/>
@ -52,6 +53,7 @@
android:layout_width="30dp"
android:layout_height="27dp"
android:scaleType="centerCrop"
android:visibility="gone"
android:src="@drawable/ic_delete_black_24dp" />
</LinearLayout>
<LinearLayout

View File

@ -65,7 +65,7 @@
<string name="MINIMO">Mínimo</string>
<string name="txtparking">Primero escanea tantos carros o tickets como quieras aparcar y finalmente escanea el parking para finalizar el proceso</string>
<string name="Ticketaparcado">Ticket aparcado</string>
<string name="Imprimiendo">Imprimiendo </string>
<string name="Imprimiendo">Imprimiendo por :</string>
<string name="Verdisponible">Ver disponible</string>
<string name="Buscar">Buscar</string>
<string name="Agregarartículoparaticket">Agregar artículo para ticket:</string>
@ -161,4 +161,5 @@
<string name="buscarDepartamento">Buscar departamento</string>
<string name="Noprinters">No hay impresora</string>
<string name="Selecccionaimpresoara">Selecciona impresora</string>
<string name="claim">Ubicación de reclamación</string>
</resources>

View File

@ -65,7 +65,7 @@
<string name="MINIMO">Minimun</string>
<string name="txtparking">First scan as many cars or tickets as you want to park and finally scan the parking to finish the process</string>
<string name="Ticketaparcado">Parked ticket</string>
<string name="Imprimiendo">Printing </string>
<string name="Imprimiendo">Printing by </string>
<string name="Verdisponible">See available</string>
<string name="Buscar">Search</string>
<string name="Agregarartículoparaticket">Add item for ticket:</string>
@ -159,5 +159,6 @@
<string name="Split">Split</string>
<string name="workermistake">Worker mistaker</string>
<string name="buscarDepartamento">Find department</string>
<string name="claim">Claim Ubication</string>
</resources>