Version 7.9, seleccionar impresora y movimiento recyclerViewer para el sacador. Llamadas smarttags al servidor ok
This commit is contained in:
parent
c423a765ef
commit
2c433fa01e
|
@ -5,7 +5,7 @@
|
|||
<map>
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable-v24/background_gradient.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable-v24/ic_history_orang.xml" value="0.22037037037037038" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable-v24/ic_history_orange_24dp.xml" value="0.38229166666666664" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable-v24/ic_history_orange_24dp.xml" value="0.16666666666666666" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.13541666666666666" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable-v24/selector_bottombar_text.xml" value="0.13541666666666666" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/alpha_b_circle_outline.xml" value="0.2359375" />
|
||||
|
@ -24,6 +24,7 @@
|
|||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_fill.xml" value="0.19814814814814816" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_flejado.xml" value="0.2916666666666667" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_full.xml" value="0.18489583333333334" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_load.xml" value="0.14666666666666667" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_off.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_outline.xml" value="0.22407407407407406" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/car.xml" value="0.30052083333333335" />
|
||||
|
@ -34,6 +35,7 @@
|
|||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/crane.xml" value="0.23802083333333332" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/day_of_sale.xml" value="0.184375" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/delete.xml" value="0.19166666666666668" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/drawable_white_circle.xml" value="0.1775" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/emoticon_error.xml" value="0.27447916666666666" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/eraser.xml" value="0.26564102564102565" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/face_man_outline.xml" value="0.22708333333333333" />
|
||||
|
@ -42,7 +44,11 @@
|
|||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_add_black_24dp.xml" value="0.22708333333333333" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_arrow_back_black_24dp.xml" value="0.22708333333333333" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_arrow_drop_down_black_24dp.xml" value="0.22708333333333333" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_autorenew_black_24dp.xml" value="0.1775" />
|
||||
<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_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" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_device_hub_black_24dp.xml" value="0.22" />
|
||||
|
@ -72,6 +78,7 @@
|
|||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_transaction.xml" value="0.22708333333333333" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_verified_user_black_24dp.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_verified_user_black_24dp_selected.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_visibility.xml" value="0.1775" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_visibility_black_24dp.xml" value="0.2546875" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_visibility_black_24dp_white.xml" value="0.2546875" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_visibility_white_24dp.xml" value="0.2546875" />
|
||||
|
|
|
@ -7,24 +7,18 @@ apply plugin: 'com.google.gms.google-services'
|
|||
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
compileSdkVersion 30
|
||||
// buildToolsVersion "29.0.3"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "es.verdnatura"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
versionCode 106
|
||||
versionName "7.8" //VERSION CODE 106 Previa final,tiene en cuenta si hay varios carros donde coger,,
|
||||
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
|
||||
//versionName "7.7.2" //VERSION CODE 103 Reparado previa que se duplicaban los iconos en previa
|
||||
//versionName "7.7.1" //VERSION CODE 103 Estaba salix en test.
|
||||
//versionName "7.7" //VERSION CODE 102.Incorpora pantalla Fallo trabajador, ara es guarda i recupera el sector en bbdd, es lleva demanar permisos de sonido,
|
||||
// i es soluciona l'error en Pasillero que tancava la app en antics mòvils.S'afegeix camp prioritat al buscar item. No demana posar vehicle un altra vegada al fer botó enrere.
|
||||
//versionName "7.6.1" //VERSION CODE 101. Pide las baldas, se había quitado sin querer y se quita menú Voz
|
||||
//versionName "7.6" //VERSION CODE 100. Envios rocket a previa, revisados databinding layouts,
|
||||
//versionName "7.5.1" //VERSION CODE 97. Control de previa, Llamadas ok, menú ok y textos en iconos y imágenes.
|
||||
//versionName "7.5.1" VERSION CODE 99 PARA TESTEAR APP-->INSTALADA EN VARIOS USUARIO 24-01-2022
|
||||
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 106,
|
||||
"versionName": "7.8",
|
||||
"versionCode": 107,
|
||||
"versionName": "7.9",
|
||||
"outputFile": "app-release.apk"
|
||||
}
|
||||
],
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -6,8 +6,8 @@ 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://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(
|
||||
GsonConverterFactory.create()
|
||||
|
|
|
@ -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 retrofit2.Call
|
||||
|
||||
|
@ -20,6 +21,15 @@ class GetAjustesUserCase(context: Context) : RestClient(context) {
|
|||
return restClient!!.worker_updateSector("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)
|
||||
return restClient!!.worker_updatePrinter("json", "1", usuario, password, "application/json",params)
|
||||
}
|
||||
|
||||
fun printer_get(usuario: String, password: String): Call<List<Printers>> {
|
||||
return restClient!!.printer_get("json", "1", usuario, password, "application/json")
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -61,18 +61,17 @@ class GetLoginUserCase(context: Context) : RestClient(context)
|
|||
}
|
||||
//NODEJS TEST
|
||||
|
||||
fun nodeJsTest(
|
||||
/*fun nodeJsTest(
|
||||
smarttag: String,
|
||||
wagon: String,
|
||||
shelving: String
|
||||
): Call<NodeJsService.SmartTagNode>
|
||||
{
|
||||
//https://smart-tag.verdnatura.es/bindShelving/A0A3B8224DBF&ABC&1
|
||||
return nodejsClient!!.bindShelving("application/json", "A0A3B8224DBF", "ABB", "1")
|
||||
return nodejsClient!!.bindShelving("application/json", "A0A3B8224DBF", "AAA", "1")
|
||||
// return nodejsClient!!.bindShelving("application/json", NodeJsService.SmartTagNode(smarttag, wagon, shelving),"A0A3B8224DBF","ABC","2")
|
||||
|
||||
}
|
||||
|
||||
}*/
|
||||
// SALIX SERGIO MENSAJE : PARA NO ENVIAR MENSAJES A COMERCIALES PONGO QUE LAS MODIFICACIONES SE ENVIAN AL CANAL CREADO.
|
||||
// SE CAMBIA VARIABLE A TRUE/FALSE
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import es.verdnatura.presentation.view.feature.smarttag.sacador.model.SmartTagRegister
|
||||
import retrofit2.Call
|
||||
|
||||
class GetSmarttagsUserCase(context: Context) : RestClient(context) {
|
||||
|
@ -30,10 +31,24 @@ class GetSmarttagsUserCase(context: Context) : RestClient(context) {
|
|||
params
|
||||
)
|
||||
}
|
||||
fun smartTagRegister(
|
||||
smarttag: String,
|
||||
shelving: String,
|
||||
level: String
|
||||
): Call<SmartTagRegister>
|
||||
{
|
||||
//https://smart-tag.verdnatura.es/bindShelving/A0A3B8224DBF&ABC&1
|
||||
return nodejsClient!!.bindShelving("application/json", smarttag, shelving, level)
|
||||
// return nodejsClient!!.bindShelving("application/json", NodeJsService.SmartTagNode(smarttag, wagon, shelving),"A0A3B8224DBF","ABC","2")
|
||||
|
||||
/* fun smartTag_nextLevel(usuario:String,password:String,vShelvingFk :String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
params.add(vShelvingFk)
|
||||
return restClient!!.smartTag_nextLevel("json","1",usuario,password,"application/json",params)
|
||||
}*/
|
||||
}
|
||||
fun smartTagInsertTicket(
|
||||
smarttag: String,
|
||||
|
||||
): Call<SmartTagRegister>
|
||||
{
|
||||
|
||||
return nodejsClient!!.insertTicket("application/json", smarttag)
|
||||
|
||||
}
|
||||
}
|
|
@ -1,10 +1,8 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import es.verdnatura.presentation.view.feature.smarttag.sacador.model.SmartTagRegister
|
||||
import retrofit2.Call
|
||||
import retrofit2.http.FormUrlEncoded
|
||||
import retrofit2.http.Header
|
||||
import retrofit2.http.POST
|
||||
import retrofit2.http.Path
|
||||
import retrofit2.http.*
|
||||
|
||||
interface NodeJsService {
|
||||
|
||||
|
@ -16,15 +14,24 @@ interface NodeJsService {
|
|||
//NODEJS TEST
|
||||
|
||||
//@FormUrlEncoded
|
||||
@POST("/bindShelving/{Id1}&{Id2}&{Id3}")
|
||||
@GET("/bindShelving/{smarttag}&{shelvingFK}&{height}")
|
||||
fun bindShelving(
|
||||
@Header("Content-Type") content_type: String,
|
||||
@Path("Id1") id: String,
|
||||
@Path("Id2") id2: String,
|
||||
@Path("Id3") id3: String
|
||||
@Path("smarttag") id: String,
|
||||
@Path("shelvingFK") id2: String,
|
||||
@Path("height") id3: String
|
||||
|
||||
):
|
||||
Call<SmartTagNode>
|
||||
Call<SmartTagRegister>
|
||||
|
||||
@GET("/insertTicket/{collectionFk}")
|
||||
fun insertTicket(
|
||||
@Header("Content-Type") content_type: String,
|
||||
@Path("collectionFk") id: String
|
||||
|
||||
):
|
||||
Call<SmartTagRegister>
|
||||
|
||||
|
||||
class SmartTagNode(
|
||||
var message: String = "",
|
||||
|
|
|
@ -1,6 +1,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.articulo.model.ItemCardVO
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
||||
|
@ -114,6 +115,27 @@ interface VerdnaturaService {
|
|||
):
|
||||
Call<List<SectorItemVO>>
|
||||
|
||||
@POST("almacennew/printer_get")//REVISADA
|
||||
fun printer_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<Printers>>
|
||||
|
||||
@POST("almacennew/worker_updatePrinter")//REVISADA
|
||||
fun worker_updatePrinter(
|
||||
@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_updateSector")//REVISADA
|
||||
fun worker_updateSector(
|
||||
@Header("aplicacion") aplicacion: String,
|
||||
|
|
|
@ -50,6 +50,10 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
protected val TOKEN = "token"
|
||||
protected val SECTORDESCRIP = "sectordescrip"
|
||||
protected val SECTORFK = "sectorFk"
|
||||
|
||||
protected val PRINTERNAME= "printername"
|
||||
protected val PRINTERFK = "printerFk"
|
||||
|
||||
protected val WAREHOUSEFK = "warehouseFk"
|
||||
protected val RECORDAR = "recordar"
|
||||
protected val ANDROID_ID = "ANDROID_ID"
|
||||
|
@ -519,6 +523,9 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
|
|||
DATENOVEHICLE->prefs.getString(name,"0").toString()
|
||||
DEPARTMENTMISTAKE->prefs.getString(name,"").toString()
|
||||
DEPARTMENTMISTAKEID->prefs.getString(name,"").toString()
|
||||
PRINTERFK->prefs.getInt(name,0).toString()
|
||||
PRINTERNAME->prefs.getString(name,"Sin impresora").toString()
|
||||
|
||||
"base_url"->{
|
||||
val preferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
preferences.getString("base_url","").toString()
|
||||
|
@ -541,7 +548,7 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
|
|||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
val editor = prefs.edit()
|
||||
|
||||
Log.d("VERDNATURA::","El name es "+name+":"+ "y el valor "+value)
|
||||
// Log.d("VERDNATURA::","El name es "+name+":"+ "y el valor "+value)
|
||||
when (name) {
|
||||
|
||||
ANDROID_ID -> editor.putString(name, value)
|
||||
|
|
|
@ -23,6 +23,7 @@ import es.verdnatura.presentation.common.hideKeyboard
|
|||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
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.main.activity.MainActivity
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
|
@ -33,6 +34,7 @@ class AjustesFragment :
|
|||
|
||||
private lateinit var customDialog: CustomDialog
|
||||
private var sectorListVO: List<SectorItemVO> = listOf()
|
||||
private var printersList: List<Printers> = listOf()
|
||||
private var vozList: List<String> = listOf()
|
||||
private var prefs: SharedPreferences? = null
|
||||
private var ajustesAdapter: AjustesAdapter? = null
|
||||
|
@ -55,9 +57,10 @@ class AjustesFragment :
|
|||
getData(SECTORDESCRIP),
|
||||
getData(SECTORFK).toInt(),
|
||||
getData(WAREHOUSEFK).toInt(),
|
||||
getData(VOZ),
|
||||
getData(WAGON),
|
||||
getData(TAGSTYPE)
|
||||
getData(TAGSTYPE),
|
||||
getData(PRINTERFK).toInt(),
|
||||
getData(PRINTERNAME),
|
||||
|
||||
|
||||
)
|
||||
|
@ -80,8 +83,6 @@ class AjustesFragment :
|
|||
getData(ANDROID_ID)
|
||||
)
|
||||
binding.txtserver.setText(getData("base_url"))
|
||||
Log.d("VERDNATURA::","La base es "+getData("base_url"))
|
||||
|
||||
super.init()
|
||||
|
||||
setEvents()
|
||||
|
@ -122,12 +123,13 @@ class AjustesFragment :
|
|||
|
||||
|
||||
} else if (item.id == 2) {
|
||||
val listVoz: ArrayList<String> = ArrayList()
|
||||
viewModel.printer_get(getData(USER),getData(PASSWORD))
|
||||
/* val listVoz: ArrayList<String> = ArrayList()
|
||||
listVoz.add("NO")
|
||||
listVoz.add("YES")
|
||||
vozList = listVoz
|
||||
val array = arrayOfNulls<String>(listVoz.size)
|
||||
showDialogVoz(array = listVoz.toArray(array))
|
||||
showDialogVoz(array = listVoz.toArray(array))*/
|
||||
|
||||
} else if (item.id == 3) {
|
||||
val listTagsType: ArrayList<String> = ArrayList()
|
||||
|
@ -153,11 +155,17 @@ class AjustesFragment :
|
|||
ma.messageWithSound(it.errorMessage,it.isError,false)
|
||||
})
|
||||
|
||||
workerupdatePrinter.observe(viewLifecycleOwner, {
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
|
||||
ma.messageWithSound(it.errorMessage,it.isError,false)
|
||||
})
|
||||
|
||||
binding.ajustessItems.adapter = ajustesAdapter
|
||||
binding.ajustessItems.layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
|
||||
loadSectorList.observe(viewLifecycleOwner, { event ->
|
||||
loadSectorList.observe(viewLifecycleOwner) { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
binding.splashProgress.visibility = View.INVISIBLE
|
||||
if (it.list.isNotEmpty() && it.list.get(0).isError) {
|
||||
|
@ -186,11 +194,69 @@ class AjustesFragment :
|
|||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
loadprintersList.observe(viewLifecycleOwner) { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
binding.splashProgress.visibility = View.INVISIBLE
|
||||
if (it.list.isNotEmpty() && it.list.get(0).isError) {
|
||||
customDialog.setTitle("Error").setDescription(it.list.get(0).errorMessage)
|
||||
.setOkButton(getString(R.string.Close)) {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
} else {
|
||||
|
||||
if (it.list != null && it.list.size > 0) {
|
||||
val listPrinters: ArrayList<String> = ArrayList()
|
||||
it.list.forEach {
|
||||
listPrinters.add(it.name)
|
||||
}
|
||||
val array = arrayOfNulls<String>(listPrinters.size)
|
||||
printersList= it.list
|
||||
showDialogPrinters(listPrinters.toArray(array))
|
||||
|
||||
} else {
|
||||
customDialog.setTitle("Impresoras")
|
||||
.setDescription(getString(R.string.Noprinters))
|
||||
.setOkButton(getString(R.string.Close)) {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
super.observeViewModel()
|
||||
}
|
||||
|
||||
|
||||
private fun showDialogPrinters(array: Array<String>) {
|
||||
val builder = AlertDialog.Builder(this.context)
|
||||
|
||||
|
||||
builder.setTitle(getString(R.string.Selecccionaimpresoara))
|
||||
builder.setItems(array) { _, which ->
|
||||
val selected = array[which]
|
||||
printersList.forEach {
|
||||
if (it.name.equals(selected)) {
|
||||
val editor = prefs!!.edit()
|
||||
editor.putString(PRINTERNAME, it.name)
|
||||
editor.putInt(PRINTERFK, it.id)
|
||||
editor.apply()
|
||||
|
||||
viewModel.ajustesitem.get(2).selected = it.name
|
||||
viewModel.worker_updatePrinter(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)
|
||||
|
||||
|
@ -234,6 +300,8 @@ class AjustesFragment :
|
|||
val editor = prefs!!.edit()
|
||||
editor.putString(VOZ, it)
|
||||
editor.apply()
|
||||
|
||||
|
||||
viewModel.ajustesitem.get(2).selected = it
|
||||
|
||||
ajustesAdapter!!.notifyDataSetChanged()
|
||||
|
|
|
@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.ajustes.fragment
|
|||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import android.util.Printer
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
|
@ -12,9 +13,7 @@ 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.AjustesItemVO
|
||||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorListVO
|
||||
import es.verdnatura.presentation.view.feature.ajustes.model.*
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
@ -38,20 +37,30 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
|||
val workerupdateSector: LiveData<ResponseItemVO>
|
||||
get() = _workerupdateSector
|
||||
|
||||
private val _workerupdatePrinter by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val workerupdatePrinter: LiveData<ResponseItemVO>
|
||||
get() = _workerupdatePrinter
|
||||
|
||||
private val _printerList by lazy { MutableLiveData<PrintersList>() }
|
||||
val printerList: LiveData<PrintersList>
|
||||
get() = _printerList
|
||||
|
||||
|
||||
val loadSectorList = Transformations.map(_sectorList) {Event(it)}
|
||||
val loadprintersList = Transformations.map(_printerList) {Event(it)}
|
||||
|
||||
|
||||
|
||||
|
||||
fun inititializeDefaultAjusts(sectorDescrip: String,sectorFk : Int, warehouseFk : Int,vozDescrip:String,carroDescrip:String,TypeTags:String) {
|
||||
fun inititializeDefaultAjusts(sectorDescrip: String,sectorFk : Int, warehouseFk : Int,carroDescrip:String,TypeTags:String,printerFk:Int,printerSelected:String) {
|
||||
_ajustesitem.add(
|
||||
AjustesItemVO(0,
|
||||
"Sector",
|
||||
sectorDescrip,
|
||||
sectorFk,
|
||||
warehouseFk)
|
||||
warehouseFk,
|
||||
0,
|
||||
printerSelected)
|
||||
)
|
||||
|
||||
|
||||
|
@ -60,35 +69,40 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
|||
"Carros",
|
||||
carroDescrip,
|
||||
0,
|
||||
0)
|
||||
)
|
||||
/*_ajustesitem.add(
|
||||
AjustesItemVO(2,
|
||||
"Voz",
|
||||
vozDescrip,
|
||||
0,
|
||||
0)
|
||||
)*/
|
||||
0,"Sin impresora")
|
||||
)
|
||||
_ajustesitem.add(
|
||||
AjustesItemVO(2,
|
||||
"Impresora etiquetas",
|
||||
printerSelected,
|
||||
0,
|
||||
0,
|
||||
printerFk,printerSelected)
|
||||
)
|
||||
_ajustesitem.add(
|
||||
AjustesItemVO(3,
|
||||
"Tipo etiqueta",
|
||||
TypeTags,
|
||||
0,
|
||||
0)
|
||||
0,
|
||||
0,"Sin impresora")
|
||||
)
|
||||
_ajustesitem.add(
|
||||
AjustesItemVO(4,
|
||||
"Control de vehículos",
|
||||
"",
|
||||
0,
|
||||
0)
|
||||
0,
|
||||
0,"Sin impresora")
|
||||
)
|
||||
_ajustesitem.add(
|
||||
AjustesItemVO(5,
|
||||
"Cerrar Sesión",
|
||||
"",
|
||||
0,
|
||||
0)
|
||||
0,
|
||||
0,"Sin impresora")
|
||||
)
|
||||
|
||||
}
|
||||
|
@ -143,6 +157,36 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
|||
|
||||
})
|
||||
}
|
||||
|
||||
fun printer_get(user:String,password:String){
|
||||
getAjustesUserCase.printer_get(user,password).enqueue(object : Callback<List<Printers>>{
|
||||
override fun onFailure(call: Call<List<Printers>>, t: Throwable) {
|
||||
val listError:ArrayList<Printers> = ArrayList()
|
||||
listError.add(Printers(0,"",true,t.message!!))
|
||||
_printerList.value = PrintersList(listError)
|
||||
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<Printers>>,
|
||||
response: Response<List<Printers>>
|
||||
) {
|
||||
|
||||
|
||||
if (response.body() != null){
|
||||
_printerList.value = response.body()?.let { PrintersList (it) }
|
||||
}else{
|
||||
val listError:ArrayList<Printers> = ArrayList()
|
||||
listError.add(Printers(0,"",true,
|
||||
getMessageFromAllResponse(nameofFunction(this),response.message())
|
||||
))
|
||||
_printerList.value = PrintersList(listError)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun worker_updateSector(user:String,password:String,sectorFk:String){
|
||||
d("El sector marcado dentro es "+sectorFk)
|
||||
getAjustesUserCase.worker_updateSector(user,password,sectorFk).enqueue(object : Callback<Unit>{
|
||||
|
@ -176,5 +220,30 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
|||
|
||||
})
|
||||
}
|
||||
fun worker_updatePrinter(user:String,password:String,printerFk:String){
|
||||
d("La impresora marcada "+printerFk)
|
||||
getAjustesUserCase.worker_updatePrinter(user,password,printerFk).enqueue(object : Callback<Unit>{
|
||||
override fun onFailure(call: Call<Unit>, t: Throwable) {
|
||||
|
||||
_workerupdatePrinter.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<Unit>,
|
||||
response: Response<Unit>
|
||||
) {
|
||||
|
||||
if (!response.isSuccessful()){
|
||||
_workerupdatePrinter.value=ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
|
||||
)
|
||||
}else{
|
||||
_workerupdatePrinter.value=ResponseItemVO(response="Actualizada impresora",isError = false, errorMessage ="Actualizada impresora")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,9 @@ class AjustesItemVO (
|
|||
var title: String = "",
|
||||
var selected: String = "",
|
||||
var sectorFk : Int?,
|
||||
var warehouse: Int?
|
||||
var warehouse: Int?,
|
||||
var printerFk:Int?,
|
||||
var printerSelected:String=""
|
||||
)
|
||||
|
||||
class SectorItemVO (
|
||||
|
@ -18,4 +20,15 @@ class SectorItemVO (
|
|||
|
||||
class SectorListVO (
|
||||
var list: List<SectorItemVO> = listOf()
|
||||
)
|
||||
class PrintersList (
|
||||
var list: List<Printers> = listOf()
|
||||
)
|
||||
class Printers(
|
||||
|
||||
var id: Int,
|
||||
var name: String="",
|
||||
val isError : Boolean = false,
|
||||
var errorMessage : String = ""
|
||||
|
||||
)
|
|
@ -108,8 +108,9 @@ class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(Buyer
|
|||
id = buyer.userFk.toInt(),
|
||||
title = buyer.nickname,
|
||||
sectorFk = 0,
|
||||
warehouse = 0
|
||||
)
|
||||
warehouse = 0,
|
||||
printerFk=0,
|
||||
printerSelected ="")
|
||||
)
|
||||
}catch (e:Exception){}
|
||||
}
|
||||
|
|
|
@ -604,6 +604,7 @@ class CollectionFragment(
|
|||
"[" + sales[positionCollectionSplit].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionCollectionSplit].ticketFk + "/summary)"
|
||||
val message =
|
||||
"Se ha enviado a Split el articulo " + sales[positionCollectionSplit].itemFk + " del ticket " + ticket
|
||||
|
||||
sendSalixMessageNew(message,sales[positionCollectionSplit].salePersonFk)
|
||||
|
||||
}
|
||||
|
@ -1073,8 +1074,7 @@ class CollectionFragment(
|
|||
}
|
||||
|
||||
private fun saleTrackingReplace(position: Int, type: String) {
|
||||
//////Log.i("VERDNATURA:","POSICION $position y el tipo $type")
|
||||
//////Log.i("VERDNATURA:","El buyfk que no es real es $originalItemScan")
|
||||
|
||||
viewModel.saleTrackingReplace(
|
||||
getData(USER),
|
||||
getData(PASSWORD),
|
||||
|
@ -1422,7 +1422,7 @@ class CollectionFragment(
|
|||
)
|
||||
|
||||
|
||||
(getString(R.string.Imprimiendo) + " por " + getData(SECTORDESCRIP)).toast(requireContext())
|
||||
(getString(R.string.Imprimiendo) + " por " + getData(PRINTERNAME)).toast(requireContext())
|
||||
}
|
||||
|
||||
private fun addItem() {
|
||||
|
@ -2057,9 +2057,11 @@ class CollectionFragment(
|
|||
|
||||
"TRUE"->{
|
||||
message = "Se ha enviado a Basura " + totalQuantity + " del articulo " + sales[positionCollectionMissing].itemFk + " ticket " + ticket
|
||||
|
||||
}
|
||||
"FALSE"->{
|
||||
message= "Se ha enviado a Faltas la cantidad de " + totalQuantity + " del articulo " + sales[positionCollectionMissing].itemFk + " ticket " + ticket
|
||||
|
||||
}
|
||||
"reject"->{
|
||||
message = "Se ha modificado la cantidad de " + sales[positionCollectionMissing].originalQuantity + " del artículo " + sales[positionCollectionMissing].itemFk + " a nueva cantidad: " + sales[positionCollectionMissing].quantity + " del ticket " + ticket
|
||||
|
@ -2083,9 +2085,12 @@ class CollectionFragment(
|
|||
|
||||
private fun incresaseSuccesful() {
|
||||
try {
|
||||
//val quantityPicked = (quantity.toInt() - sales[position].quantity.toInt()).toString()
|
||||
//sales[position].originalQuantity = quantity
|
||||
sales[positionIncreaseQuantity].quantity = quantityIncrease
|
||||
//val quantityPicked = (quantity.toInt() - sales[position].quantitytoInt()).toString()
|
||||
|
||||
// sergio: se añade linea para que se actualice la originalQuantity
|
||||
//sales[positionIncreaseQuantity].originalQuantity = quantityIncrease
|
||||
|
||||
sales[positionIncreaseQuantity].quantity = quantityIncrease
|
||||
/*if (type == CONTROLADOR){
|
||||
showShelving(position,0,quantityPicked)
|
||||
}*/
|
||||
|
@ -2099,6 +2104,7 @@ class CollectionFragment(
|
|||
val message =
|
||||
"Se ha modificado la cantidad original " + sales[positionIncreaseQuantity].originalQuantity + " del artículo " + sales[positionIncreaseQuantity].itemFk + " a nueva cantidad: " + sales[positionIncreaseQuantity].quantity + " del ticket " + ticket
|
||||
|
||||
|
||||
sendSalixMessageNew(message, sales[positionIncreaseQuantity].salePersonFk)
|
||||
/* val ticket =
|
||||
"[" + sales[positionIncreaseQuantity].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionIncreaseQuantity].ticketFk + "/summary)"
|
||||
|
@ -2109,6 +2115,7 @@ class CollectionFragment(
|
|||
workerId = sales[positionIncreaseQuantity].salePersonFk,
|
||||
message = message, "sendChekingPresence"
|
||||
)*/
|
||||
sales[positionIncreaseQuantity].originalQuantity = quantityIncrease
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ class CollectionShowTicketFragment(
|
|||
"collectionStickerPrint"
|
||||
)
|
||||
|
||||
(getString(R.string.Imprimiendo) + " por " + getData(SECTORDESCRIP)).toast(requireContext())
|
||||
(getString(R.string.Imprimiendo) + " por " + getData(PRINTERNAME)).toast(requireContext())
|
||||
}
|
||||
|
||||
private fun setEvents() {
|
||||
|
|
|
@ -12,7 +12,7 @@ class ImageViewActivity : BaseActivity<ActivityImageviewBinding>(){
|
|||
|
||||
override fun init() {
|
||||
binding.mainToolbar.toolbarTitle.text = (intent.getStringExtra("title"))
|
||||
binding.imgView.loadUrl(intent.getStringExtra("url"))
|
||||
binding.imgView.loadUrl(intent.getStringExtra("url")!!)
|
||||
|
||||
binding.mainToolbar.backButton.setOnClickListener {
|
||||
onBackPressed()
|
||||
|
|
|
@ -24,7 +24,7 @@ import es.verdnatura.presentation.view.feature.workermistake.model.*
|
|||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
import timber.log.Timber
|
||||
import timber.log.Timber.d
|
||||
|
||||
class InventaryViewModel(context: Context) : BaseViewModel() {
|
||||
|
||||
|
@ -297,6 +297,7 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
|
|||
{
|
||||
override fun onFailure(call: Call<Unit>, t: Throwable)
|
||||
{
|
||||
d("Error message "+t.message)
|
||||
_responseAddMistake.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)
|
||||
|
@ -310,14 +311,16 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
|
|||
{
|
||||
if (!response.isSuccessful)
|
||||
{
|
||||
d("Error message:"+{response.errorBody()}+"-"+response.message()+"-"+response.raw())
|
||||
_responseAddMistake.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
|
||||
)
|
||||
} else
|
||||
{
|
||||
|
||||
// sergio:refactor:solo debería haber un mensaje no un response o errorMessage
|
||||
_responseAddMistake.value =
|
||||
// sergio:refactor:solo debería haber un mensaje no un response o errorMessage
|
||||
ResponseItemVO(isError = false, response ="Causa del error registrada", errorMessage = "Causa del error registrada")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package es.verdnatura.presentation.view.feature.login.fragment
|
|||
|
||||
//import es.verdnatura.presentation.view.feature.login.model.LoginItemVO
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import android.content.pm.PackageInfo
|
||||
|
@ -11,14 +10,12 @@ import android.net.Uri
|
|||
import android.provider.Settings
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import androidx.preference.PreferenceManager
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentLoginBinding
|
||||
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
|
||||
import timber.log.Timber.d
|
||||
import java.lang.Boolean.TRUE
|
||||
import kotlin.system.exitProcess
|
||||
|
@ -87,9 +84,6 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
true
|
||||
}
|
||||
|
||||
//NODEJS TEST
|
||||
/* Log.d("VERDNATURA:","NODEJS in")
|
||||
viewModel.nodeJsTest("A0A3B8224DBF","AAA","1")*/
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package es.verdnatura.presentation.view.feature.login.fragment
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.google.gson.Gson
|
||||
|
@ -305,7 +306,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
|
|||
})
|
||||
}
|
||||
|
||||
fun nodeJsTest(smarttag: String, wagon: String, shelving: String)
|
||||
/* fun nodeJsTest(smarttag: String, wagon: String, shelving: String)
|
||||
{
|
||||
getLoginUserCase.nodeJsTest(smarttag, wagon, shelving)
|
||||
.enqueue(object : Callback<NodeJsService.SmartTagNode>
|
||||
|
@ -319,13 +320,13 @@ class LoginViewModel(context: Context) : BaseViewModel()
|
|||
|
||||
val workerId: NodeJsService.SmartTagNode?
|
||||
|
||||
/* if (response.isSuccessful()){
|
||||
*//* if (response.isSuccessful()){
|
||||
Log.i("VERDNATURA::","OK")
|
||||
}
|
||||
|
||||
if (!response.errorBody().toString().isEmpty()){
|
||||
|
||||
}*/
|
||||
}*//*
|
||||
|
||||
if (response.body() != null)
|
||||
{
|
||||
|
@ -352,13 +353,13 @@ class LoginViewModel(context: Context) : BaseViewModel()
|
|||
val workerId =
|
||||
NodeJsService.SmartTagNode(isError = true, errorMessage = t.message!!)
|
||||
|
||||
// Log.i("VERDNATURA::","el error nodejs es "+t.message+"--"+t.cause.toString()+"--"+t.stackTrace.toString())
|
||||
Log.i("VERDNATURA::","el error nodejs es "+t.message+"--"+t.cause.toString()+"--"+t.stackTrace.toString())
|
||||
|
||||
_nodejs.value = workerId
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}*/
|
||||
|
||||
fun getListFromJSON(json: JsonObject): MutableList<itemsExpeditionDynamics>
|
||||
{
|
||||
|
|
|
@ -93,7 +93,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
|
||||
|
||||
|
||||
if (haveSector()) addFragment(
|
||||
if (haveSector() && havePrinter()) addFragment(
|
||||
PasilleroFragment.newInstance("Verdnatura"),
|
||||
R.id.main_frame_layout,
|
||||
PasilleroFragment.TAG,
|
||||
|
@ -145,7 +145,12 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
return sectorFk != -1
|
||||
|
||||
}
|
||||
private fun havePrinter(): Boolean {
|
||||
val prefs: SharedPreferences = getSharedPreferences("es.verdnatura.user.prefs", 0)
|
||||
val printerFk = prefs.getInt("printerFk", -1)
|
||||
return printerFk != -1
|
||||
|
||||
}
|
||||
|
||||
private fun setBottomMenu() {
|
||||
val bottomMenu = binding.mainBottomNavigation
|
||||
|
@ -345,7 +350,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
}
|
||||
|
||||
"Registrar SmartTags" -> {
|
||||
addFragmentOnTop(RegisterSmartTagsFragment.newInstance(entryPoint))
|
||||
addFragmentOnTop(RegisterSmartTagsFragment.newInstance(item.title))
|
||||
}
|
||||
|
||||
//BUFFERS
|
||||
|
|
|
@ -105,7 +105,7 @@ class ExpeditionPalletDetailFragment(
|
|||
}else if(item == iconPrint){
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
|
||||
(getString(R.string.Imprimiendo)+" por " +getData(SECTORDESCRIP)).toast(requireContext())
|
||||
(getString(R.string.Imprimiendo)+" por " +getData(PRINTERNAME)).toast(requireContext())
|
||||
viewModel.expeditionPalletPrintSet(getData(USER),
|
||||
getData(PASSWORD),itemPallet!!.Pallet,getData(SECTORFK),"expeditionPallet_PrintSet")
|
||||
|
||||
|
|
|
@ -12,40 +12,25 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
|
|||
|
||||
fun inititializeDefaultData() {
|
||||
|
||||
/* _pasillerositem.add(
|
||||
/* _pasillerositem.add(
|
||||
PasillerosItemVO(20,
|
||||
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)
|
||||
)
|
||||
_pasillerositem.add(
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(21,
|
||||
R.drawable.barcode,
|
||||
R.drawable.barcode_scan,
|
||||
"Registrar SmartTags",R.string.SmarttagRegister)
|
||||
)
|
||||
*/
|
||||
)*/
|
||||
|
||||
|
||||
//sergio para que aparezca el nuevo menu
|
||||
|
||||
/* _pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
7,
|
||||
R.drawable.ic_add_black_24dp,
|
||||
"Obtener colección previa", R.string.PreSacador,"Obtiene colecciones para sacar en previa"
|
||||
)
|
||||
)*/
|
||||
|
||||
/* _pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
7,
|
||||
R.drawable.ic_streetview_black_24dp,
|
||||
"Pre Sacador", R.string.PreSacador,"Carga un ticket de previa para sacarlo"
|
||||
)
|
||||
)*/
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
7,
|
||||
|
|
|
@ -361,7 +361,7 @@ class EndSacadorFragment (
|
|||
"[" + sales[positionCollectionSplit].id + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionCollectionSplit].id + "/summary)"
|
||||
val message =
|
||||
"Se ha enviado a Split el articulo " + sales[positionCollectionSplit].itemFk +" del ticket " + ticket
|
||||
//"Se ha enviado a Split el articulo " + sales[positionCollectionSplit].itemFk + "(Referencia:"+sales[positionCollectionSplit].reference+") del ticket " + ticket
|
||||
|
||||
|
||||
/* viewModel.sendChekingPresence(
|
||||
token = getData(TOKEN),
|
||||
|
@ -389,7 +389,7 @@ class EndSacadorFragment (
|
|||
"[" + sales[positionIncreaseQuantity].id + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionIncreaseQuantity].id + "/summary)"
|
||||
val message =
|
||||
"Se ha modificado desde previa la cantidad original " + sales[positionIncreaseQuantity].quantity + " del artículo " + sales[positionIncreaseQuantity].itemFk +" a nueva cantidad: " + quantityIncrease + " del ticket " + ticket
|
||||
//"Se ha modificado desde previa la cantidad original " + sales[positionIncreaseQuantity].quantity + " del artículo " + sales[positionIncreaseQuantity].itemFk + "(Referencia:"+sales[positionIncreaseQuantity].reference+") a nueva cantidad: " + quantityIncrease + " del ticket " + ticket
|
||||
|
||||
|
||||
|
||||
sendSalixMessageNew(message, sales[positionIncreaseQuantity].salesPersonFk)
|
||||
|
@ -432,11 +432,12 @@ class EndSacadorFragment (
|
|||
|
||||
"TRUE"->{
|
||||
message = "Se ha enviado desde previa a Basura " + totalQuantity + " del articulo " + sales[positionCollectionMissing].itemFk + " ticket " + ticket
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
"FALSE"->{
|
||||
message= "Se ha enviado desde previa a Faltas la cantidad de " + totalQuantity + " del articulo " + sales[positionCollectionMissing].itemFk + " ticket " + ticket
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -444,7 +445,6 @@ class EndSacadorFragment (
|
|||
"reject"->{
|
||||
var quantityOriginal=totalQuantity.toInt()+quantityCollectionMissing.toInt()
|
||||
message = "Se ha modificado desde previa la cantidad de " +quantityOriginal+ " del artículo " + sales[positionCollectionMissing].itemFk + " a nueva cantidad: " + quantityCollectionMissing+ " del ticket " + ticket
|
||||
// message = "Se ha modificado desde previa la cantidad de " +quantityOriginal+ " del artículo " + sales[positionCollectionMissing].itemFk + "("+sales[positionCollectionMissing].reference+") a nueva cantidad: " + quantityCollectionMissing+ " del ticket " + ticket
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,8 +21,7 @@ fun PreSacadorItemVO.toSale() : SaleVO {
|
|||
agencyName = if (trabajador.isNullOrEmpty()) { "" } else trabajador,
|
||||
packingType=packingType,
|
||||
salePersonFk=if (salesPersonFk.isNullOrEmpty()){""}else salesPersonFk,
|
||||
//TODO modificar back y bbdd para obtener reference
|
||||
reference=if (reference.isNullOrEmpty()){""}else{reference}
|
||||
|
||||
|
||||
)
|
||||
}
|
||||
|
|
|
@ -3,8 +3,11 @@ package es.verdnatura.presentation.view.feature.sacador.fragment
|
|||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import androidx.fragment.app.setFragmentResultListener
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import es.verdnatura.R
|
||||
|
@ -65,7 +68,21 @@ class SacadorFragment :
|
|||
|
||||
|
||||
}
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
// Use the Kotlin extension in the fragment-ktx artifact
|
||||
setFragmentResultListener("requestKey") { requestKey, bundle ->
|
||||
|
||||
val result = bundle.getString("tagMode")
|
||||
resultTagMode=result
|
||||
Log.d("VERDNATURA::","el result es "+result)
|
||||
if (result.equals("complete") && getData(TAGSTYPE).equals("SmartTags")) {
|
||||
viewModel.collectionNew(getData(USER),
|
||||
getData(PASSWORD), getData(SECTORFK), getData(WAGON), getData(TAGSTYPE),"collection_new_wagon")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
override fun onPause() {
|
||||
goBack = true
|
||||
goBack2 = true
|
||||
|
@ -105,6 +122,7 @@ class SacadorFragment :
|
|||
|
||||
iconAdd.drawable -> {
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
// checkTagsMode()
|
||||
viewModel.collectionNew(getData(USER),
|
||||
getData(PASSWORD),getData(SECTORFK),getData(WAGON),getData(TAGSTYPE),"collection_new_wagon")
|
||||
}
|
||||
|
@ -130,14 +148,13 @@ class SacadorFragment :
|
|||
|
||||
private fun checkTagsMode() {
|
||||
|
||||
// Log.i("VERDNATURA:", "Tag type: ${getTagsType()}")
|
||||
|
||||
|
||||
if (getData(TAGSTYPE).equals("Stickers")) {
|
||||
//viewModel.collectionNew(user, password, sectorFk, wagons, "Stickers")
|
||||
viewModel.collectionNew(getData(USER),
|
||||
getData(PASSWORD), getData(SECTORFK), getData(WAGON),"collection_new_wagon")
|
||||
} else {
|
||||
// Log.i("VERDNATURA:", " el resultTagmode es ${resultTagMode}")
|
||||
Log.d("VERDNATURA::","ResultMode"+resultTagMode)
|
||||
if (resultTagMode.equals("complete")) {
|
||||
viewModel.collectionNew(getData(USER),
|
||||
getData(PASSWORD), getData(SECTORFK), getData(WAGON), getData(TAGSTYPE),"collection_new_wagon")
|
||||
|
@ -187,7 +204,8 @@ class SacadorFragment :
|
|||
if (goBack) addCollectionToList(it.response)
|
||||
}
|
||||
goBack = false
|
||||
//sergio:para asegurarnos que aparece en pantalla. En mi movil personal y trabajo no hacia falta.
|
||||
//sergio:para asegurarnos que aparece en pantalla.
|
||||
|
||||
|
||||
var working_in_test=false
|
||||
|
||||
|
@ -201,6 +219,20 @@ class SacadorFragment :
|
|||
|
||||
|
||||
})
|
||||
|
||||
registerSmarttagInsert.observe(viewLifecycleOwner, Observer {
|
||||
|
||||
if (!goBack){
|
||||
if (it.isError) {
|
||||
ma.messageWithSound(it.errorMessage,true,false)
|
||||
|
||||
} else {
|
||||
ma.messageWithSound(it.errorMessage,false,false)
|
||||
}
|
||||
goBack = false}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,6 +250,7 @@ class SacadorFragment :
|
|||
|
||||
private fun addCollectionToList(collection: String) {
|
||||
var isNew = true
|
||||
|
||||
collectionsList.forEach {
|
||||
if (it.collectionFk == collection) {
|
||||
isNew = false
|
||||
|
@ -225,6 +258,9 @@ class SacadorFragment :
|
|||
}
|
||||
if (isNew) {
|
||||
collectionsList.add(CollectionVO(collectionFk = collection, created = "Nuevo"))
|
||||
Log.d("VERDNATURA::","llamada nodejs insert")
|
||||
viewModel.smartTagInsertTicket(collection)
|
||||
|
||||
adapter?.notifyDataSetChanged()
|
||||
} else {
|
||||
customDialog.setTitle("Atención")
|
||||
|
|
|
@ -2,9 +2,11 @@ package es.verdnatura.presentation.view.feature.sacador.fragment
|
|||
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.GetSacadorControladorUserCase
|
||||
import es.verdnatura.domain.GetSmarttagsUserCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
|
@ -14,6 +16,7 @@ import es.verdnatura.presentation.view.feature.collection.mapper.map
|
|||
import es.verdnatura.presentation.view.feature.sacador.mapper.toDateFormat
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionListVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import es.verdnatura.presentation.view.feature.smarttag.sacador.model.SmartTagRegister
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
@ -26,6 +29,10 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
|
|||
context
|
||||
)
|
||||
|
||||
private val GetSmarttagsUserCase: GetSmarttagsUserCase = GetSmarttagsUserCase(
|
||||
context
|
||||
)
|
||||
|
||||
private val _collectionList by lazy { MutableLiveData<CollectionListVO>() }
|
||||
val collectionList: LiveData<CollectionListVO>
|
||||
get() = _collectionList
|
||||
|
@ -38,6 +45,9 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
|
|||
val response: LiveData<ResponseItemVO>
|
||||
get() = _response
|
||||
|
||||
private val _registerSmarttagInsert by lazy { MutableLiveData<SmartTagRegister>() }
|
||||
val registerSmarttagInsert: LiveData<SmartTagRegister>
|
||||
get() = _registerSmarttagInsert
|
||||
|
||||
|
||||
fun collectionTicketGet(
|
||||
|
@ -207,4 +217,53 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
|
|||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
fun smartTagInsertTicket(collectionFk: String)
|
||||
{
|
||||
GetSmarttagsUserCase.smartTagInsertTicket(collectionFk)
|
||||
.enqueue(object : Callback<SmartTagRegister>
|
||||
{
|
||||
override fun onResponse(
|
||||
call: Call<SmartTagRegister>,
|
||||
response: Response<SmartTagRegister>
|
||||
)
|
||||
{
|
||||
|
||||
val responseSmart: SmartTagRegister
|
||||
|
||||
if (response.isSuccessful()){
|
||||
Log.i("VERDNATURA::","El mensaje es "+response.message())
|
||||
responseSmart = SmartTagRegister(
|
||||
message="Ticket insertado OK.",
|
||||
isError = false,
|
||||
errorMessage = ""
|
||||
)
|
||||
|
||||
}else{
|
||||
responseSmart = SmartTagRegister(
|
||||
isError = true,
|
||||
errorMessage = response.message()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
_registerSmarttagInsert.value = responseSmart
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<SmartTagRegister>, t: Throwable)
|
||||
{
|
||||
val responseSmart =
|
||||
SmartTagRegister(isError = true, errorMessage = t.message!!)
|
||||
|
||||
Log.i("VERDNATURA::","el error nodejs es "+t.message+"--"+t.cause.toString()+"--"+t.stackTrace.toString())
|
||||
|
||||
_registerSmarttagInsert.value = responseSmart
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -61,8 +61,7 @@ class SaleVO(
|
|||
var cel2: String = "",
|
||||
var cel3: String = "",
|
||||
var saleGroupFk: String = "",
|
||||
var packingShelve:String="",
|
||||
var reference:String=""
|
||||
var packingShelve:String=""
|
||||
|
||||
|
||||
)
|
||||
|
|
|
@ -2,6 +2,7 @@ package es.verdnatura.presentation.view.feature.smarttag.register
|
|||
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.view.View.*
|
||||
import android.view.inputmethod.EditorInfo
|
||||
|
@ -40,6 +41,7 @@ class RegisterSmartTagsFragment(
|
|||
fun newInstance(entryPoint: String) = RegisterSmartTagsFragment(entryPoint)
|
||||
}
|
||||
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
super.onAttach(context)
|
||||
// sergio: en test: Log.i("VERDNATURA:","attached")
|
||||
|
@ -84,6 +86,8 @@ class RegisterSmartTagsFragment(
|
|||
|
||||
private fun setToolBar() {
|
||||
|
||||
|
||||
// Log.d("VERDNATURA::","Title"+entryPoint)
|
||||
binding.mainToolbar.toolbarTitle.text = entryPoint
|
||||
|
||||
}
|
||||
|
@ -92,32 +96,49 @@ class RegisterSmartTagsFragment(
|
|||
private fun bindShelving_add(shelvingOrSmarttag: String) {
|
||||
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
//poner el bindshelving aqui
|
||||
|
||||
viewModel.workerShelving_add(getData(USER),
|
||||
getData(PASSWORD), shelvingOrSmarttag)
|
||||
Log.d("VERDNATURA::","El selvingORSmarttag es "+shelvingOrSmarttag)
|
||||
if (listSmartTags.size < 1) {
|
||||
|
||||
} else {
|
||||
("http://localhost:7777/bindShelving/${listSmartTags.first().code}" + "&" + shelvingOrSmarttag + "&${listSmartTags.size}").toast(
|
||||
/* ("https://smart-tag.verdnatura.es/bindShelving/$shelvingOrSmarttag&${listSmartTags.first().code}&${listSmartTags.size}").toast(
|
||||
requireContext()
|
||||
)
|
||||
)*/
|
||||
viewModel.smartTagRegister(shelvingOrSmarttag,listSmartTags.first().code!!,listSmartTags.size.toString())
|
||||
|
||||
// Log.d("VERDNATURA::","https://smart-tag.verdnatura.es/bindShelving/$shelvingOrSmarttag&${listSmartTags.first().code}&${listSmartTags.size}")
|
||||
}
|
||||
|
||||
|
||||
itemScaned = shelvingOrSmarttag
|
||||
|
||||
add_item()
|
||||
}
|
||||
|
||||
private fun add_item(){
|
||||
var nameSmartTagwithWagon: String
|
||||
|
||||
nameSmartTagwithWagon =
|
||||
getTextScaned(listSmartTags.size + 1) + itemScaned
|
||||
customDialogList.setTitle(getTextToPosition(listSmartTags.size + 1))
|
||||
|
||||
|
||||
listSmartTags.add(SmartTag(itemScaned, nameSmartTagwithWagon))
|
||||
smartAdapter!!.notifyDataSetChanged()
|
||||
customDialogList.setValue("")
|
||||
}
|
||||
private fun bindShelving_remove() {
|
||||
|
||||
// binding.splashProgress.visibility = VISIBLE
|
||||
//ponser el unbindshleving aqui
|
||||
//poner el unbindshleving aqui
|
||||
//sergio:esto se debe hacer en
|
||||
|
||||
|
||||
("http://localhost:7777/unbindShelving/${listSmartTags.first().code}" + "&" + listSmartTags.last().code + "&${listSmartTags.size}").toast(
|
||||
requireContext()
|
||||
)
|
||||
listSmartTags.removeAt(listSmartTags.size - 1)
|
||||
|
||||
listSmartTags.removeAt(listSmartTags.size - 1)
|
||||
smartAdapter!!.notifyDataSetChanged()
|
||||
|
||||
|
||||
|
@ -140,8 +161,10 @@ class RegisterSmartTagsFragment(
|
|||
private fun setEvents() {
|
||||
|
||||
binding.mainToolbar.backButton.setOnClickListener {
|
||||
// Log.i("VERDNATURA:","PULSADO")
|
||||
|
||||
customDialogList.dismiss()
|
||||
requireActivity().onBackPressed()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -152,22 +175,27 @@ class RegisterSmartTagsFragment(
|
|||
|
||||
with(viewModel) {
|
||||
binding.splashProgress.visibility = GONE
|
||||
|
||||
registerSmarttagNode.observe(viewLifecycleOwner, Observer {
|
||||
|
||||
if (it.isError){
|
||||
ma.messageWithSound(it.errorMessage,true,false)
|
||||
}else{
|
||||
ma.messageWithSound(it.message,false,false)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
responseadd.observe(viewLifecycleOwner, Observer {
|
||||
// Log.i("VERDNATURA", "Revisar llamada de las etiquetas smarttags : ${it.response}")
|
||||
|
||||
|
||||
if (it.isError) {
|
||||
ma.messageWithSound(it.errorMessage,true,false)
|
||||
/* customDialog.setTitle("Error").setDescription(it.errorMessage)
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()*/
|
||||
|
||||
} else {
|
||||
var nameSmartTagwithWagon: String
|
||||
|
||||
//"Etiqueta/matrícula añadida correctamente".toast(context)
|
||||
//var sizeSmartTags = listSmartTags.size + 1
|
||||
|
||||
nameSmartTagwithWagon =
|
||||
getTextScaned(listSmartTags.size + 1) + itemScaned
|
||||
customDialogList.setTitle(getTextToPosition(listSmartTags.size + 1))
|
||||
|
@ -223,6 +251,7 @@ class RegisterSmartTagsFragment(
|
|||
if (listSmartTags.size > 0) {
|
||||
// setFragmentResult("requestkey", bundleOf("tagMode" to "SmartTag"))
|
||||
customDialogList.dismiss()
|
||||
requireActivity().onBackPressed()
|
||||
// ma.openFragmentPickers()
|
||||
/*listSmartTags.forEach {
|
||||
Log.i("VERDNATURA:","El codigo es :${it.code}")
|
||||
|
@ -230,15 +259,16 @@ class RegisterSmartTagsFragment(
|
|||
workerShelving_add(userFk, it.code!!)*/
|
||||
|
||||
} else {
|
||||
customDialog.setTitle("Atención").setDescription("No ha escaneado Smartags")
|
||||
/* customDialog.setTitle("Atención").setDescription("No ha escaneado Smartags")
|
||||
.setOkButton("Ok")
|
||||
{
|
||||
customDialog.dismiss()
|
||||
{*/
|
||||
customDialogList.dismiss()
|
||||
requireActivity().onBackPressed()
|
||||
|
||||
}.show()
|
||||
/* }.show()*/
|
||||
}
|
||||
|
||||
}.setKoButton("Deshacer") {
|
||||
/* }.setKoButton("Deshacer") {
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
|
||||
if (!listSmartTags.isEmpty()) {
|
||||
|
@ -249,7 +279,7 @@ class RegisterSmartTagsFragment(
|
|||
customDialogList.dismiss()
|
||||
requireActivity().onBackPressed()
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
//
|
||||
|
@ -284,7 +314,7 @@ class RegisterSmartTagsFragment(
|
|||
|
||||
|
||||
} else {
|
||||
bindShelving_add(customDialogList.getValue())
|
||||
bindShelving_add(customDialogList.getValue().uppercase())
|
||||
}
|
||||
|
||||
// showScanSmartTags(SmartTag(customDialogList.getValue()))
|
||||
|
|
|
@ -11,6 +11,8 @@ import androidx.fragment.app.setFragmentResult
|
|||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentSacadorAssociatesmarttagBinding
|
||||
import es.verdnatura.databinding.FragmentSacadorAssociatesmarttagBindingImpl
|
||||
import es.verdnatura.databinding.FragmentVehiclecontrolBinding
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
|
@ -26,7 +28,7 @@ import timber.log.Timber
|
|||
|
||||
class AssociateSmartTagsFragment(
|
||||
var entryPoint: String = ""
|
||||
) : BaseFragment<FragmentVehiclecontrolBinding, SmartTagsViewModel>(
|
||||
) : BaseFragment<FragmentSacadorAssociatesmarttagBinding, SmartTagsViewModel>(
|
||||
SmartTagsViewModel::class
|
||||
) {
|
||||
|
||||
|
@ -103,13 +105,7 @@ class AssociateSmartTagsFragment(
|
|||
|
||||
viewModel.workerShelving_add(getData(USER),
|
||||
getData(PASSWORD), shelvingOrSmarttag)
|
||||
if (listSmartTags.size < 1) {
|
||||
|
||||
} else {
|
||||
("http://localhost:7777/bindShelving/${listSmartTags.first().code}" + "&" + shelvingOrSmarttag + "&${listSmartTags.size}").toast(
|
||||
requireContext()
|
||||
)
|
||||
}
|
||||
itemScaned = shelvingOrSmarttag
|
||||
|
||||
}
|
||||
|
@ -123,9 +119,9 @@ class AssociateSmartTagsFragment(
|
|||
viewModel.workerShelving_delete(getData(USER),
|
||||
getData(PASSWORD), listSmartTags.last().code.toString())
|
||||
|
||||
("http://localhost:7777/unbindShelving/${listSmartTags.first().code}" + "&" + listSmartTags.last().code + "&${listSmartTags.size}").toast(
|
||||
/* ("http://localhost:7777/unbindShelving/${listSmartTags.first().code}" + "&" + listSmartTags.last().code + "&${listSmartTags.size}").toast(
|
||||
requireContext()
|
||||
)
|
||||
)*/
|
||||
|
||||
}
|
||||
|
||||
|
@ -161,24 +157,10 @@ class AssociateSmartTagsFragment(
|
|||
|
||||
if (it.isError) {
|
||||
ma.messageWithSound(it.errorMessage,true,false)
|
||||
/* customDialog.setTitle("Error").setDescription(it.errorMessage)
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()*/
|
||||
|
||||
} else {
|
||||
/* if (it.response != null) {
|
||||
|
||||
customDialog.setTitle("Error")
|
||||
.setDescription("Etiqueta o carro no válido")
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
|
||||
} else {*/
|
||||
|
||||
//"Etiqueta/matrícula añadida correctamente".toast(context)
|
||||
//var sizeSmartTags = listSmartTags.size + 1
|
||||
|
||||
ma.messageWithSound("Carro/etiqueta insertado",false,false)
|
||||
var nameSmartTagwithWagon =
|
||||
getTextScaned(0) + itemScaned
|
||||
customDialogList.setTitle(getTextToPosition(0))
|
||||
|
@ -188,7 +170,7 @@ class AssociateSmartTagsFragment(
|
|||
|
||||
customDialogList.setValue("")
|
||||
|
||||
// }
|
||||
|
||||
}
|
||||
binding.splashProgress.visibility = GONE
|
||||
})
|
||||
|
@ -210,18 +192,13 @@ class AssociateSmartTagsFragment(
|
|||
}.show()
|
||||
|
||||
} else {
|
||||
//var nameSmartTagwithWagon = ""
|
||||
|
||||
/* nameSmartTagwithWagon =
|
||||
getTextScaned(listSmartTags.size + 1) + itemScaned
|
||||
customDialogList.setTitle(getTextToPosition(listSmartTags.size + 1))
|
||||
|
||||
listSmartTags.add(SmartTag(itemScaned, nameSmartTagwithWagon))*/
|
||||
listSmartTags.removeAt(listSmartTags.size - 1)
|
||||
smartAdapter!!.notifyDataSetChanged()
|
||||
|
||||
customDialogList.setValue("")
|
||||
|
||||
ma.messageWithSound("Carro/etiqueta borrada",false,false)
|
||||
}
|
||||
}
|
||||
binding.splashProgress.visibility = GONE
|
||||
|
@ -271,6 +248,8 @@ class AssociateSmartTagsFragment(
|
|||
// setFragmentResult("requestkey", bundleOf("tagMode" to "SmartTag"))
|
||||
customDialogList.dismiss()
|
||||
|
||||
|
||||
Log.d("VERDNATURA::","Vamos a abrrir Sacadores")
|
||||
val result = "complete"
|
||||
setFragmentResult("requestKey", bundleOf("tagMode" to result))
|
||||
ma.openFragmentPickers(true)
|
||||
|
@ -280,12 +259,13 @@ class AssociateSmartTagsFragment(
|
|||
workerShelving_add(userFk, it.code!!)*/
|
||||
|
||||
} else {
|
||||
customDialog.setTitle("Atención").setDescription("No ha escaneado Smartags")
|
||||
/* customDialog.setTitle("Atención").setDescription("No ha escaneado Smartags")
|
||||
.setOkButton("Ok")
|
||||
{
|
||||
customDialog.dismiss()
|
||||
{*/
|
||||
customDialogList.dismiss()
|
||||
requireActivity().onBackPressed()
|
||||
|
||||
}.show()
|
||||
// }.show()
|
||||
}
|
||||
|
||||
}.setKoButton("Deshacer") {
|
||||
|
@ -310,7 +290,7 @@ class AssociateSmartTagsFragment(
|
|||
customDialogList.getEditText().setOnEditorActionListener { _, actionId, _ ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) {
|
||||
if (!customDialogList.getValue().isNullOrEmpty()) {
|
||||
bindShelving_add(customDialogList.getValue())
|
||||
bindShelving_add(customDialogList.getValue().uppercase())
|
||||
}
|
||||
customDialogList.setValue("")
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
|
|
|
@ -2,12 +2,15 @@ package es.verdnatura.presentation.view.feature.smarttag.sacador.fragment
|
|||
|
||||
import android.content.Context
|
||||
import android.os.Message
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.GetSmarttagsUserCase
|
||||
import es.verdnatura.domain.GetVehicleControlTimeUserCase
|
||||
import es.verdnatura.domain.NodeJsService
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import es.verdnatura.presentation.view.feature.smarttag.sacador.model.SmartTagRegister
|
||||
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
|
@ -38,6 +41,10 @@ class SmartTagsViewModel(context: Context) : BaseViewModel() {
|
|||
val responselevel: LiveData<ResponseItemVO>
|
||||
get() = _responselevel
|
||||
|
||||
private val _registerSmarttagNode by lazy { MutableLiveData<SmartTagRegister>() }
|
||||
val registerSmarttagNode: LiveData<SmartTagRegister>
|
||||
get() = _registerSmarttagNode
|
||||
|
||||
|
||||
fun workerShelving_add(usuario:String,password:String,shelvingFK:String){
|
||||
GetSmarttagsUserCase.workerShelving_add(usuario,password,shelvingFK).enqueue(object : Callback<Void>{
|
||||
|
@ -100,6 +107,49 @@ class SmartTagsViewModel(context: Context) : BaseViewModel() {
|
|||
})
|
||||
}
|
||||
|
||||
fun smartTagRegister(smarttag: String, wagon: String, shelving: String)
|
||||
{
|
||||
GetSmarttagsUserCase.smartTagRegister(smarttag, wagon, shelving)
|
||||
.enqueue(object : Callback<SmartTagRegister>
|
||||
{
|
||||
override fun onResponse(
|
||||
call: Call<SmartTagRegister>,
|
||||
response: Response<SmartTagRegister>
|
||||
)
|
||||
{
|
||||
|
||||
val responseSmart: SmartTagRegister
|
||||
|
||||
if (response.isSuccessful()){
|
||||
Log.i("VERDNATURA::","El mensaje es "+response.message())
|
||||
responseSmart = SmartTagRegister(
|
||||
message="Registrada smartTag.",
|
||||
isError = false,
|
||||
errorMessage = ""
|
||||
)
|
||||
|
||||
}else{
|
||||
responseSmart = SmartTagRegister(
|
||||
isError = true,
|
||||
errorMessage = response.message()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
_registerSmarttagNode.value = responseSmart
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<SmartTagRegister>, t: Throwable)
|
||||
{
|
||||
val responseSmart =
|
||||
SmartTagRegister(isError = true, errorMessage = t.message!!)
|
||||
|
||||
Log.i("VERDNATURA::","el error nodejs es "+t.message+"--"+t.cause.toString()+"--"+t.stackTrace.toString())
|
||||
|
||||
_registerSmarttagNode.value = responseSmart
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
}
|
|
@ -11,18 +11,13 @@ class SmartTagScan (
|
|||
class SmartTagScanList(
|
||||
var list:List<SmartTagScan> = listOf()
|
||||
)
|
||||
/*
|
||||
class ItemExpeditionScanVO(
|
||||
var id:String = "",
|
||||
var expeditionFk:String = "",
|
||||
var Ruta:String = "",
|
||||
var Ticket:String = "",
|
||||
var Caja:String = "",
|
||||
var isError:Boolean = false,
|
||||
var errorMessage:String = ""
|
||||
|
||||
class SmartTagRegister(
|
||||
var message: String = "",
|
||||
var smarttag: String = "",
|
||||
var wagon: String = "",
|
||||
var shelving: String = "",
|
||||
var isError: Boolean = false,
|
||||
var errorMessage: String = ""
|
||||
)
|
||||
|
||||
class ItemExpeditionScanList(
|
||||
var list:List<ItemExpeditionScanVO> = listOf()
|
||||
)*/
|
||||
|
||||
|
|
|
@ -159,4 +159,6 @@
|
|||
<string name="Split">Split</string>
|
||||
<string name="workermistake">Fallo del trabajador</string>
|
||||
<string name="buscarDepartamento">Buscar departamento</string>
|
||||
<string name="Noprinters">No hay impresora</string>
|
||||
<string name="Selecccionaimpresoara">Selecciona impresora</string>
|
||||
</resources>
|
||||
|
|
|
@ -46,7 +46,9 @@
|
|||
<string name="Sinsector">Without sector</string>
|
||||
<string name="Close">Close</string>
|
||||
<string name="Noexistessectores">There are no sectors.</string>
|
||||
<string name="Noprinters">There are no printers.</string>
|
||||
<string name="Seleccionaunsector">Select a sector</string>
|
||||
<string name="Selecccionaimpresoara">Select a printer</string>
|
||||
<string name="Pasilleros">Corridors</string>
|
||||
<string name="Sacadores">Punch</string>
|
||||
<string name="Controladores">Controller</string>
|
||||
|
|
Loading…
Reference in New Issue