Versión 6.1.3 más textos cambiados y quitadas llamadas a collection_updateState

This commit is contained in:
sergiodt 2021-07-05 07:49:54 +02:00 committed by sergiodt
parent 6b374d72b7
commit f8ac0a95bc
86 changed files with 2320 additions and 273 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8" />
<bytecodeTargetLevel target="11" />
</component>
</project>

View File

@ -5,6 +5,7 @@
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="disableWrapperSourceDistributionNotification" value="true" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">

View File

@ -21,5 +21,10 @@
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://jitpack.io" />
</remote-repository>
</component>
</project>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@ -3,6 +3,7 @@
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />

View File

@ -14,8 +14,9 @@ android {
applicationId "es.verdnatura"
minSdkVersion 21
targetSdkVersion 29
versionCode 55
versionName "5.4.5"
versionCode 60
// versionName "5.4.4"
versionName "6.1.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@ -84,4 +85,7 @@ dependencies {
implementation 'com.google.firebase:firebase-analytics:17.5.0'
implementation 'com.google.firebase:firebase-crashlytics:17.2.1'
//search
implementation 'com.github.mirrajabi:search-dialog:1.1'
}

Binary file not shown.

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

Binary file not shown.

View File

@ -0,0 +1,18 @@
{
"version": 2,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "es.verdnatura",
"variantName": "processReleaseResources",
"elements": [
{
"type": "SINGLE",
"filters": [],
"versionCode": 60,
"versionName": "6.1.3",
"outputFile": "app-release.apk"
}
]
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

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

Binary file not shown.

Binary file not shown.

View File

@ -3,6 +3,7 @@ package es.verdnatura.di
import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesViewModel
import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardViewModel
import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemViewModel
import es.verdnatura.presentation.view.feature.buscaritemall.fragment.BuscarItemAllViewModel
import es.verdnatura.presentation.view.feature.calidad.fragment.BuyersViewModel
import es.verdnatura.presentation.view.feature.calidad.fragment.QaualityViewModel
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionViewModel
@ -53,6 +54,11 @@ val viewModelModule = module{
BuscarItemViewModel(androidContext())
}
// Pasilleros / Buscar Item 2
viewModel {
BuscarItemAllViewModel(androidContext())
}
// Pasilleros / Inventario
viewModel {
InventaryViewModel(androidContext())

View File

@ -3,6 +3,7 @@ package es.verdnatura.domain
import android.content.Context
import android.content.SharedPreferences
import android.preference.PreferenceManager
import android.util.Log
import okhttp3.OkHttpClient
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
@ -13,8 +14,8 @@ class ApiUtils {
companion object {
//const val BASE_URL:String = "http://192.168.1.54:8009/"
const val BASE_URL:String = "https://app.verdnatura.es/"
//const val BASE_URL:String = "https://test-app.verdnatura.es/"
//const val BASE_URL:String = "http://10.1.4.186/"
fun getApiService(context: Context):VerdnaturaService{
val retrofit = Retrofit.Builder()

View File

@ -0,0 +1,15 @@
package es.verdnatura.domain
import android.content.Context
import es.verdnatura.presentation.view.feature.buscaritemall.model.ItemLocationAll
import retrofit2.Call
class GetBuscarItemAllUserCase(context: Context) : RestClient(context) {
fun searchItemsUbicadorAll(usuario:String,password:String,itemFk:String) : Call<List<ItemLocationAll>> {
val params:ArrayList<String> = ArrayList()
params.add(itemFk)
return restClient!!.searchItemsUbicadorAll("json","1",usuario,password,"application/json",params = params)
}
}

View File

@ -1,6 +1,8 @@
package es.verdnatura.domain
import android.content.Context
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import retrofit2.Call
@ -13,6 +15,13 @@ class GetInventaryUserCase(context: Context) : RestClient(context) {
return restClient!!.itemShelvingRadar("json","1",usuario,password,"application/json",params = params)
}
fun itemShelvingRadarFilterBuyer(usuario:String,password:String,buyerFk:String,warehouseFk: String) : Call<List<ItemInventaryVO>> {
val params:ArrayList<String> = ArrayList();
params.add(buyerFk)
params.add(warehouseFk)
return restClient!!.itemShelvingRadarFilterBuyer("json","1",usuario,password,"application/json",params = params)
}
fun faultsReview(usuario:String,password:String,warehouseFk:String) : Call<List<ItemFaltasVO>> {
val params:ArrayList<String> = ArrayList();
params.add(warehouseFk)
@ -26,4 +35,10 @@ class GetInventaryUserCase(context: Context) : RestClient(context) {
return restClient!!.faultsReview_isChecked("json","1",usuario,password,"application/json",params = params)
}
fun itemShelvingBuyerGet(usuario:String,password:String) : Call<List<BuyerVO>> {
return restClient!!.itemShelvingBuyerGet("json","1",usuario,password,"application/json")
}
}

View File

@ -2,6 +2,7 @@ package es.verdnatura.domain
import android.content.Context
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoVO
import retrofit2.Call
@ -14,6 +15,10 @@ class GetItemCardUserCase(context: Context) : RestClient(context) {
return restClient!!.getItemCard("json","1",usuario,password,"application/json",params = params)
}
fun getItemPackingType(usuario:String,password:String) : Call<List<ItemPackingType>> {
val params:ArrayList<String> = ArrayList();
return restClient!!.getItemPackingType("json","1",usuario,password,"application/json",params = params)
}
fun itemStockUpdate(usuario:String,password:String,itemFk:String,warehouseFk:String,newVisible:String,isTrash:String ) : Call<String> {
val params:ArrayList<String> = ArrayList();
@ -57,6 +62,14 @@ class GetItemCardUserCase(context: Context) : RestClient(context) {
return restClient!!.updatePacking("json","1",usuario,password,"application/json",params = params)
}
fun updatePackingType(usuario:String,password:String,itemFk:String,ItemPackingType:String) : Call<Boolean> {
val params:ArrayList<String> = ArrayList();
params.add(itemFk)
params.add(ItemPackingType)
return restClient!!.updatePackingType("json","1",usuario,password,"application/json",params = params)
}
fun itemSaveMin(usuario:String,password:String,itemFk:String,value:String) : Call<String> {
val params:ArrayList<String> = ArrayList();
params.add(itemFk)

View File

@ -3,12 +3,13 @@ package es.verdnatura.domain
import android.content.Context
import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO
import es.verdnatura.presentation.view.feature.login.model.SalixMessageVO
import es.verdnatura.presentation.view.feature.login.model.versionApp
import retrofit2.Call
class GetLoginUserCase(context: Context) : RestClient(context) {
fun login(usuario:String,password:String) : Call<String>{
val params:ArrayList<String> = ArrayList();
val params:ArrayList<String> = ArrayList()
params.add(usuario)
params.add(password)
return restClient!!.login("json","1",usuario,password,"application/json",params)
@ -18,8 +19,8 @@ class GetLoginUserCase(context: Context) : RestClient(context) {
return salixClient!!.login("application/json", LoginSalixVO(usuario,password))
}
fun checkVersion(usuario:String,password:String,version:String) : Call<Boolean> {
val params:ArrayList<String> = ArrayList();
fun checkVersion_old(usuario:String,password:String,version:String) : Call<Boolean> {
val params:ArrayList<String> = ArrayList()
params.add(version)
return restClient!!.version("json","1",usuario,password,"application/json",params)
}
@ -28,4 +29,10 @@ class GetLoginUserCase(context: Context) : RestClient(context) {
return salixClient!!.sendChekingPresence(content_type = "application/json", authorization = token, params = SalixMessageVO(workerId = workerId,message = message))
}
fun checkVersion(usuario:String,password:String,nameApp:String) : Call<versionApp> {
val params:ArrayList<String> = ArrayList()
params.add(nameApp)
return restClient!!.version2("json","1",usuario,password,"application/json",params)
}
}

View File

@ -12,59 +12,74 @@ class GetPaletizadoresUserCase(context: Context) : RestClient(context) {
}
fun expeditionTruckAdd(usuario:String,password:String,vHour:String,vDescription:String) : Call<String> {
val params:ArrayList<String> = ArrayList();
val params:ArrayList<String> = ArrayList()
params.add(vHour)
params.add(vDescription)
// ////Log.i("VERDNATURA"," La hora es $vHour y descrip $vDescription")
return restClient!!.expeditionTruckAdd("json","1",usuario,password,"application/json",params)
}
fun expeditionPallet_List(usuario:String,password:String,vTruckFk:String) : Call<List<ItemPalletVO>> {
val params:ArrayList<String> = ArrayList();
val params:ArrayList<String> = ArrayList()
params.add(vTruckFk)
return restClient!!.expeditionPallet_List("json","1",usuario,password,"application/json",params)
}
fun expeditionScanAdd(usuario:String,password:String,vPalletFk:String,vTruckFk:String) : Call<List<ItemScanVO>> {
val params:ArrayList<String> = ArrayList();
val params:ArrayList<String> = ArrayList()
params.add(vPalletFk)
params.add(vTruckFk)
return restClient!!.expeditionScanAdd("json","1",usuario,password,"application/json",params)
}
fun expeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String) : Call<String> {
val params:ArrayList<String> = ArrayList();
val params:ArrayList<String> = ArrayList()
params.add(vPalletFk)
params.add(vExpeditionFk)
return restClient!!.expeditionScanPut("json","1",usuario,password,"application/json",params)
}
fun checkRouteExpeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String) : Call<String> {
val params:ArrayList<String> = ArrayList()
params.add(vPalletFk)
params.add(vExpeditionFk)
return restClient!!.checkRouteExpeditionScanPut("json","1",usuario,password,"application/json",params)
}
fun expeditionPalletView(usuario:String,password:String,vPalletFk:String) : Call<List<ItemPalletViewVO>> {
val params:ArrayList<String> = ArrayList();
val params:ArrayList<String> = ArrayList()
params.add(vPalletFk)
return restClient!!.expeditionPalletView("json","1",usuario,password,"application/json",params)
}
fun expeditionPalletDel(usuario:String,password:String,vPalletFk:String) : Call<String> {
val params:ArrayList<String> = ArrayList();
val params:ArrayList<String> = ArrayList()
params.add(vPalletFk)
return restClient!!.expeditionPalletDel("json","1",usuario,password,"application/json",params)
}
fun expeditionScanList(usuario:String,password:String,vPalletFk:String) : Call<List<ItemExpeditionScanVO>> {
val params:ArrayList<String> = ArrayList();
val params:ArrayList<String> = ArrayList()
params.add(vPalletFk)
return restClient!!.expeditionScanList("json","1",usuario,password,"application/json",params)
}
fun expeditionScanDel(usuario:String,password:String,vScanFk:String) : Call<String> {
val params:ArrayList<String> = ArrayList();
val params:ArrayList<String> = ArrayList()
params.add(vScanFk)
return restClient!!.expeditionScanDel("json","1",usuario,password,"application/json",params)
}
fun expeditionPalletPrintSet(usuario:String,password:String,vPalletFk:String) : Call<String> {
fun expeditionPalletPrintSet(
usuario: String,
password: String,
vPalletFk: String,
vSectorFk: String
) : Call<String> {
val params:ArrayList<String> = ArrayList();
params.add(vPalletFk)
params.add(vSectorFk)
return restClient!!.expeditionPalletPrintSet("json","1",usuario,password,"application/json",params)
}

View File

@ -1,6 +1,7 @@
package es.verdnatura.domain
import android.content.Context
import android.util.Log
import es.verdnatura.presentation.view.feature.collection.ItemVO
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
@ -17,11 +18,14 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
return restClient!!.collectionTicketGet("json","1",usuario,password,"application/json",params)
}
fun collectionNew(usuario:String,password:String,sectorFk:String) : Call<String> {
fun collectionNew(usuario:String,password:String,sectorFk:String,carros:String) : Call<String> {
val params:ArrayList<String> = ArrayList();
params.add(sectorFk)
params.add(carros)
return restClient!!.collectionNew("json","1",usuario,password,"application/json",params)
}
}
fun collectionGet(usuario:String,password:String) : Call<List<CollectionVO>> {
val params:ArrayList<String> = ArrayList();

View File

@ -4,6 +4,8 @@ package es.verdnatura.domain
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
import es.verdnatura.presentation.view.feature.buscaritemall.model.ItemLocationAll
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
import es.verdnatura.presentation.view.feature.calidad.model.ItemBuyerVO
@ -11,6 +13,7 @@ import es.verdnatura.presentation.view.feature.collection.ItemVO
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoVO
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import es.verdnatura.presentation.view.feature.login.model.versionApp
import es.verdnatura.presentation.view.feature.paletizador.model.*
import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
@ -46,6 +49,16 @@ interface VerdnaturaService {
@Body params: List<String>):
Call<Boolean>
@POST("/security/getVersion")
fun version2(@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<versionApp>
//AJUSTES ========================================================================>
@POST("almacennew/sector_get")
@ -273,6 +286,17 @@ interface VerdnaturaService {
@Body params: List<String>):
Call<ItemCardVO>
@POST("almacennew/get_ItemPackingType")
fun getItemPackingType(@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<List<ItemPackingType>>
@POST("almacennew/itemStockUpdate")
fun itemStockUpdate(@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@ -318,6 +342,15 @@ interface VerdnaturaService {
@Body params: List<String>):
Call<String>
@POST("almacennew/update_ItemPackingType")
fun updatePackingType(@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<Boolean>
@POST("almacennew/itemSaveMin")
fun itemSaveMin(@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@ -347,7 +380,19 @@ interface VerdnaturaService {
@Body params: List<String>):
Call<List<ItemLocationVO>>
// BUSCAR ITEM ALL
@POST("almacennew/getItemUbication")
fun searchItemsUbicadorAll(@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<List<ItemLocationAll>>
//INVENTARIO ========================================================================>
@POST("almacennew/itemShelvingRadar")
fun itemShelvingRadar(@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@ -357,6 +402,15 @@ interface VerdnaturaService {
@Body params: List<String>):
Call<List<ItemInventaryVO>>
@POST("almacennew/itemShelving_filterBuyer")
fun itemShelvingRadarFilterBuyer(@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<List<ItemInventaryVO>>
@POST("almacennew/faultsReview")
fun faultsReview(@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@ -523,6 +577,17 @@ interface VerdnaturaService {
@Body params: List<String>):
Call<String>
@POST("almacennew/checkRouteExpeditionScanPut")
fun checkRouteExpeditionScanPut(@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String,
@Body params: List<String>):
Call<String>
@POST("almacennew/expeditionPalletView")
fun expeditionPalletView(@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@ -595,4 +660,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String,
@Body params: List<String>):
Call<String>
}
}

View File

@ -1,8 +1,11 @@
package es.verdnatura.presentation.base
import android.Manifest
import android.app.AlarmManager
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.content.pm.PackageManager
import android.media.AudioManager
import android.os.Build
@ -23,7 +26,6 @@ import androidx.fragment.app.Fragment
import es.verdnatura.domain.toast
import es.verdnatura.presentation.common.mediaCurrentVolume
import es.verdnatura.presentation.common.mediaMaxVolume
import es.verdnatura.presentation.common.setMediaVolume
import org.koin.androidx.viewmodel.ext.android.viewModel
import java.util.*
import kotlin.reflect.KClass
@ -32,7 +34,7 @@ import kotlin.reflect.KClass
abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelClass: KClass<V>) :
Fragment(), TextToSpeech.OnInitListener , RecognitionListener{
protected val TAG="VERDNATURA"
protected val PREFS_USER = "es.verdnatura.user.prefs"
protected val USERFK = "userFk"
protected val USER = "user"
@ -43,11 +45,18 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
protected val WAREHOUSEFK = "warehouseFk"
protected val RECORDAR = "recordar"
protected val VOZ = "voz"
//nuevo campo número carros ajustes y campos para guardar el buyerid y buyernickname
protected val BUYER = "buyernickname"
protected val BUYERID="buyerid"
protected val CARRO="carro"
protected val WAREHOUSEFK_DEFAULT=60
protected val viewModel: V by viewModel(viewModelClass)
protected lateinit var binding: T
private var isOnReadyForSpeech = false
private var textToSpeech: TextToSpeech? = null
private var mAudioManager:AudioManager? = null
protected var mSpeechRecognizer: SpeechRecognizer? = null
@ -101,6 +110,21 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
mAudioManager = requireActivity().getSystemService(Context.AUDIO_SERVICE) as AudioManager
}
open fun restartapp(f : Fragment){
val mStartActivity = Intent(context, f::class.java)
val mPendingIntentId = 123456
val mPendingIntent = PendingIntent.getActivity(
context,
mPendingIntentId,
mStartActivity,
PendingIntent.FLAG_CANCEL_CURRENT
)
val mgr = context!!.getSystemService(Context.ALARM_SERVICE) as AlarmManager
mgr[AlarmManager.RTC, System.currentTimeMillis() + 100] = mPendingIntent
System.exit(0)
}
open fun initialize(){
//ESCUCHA
try {
@ -316,94 +340,107 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
mSpeechRecognizer = null
}
}
fun saveBuyer(buyernickname: String) {
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER, 0)
val editor = prefs.edit()
editor.putString(BUYER, buyernickname)
editor.apply()
}
fun saveBuyerId(buyerid: String) {
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER, 0)
val editor = prefs.edit()
editor.putString(BUYERID, buyerid)
editor.apply()
}
/*open fun wordToNumber(input: String?): Int {
var input = input
var isValidInput = true
var result = 0
var finalResult = 0
if (input != null && input.length > 0) {
input = input.replace("-".toRegex(), " ")
input = input.toLowerCase().replace(" and".toRegex(), " ")
val splittedParts =
input.trim { it <= ' ' }.split("\\s+".toRegex()).toTypedArray()
for (str in splittedParts) {
if (!es.verdnatura.warehouse.UTILS.Utils.allowedStrings.contains(str)) {
isValidInput = false
return -1
}
}
if (isValidInput) {
/*open fun wordToNumber(input: String?): Int {
var input = input
var isValidInput = true
var result = 0
var finalResult = 0
if (input != null && input.length > 0) {
input = input.replace("-".toRegex(), " ")
input = input.toLowerCase().replace(" and".toRegex(), " ")
val splittedParts =
input.trim { it <= ' ' }.split("\\s+".toRegex()).toTypedArray()
for (str in splittedParts) {
if (str.equals("cero", ignoreCase = true)) {
result += 0
} else if (str.equals("uno", ignoreCase = true)) {
result += 1
} else if (str.equals("dos", ignoreCase = true)) {
result += 2
} else if (str.equals("tres", ignoreCase = true)) {
result += 3
} else if (str.equals("cuatro", ignoreCase = true)) {
result += 4
} else if (str.equals("cinco", ignoreCase = true)) {
result += 5
} else if (str.equals("seis", ignoreCase = true)) {
result += 6
} else if (str.equals("siete", ignoreCase = true)) {
result += 7
} else if (str.equals("ocho", ignoreCase = true)) {
result += 8
} else if (str.equals("nueve", ignoreCase = true)) {
result += 9
} else if (str.equals("diez", ignoreCase = true)) {
result += 10
} else if (str.equals("once", ignoreCase = true)) {
result += 11
} else if (str.equals("doce", ignoreCase = true)) {
result += 12
} else if (str.equals("trece", ignoreCase = true)) {
result += 13
} else if (str.equals("catorce", ignoreCase = true)) {
result += 14
} else if (str.equals("quince", ignoreCase = true)) {
result += 15
} else if (str.equals("dieziseis", ignoreCase = true)) {
result += 16
} else if (str.equals("diezisiete", ignoreCase = true)) {
result += 17
} else if (str.equals("dieziocho", ignoreCase = true)) {
result += 18
} else if (str.equals("diezinueve", ignoreCase = true)) {
result += 19
} else if (str.equals("veinte", ignoreCase = true)) {
result += 20
} else if (str.equals("treinta", ignoreCase = true)) {
result += 30
} else if (str.equals("cuarenta", ignoreCase = true)) {
result += 40
} else if (str.equals("cincuenta", ignoreCase = true)) {
result += 50
} else if (str.equals("sesenta", ignoreCase = true)) {
result += 60
} else if (str.equals("setenta", ignoreCase = true)) {
result += 70
} else if (str.equals("ochenta", ignoreCase = true)) {
result += 80
} else if (str.equals("noventa", ignoreCase = true)) {
result += 90
} else if (str.equals("cien", ignoreCase = true)) {
result *= 100
} else if (str.equals("mil", ignoreCase = true)) {
result *= 1000
finalResult += result
result = 0
if (!es.verdnatura.warehouse.UTILS.Utils.allowedStrings.contains(str)) {
isValidInput = false
return -1
}
}
finalResult += result
return finalResult
if (isValidInput) {
for (str in splittedParts) {
if (str.equals("cero", ignoreCase = true)) {
result += 0
} else if (str.equals("uno", ignoreCase = true)) {
result += 1
} else if (str.equals("dos", ignoreCase = true)) {
result += 2
} else if (str.equals("tres", ignoreCase = true)) {
result += 3
} else if (str.equals("cuatro", ignoreCase = true)) {
result += 4
} else if (str.equals("cinco", ignoreCase = true)) {
result += 5
} else if (str.equals("seis", ignoreCase = true)) {
result += 6
} else if (str.equals("siete", ignoreCase = true)) {
result += 7
} else if (str.equals("ocho", ignoreCase = true)) {
result += 8
} else if (str.equals("nueve", ignoreCase = true)) {
result += 9
} else if (str.equals("diez", ignoreCase = true)) {
result += 10
} else if (str.equals("once", ignoreCase = true)) {
result += 11
} else if (str.equals("doce", ignoreCase = true)) {
result += 12
} else if (str.equals("trece", ignoreCase = true)) {
result += 13
} else if (str.equals("catorce", ignoreCase = true)) {
result += 14
} else if (str.equals("quince", ignoreCase = true)) {
result += 15
} else if (str.equals("dieziseis", ignoreCase = true)) {
result += 16
} else if (str.equals("diezisiete", ignoreCase = true)) {
result += 17
} else if (str.equals("dieziocho", ignoreCase = true)) {
result += 18
} else if (str.equals("diezinueve", ignoreCase = true)) {
result += 19
} else if (str.equals("veinte", ignoreCase = true)) {
result += 20
} else if (str.equals("treinta", ignoreCase = true)) {
result += 30
} else if (str.equals("cuarenta", ignoreCase = true)) {
result += 40
} else if (str.equals("cincuenta", ignoreCase = true)) {
result += 50
} else if (str.equals("sesenta", ignoreCase = true)) {
result += 60
} else if (str.equals("setenta", ignoreCase = true)) {
result += 70
} else if (str.equals("ochenta", ignoreCase = true)) {
result += 80
} else if (str.equals("noventa", ignoreCase = true)) {
result += 90
} else if (str.equals("cien", ignoreCase = true)) {
result *= 100
} else if (str.equals("mil", ignoreCase = true)) {
result *= 1000
finalResult += result
result = 0
}
}
finalResult += result
return finalResult
}
}
}
return finalResult
}*/
return finalResult
}*/
}

View File

@ -1,10 +1,14 @@
package es.verdnatura.presentation.view.feature.ajustes.fragment
import android.app.AlarmManager
import android.app.AlertDialog
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.os.Bundle
import android.preference.PreferenceManager
import android.util.Log
import android.view.KeyEvent
import android.view.View
import androidx.lifecycle.Observer
@ -20,6 +24,8 @@ 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.SectorItemVO
import es.verdnatura.presentation.view.feature.login.activity.LoginActivity
import es.verdnatura.presentation.view.feature.login.fragment.LoginFragment
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_ajustes.*
import kotlinx.android.synthetic.main.fragment_ajustes.splash_progress
@ -34,6 +40,8 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
private var vozList:List<String> = listOf()
private var prefs: SharedPreferences? = null
private var ajustesAdapter: AjustesAdapter? = null
//añadido
private var carroList:List<String> = listOf()
companion object {
fun newInstance() = AjustesFragment()
@ -43,8 +51,9 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
override fun onCreate(savedInstanceState: Bundle?) {
prefs = activity!!.getSharedPreferences(PREFS_USER,0)
customDialog = CustomDialog(requireContext())
viewModel.inititializeDefaultAjusts(prefs!!.getString(SECTORDESCRIP,getString(R.string.Sinsector)).toString(),prefs!!.getInt(SECTORFK,0),prefs!!.getInt(WAREHOUSEFK,0),prefs!!.getString(VOZ,"NO").toString())
//modificat el InitilializeAjusts
viewModel.inititializeDefaultAjusts(prefs!!.getString(SECTORDESCRIP,getString(R.string.Sinsector)).toString(),prefs!!.getInt(SECTORFK,0),prefs!!.getInt(WAREHOUSEFK,0),prefs!!.getString(VOZ,"NO").toString(),prefs!!.getString(CARRO,"2").toString())
super.onCreate(savedInstanceState)
}
@ -61,10 +70,17 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
txtserver.setOnKeyListener(View.OnKeyListener { v, keyCode, event ->
if (keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_UP) {
this.setDefaults("base_url",txtserver.text.toString(),this.requireContext())
this.setDefaults("base_url", edittext_server.text.toString(), this.requireContext())
this.hideKeyboard()
// sergio: se comenta línea de abajo porque da fallo en la app//
// this.setDefaults("base_url", edittext_server.text.toString(), this.requireContext())
this.hideKeyboard()
//sergio:creada restartapp en BaseFragment por si es necesario utilizarla de nuevo.
// se hace un restart por si se cambia el servidor para que tome nuevos valores
restartapp(this)
return@OnKeyListener false
}
false
})
@ -82,7 +98,22 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
} else if (item.id == 1){
activity!!.onBackPressed()
}else if (item.id == 2){
getString(R.string.Nodisponibleenestaversión).toast(requireContext())
// ////Log.i("VERDNATURA","Carros pulsados")
val listCarros : ArrayList<String> = ArrayList()
listCarros.add("1")
listCarros.add("2")
listCarros.add("3")
listCarros.add("4")
listCarros.add("5")
listCarros.add("6")
carroList = listCarros
val array= arrayOfNulls<String>(listCarros.size)
showDialogCarros(array=listCarros.toArray(array))
// getString(R.string.Nodisponibleenestaversión).toast(requireContext())
// getString(R.string.enbreveDisponible).toast(requireContext())
}else if (item.id == 3){
val listVoz : ArrayList<String> = ArrayList()
listVoz.add("NO")
@ -151,9 +182,7 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
}
}
}
val dialog = builder.create()
dialog.show()
}
@ -170,7 +199,6 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
val editor = prefs!!.edit()
editor.putString(VOZ,it)
editor.apply()
viewModel.ajustesitem.get(3).selected = it
ajustesAdapter!!.notifyDataSetChanged()
@ -186,6 +214,36 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
}
//sergio : guardar datos
private fun showDialogCarros(array:Array<String>){
val builder = AlertDialog.Builder(this.context)
builder.setTitle(getString(R.string.Seleccionauncarro))
builder.setItems(array) { _, which ->
val selected = array[which]
carroList.forEach {
if (it.equals(selected)){
val editor = prefs!!.edit()
editor.putString(CARRO,it)
editor.apply()
viewModel.ajustesitem.get(2).selected = it
ajustesAdapter!!.notifyDataSetChanged()
return@forEach
}
}
}
val dialog = builder.create()
dialog.show()
}
fun setDefaults(key: String?, value: String?, context: Context?) {
val preferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
val editor = preferences.edit()

View File

@ -35,7 +35,7 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
fun inititializeDefaultAjusts(sectorDescrip: String,sectorFk : Int, warehouseFk : Int,vozDescrip:String) {
fun inititializeDefaultAjusts(sectorDescrip: String,sectorFk : Int, warehouseFk : Int,vozDescrip:String,carroDescrip:String) {
_ajustesitem.add(
AjustesItemVO(0,
"Sector",
@ -54,7 +54,7 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
_ajustesitem.add(
AjustesItemVO(2,
"Carros",
"",
carroDescrip,
0,
0)
)

View File

@ -2,11 +2,15 @@ package es.verdnatura.presentation.view.feature.articulo.fragment
import android.app.AlertDialog
import android.content.Intent
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.util.Log
import android.view.View
import android.view.inputmethod.EditorInfo
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
@ -26,12 +30,17 @@ import es.verdnatura.presentation.view.feature.articulo.adapter.ItemCardAdapter
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
import es.verdnatura.presentation.view.feature.calidad.model.BuyerListVO
import es.verdnatura.presentation.view.feature.imageview.activity.ImageViewActivity
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.inventario.fragment.SearchBuyerModel
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.buyers_fragment.*
import kotlinx.android.synthetic.main.fragment_item_card.*
import kotlinx.android.synthetic.main.fragment_item_card.splash_progress
import kotlinx.android.synthetic.main.toolbar.*
class ItemCardFragment(
@ -47,6 +56,9 @@ class ItemCardFragment(
private var barcodeAdapter : BarcodeAdapter? = null
private var listItemsRow:ArrayList<ItemCardRowVO> = ArrayList()
private var listBarcodes:ArrayList<BarcodeVO> = ArrayList()
private var itemsPackingType:ArrayList<ItemPackingType> = ArrayList()
private var itemInfoG:ItemCardVO? = null
@ -58,17 +70,23 @@ class ItemCardFragment(
private lateinit var customDialogList: CustomDialogList
private lateinit var customDialogTwo: CustomDialogTwoButtons
private val _buyersList by lazy { MutableLiveData<BuyerListVO>() }
val buyersList: LiveData<BuyerListVO>
get() = _buyersList
override fun getLayoutId(): Int = R.layout.fragment_item_card
override fun init() {
itemcard_layout.visibility = View.GONE
activity!!.main_bottom_navigation.visibility = View.GONE
setEvents()
toolbar_title.text = "ItemCard"
toolbar_title.text = getString(R.string.ConsultarArticulo)
customDialog = CustomDialog(requireContext())
customDialogInput = CustomDialogInput(requireContext())
customDialogList = CustomDialogList(requireContext())
customDialogTwo = CustomDialogTwoButtons(requireContext())
//sergio: se le pasa el item desde otros fragments
if (!itemFk.isNullOrEmpty()){
getItemCard(itemFk)
}
@ -138,6 +156,7 @@ class ItemCardFragment(
this.itemFk = itemFk
splash_progress.visibility = View.VISIBLE
viewModel.getItemCard(itemFk,warehouseFk,user!!,password!!)
viewModel.getItemPackingType(user!!,password!!)
}
override fun observeViewModel() {
@ -165,6 +184,13 @@ class ItemCardFragment(
}
})
itemspackinglist.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.GONE
// Log.i("VERDNATURA","el code es $it.code")
// Log.i("VERDNATURA","la descrip es $it.description")
createItemTypeTypeList(it.list)
})
response.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.GONE
if (it.isError){
@ -178,6 +204,20 @@ class ItemCardFragment(
}
}
private fun createItemTypeTypeList(list: List<ItemPackingType>) {
itemsPackingType.clear()
list.forEach { item ->
if (!item.isError){
try {
itemsPackingType.add(ItemPackingType(item.code,item.description));
// Log.i("VERDNATURA","Nombre encajado ${item.code} : ${item.description}")
}catch (e:Exception){}
}
}}
private fun setItemCard(itemInfo:ItemCardVO){
itemInfoG = itemInfo
toolbar_title.text = itemInfo.id+"-"+itemInfo.longName
@ -190,7 +230,7 @@ class ItemCardFragment(
itemcard_tag3.text = itemInfo.value6
itemcard_tag4.text = itemInfo.value7 + " " + itemInfo.origin
listItemsRow = ArrayList()
listItemsRow.add(ItemCardRowVO(title = "Total",value = itemInfo.total,isEditable = false))
listItemsRow.add(ItemCardRowVO(title = getString(R.string.total),value = itemInfo.total,isEditable = false))
listItemsRow.add(ItemCardRowVO(title = getString(R.string.Disponible),value = itemInfo.available,isEditable = false))
listItemsRow.add(ItemCardRowVO(title = getString(R.string.Ubicado),value = itemInfo.enAltillo,isEditable = false))
@ -201,16 +241,20 @@ class ItemCardFragment(
listItemsRow.add(ItemCardRowVO(title = getString(R.string.BUSCARITEM),value = "",isEditable = true, action = "buscarItem"))
//listItemsRow.add(ItemCardRowVO(title = "NICHO",value = itemInfo.nicho,isEditable = true, action = "itemPlacementSave"))
// listItemsRow.add(ItemCardRowVO(title = "RESERVA",value = itemInfo.reserva,isEditable = true, action = "itemPlacementSave"))
listItemsRow.add(ItemCardRowVO(title = "GROUPING",value = itemInfo.grouping,isEditable = true, action = "updateGrouping"))
listItemsRow.add(ItemCardRowVO(title = "PACKING",value = itemInfo.packing,isEditable = true, action = "updatePacking"))
listItemsRow.add(ItemCardRowVO(title = getString(R.string.Grouping),value = itemInfo.grouping,isEditable = true, action = "updateGrouping"))
listItemsRow.add(ItemCardRowVO(title = getString(R.string.Packing),value = itemInfo.packing,isEditable = true, action = "updatePacking"))
listItemsRow.add(ItemCardRowVO(title = getString(R.string.MINIMO),value = itemInfo.min,isEditable = true, action = "itemSaveMin"))
listItemsRow.add(ItemCardRowVO(title = "BARCODE",barcodes = itemInfo.barcodes,isEditable = true, action = "toBarcode"))
listItemsRow.add(ItemCardRowVO(title = getString(R.string.Barcode),barcodes = itemInfo.barcodes,isEditable = true, action = "toBarcode"))
//sergio para itemTypePacking
listItemsRow.add(ItemCardRowVO(title = getString(R.string.tipodeencajado),value = itemInfo.itemPackingTypeFk,isEditable = true, action = "updateSector"))
listBarcodes = itemInfo.barcodes as ArrayList<BarcodeVO>
adapter = ItemCardAdapter(listItemsRow,object: OnItemCardRowClickListener{
override fun onItemCardRowClickListener(item: ItemCardRowVO) {
if (item.action=="updateSector"){ showDialogSelectItemTypePacking()
}else{
if(item.action != "toBarcode" && item.action != "buscarItem" && item.action != "itemStockUpdateAdd" && item.action != "itemStockUpdateRemove"){
customDialogInput.setTitle(item.title!!).setDescription("Valor actual: "+item.value!!).setOkButton("Guardar"){
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
@ -281,7 +325,7 @@ class ItemCardFragment(
return@setOnEditorActionListener true
}
false
}
}}
}
}
@ -360,8 +404,6 @@ class ItemCardFragment(
}.show()
}
}
private fun prepareItemStockUpdate2(itemB:ItemCardRowVO,value:String){
@ -449,4 +491,27 @@ class ItemCardFragment(
changeOfflineValue(item,"", listBarcodes)
}
private fun showDialogSelectItemTypePacking(){
var array= arrayOfNulls<String>(itemsPackingType.size)
for (indice in array.indices){
array[indice]=itemsPackingType[indice].code + " : "+itemsPackingType[indice].description
}
val builder = AlertDialog.Builder(this.context)
builder.setTitle(getString(R.string.mensajeseleccionencajado))
.setItems(array
) { dialog, position ->
updateItemPackingType(itemsPackingType[position].code.toString());
}
builder.create().show()
}
private fun updateItemPackingType(itemPackingType:String) {
splash_progress.visibility = View.VISIBLE
viewModel.updatePackingType(this.itemFk,user,password,itemPackingType)
}
}

View File

@ -2,12 +2,18 @@ package es.verdnatura.presentation.view.feature.articulo.fragment
import android.content.Context
import android.util.Log
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetItemCardUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingTypeList
import es.verdnatura.presentation.view.feature.calidad.model.BuyerListVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
import es.verdnatura.presentation.view.feature.calidad.model.ItemBuyerListVO
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
@ -24,6 +30,10 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
val response: LiveData<ResponseItemVO>
get() = _response
private val _itemspackinglist by lazy { MutableLiveData<ItemPackingTypeList>() }
val itemspackinglist: LiveData<ItemPackingTypeList>
get() = _itemspackinglist
fun getItemCard(itemFk:String,warehouseFk:String,user:String,password:String) {
getItemCardUserCase.getItemCard(user,password,itemFk,warehouseFk).enqueue(object :Callback<ItemCardVO>{
@ -42,6 +52,31 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
})
}
fun getItemPackingType(user:String,password:String) {
getItemCardUserCase.getItemPackingType(user,password).enqueue(object :
Callback<List<ItemPackingType>>{
override fun onFailure(call: Call<List<ItemPackingType>>, t: Throwable) {
val listError:ArrayList<ItemPackingType> = ArrayList()
listError.add(ItemPackingType(isError = true,errorMessage = t.message!!))
_itemspackinglist.value = ItemPackingTypeList(listError)
}
override fun onResponse(call: Call<List<ItemPackingType>>, response: Response<List<ItemPackingType>>) {
if (response.body() != null){
_itemspackinglist.value = response.body()?.let { ItemPackingTypeList(it) }
}else{
val listError:ArrayList<ItemPackingType> = ArrayList()
listError.add(ItemPackingType(isError = true,errorMessage = "Error en la llamada de getItemPackingType"))
_itemspackinglist.value = ItemPackingTypeList(listError)
}
}
})
}
fun itemStockUpdate(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String){
getItemCardUserCase.itemStockUpdate(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
@ -132,6 +167,27 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
})
}
//sergio ver como solucionar el tema del "Finish"
fun updatePackingType(itemFk:String,user:String,password:String,itemPackingType:String){
getItemCardUserCase.updatePackingType(user,password,itemFk,itemPackingType).enqueue(object : Callback<Boolean>{
override fun onFailure(call: Call<Boolean>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar PackingType "+itemFk+ " Respuesta:"+t.message!!)
}
override fun onResponse(call: Call<Boolean>, response: Response<Boolean>) {
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada updatePackingType")
}else{
//if (response.body()=="Finish"){
// Log.i("VERDNATURA","Fisnih encontrado")}
_response.value = ResponseItemVO(isError = false,response = response.body()!!.toString())
}
}
})
}
fun itemSaveMin(itemFk:String,user:String,password:String,value:String){
getItemCardUserCase.itemSaveMin(user,password,itemFk,value).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {

View File

@ -29,7 +29,8 @@ class ItemCardVO (
var isError: Boolean = false,
var errorMessage:String = "",
var urlImage200:String = "",
var urlImage:String = ""
var urlImage:String = "",
var itemPackingTypeFk:String =" "
)
class ItemCardRowVO (
@ -46,3 +47,5 @@ class BarcodeVO(

View File

@ -0,0 +1,15 @@
package es.verdnatura.presentation.view.feature.articulo.model
class ItemPackingType (
var code:String= "",
var description:String = "",
var isError: Boolean = false,
var errorMessage:String = ""
)
class ItemPackingTypeList (
var list: List<ItemPackingType> = listOf()
)

View File

@ -41,7 +41,7 @@ class BuscarItemFragment(
override fun init() {
activity!!.main_bottom_navigation.visibility = View.GONE
toolbar_title.text = "getItemUbication"
toolbar_title.text = getString(R.string.getubicaition)
customDialog = CustomDialog(requireContext())
setEvents()
if (!itemFk.isNullOrEmpty()){

View File

@ -0,0 +1,44 @@
package es.verdnatura.presentation.view.feature.buscaritemall.adapter
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.databinding.ItemLocationAllRowBinding
import es.verdnatura.databinding.ItemLocationRowBinding
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.view.feature.buscaritemall.model.ItemLocationAll
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
class LocationAdapterAll (
private val items: List<ItemLocationAll>,
private val onPasillerosItemClickListener: OnPasillerosItemClickListener
): RecyclerView.Adapter<LocationAdapterAll.ItemHolderAll> () {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolderAll{
return ItemHolderAll(
ItemLocationAllRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
)
}
override fun getItemCount() =items.size
override fun onBindViewHolder(holder: ItemHolderAll, position: Int) {
holder.bind(items[position])
holder.binding.root.setOnClickListener {
onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = "Ubicador"),items[position].Matricula)
}
}
class ItemHolderAll(
val binding: ItemLocationAllRowBinding
) : RecyclerView.ViewHolder(binding.root){
private val res = binding.root.context.resources
fun bind(item: ItemLocationAll) {
binding.apply {
this.item = item
}
}
}
}

View File

@ -0,0 +1,143 @@
package es.verdnatura.presentation.view.feature.buscaritem.fragment
import android.content.Context
import android.content.SharedPreferences
import android.util.Log
import android.view.View
import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentBuscarItemAllBinding
import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.buscaritemall.adapter.LocationAdapterAll
import es.verdnatura.presentation.view.feature.buscaritemall.fragment.BuscarItemAllViewModel
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_buscar_item.*
import kotlinx.android.synthetic.main.fragment_buscar_item.edit_itemFk
import kotlinx.android.synthetic.main.fragment_buscar_item.location_recyclerview
import kotlinx.android.synthetic.main.fragment_buscar_item.splash_progress
import kotlinx.android.synthetic.main.fragment_buscar_item_all.*
import kotlinx.android.synthetic.main.fragment_inventary.*
import kotlinx.android.synthetic.main.toolbar.*
class BuscarItemAllFragment(
var itemFk:String = ""
) : BaseFragment<FragmentBuscarItemAllBinding, BuscarItemAllViewModel>(BuscarItemAllViewModel::class) {
private var user = ""
private var password = ""
private var warehouseFk = ""
private var adapter : LocationAdapterAll? = null
private lateinit var customDialog: CustomDialog
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
companion object {
fun newInstance(entryPoint:String) = BuscarItemAllFragment(entryPoint)
}
override fun onAttach(context: Context) {
if (context is OnPasillerosItemClickListener) pasillerosItemClickListener = context
super.onAttach(context)
}
override fun getLayoutId(): Int = R.layout.fragment_buscar_item_all
override fun init() {
activity!!.main_bottom_navigation.visibility = View.GONE
toolbar_title.text = getString(R.string.getubicaition)
customDialog = CustomDialog(requireContext())
setEvents()
if (!itemFk.isNullOrEmpty()){
getLocations(itemFk)
}
super.init()
}
private fun setEvents(){
edit_itemFk.requestFocus()
edit_itemFk.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!edit_itemFk.text.toString().isNullOrEmpty())
getLocations(edit_itemFk.text.toString())
edit_itemFk.setText("")
(activity as MainActivity).hideKeyboard(edit_itemFk)
return@setOnEditorActionListener true
}
false
}
edit_itemFk.setOnKeyListener { v, keyCode, event ->
Log.i("VERDNATURA","text")
return@setOnKeyListener false}
/*if (filter_itemFk.text.toString().isNullOrEmpty()){
if (listInvetory.size != listInvetoryAux.size){
listInvetory.removeAll(listInvetoryAux)
listInvetoryAux.forEach {
listInvetory.add(it)
}
}
}else{
listInvetory.removeAll(listInvetoryAux)
listInvetoryAux.forEach {
if ((it.itemFk.contains(filter_itemFk.text.toString(),true)) || (it.producer?.contains(filter_itemFk.text.toString(),true))){
listInvetory.add(it)
}
}
}
LocationAdapterAll!!.notifyDataSetChanged()
return@setOnKeyListener false
}*/
backButton.setOnClickListener {
activity!!.onBackPressed()
}
}
private fun getLocations(itemFk:String){
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
user = prefs.getString(USER,"").toString()
password = prefs.getString(PASSWORD,"").toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
this.itemFk = itemFk
splash_progress.visibility = View.VISIBLE
viewModel.getLocationsAll(user,password,itemFk)
}
override fun observeViewModel() {
with(viewModel){
loadLocationListAll.observe(viewLifecycleOwner, Observer { event ->
event.getContentIfNotHandled().notNull {
splash_progress.visibility = View.GONE
adapter = LocationAdapterAll(it.list,pasillerosItemClickListener!!)
location_all_recyclerview.adapter = adapter
location_all_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
var totalVisible:Int = 0
it.list.forEach {
if (!it.visible.isNullOrEmpty())
totalVisible += it.visible.toInt()
}
toolbar_title.text = "Item: "+itemFk+ " Total visible: "+totalVisible
}
})
}
}
}

View File

@ -0,0 +1,53 @@
package es.verdnatura.presentation.view.feature.buscaritemall.fragment
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetBuscarItemAllUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.view.feature.buscaritemall.model.ItemLocationAll
import es.verdnatura.presentation.view.feature.buscaritemall.model.LocationListAll
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
class BuscarItemAllViewModel(context: Context) : BaseViewModel() {
private val getBuscarItemAllUserCase: GetBuscarItemAllUserCase = GetBuscarItemAllUserCase(context)
private val _locationListAll by lazy { MutableLiveData<LocationListAll>() }
val locationListAll: LiveData<LocationListAll>
get() = _locationListAll
val loadLocationListAll = Transformations.map(_locationListAll) { Event(it) }
fun getLocationsAll(user:String,password:String,itemFk:String){
getBuscarItemAllUserCase.searchItemsUbicadorAll(user,password,itemFk).enqueue(object : Callback<List<ItemLocationAll>> {
override fun onFailure(call: Call<List<ItemLocationAll>>, t: Throwable) {
val listError:ArrayList<ItemLocationAll> = ArrayList()
listError.add(ItemLocationAll(isError = true,errorMessage = t.message!!))
_locationListAll.value = LocationListAll(listError)
}
override fun onResponse(
call: Call<List<ItemLocationAll>>,
response: Response<List<ItemLocationAll>>
) {
if (response.body() != null){
_locationListAll.value = response.body()?.let { LocationListAll(it) }
}else{
val listError:ArrayList<ItemLocationAll> = ArrayList()
listError.add(ItemLocationAll(isError = true,errorMessage = "Error en la llamada de searchItemsUbicadorAll"))
_locationListAll.value = LocationListAll(listError)
}
}
})
}
}

View File

@ -0,0 +1,18 @@
package es.verdnatura.presentation.view.feature.buscaritemall.model
class ItemLocationAll (
var Parking:String = "",
var Matricula:String = "",
var visible:String = "",
var Disponible:String = "",
var level:String = "",
var created:String = "",
var itemFk:String = "",
val isError : Boolean = false,
var errorMessage : String = ""
)
class LocationListAll (
var list: List<ItemLocationAll> = listOf()
)

View File

@ -62,7 +62,7 @@ class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(Buyer
customDialog = CustomDialog(requireContext())
activity!!.main_bottom_navigation.visibility = View.GONE
splash_progress.visibility = View.VISIBLE
toolbar_title.text = "itemShelving_BuyerGet"
toolbar_title.text = getString(R.string.quality)
setToolBar()
setEvents()
super.init()

View File

@ -46,4 +46,4 @@ class BuyersViewModel(context: Context) : BaseViewModel() {
})
}
}
}

View File

@ -1,6 +1,6 @@
package es.verdnatura.presentation.view.feature.calidad.model
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
//import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
class BuyerVO (
var userFk:String = "",

View File

@ -110,6 +110,7 @@ class CollectionFragment(
mpok = MediaPlayer.create((activity as MainActivity),R.raw.ok)
if (collection.tickets.isEmpty()){
viewModel.collectionTicketGet(user,password,collection.collectionFk,sectorFk)
Log.i("VERDNATURA","La collection es ${collection.collectionFk}")
}
@ -133,6 +134,8 @@ class CollectionFragment(
toolbar_title.text = "collectionTicket_get"
setToolBar()
setEvents()
// Log.i("VERDNATURA","el type es $type")
if (type == SACADOR && voz != "NO"){
setSpeak()
}
@ -190,8 +193,9 @@ class CollectionFragment(
hideKeyboards()
scan_input.requestFocus()
scan_input.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {//ID=0 ACTION_NEXT ID=5 ACTION_UNESPECEFIED)
if (!scan_input.text.toString().isNullOrEmpty()){
////Log.i("VERDNATURA","Pita o no pita si encuentra. Diferencia si es matricula o no")
findSale(scan_input.text.toString())
}
scan_input.setText("")
@ -207,6 +211,7 @@ class CollectionFragment(
collection_swipe.setOnRefreshListener {
if (splash_progress != null) splash_progress.visibility = View.VISIBLE
viewModel.collectionTicketGet(user,password,collection.collectionFk,sectorFk)
Log.i("VERDNATURA","La collection es ${collection.collectionFk}")
collection_swipe.isRefreshing = false
}
}
@ -262,6 +267,7 @@ class CollectionFragment(
}else{
if (splash_progress != null) splash_progress.visibility = View.VISIBLE
viewModel.collectionTicketGet(user,password,collection.collectionFk,sectorFk)
Log.i("VERDNATURA","La collection es ${collection.collectionFk}")
}
}
@ -329,6 +335,7 @@ class CollectionFragment(
if (tickets.firstOrNull { it == saleVO.ticketFk}.isNullOrEmpty())
tickets.add(saleVO.ticketFk)
}else if (type == CONTROLADOR){
//sergio el type CHECKED =CONTROLADOR
salesList.add(saleVO)
if (tickets.firstOrNull { it == saleVO.ticketFk}.isNullOrEmpty())
tickets.add(saleVO.ticketFk)
@ -344,6 +351,7 @@ class CollectionFragment(
sales.forEachIndexed { index, saleVO ->
if (saleVO.saleFk == sale.saleFk){
showQuantityDialog(index)
}
}
@ -355,6 +363,7 @@ class CollectionFragment(
if (saleVO.saleFk == sale.saleFk){
if (type == CONTROLADOR) {
markLine(index,type)
////Log.i("VERDNATURA","marcamos linea")
} else if (type == SACADOR){
if (sale.isPrepared == "0"){
showScanner(index,sale)
@ -385,7 +394,8 @@ class CollectionFragment(
setListPosition(storedBackPosition,true)
setScrollListener(lm!!)
changeInitTicketState()
//sergio: se quita porque se realiza desde triggers
// changeInitTicketState()
printObservations(observations)
}
@ -408,7 +418,6 @@ class CollectionFragment(
}.show()
}
}
//SEARCH AND MARK
private fun findSale(txtscan:String){
goBack = false
@ -420,6 +429,17 @@ class CollectionFragment(
if (type == SACADOR){
for (saleVO in sales) {
//sergio: pita si encuentra ticket
////Log.i("VERDNATURA","SE busca en sales ${saleVO.ticketFk}")
if (saleVO.ticketFk==txtscan){
isOk=true
if ((isOk) && mpok != null) mpok!!.start()
//Log.i("VERDNTURA","ENCONTRADO")
break;
}
if(saleVO.isPrepared != "1" && saleVO.isPreviousPrepared != "1"){
//1- Por itemFk
/* if (txtscan == saleVO.itemFk){
@ -432,9 +452,11 @@ class CollectionFragment(
if (saleVO.placements != null){
var shelvingIndex = 0
for (placementVO in saleVO.placements){
// para comprobar si es igual a una matricula
if (placementVO.shelving != null && placementVO.visible != null && txtscan.toUpperCase() == placementVO.shelving.toUpperCase() && placementVO.visible != "(0)"){
if (mpok != null) mpok!!.start()
isOk = true
////Log.i("VERDNATURA","encontrado producto")
showShelving(index,shelvingIndex)
isBreak = true
break
@ -475,6 +497,7 @@ class CollectionFragment(
}
}else if(type == CONTROLADOR){
////Log.i("VERDNATURA","El tipo es controlador")
for (saleVO in sales) {
if(saleVO.isControlled == "0"){
//1- Por itemFk
@ -515,6 +538,7 @@ class CollectionFragment(
storedPosition = 0
storedBackPosition = 0
viewModel.collectionTicketGet(user,password,txtscan,sectorFk)
Log.i("VERDNATURA","La collection es ${txtscan}")
}
}
}
@ -582,6 +606,7 @@ class CollectionFragment(
private fun markLine(position:Int,newType: String){
state = 0
////Log.i("VERDNATURA","Marcamos linea y enviamos saleTracking")
if (type == SACADOR){
sales[position].isPrepared = if (sales[position].isPrepared == "1") "0" else "1"
if (sales[position].isPrepared == "1"){
@ -617,6 +642,8 @@ 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(
usuario = user,
password = password,
@ -626,6 +653,10 @@ class CollectionFragment(
vStateFk = type.toString(),
vBuyFk = originalItemScan
)
//Log.i("VERDNATURA","POSICION $position y el tipo $type")
//Log.i("VERDNATURA","El buyfk que no es real es $originalItemScan")
}
private fun unMarkLine(position: Int,newType: String){
@ -664,6 +695,7 @@ class CollectionFragment(
try{
quantityGet = (sales[position].quantity.toInt() - sales[position].pickedQuantity.toInt()).toString()
}catch (e:Exception){}
////Log.i("VERDNATURA","Aparece para enviar")
viewModel.itemPlacementSupplyAiming(
usuario = user,
password = password,
@ -674,6 +706,7 @@ class CollectionFragment(
}
private fun printShelvingResult(placementSupplyListVO: PlacementSupplyListVO){
////Log.i("VERDNATURA","Print CustomDialog")
var shelving = ""
var item = ""
var longName = ""
@ -698,16 +731,21 @@ class CollectionFragment(
placementSupplyListVO.list.forEach {
if (it.stock != "0")
listPlacementSupply.add(BarcodeVO(code = it.proposal))
////Log.i("VERDNATURA","Array de placementsupply")
}
try {
customDialogList.setTitle("$shelving($item) $total de $longName").setOkButton("Coger") {
////Log.i("VERDNATURA","Pulso COGER-1")
customDialogList.setTitle("$shelving($item) $total dee $longName").setOkButton("Coger") {
////Log.i("VERDNATURA","Pulso COGER-2")
if (customDialogList.getValueTwo().isNotEmpty()) {
if (isNumber(customDialogList.getValue()) && isNumber(total) && customDialogList.getValue().toInt() > total.toInt()) {
"La cantidad supera a la disponible".toast(requireContext())
} else if (isNumber(customDialogList.getValue())) {
originalItemScan = customDialogList.getValueTwo()
// Log.i("VERDATURA","Le pasamos el siguiente item $originalItemScan que es el escaneado")
if (checkItemScan(customDialogList.getValueTwo())) {
onQuantityOfShelvingSelected(itemShelvingFk)
////Log.i("VERDNATURA","Cantidad seleccionada")
mpok?.start()
customDialogList.dismiss()
} else {
@ -737,7 +775,9 @@ class CollectionFragment(
customDialogList.dismiss()
}.setHintValue("Cantidad que coges:").setValue(total).setHintValueTwo("Escanea item")
.setValueTwo("").show()
}catch (e:Exception){}
}catch (e:Exception){
////Log.i("VERDNATURA","${e.message.toString()}")
}
try{
customDialogList.getEditTextTwo().post(Runnable {
customDialogList.getEditTextTwo().requestFocusFromTouch()
@ -811,14 +851,16 @@ class CollectionFragment(
customDialogList.getRecyclerView().layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
}
private fun checkItemScan(valueToCheck:String):Boolean{
////Log.i("VERDNATURA","Entramos a comprobar el CheckItemScan $valueToCheck")
if (storedPosition >= 0 && sales.size > storedPosition) {
val saleToCheck = sales[storedPosition]
//////Log.i("VERDNATURA","Entramos a comprobar si lo escaneado es el item $saleToCheck.itemFk escaneado:$valueToCheck")
if (saleToCheck.itemFk == valueToCheck)
return true
else {
saleToCheck.Barcodes.forEach { barcode ->
////Log.i("VERDNATURA","Mirando barcode ${barcode.toString()}")
if (barcode == valueToCheck)
return true
}
@ -1056,12 +1098,14 @@ class CollectionFragment(
if (toolbar_subtitle != null && totalMark != null && sales != null) toolbar_subtitle.text = "" +totalMark + "/" + sales.size
if (totalMark == sales.size) {
getString(R.string.Coleccióncompleta).toast(this.context,Toast.LENGTH_SHORT)
changeTicketState()
//sergio: se quita porque se realiza desde triggers
//changeTicketState()
}
}
//FALTAS / BASURA / SPLIT
private fun showQuantityDialog(position:Int) {
// Log.i("VERDNATURA","Aparece CustomDialog")
customDialogThreeButtons.setDescription(getString(R.string.txtnuevacantidad)).setValue("")
.setOkButton(getString(R.string.Faltas)){
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()){
@ -1152,7 +1196,7 @@ class CollectionFragment(
quantity = totalQuantity.toString(),
warehouseFk = warehouseFk,
type = "FALSE",
originalQuantity = quantity
originalQuantity = quantity
)
//sales[position].originalQuantity = quantity
sales[position].quantity = quantity

View File

@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.controlador.fragment
import android.content.Context
import android.content.SharedPreferences
import android.os.Bundle
import android.util.Log
import android.view.View
import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer
@ -38,9 +39,11 @@ class ControladorFragment : BaseFragment<FragmentControladorBinding,ControladorV
}
override fun init() {
splash_progress.visibility = View.GONE
customDialog = CustomDialog(requireContext())
toolbar_title.text = "collection_get"
toolbar_title.text = getString(R.string.getcollection)
setEvents()
super.init()
}
@ -60,6 +63,7 @@ class ControladorFragment : BaseFragment<FragmentControladorBinding,ControladorV
}
private fun setEvents(){
scan_input.requestFocus()
scan_input.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
@ -71,6 +75,7 @@ class ControladorFragment : BaseFragment<FragmentControladorBinding,ControladorV
sectorFk = sectorFk,
collectionFk = scan_input.text.toString()
)
Log.i("VERDNATURA","La collection es ${scan_input.text.toString()}")
}
scan_input.setText("")
(activity as MainActivity).hideKeyboard(scan_input)
@ -100,4 +105,6 @@ class ControladorFragment : BaseFragment<FragmentControladorBinding,ControladorV
private fun navigateToCollectionList(collection: CollectionVO){
onCollectionSelectedListener?.onCollectionSelected(collection, ConstAndValues.CONTROLADOR)
}
}

View File

@ -64,7 +64,7 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
override fun init() {
splash_progress.visibility = View.VISIBLE
activity!!.main_bottom_navigation.visibility = View.GONE
toolbar_title.text = "faultsReview"
toolbar_title.text = getString(R.string.faultsReview)
setToolBar()
customDialogInput = CustomDialogInput(requireContext())

View File

@ -35,7 +35,7 @@ class HistoricoAdapter (
this.item = item
val sdf = SimpleDateFormat("yyyy-MM-dd")
val currentDate = sdf.format(Date())
if (currentDate == item.date){
if (currentDate == item.shipped){
historicoDate.setBackgroundColor(res.getColor(R.color.verdnatura_pumpkin_orange))
}else{
historicoDate.setBackgroundColor(res.getColor(R.color.verdnatura_black_5))

View File

@ -49,7 +49,7 @@ class HistoricoFragment(
customDialog = CustomDialog(requireContext())
activity!!.main_bottom_navigation.visibility = View.GONE
viewModel.itemDiary(user,password,itemFk,warehouseFk)
toolbar_title.text = "itemDiary"
toolbar_title.text = getString(R.string.itemdiary)
setEvents()
super.init()
}
@ -82,7 +82,7 @@ class HistoricoFragment(
val currentDate = sdf.format(Date())
for (item in it.list){
if (currentDate == item.date){
if (currentDate == item.shipped){
break
}
positionToday += 1

View File

@ -1,7 +1,7 @@
package es.verdnatura.presentation.view.feature.historico.model
class ItemHistoricoVO (
var date:String = "",
var shipped:String = "",
var stateName:String = "",
var origin:String = "",
var reference: String = "",

View File

@ -5,7 +5,6 @@ import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.view.View
import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
@ -16,14 +15,19 @@ import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
import es.verdnatura.presentation.view.feature.inventario.adapter.InventoryAdapter
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import ir.mirrajabi.searchdialog.SimpleSearchDialogCompat
import ir.mirrajabi.searchdialog.core.SearchResultListener
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.buyers_fragment.*
import kotlinx.android.synthetic.main.fragment_ajustes.*
import kotlinx.android.synthetic.main.fragment_buscar_item.location_recyclerview
import kotlinx.android.synthetic.main.fragment_buscar_item.splash_progress
import kotlinx.android.synthetic.main.fragment_inventary.*
import kotlinx.android.synthetic.main.fragment_inventary.filter_itemFk
import kotlinx.android.synthetic.main.toolbar.*
class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewModel>(InventaryViewModel::class) {
@ -42,11 +46,21 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
private var hideLoad = true
private var layoutManager : LinearLayoutManager? = null
private var firstVisiblePosition = 0
private var secondVisiblePosition = 1
//sergio : cmbios para insertar lista compradores en inventary en el searchable
private val items=ArrayList<SearchBuyerModel>()
private var prefs: SharedPreferences? = null
private lateinit var buyerId:String
companion object {
fun newInstance() = InventaryFragment()
}
//override fun getLayoutId(): Int = R.layout.fragment_inventary
override fun getLayoutId(): Int = R.layout.fragment_inventary
override fun onAttach(context: Context) {
@ -55,21 +69,48 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
}
override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
user = prefs.getString(USER,"").toString()
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,1).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
viewModel.getInventory(user,password,sectorFk)
prefs = activity!!.getSharedPreferences(PREFS_USER,0)
user = prefs!!.getString(USER,"").toString()
password = prefs!!.getString(PASSWORD,"").toString()
sectorFk = prefs!!.getInt(SECTORFK,1).toString()
warehouseFk = prefs!!.getInt(WAREHOUSEFK,1).toString()
//sergio. se quita para subir version.A la espera de como será el inventario
viewModel.itemShelvingBuyerGet(user = user,password = password)
super.onCreate(savedInstanceState)
}
override fun init() {
filter_buyer.setText(prefs!!.getString(BUYER,""))
splash_progress.visibility = View.VISIBLE
buyerId=prefs!!.getString(BUYERID,"").toString()
//Log.i("VERDNATURA","el sector es $warehouseFk")
//Log.i("VERDNATURA","el sbuyerid es $buyerId")
viewModel.getInventory(user,password,buyerId,warehouseFk)
filter_buyer.setOnClickListener{
//SimpleSearchDialogCompat(context,getString(R.string.compradores),getString(R.string.escribirparteNombre),null,initData(),
SimpleSearchDialogCompat(context,getString(R.string.compradores),getString(R.string.escribirparteNombre),null,items,
SearchResultListener { baseSearchDialogCompat, nombre, position ->
////Log.i("VERDNATURA","nombre "+nombre.title)
////Log.i("VERDNATURA","el id es "+nombre.getBuyerId())
filter_buyer.setText((nombre.title))
saveBuyer(nombre.getBuyerNickname())
saveBuyerId(nombre.getBuyerId())
buyerId=nombre.getBuyerId()
viewModel.getInventory(user,password,nombre.getBuyerId(),warehouseFk)
splash_progress.visibility = View.VISIBLE
baseSearchDialogCompat.dismiss()
}).show()
}
customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext())
activity!!.main_bottom_navigation.visibility = View.GONE
splash_progress.visibility = View.VISIBLE
toolbar_title.text = "itemShelvingRadar"
toolbar_title.text = getString(R.string.itemShelvingRadar)
setToolBar()
setEvents()
@ -77,29 +118,36 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
reload = false
splash_progress.visibility = View.VISIBLE
hideLoad = false
viewModel.getInventory(user,password,sectorFk)
viewModel.getInventory(user,password,buyerId,warehouseFk)
}
super.init()
}
private fun setToolBar(){
val listIcons:ArrayList<Drawable> = ArrayList()
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
listIcons.add(iconReload)
toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener{
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload){
splash_progress.visibility = View.VISIBLE
firstVisiblePosition = layoutManager?.findFirstVisibleItemPosition() ?: 0
viewModel.getInventory(user,password,sectorFk)
// sergio.
viewModel.getInventory(user,password,buyerId,warehouseFk)
//viewModel.getInventory(user,password,prefs!!.getInt(SECTORFK,1).toString())
}
}
})
toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
private fun setEvents(){
@ -120,7 +168,7 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
}else{
listInvetory.removeAll(listInvetoryAux)
listInvetoryAux.forEach {
if (it.itemFk.contains(filter_itemFk.text.toString(),true)){
if ((it.itemFk.contains(filter_itemFk.text.toString(),true)) || (it.producer?.contains(filter_itemFk.text.toString(),true))){
listInvetory.add(it)
}
}
@ -150,6 +198,12 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
override fun observeViewModel() {
with(viewModel){
//sergio: para compradores
buyersList.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.GONE
createBuyerList(it.list)
})
inventaryList.observe(viewLifecycleOwner, Observer {
if (hideLoad){
@ -169,18 +223,28 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
adapter = InventoryAdapter(listInvetory,object: OnInvetoryNichoClickListener{
override fun onInvetoryNichoClickListener(item: ItemInventaryVO) {
customDialogInput.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){
viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0")
changeOfflineValue(item)
customDialogInput.dismiss()
}.setKoButton("Cancelar"){
customDialogInput.dismiss()
}.setValue("0").show()
customDialogInput.getEditText().requestFocus()
//sergio: cambiad customdialogInput pòr customdialog 6.1.4
//Log.i("VERDNATURA","A tirar tanto")
customDialog.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){
//customDialogInput.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){
//Log.i("VERDNATURA","A tirar tanto viewmodel dentro")
viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,"0","0")
// viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0")
changeOfflineValue(item)
// customDialogInput.dismiss()
customDialog.dismiss()
}.setKoButton("Cancelar"){
// customDialogInput.dismiss()
customDialog.dismiss()
}.show()
// }.setValue("0").show()
//sergio: ya no recoge focus porque no tiene cuadro para insertar número de artículo
/* customDialogInput.getEditText().requestFocus()
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
if (!customDialogInput.getValue().isNullOrEmpty()){
//Log.i("VERDNATURA","A tirar tanto viewmodel fuera")
viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0")
changeOfflineValue(item)
}
@ -190,7 +254,7 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
return@setOnEditorActionListener true
}
false
}
}*/
}
},onPasillerosItemClickListener = pasillerosItemClickListener!!)
@ -243,4 +307,19 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
}
//sergio:añadido para compradores
private fun createBuyerList(list: List<BuyerVO>){
items.clear()
list.forEach { buyer ->
if (!buyer.isError){
try {
items.add(SearchBuyerModel(buyer.nickname,buyer.userFk));
//Log.i("VERDNATURA","Nombre comprador ${buyer.nickname} : ${buyer.userFk}")
}catch (e:Exception){}
}
}}
}

View File

@ -9,6 +9,10 @@ import es.verdnatura.domain.GetItemCardUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
import es.verdnatura.presentation.view.feature.ajustes.model.SectorListVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerListVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
import es.verdnatura.presentation.view.feature.inventario.model.InventaryListVO
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import retrofit2.Call
@ -30,11 +34,71 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
get() = _response
private val _buyersList by lazy { MutableLiveData<BuyerListVO>() }
val buyersList: LiveData<BuyerListVO>
get() = _buyersList
//sergio para obtener comprador
fun itemShelvingBuyerGet(user:String,password:String){
getInventaryUserCase.itemShelvingBuyerGet(user,password).enqueue(object :
Callback<List<BuyerVO>> {
override fun onFailure(call: Call<List<BuyerVO>>, t: Throwable) {
val listError:ArrayList<BuyerVO> = ArrayList()
listError.add(BuyerVO(isError = true,errorMessage = t.message!!))
_buyersList.value = BuyerListVO(listError)
}
override fun onResponse(
call: Call<List<BuyerVO>>,
response: Response<List<BuyerVO>>
) {
if (response.body() != null){
_buyersList.value = response.body()?.let { BuyerListVO(it) }
}else{
val listError:ArrayList<BuyerVO> = ArrayList()
listError.add(BuyerVO(isError = true,errorMessage = "Error en la llamada de itemShelving_buyerGet"))
_buyersList.value = BuyerListVO(listError)
}
}
})
}
val loadInventaryList = Transformations.map(_inventaryList) { Event(it) }
//sergio: borrar. En 6.1.3 ya no se utiliza
/*fun getInventory(user:String,password:String,buyerFk:String){
fun getInventory(user:String,password:String,sectorFk:String){
getInventaryUserCase.itemShelvingRadar(user,password,sectorFk).enqueue(object :
getInventaryUserCase.itemShelvingRadar(user,password,buyerFk).enqueue(object :
Callback<List<ItemInventaryVO>> {
override fun onFailure(call: Call<List<ItemInventaryVO>>, t: Throwable) {
val listError:ArrayList<ItemInventaryVO> = ArrayList()
listError.add(ItemInventaryVO(isError = true,errorMessage = t.message!!))
_inventaryList.value = InventaryListVO(listError)
}
override fun onResponse(
call: Call<List<ItemInventaryVO>>,
response: Response<List<ItemInventaryVO>>
) {
if (response.body() != null){
_inventaryList.value = response.body()?.let { InventaryListVO(it) }
}else{
val listError:ArrayList<ItemInventaryVO> = ArrayList()
listError.add(ItemInventaryVO(isError = true,errorMessage = "Error en la llamada de itemShelvingRadar"))
_inventaryList.value = InventaryListVO(listError)
}
}
})
}*/
fun getInventory(user:String,password:String,buyerFk:String,warehouseFk: String){
// getInventaryUserCase.itemShelvingRadar(user,password,buyerFk).enqueue(object :
getInventaryUserCase.itemShelvingRadarFilterBuyer(user,password,buyerFk,warehouseFk).enqueue(object :
Callback<List<ItemInventaryVO>> {
override fun onFailure(call: Call<List<ItemInventaryVO>>, t: Throwable) {
val listError:ArrayList<ItemInventaryVO> = ArrayList()
@ -77,4 +141,6 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
})
}
}

View File

@ -0,0 +1,22 @@
package es.verdnatura.presentation.view.feature.inventario.fragment
import ir.mirrajabi.searchdialog.core.Searchable
class SearchBuyerModel(private var nickname: String?, private var buyerId: String?) : Searchable {
override fun getTitle(): String {
return nickname!!
}
fun getBuyerId(): String {
return buyerId!!
}
fun getBuyerNickname(): String {
return nickname!!
}
}

View File

@ -0,0 +1,16 @@
package es.verdnatura.presentation.view.feature.inventario.model
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
class BuyerInventary (
var userFk:String = "",
var nickname:String= "",
var isError:Boolean = false,
var errorMessage:String = ""
)
class BuyerListInventary (
var list: List<BuyerInventary> = listOf()
)

View File

@ -12,7 +12,8 @@ class ItemInventaryVO (
var errorMessage:String = ""
)
class InventaryListVO (
var list: List<ItemInventaryVO> = listOf()
)
)

View File

@ -1,11 +1,13 @@
package es.verdnatura.presentation.view.feature.login.activity
import android.content.Intent
import es.verdnatura.R
import es.verdnatura.databinding.ActivityLoginBinding
import es.verdnatura.presentation.base.BaseActivity
import es.verdnatura.presentation.common.TAG
import es.verdnatura.presentation.common.addFragment
import es.verdnatura.presentation.view.feature.login.fragment.LoginFragment
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
class LoginActivity : BaseActivity<ActivityLoginBinding>() {
@ -22,7 +24,11 @@ class LoginActivity : BaseActivity<ActivityLoginBinding>() {
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT))*/
addFragment(LoginFragment.newInstance(),R.id.main_frame_layout,LoginFragment.TAG)
//sergio: para no hacer login se inicia MainActivity directamente
/* val intent = Intent(this, MainActivity::class.java)
startActivity(intent)*/
}

View File

@ -6,6 +6,8 @@ import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.net.Uri
import android.preference.PreferenceManager
import android.view.KeyEvent
@ -34,6 +36,8 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
override fun getLayoutId(): Int = R.layout.fragment_login
override fun init() {
customDialog = CustomDialog(requireContext())
checkUser()
button_login.setOnClickListener(View.OnClickListener {
@ -55,12 +59,16 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
if (keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_UP) {
this.setDefaults("base_url", edittext_server.text.toString(), this.requireContext())
this.hideKeyboard()
//sergio: deberia lanzar la funcion nueva creada por mi restartapp de BaseFragment. Pero no vuelve a arrancar
restartapp()
return@OnKeyListener false
}
false
})
}
private fun checkUser(){
@ -77,6 +85,42 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
override fun observeViewModel() {
with(viewModel){
versionappitem.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.INVISIBLE
if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
} else {
splash_progress.visibility = View.VISIBLE
if (it.version.equals(getInfoVersionNameApp())) {
splash_progress.visibility = View.INVISIBLE
goToMain()}
else {
customDialog.setTitle(getString(R.string.Actualizar))
.setDescription(getString(R.string.updatemng)).setOkButton(
getString(
R.string.Actualizar
)
) {
val openURL = Intent(Intent.ACTION_VIEW)
openURL.data = Uri.parse("https://app.verdnatura.es/bin/vn-picking.apk")
startActivity(openURL)
}.setKoButton("Cancelar") {
customDialog.dismiss()
goToMain()
}.show()
}
}
})
loginitem.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.INVISIBLE
if (it.isError) {
@ -153,6 +197,12 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
super.observeViewModel()
}
private fun getInfoVersionNameApp(): String {
val manager: PackageManager = context!!.getPackageManager()
val info: PackageInfo = manager.getPackageInfo(context!!.getPackageName(), 0)
return info.versionName
}
private fun saveTokenPref(token: String){
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER, 0)
val editor = prefs.edit()
@ -188,15 +238,16 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
}
private fun getVersion(){
val versionName = activity!!.packageManager.getPackageInfo(activity!!.packageName, 0).versionName
splash_progress.visibility = View.VISIBLE
viewModel.checkVersion(
viewModel.checkVersion(
user = edittext_username.text.toString(),
password = edittext_password.text.toString(),
version = versionName
)
nameApp = "warehouse")
// version = versionName)
}
fun setDefaults(key: String?, value: String?, context: Context?) {
val preferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
val editor = preferences.edit()
@ -209,7 +260,8 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
return preferences.getString(key, null)
}
fun restartapp(){
// sergio:creada restart en BaseFragment para AjustesFragment...
fun restartapp(){
val mStartActivity = Intent(context, LoginActivity::class.java)
val mPendingIntentId = 123456
val mPendingIntent = PendingIntent.getActivity(

View File

@ -7,6 +7,7 @@ import es.verdnatura.domain.GetLoginUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.view.feature.login.model.LoginItemVO
import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO
import es.verdnatura.presentation.view.feature.login.model.versionApp
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
@ -29,6 +30,10 @@ class LoginViewModel(context: Context) : BaseViewModel() {
val version : LiveData<Boolean>
get() = _version
//sergio: nueva version para actualizar
private val _versionappitem by lazy { MutableLiveData<versionApp> ()}
val versionappitem : LiveData<versionApp>
get() = _versionappitem
fun login(user:String,password:String){
getLoginUserCase.login(user,password).enqueue(object : Callback<String>{
@ -74,7 +79,7 @@ class LoginViewModel(context: Context) : BaseViewModel() {
})
}
fun checkVersion(user:String,password:String,version:String){
/*fun checkVersion_old(user:String,password:String,version:String){
getLoginUserCase.checkVersion(user,password,version).enqueue(object : Callback<Boolean>{
override fun onResponse(call: Call<Boolean>, response: Response<Boolean>) {
if (response.body() != null){
@ -88,6 +93,27 @@ class LoginViewModel(context: Context) : BaseViewModel() {
_version.value = true
}
})
}
}*/
//sergio:checkVersion new
fun checkVersion(user:String,password:String,nameApp:String){
getLoginUserCase.checkVersion(user,password,nameApp).enqueue(object : Callback<versionApp>{
override fun onResponse(call: Call<versionApp>, response: Response<versionApp>) {
var versionApp:versionApp?
if (response.body() != null){
versionApp= response.body()?.version?.let { versionApp(nameApp,it,isError = false,errorMessage = "") }
// Log.i("VERDNATURA","Recogemos ${versionApp?.version}")
}else{
versionApp = versionApp(user,password,isError = true,errorMessage = "Error al conectar.")
}
_versionappitem.value=versionApp
}
override fun onFailure(call: Call<versionApp>, t: Throwable) {
val versionApp=versionApp(nameApp,"",isError=true,errorMessage=t.message!!)
_versionappitem.value = versionApp
}
})
}
}

View File

@ -20,4 +20,11 @@ class SalixMessageVO (
val token:String = "",
var isError:Boolean = false,
var errorMessage:String = ""
)
class versionApp(
val appname:String="",
val version:String="",
var isError:Boolean = false,
val errorMessage:String=""
)

View File

@ -13,6 +13,7 @@ import es.verdnatura.presentation.common.*
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesFragment
import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardFragment
import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemAllFragment
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
@ -95,6 +96,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
applicationContext,R.drawable.ic_build_black_24dp),selectedImage = ContextCompat.getDrawable(
applicationContext,R.drawable.ic_build_black_24dp_selected)))
// Add al items to menu view
bottomMenuItems.forEach {
bottomMenu.menu.add(Menu.NONE, it.id, Menu.NONE, it.title).icon = it.defaultImage
@ -128,8 +130,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
when (selectedItemMenu?.title) {
getString(R.string.Pasilleros) -> {
getString(R.string.Pasilleros) -> {
fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
delete_Fragments()
addFragment(PasilleroFragment.newInstance(),R.id.main_frame_layout, PasilleroFragment.TAG,false)
true
}
@ -141,6 +144,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
getString(R.string.Controladores) -> {
fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
addFragment(ControladorFragment.newInstance(),R.id.main_frame_layout, ControladorFragment.TAG,false)
true
}
getString(R.string.Paletizadores) -> {
@ -165,7 +169,20 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
}
}
private fun delete_Fragments() {
fm.getFragments().forEach {
// Log.i("VERDNATURA", "si esta ${it.tag.toString()}")
var fragment:Fragment?=supportFragmentManager.findFragmentByTag(it.tag.toString())
if (fragment!= null) supportFragmentManager
.beginTransaction().remove(fragment)
.commit()
}
}
override fun onPasillerosItemClickListener(item: PasillerosItemVO, entryPoint: String) {
when (item.title){
"Pre Sacador" -> {
@ -183,8 +200,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
"Buscar item" -> {
addFragmentOnTop(BuscarItemFragment.newInstance(entryPoint))
}
// "Buscar item full" -> {
// addFragmentOnTop(BuscarItemAllFragment.newInstance(entryPoint))
// }
"Historico" -> {
addFragmentOnTop(HistoricoFragment.newInstance(entryPoint))
//addFragmentOnTop(HistoricoFragment.newInstance(entryPoint))
}
"Inventario" -> {
addFragmentOnTop(InventaryFragment.newInstance())
@ -208,7 +228,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
Log.i("Item: ",item.title)
}
fun addFragmentOnTop(fragment: Fragment?) {
supportFragmentManager
.beginTransaction()
.replace(R.id.main_frame_layout, fragment!!)
@ -219,13 +242,15 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
override fun onBackPressed() {
try{
fm.executePendingTransactions()
try{
fm.executePendingTransactions()
}catch (e:Exception){}
if (fm.backStackEntryCount > 0) {
fm.popBackStackImmediate()
fm.popBackStackImmediate()
}else {
customDialog.setTitle("Cerrar sesión").setDescription("¿Estás seguro de cerrar la sesión?").setOkButton("Salir"){
customDialog.dismiss()
@ -238,22 +263,32 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
}
override fun onTruckClickListener(item: ItemExpeditionTruckVO, entryPoint: String) {
addFragmentOnTop(ExpeditionPalletFragment.newInstance(item))
addFragmentOnTop(ExpeditionPalletFragment.newInstance(item))
//Log.i("VERDNATURA","clickamos la expedicion y abrimos ExpeditionPalletFragment")
}
override fun onPalletClickListener(itemTruck: ItemExpeditionTruckVO,itemPallet: ItemPalletVO) {
addFragmentOnTop(ExpeditionScanFragment.newInstance(itemTruck,itemPallet))
}
override fun onComprobarPalletViewClickListener(
itemTruck: ItemExpeditionTruckVO,
itemPallet: ItemPalletVO
) {
addFragmentOnTop(ExpeditionPalletDetailFragment.newInstance(itemTruck,itemPallet))
}
override fun onCollectionSelected(collection: CollectionVO,type:String) {
fm.popBackStack()
// Log.i("VERDNATURA","el type es $type")
addFragmentOnTop(CollectionFragment.newInstance(collection,type))
}
override fun onBuyerSelected(userFk: String) {

View File

@ -1,5 +1,6 @@
package es.verdnatura.presentation.view.feature.paletizador.adapter
import android.util.Log
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
@ -25,6 +26,7 @@ class ExpeditionListAdapter (
holder.bind(items[position])
holder.binding.root.setOnClickListener {
onTruckClickListener.onTruckClickListener(items[position],"")
//Log.i("VERDNATURA","3-ontruckClickListener")
}
}

View File

@ -4,6 +4,7 @@ import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
@ -16,6 +17,7 @@ import es.verdnatura.presentation.common.OnPalletClickListener
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogList
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.paletizador.adapter.ExpeditionPalletViewAdapter
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
@ -63,6 +65,7 @@ class ExpeditionPalletDetailFragment(
sectorFk = prefs.getInt(SECTORFK,1).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
super.onCreate(savedInstanceState)
}
@ -86,8 +89,12 @@ class ExpeditionPalletDetailFragment(
button_ok.setOnClickListener {
activity!!.onBackPressed()
}
// sergio: en caso de que hay problemas habrá que cambiar aquí la llamada
// MainActivity.addFragmentOnTop(ExpeditionPalletDetailFragment.newInstance(itemTruck,itemPallet))
// que llame diractamente al fragment para que no se repita la ultima accion
//Log.i("VERDNATURA", "pulsamos boton OK en detail fragment")
}
}
private fun setToolBar(){
@ -111,7 +118,10 @@ class ExpeditionPalletDetailFragment(
viewModel.expeditionPalletDel(user,password,itemPallet!!.Pallet)
}else if(item == iconPrint){
splash_progress.visibility = View.VISIBLE
viewModel.expeditionPalletPrintSet(user,password,itemPallet!!.Pallet)
viewModel.expeditionPalletPrintSet(user,password,itemPallet!!.Pallet,sectorFk)
////Log.i("VERDNATURA","imprimiento etiqueta pallet $itemPallet.Pallet y sector $sectorFk")
}
}
})

View File

@ -65,8 +65,13 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel() {
})
}
fun expeditionPalletPrintSet(usuario:String,password:String,vPalletFk:String){
getPaletizadoresUserCase.expeditionPalletPrintSet(usuario,password,vPalletFk).enqueue(object : Callback<String>{
fun expeditionPalletPrintSet(
usuario: String,
password: String,
vPalletFk: String,
vSectorFk: String
){
getPaletizadoresUserCase.expeditionPalletPrintSet(usuario,password,vPalletFk,vSectorFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al imprimir pallet "+vPalletFk+ " Respuesta:"+t.message!!)
}

View File

@ -5,6 +5,7 @@ import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.media.MediaPlayer
import android.os.Bundle
import android.util.Log
import android.view.View
import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer
@ -54,6 +55,7 @@ class ExpeditionPalletFragment(
var mperror: MediaPlayer? = null
var mpok: MediaPlayer? = null
companion object {
fun newInstance(item: ItemExpeditionTruckVO) =
ExpeditionPalletFragment(item)
@ -87,6 +89,7 @@ class ExpeditionPalletFragment(
setToolBar()
setEvents()
viewModel.expeditionPallet_List(user,password,itemExpeditionTruckVO!!.truckFk)
//Log.i("VERDNATURA","4-listamos listado de pallets para la expedicion")
super.init()
}
@ -141,7 +144,34 @@ class ExpeditionPalletFragment(
}.show()
}
})
responseCheckexpeditionScanPut.observe(viewLifecycleOwner, Observer {
if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()
}else{
//Log.i("VERDNATURA"," Resultado llamada es ${it.response.toString()}")
if (it.response=="0") {
//"Rutas iguales ${it.response}".toast(activity!!)
//Log.i("VERDNATURA","Rutas iguales")
}
if (it.response=="1"){
mperror?.start()
// "Resultado llamada $it.response".toast(activity!!)
// customDialog.setTitle("Rutas distintas").setDescription(it.response).setOkButton("Cerrar"){
// customDialog.dismiss()
// }.show()
}}
})
}
}
private fun printExpeditionList(it: ItemPalletListVO){
@ -150,6 +180,7 @@ class ExpeditionPalletFragment(
adapter = ExpeditionPalletAdapter(it.list,onPalletClickListener!!,onComprobarPalletViewClickListener!!,itemExpeditionTruckVO!!)
expedition_pallet_recyclerview.adapter = adapter
expedition_pallet_recyclerview.layoutManager = lm
}
private fun expeditionScanAdd(){
@ -158,6 +189,8 @@ class ExpeditionPalletFragment(
}
private fun showScanExpeditions(it:ItemScanList){
//Log.i("VERDNATURA","VA A ESCANEAR EN PALLETFRAGMENT")
splash_progress.visibility = View.GONE
listExpeditions = ArrayList()
@ -203,6 +236,8 @@ class ExpeditionPalletFragment(
listExpeditions.add(0,BarcodeVO(code = customDialogList.getValue()))
customDialogList.setDescription("Total: "+listExpeditions.size)
viewModel.expeditionScanPut(user,password,it.list.get(0).palletFk,customDialogList.getValue())
//Log.i("VERDNATURA"," palletizando ${it.list.get(0).palletFk} expedi: ${customDialogList.getValue()}")
viewModel.checkRouteExpeditionScanPut(user,password,it.list.get(0).palletFk,customDialogList.getValue());
}else{
if (mperror != null) mperror!!.start()
}

View File

@ -1,6 +1,7 @@
package es.verdnatura.presentation.view.feature.paletizador.fragment
import android.content.Context
import android.util.Log
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
@ -31,6 +32,14 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
val response: LiveData<ResponseItemVO>
get() = _response
//sergio: añadido para comprobar rutas escaneado desde PalletFragment
private val _responseCheckexpeditionScanPut by lazy { MutableLiveData<ResponseItemVO>() }
val responseCheckexpeditionScanPut: LiveData<ResponseItemVO>
get() = _responseCheckexpeditionScanPut
fun expeditionPallet_List(usuario:String,password:String,vTruckFk:String){
getPaletizadoresUserCase.expeditionPallet_List(usuario,password,vTruckFk).enqueue(object :
Callback<List<ItemPalletVO>> {
@ -96,4 +105,21 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
})
}
fun checkRouteExpeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String){
getPaletizadoresUserCase.checkRouteExpeditionScanPut(usuario,password,vPalletFk,vExpeditionFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar expedition "+vExpeditionFk+ " Respuesta:"+t.message!!)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_responseCheckexpeditionScanPut.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada checkExpeditionScan_Put")
}else{
_responseCheckexpeditionScanPut.value = ResponseItemVO(isError = false,response = response.body()!!)
//Log.i("VERDNATURA","Resultado checkExpeditionScan ${_responseCheckexpeditionScanPut.value}")
}
}
})
}
}

View File

@ -3,7 +3,9 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment
import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.media.MediaPlayer
import android.os.Bundle
import android.util.Log
import android.view.View
import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer
@ -11,6 +13,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentExpeditionScanBinding
import es.verdnatura.domain.notNull
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.*
import es.verdnatura.presentation.view.component.CustomDialog
@ -47,7 +50,8 @@ class ExpeditionScanFragment (
private var listExpeditions:ArrayList<BarcodeVO> = ArrayList()
private var expeditionAdapter : BarcodeAdapter? = null
private lateinit var customDialog: CustomDialog
var mperror: MediaPlayer? = null
var mpok: MediaPlayer? = null
companion object {
fun newInstance(item: ItemExpeditionTruckVO,itemPalletVO: ItemPalletVO) =
@ -68,6 +72,7 @@ class ExpeditionScanFragment (
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,1).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
mperror = MediaPlayer.create((activity as MainActivity),R.raw.error)
super.onCreate(savedInstanceState)
}
@ -138,6 +143,30 @@ class ExpeditionScanFragment (
}
})
responseCheckexpeditionScanPut.observe(viewLifecycleOwner, Observer {
if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()
}else{
//Log.i("VERDNATURA"," Resultado llamada es ${it.response.toString()}")
if (it.response=="0") {
//"Rutas iguales ${it.response}".toast(activity!!)
//Log.i("VERDNATURA","Rutas iguales")
}
if (it.response=="1"){
mperror?.start()
// "Resultado llamada $it.response".toast(activity!!)
// customDialog.setTitle("Rutas distintas").setDescription(it.response).setOkButton("Cerrar"){
// customDialog.dismiss()
// }.show()
}}
})
responseDeleteScan.observe(viewLifecycleOwner, Observer {
if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
@ -177,21 +206,27 @@ class ExpeditionScanFragment (
private fun expeditionScanAdd(){
splash_progress.visibility = View.VISIBLE
viewModel.expeditionScanAdd(usuario = user,password = password,vPalletFk = itemPalletVO!!.Pallet,vTruckFk = itemExpeditionTruckVO!!.truckFk)
//Log.i("VERDNATURA","entramos a escanear ticket del pallet")
}
private fun showScanExpeditions(it: ItemScanList){
//Log.i("VERDNATURA","muestra expediciones")
listExpeditions = ArrayList()
splash_progress.visibility = View.GONE
it.list.forEach {
if(it.expeditionFk != "0")
listExpeditions.add(BarcodeVO(code = it.expeditionFk))
}
//sergio:Comprueba si el numero es mayor>0
customDialogList.setTitle("Pallet"+itemPalletVO!!.Pallet+" ("+toolbar_title.text+")").setOkButton("Comprobar"){
//Log.i("VERDNATURA","Añadida etiqueta")
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
if (listExpeditions.size > 0){
//Log.i("VERDNATURA","boton comprobar . si las expediciones >0 muetra DetailFragment")
onComprobarPalletViewClickListener!!.onComprobarPalletViewClickListener(itemExpeditionTruckVO!!,
ItemPalletVO(Pallet = it.list.get(0).palletFk)
)
@ -213,13 +248,35 @@ class ExpeditionScanFragment (
customDialogList.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
//sergio: seguimos escaneando id=0 -> sin especificar id=5->next
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!customDialogList.getValue().isNullOrEmpty()){
listExpeditions.add(BarcodeVO(code = customDialogList.getValue()))
viewModel.expeditionScanPut(user,password,it.list.get(0).palletFk,customDialogList.getValue())
if (!customDialogList.getValue().isNullOrEmpty()) {
//Log.i("VERDNATURA", "scan put pallet ${it.list.get(0).palletFk}");
//Log.i("VERDNATURA", "scan put list ${customDialogList.getValue()}");
listExpeditions.add(BarcodeVO(code = customDialogList.getValue()))
viewModel.expeditionScanPut(
user,
password,
it.list.get(0).palletFk,
customDialogList.getValue()
)
//Log.i("VERDNATURA", "scan put pallet ${it.list.get(0).palletFk}");
//Log.i("VERDNATURA", "scan put list ${customDialogList.getValue()}");
// //Log.i("VERDNATURA","misma ruta ?")
//sergio:comprueba si es de la misma ruta. Check_route_expedition.
checkRouteExpeditionScanPut(user, password,it.list.get(0).palletFk,customDialogList.getValue())
//Log.i("VERDNATURA", "scan put pallet ${it.list.get(0).palletFk}");
//Log.i("VERDNATURA", "scan put list ${customDialogList.getValue()}");
expeditionAdapter!!.notifyDataSetChanged()
}
customDialogList.setValue("")
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
@ -240,5 +297,30 @@ class ExpeditionScanFragment (
}
private fun checkRouteExpeditionScanPut(user: String, password: String, palletFk: String, expedition: String){
viewModel.checkRouteExpeditionScanPut(user,password,palletFk,expedition);
// "Pallet $palletFk y expediti $expedition".toast(activity!!)
// //Log.i("VERDNATURA", "ha entrado en checkexpedition");
/* var addScanInput = false;
customDialogTwoButtons.setTitle("La etiqueta escaneada no pertenece a la misma ruta. \n¿Desea incluirla igualmente?")
.setOkButton("Incluir") {
addScanInput = true
customDialogTwoButtons.dismiss()
return@setOkButton
}
.setKoButton("Eliminar") {
addScanInput = false
customDialogTwoButtons.dismiss()
return@setKoButton
}.show()
*/
}
}

View File

@ -1,6 +1,7 @@
package es.verdnatura.presentation.view.feature.paletizador.fragment
import android.content.Context
import android.util.Log
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
@ -35,6 +36,12 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel() {
val responseDeleteScan: LiveData<ResponseItemVO>
get() = _responseDeleteScan
//sergio:añadido para llamada nueva checkexpeditionScan
private val _responseCheckexpeditionScanPut by lazy { MutableLiveData<ResponseItemVO>() }
val responseCheckexpeditionScanPut: LiveData<ResponseItemVO>
get() = _responseCheckexpeditionScanPut
fun expeditionScanList(usuario:String,password:String,vPalletFk:String){
getPaletizadoresUserCase.expeditionScanList(usuario,password,vPalletFk).enqueue(object :
Callback<List<ItemExpeditionScanVO>> {
@ -94,11 +101,30 @@ class ExpeditionScanViewModel(context: Context) : BaseViewModel() {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada expeditionScan_Put")
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
}
})
}
fun checkRouteExpeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String){
getPaletizadoresUserCase.checkRouteExpeditionScanPut(usuario,password,vPalletFk,vExpeditionFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar expedition "+vExpeditionFk+ " Respuesta:"+t.message!!)
}
override fun onResponse(call: Call<String>, response: Response<String>) {
if (response.body() == null){
_responseCheckexpeditionScanPut.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada checkExpeditionScan_Put")
}else{
_responseCheckexpeditionScanPut.value = ResponseItemVO(isError = false,response = response.body()!!)
// //Log.i("VERDNATURA","Resultado checkExpeditionScan ${_responseCheckexpeditionScanPut.value}")
}
}
})
}
fun expeditionScanDel(usuario:String,password:String,vScanFk:String){
getPaletizadoresUserCase.expeditionScanDel(usuario,password,vScanFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {

View File

@ -4,6 +4,7 @@ import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.util.Log
import android.view.View
import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer
@ -39,7 +40,7 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
private var onTruckClickListener: OnTruckClickListener? = null
companion object {
companion object {//similar a static en Java
fun newInstance() = ExpeditionTruckListFragment()
}
@ -65,6 +66,7 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
toolbar_title.text = "PScan: "+getCURDATE()
backButton.visibility = View.GONE
setToolBar()
//Log.i("VERDNATURA","1-cargamos expediciones")
viewModel.expeditionTruckList(user,password)
super.init()
}
@ -111,6 +113,7 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
adapter = ExpeditionListAdapter(it.list,onTruckClickListener!!)
expedition_truck_recyclerview.adapter = adapter
expedition_truck_recyclerview.layoutManager = lm
//Log.i("VERDNATURA","2-Rellenamos adapter")
}
private fun addTruck(){

View File

@ -44,6 +44,13 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
"Buscar item",R.string.BuscarItem)
)
//sergio: pruebas cau item buscar
/* _pasillerositem.add(
PasillerosItemVO(9,
R.drawable.ic_visibility_black_24dp,
"Buscar item full",R.string.test)
)*/
_pasillerositem.add(
PasillerosItemVO(1,
R.drawable.ic_dashboard_black_24dp,

View File

@ -8,6 +8,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.R
import es.verdnatura.databinding.ItemArticleRowBinding
import es.verdnatura.databinding.ItemArticleRowPresacadorBinding
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.common.OnQuantityClickListener
import es.verdnatura.presentation.common.OnSaleClickListener
@ -27,8 +28,11 @@ class PreSacadorAdapter (
var position:Int = 0
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AjustesItemHolder {
this.context = parent.context
return AjustesItemHolder(
ItemArticleRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
ItemArticleRowPresacadorBinding.inflate(LayoutInflater.from(parent.context),parent,false)
)
}
@ -40,7 +44,7 @@ class PreSacadorAdapter (
}
inner class AjustesItemHolder(
val binding: ItemArticleRowBinding
val binding: ItemArticleRowPresacadorBinding
) : RecyclerView.ViewHolder(binding.root){
fun bind(preSale: PreSacadorItemVO) {
binding.apply {

View File

@ -5,6 +5,7 @@ import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.media.MediaPlayer
import android.os.Bundle
import android.util.Log
import android.view.View
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
@ -61,6 +62,8 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
private lateinit var customDialogThreeButtons: CustomDialogThreeButtons
private var token = ""
private var ticketFk = ""
//sergio: se añada para leer el articulo leido que era el buyFk
private var originalItemScan: String = ""
override fun onAttach(context: Context) {
if (context is OnPasillerosItemClickListener) pasillerosItemClickListener = context
@ -87,21 +90,25 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
activity!!.main_bottom_navigation.visibility = View.GONE
splash_progress.visibility = View.GONE
toolbar_title.text = "ticketToPrePrepare"
toolbar_title.text = getString(R.string.getticketpre)
setToolBar()
setEvents()
super.init()
}
private fun setEvents(){
backButton.setOnClickListener {
activity!!.onBackPressed()
}
//ESCANER =========
hideKeyboards()
scan_input.requestFocus()
scan_input.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!scan_input.text.toString().isNullOrEmpty()){
if (scan_input.text.contains("-")){
//es parking
@ -181,6 +188,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
//CREATE LIST
private fun searchTicket(ticketFk:String){
Log.i(TAG,"Escaneamos ticket en previa")
ticket = ticketFk
splash_progress.visibility = View.VISIBLE
viewModel.ticketToPrePrepare(
@ -261,6 +269,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
if (totalMark == sales.size) {
"Ticket completo".toast(this.context, Toast.LENGTH_SHORT)
}
}
private fun setListPosition(position:Int){
@ -352,8 +361,18 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
saleFk = sales[position].idMovimiento,
vIsChecked = if (sales[position].picked == sales[position].quantity) "1" else "0",
vOriginalQuantity = sales[position].picked.toString(),
vStateFk = PRESACADOR
vStateFk = PRESACADOR,
//sergio: se añade originalItemScan para
vBuyFk = originalItemScan
)
// //Log.i("VERDNATURA","El id movimiento es ${sales[position].idMovimiento}")
// //Log.i("VERDNATURA","Checked is ${if (sales[position].picked == sales[position].quantity) "1" else "0"}")
// //Log.i("VERDNATURA","Position is ${position}")
}
private fun unMarkLine(position: Int){
@ -418,8 +437,13 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
listPlacementSupply.add(BarcodeVO(code = it.proposal))
}
customDialogList.setTitle("$shelving($item) $total de $longName").setOkButton("Coger"){
customDialogList.setTitle("$shelving($item) $total del $longName").setOkButton("Coger"){
if (customDialogList.getValueTwo().isNotEmpty()){
if (checkItemScan(customDialogList.getValueTwo())){
onQuantityOfShelvingSelected(itemShelvingFk)
mpok?.start()
@ -457,6 +481,11 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
originalItemScan=customDialogList.getValueTwo()
//Log.i("VERDNATURA","el item original es $originalItemScan")
if (customDialogList.getValueTwo().isNotEmpty()){
if (checkItemScan(customDialogList.getValueTwo())){
onQuantityOfShelvingSelected(itemShelvingFk)
@ -536,6 +565,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
}
private fun showScanner(index:Int, sale:PreSacadorItemVO){
customDialogInput.setTitle(""+sale.itemFk).setDescription("Escanea el carro para el item seleccionado").setOkButton("Aceptar"){
if (!customDialogInput.getValue().isNullOrEmpty()) {
findSale(customDialogInput.getValue(),index)
@ -572,6 +602,7 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
collectionFk = ticket,
sectorFk = sectorFk
)
//Log.i("VERDNATURA","La collection es $ticket, sectorFk $sectorFk, user $user i pass $password")
"Imprimiendo...".toast(requireContext())
}
@ -617,7 +648,9 @@ class PreSacadorFragment : BaseFragment<FragmentPreSacadorBinding,PreSacadorView
password = password,
ticketFk = ticket,
parking = parking
)
//Log.i("VERDNATURA","El usuario $user pass $password ticket $ticketFk y parking $parking")
if (mpok != null) mpok!!.start()
"Ticket aparcado".toast(requireContext())
}

View File

@ -134,8 +134,11 @@ class PreSacadorViewModel (context: Context): BaseViewModel() {
})
}
fun saleTrackingReplace(usuario:String,password:String,saleFk:String,vOriginalQuantity:String,vStateFk:String,vIsChecked:String){
getSacadorControladorUserCase.saleTrackingReplace(usuario,password,saleFk,vOriginalQuantity,vStateFk,vIsChecked,"0").enqueue(object : Callback<String>{
fun saleTrackingReplace(usuario:String,password:String,saleFk:String,vOriginalQuantity:String,vStateFk:String,vIsChecked:String,vBuyFk:String){
//Lo ultimo que se envia
//sergio: se quita el 0 que habia por defecto para la previa se añada el buyFk que sera el item escaneado.
//getSacadorControladorUserCase.saleTrackingReplace(usuario,password,saleFk,vOriginalQuantity,vStateFk,vIsChecked,"0").enqueue(object : Callback<String>{
getSacadorControladorUserCase.saleTrackingReplace(usuario,password,saleFk,vOriginalQuantity,vStateFk,vIsChecked,vBuyFk).enqueue(object : Callback<String>{
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
}

View File

@ -18,7 +18,9 @@ fun PreSacadorItemVO.toSale() : SaleVO {
workerFk = if (trabajador.isNullOrEmpty()) { "0" } else trabajador,
originalQuantity = quantity.toString(),
placements = carros,
agencyName = if (trabajador.isNullOrEmpty()) { "" } else trabajador
agencyName = if (trabajador.isNullOrEmpty()) { "" } else trabajador,
packingType=packingType
)
}

View File

@ -5,6 +5,7 @@ import es.verdnatura.presentation.view.feature.sacador.model.PlacementVO
class PreSacadorItemVO (
var id : String = "",
var itemFk : String = "",
var packingType: String="",
var longName : String = "",
var subName : String = "",
var quantity : Int = 0,

View File

@ -83,7 +83,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
activity!!.main_bottom_navigation.visibility = View.GONE
splash_progress.visibility = View.GONE
toolbar_title.text = "itemPlacementSupplyGetOrder"
toolbar_title.text = getString(R.string.itemPlacementSupplyGetOrder)
setToolBar()
setEvents()
super.init()
@ -530,6 +530,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
}
private fun showScanner(index:Int, sale:PreSacadorItemVO){
////Log.i("VERDNATURA","CUSTOMDIALOG para enviar")
customDialogInput.setTitle(""+sale.itemFk).setDescription("Escanea el carro para el item seleccionado").setOkButton("Aceptar"){
if (!customDialogInput.getValue().isNullOrEmpty()) {
findSale(customDialogInput.getValue(),index)

View File

@ -1,5 +1,6 @@
package es.verdnatura.presentation.view.feature.sacador.adapter
import android.util.Log
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
@ -26,6 +27,7 @@ class CollectionAdapter (
holder.bind(items[position])
holder.binding.root.setOnClickListener {
onCollectionSelected.onCollectionSelected(items[position],SACADOR)
////Log.i("VERDNATURA","2-Click item ${items[position].collectionFk}")
}
}

View File

@ -4,6 +4,7 @@ import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
@ -32,6 +33,7 @@ class SacadorFragment : BaseFragment<FragmentSacadorBinding,SacadorViewModel>(Sa
private lateinit var customDialog: CustomDialog
private var collectionsList:ArrayList<CollectionVO> = ArrayList()
private var adapter: CollectionAdapter? = null
private var carros=""
companion object {
@ -51,6 +53,8 @@ class SacadorFragment : BaseFragment<FragmentSacadorBinding,SacadorViewModel>(Sa
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,1).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
//sergio: asignamos carros por defecto 2
carros= prefs!!.getString(CARRO,"2").toString()
super.onCreate(savedInstanceState)
}
@ -59,16 +63,19 @@ class SacadorFragment : BaseFragment<FragmentSacadorBinding,SacadorViewModel>(Sa
customDialog = CustomDialog(requireContext())
splash_progress.visibility = View.VISIBLE
splash_progress_two.visibility = View.GONE
toolbar_title.text = "collection_get"
//el texto de la toolbar
toolbar_title.text =getString(R.string.getcollection)
setToolBar()
setEvents()
viewModel.collectionGet(user,password)
super.init()
}
override fun onPause() {
goBack = true
goBack2 = true
goBack2 = true
super.onPause()
}
@ -80,8 +87,10 @@ class SacadorFragment : BaseFragment<FragmentSacadorBinding,SacadorViewModel>(Sa
toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
if(item == iconAdd){
////Log.i("VERDNATURA","pulsando el +")
splash_progress_two.visibility = View.VISIBLE
viewModel.collectionNew(user,password,sectorFk)
viewModel.collectionNew(user,password,sectorFk,carros)
}
}
})
@ -91,7 +100,10 @@ class SacadorFragment : BaseFragment<FragmentSacadorBinding,SacadorViewModel>(Sa
private fun setEvents(){
sacador_swipe.setOnRefreshListener {
splash_progress.visibility = View.VISIBLE
viewModel.collectionGet(user,password)
Log.i("VERDNATURA","CollectionGet desde SacadorFragment SETEVENTS del swipe")
//sergio: para mostrar que si se refresca o no
sacador_swipe.isRefreshing = false
}
}
@ -135,11 +147,13 @@ class SacadorFragment : BaseFragment<FragmentSacadorBinding,SacadorViewModel>(Sa
}
val lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
adapter = CollectionAdapter(collectionsList,onCollectionSelectedListener!!)
////Log.i("VERDNATURA","3-New fragment")
fragment_sacador_collections.layoutManager = lm
fragment_sacador_collections.adapter = adapter
}
private fun addCollectionToList(collection:String){
var isNew = true
collectionsList.forEach {
@ -160,6 +174,7 @@ class SacadorFragment : BaseFragment<FragmentSacadorBinding,SacadorViewModel>(Sa
private fun navigateToCollectionList(collection:CollectionVO){
collectionsList.add(collection)
adapter?.notifyDataSetChanged()
onCollectionSelectedListener?.onCollectionSelected(collection, SACADOR)
}

View File

@ -2,6 +2,7 @@ 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
@ -11,6 +12,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 org.json.JSONObject
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
@ -19,7 +21,9 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
val emptyMessage = "No tienes colecciones pendientes. Presiona sobre el + para crear colección";
private val getSacadorControladorUserCase: GetSacadorControladorUserCase = GetSacadorControladorUserCase(context)
private val getSacadorControladorUserCase: GetSacadorControladorUserCase = GetSacadorControladorUserCase(
context
)
private val _collectionList by lazy { MutableLiveData<CollectionListVO>() }
val collectionList: LiveData<CollectionListVO>
@ -34,62 +38,108 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
get() = _response
fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String,print:String){
getSacadorControladorUserCase.collectionTicketGet(usuario,password,collectionFk,sectorFk,print).enqueue(object :
fun collectionTicketGet(
usuario: String,
password: String,
collectionFk: String,
sectorFk: String,
print: String
){
getSacadorControladorUserCase.collectionTicketGet(
usuario,
password,
collectionFk,
sectorFk,
print
).enqueue(object :
Callback<CollectionVO> {
override fun onFailure(call: Call<CollectionVO>, t: Throwable) {
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = t.message!!)
_collectionTicketList.value = CollectionVO(
isError = true,
errorMessage = t.message!!
)
}
override fun onResponse(
call: Call<CollectionVO>,
response: Response<CollectionVO>
) {
if (response.body() != null){
if (response.body() != null) {
_collectionTicketList.value = response.body()?.let { it.map() }
}else{
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = "No hay tickets para sacar")
} else {
_collectionTicketList.value = CollectionVO(
isError = true,
errorMessage = "No hay tickets para sacar"
)
}
}
})
}
// fun collectionNew(usuario:String,password:String,sectorFk:String){
// getSacadorControladorUserCase.collectionNew(usuario,password,sectorFk).enqueue(object :
fun collectionNew(usuario: String, password: String, sectorFk: String, carros: String){
////Log.i("VERDNATURA", "El sector para CollectionNew es $sectorFk y los carros son $carros")
fun collectionNew(usuario:String,password:String,sectorFk:String){
getSacadorControladorUserCase.collectionNew(usuario,password,sectorFk).enqueue(object :
Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value = ResponseItemVO(isError = true,errorMessage = ""+t.message!!)
}
override fun onResponse(
call: Call<String>,
response: Response<String>
) {
if (response.body() != null){
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}else{
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada collectionNew")
}
}
})
getSacadorControladorUserCase.collectionNew(usuario, password, sectorFk, carros).enqueue(
object :
Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
_response.value =
ResponseItemVO(isError = true, errorMessage = "" + t.message!!)
////Log.i("VERDNATURA",t.message.toString())
}
override fun onResponse(
call: Call<String>,
response: Response<String>
) {
if (response.body() != null) {
_response.value =
ResponseItemVO(isError = false, response = response.body()!!)
} else {
val error=response.message()
////Log.i("VERDNATURA",""+ error)
_response.value = ResponseItemVO(
isError = true,
// errorMessage = "Error en la llamada collectionNew"
errorMessage = "No hay tickets para sacar"
)
}
}
})
}
fun collectionGet(usuario:String,password:String){
getSacadorControladorUserCase.collectionGet(usuario,password).enqueue(object :
fun collectionGet(usuario: String, password: String){
////Log.i("VERDNATURA","collectionGet para coger tickets")
getSacadorControladorUserCase.collectionGet(usuario, password).enqueue(object :
Callback<List<CollectionVO>> {
override fun onFailure(call: Call<List<CollectionVO>>, t: Throwable) {
val listError:ArrayList<CollectionVO> = ArrayList()
listError.add(CollectionVO(isError = true,errorMessage = t.message!!))
val listError: ArrayList<CollectionVO> = ArrayList()
listError.add(CollectionVO(isError = true, errorMessage = t.message!!))
_collectionList.value = CollectionListVO(listError)
}
override fun onResponse(
call: Call<List<CollectionVO>>,
response: Response<List<CollectionVO>>
) {
if (response.body() != null){
_collectionList.value = response.body()?.let { CollectionListVO(it.toDateFormat()) }
}else{
val listError:ArrayList<CollectionVO> = ArrayList()
listError.add(CollectionVO(isError = true,errorMessage = "Error en la llamada de collection_get"))
if (response.body() != null) {
_collectionList.value =
response.body()?.let { CollectionListVO(it.toDateFormat()) }
} else {
val listError: ArrayList<CollectionVO> = ArrayList()
listError.add(
CollectionVO(
isError = true,
errorMessage = "Error en la llamada de collection_get"
)
)
_collectionList.value = CollectionListVO(listError)
}

View File

@ -52,7 +52,8 @@ class SaleVO(
var placements : List<PlacementVO> = listOf(),
var Barcodes : List<String> = listOf(),
var isNew : Boolean = false,
var salePersonFk : String = ""
var salePersonFk : String = "",
var packingType:String =""
)
class PlacementVO(

View File

@ -50,7 +50,7 @@ class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, She
customDialog = CustomDialog(requireContext())
activity!!.main_bottom_navigation.visibility = View.GONE
toolbar_title.text = "shelvingParking_get"
toolbar_title.text = getString(R.string.shelvingParking_get)
setEvents()
super.init()
}

View File

@ -78,7 +78,7 @@ class UbicadorFragment(
customDialogUbicador = CustomDialogUbicador(requireContext())
customDialogTwoButtons = CustomDialogTwoButtons(requireContext())
activity!!.main_bottom_navigation.visibility = View.GONE
toolbar_title.text = "itemShelvingList"
toolbar_title.text = getString(R.string.locator)
setEvents()
setToolBar()
if (!shelvingFk.isNullOrEmpty()){

View File

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="viewModel"
type="es.verdnatura.presentation.view.feature.buscaritemall.model.ItemLocationAll" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:paddingTop="@dimen/toolbar_height">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textinputlayout_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColorHint="@android:color/darker_gray">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edit_itemFk"
style="@style/InputLineTextSearch"
android:layout_width="match_parent"
android:backgroundTint="@android:color/white"
android:hint="@string/Escaneaetiqueta"
android:inputType="text"
android:lines="1"
android:maxLines="1"
android:textColor="@color/verdnatura_white"
android:textColorHint="@android:color/darker_gray" />
</com.google.android.material.textfield.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="@dimen/layout_margin_min"
android:layout_marginBottom="@dimen/layout_margin_1"
android:paddingLeft="@dimen/layout_margin_min"
android:paddingRight="@dimen/layout_margin_min">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Parking"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/Matrícula"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/Visible"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/Fecha"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/location_all_recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
tools:listitem="@layout/item_location_all_row"/>
</LinearLayout>
<include
android:id="@+id/main_toolbar"
layout="@layout/toolbar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/splash_progress"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/verdnatura_black_8_alpha_6"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:gravity="center">
<com.airbnb.lottie.LottieAnimationView
android:layout_width="wrap_content"
android:layout_height="@dimen/verdnatura_logo_large_height"
app:lottie_autoPlay="true"
app:lottie_loop="true"
app:lottie_rawRes="@raw/orange_loading"
app:lottie_speed="2" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@ -30,17 +30,56 @@
android:layout_height="wrap_content"
android:textColorHint="@android:color/darker_gray">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/filter_itemFk"
style="@style/InputLineTextSearch"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_weight="1.5"
android:backgroundTint="@android:color/white"
android:hint="@string/Filtro"
android:inputType="number"
android:inputType="text"
android:lines="1"
android:maxLines="1"
android:textAlignment="center"
android:textColor="@color/verdnatura_white"
android:textColorHint="@android:color/darker_gray" />
<TextView
android:id="@+id/filter_buyer"
style="@style/InputLineTextSearch"
android:layout_width="match_parent"
android:layout_weight="1"
android:backgroundTint="@android:color/white"
android:drawableEnd="@drawable/ic_arrow_drop_down_black_24dp"
android:focusable="false"
android:hint="@string/buscarcomprador"
android:inputType="text"
android:lines="1"
android:maxLines="1"
android:textAlignment="center"
android:textColor="@color/verdnatura_pumpkin_orange"
android:textColorHint="@android:color/darker_gray"
android:visibility="visible" />
<ImageView
android:id="@+id/item_image"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:scaleType="centerCrop"
android:src="@drawable/ic_chevron_right_black_24dp"
android:visibility="gone" />
</LinearLayout>
</com.google.android.material.textfield.TextInputLayout>
<LinearLayout
@ -51,30 +90,33 @@
android:layout_marginBottom="@dimen/layout_margin_1"
android:paddingLeft="@dimen/layout_margin_min"
android:paddingRight="@dimen/layout_margin_min">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Downstairs"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
android:gravity="center"
android:text="@string/ubicado"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Upstairs"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
android:gravity="center"
android:text="@string/altillo"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/Nicho"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
android:gravity="center"
android:text="@string/sinubicar"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" />
</LinearLayout>

View File

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="viewModel"
type="es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:paddingTop="@dimen/toolbar_height">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textinputlayout_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColorHint="@android:color/darker_gray">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/filter_itemFk"
style="@style/InputLineTextSearch"
android:layout_width="match_parent"
android:backgroundTint="@android:color/white"
android:layout_weight="1"
android:hint="@string/Filtro"
android:inputType="text"
android:lines="1"
android:maxLines="1"
android:textColor="@color/verdnatura_white"
android:textColorHint="@android:color/darker_gray" />
</com.google.android.material.textfield.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="@dimen/layout_margin_min"
android:layout_marginBottom="@dimen/layout_margin_1"
android:paddingLeft="@dimen/layout_margin_min"
android:paddingRight="@dimen/layout_margin_min">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/ubicado"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/altillo"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/sinubicar"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/location_recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
tools:listitem="@layout/item_inventary_row"/>
</LinearLayout>
<include
android:id="@+id/main_toolbar"
layout="@layout/toolbar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/splash_progress"
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/verdnatura_black_8_alpha_6"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:gravity="center">
<com.airbnb.lottie.LottieAnimationView
android:layout_width="wrap_content"
android:layout_height="@dimen/verdnatura_logo_large_height"
app:lottie_autoPlay="true"
app:lottie_loop="true"
app:lottie_rawRes="@raw/orange_loading"
app:lottie_speed="2" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@ -49,7 +49,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="8dp"
tools:listitem="@layout/item_article_row" />
tools:listitem="@layout/item_article_row_presacador" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

View File

@ -0,0 +1,271 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tool="http://schemas.android.com/tools"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="sale"
type="es.verdnatura.presentation.view.feature.sacador.model.SaleVO" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginBottom="@dimen/layout_margin_min">
<!--CABECERA=================================================-->
<LinearLayout
android:id="@+id/item_row_layout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/verdnatura_black_5">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/verdnatura_warm_grey"
android:padding="@dimen/layout_margin_min"
android:orientation="vertical">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/verdnatura_white"
android:text="@string/Nivel"
android:textSize="@dimen/h8"
android:layout_marginRight="@dimen/layout_margin_min"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/verdnatura_white"
android:text="@{sale.level}"
tool:text="2"
android:textStyle="bold"
android:textSize="@dimen/h8"
android:layout_marginRight="@dimen/layout_margin_min"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/verdnatura_white"
android:text="@string/Ticket"
android:textSize="@dimen/h8"
android:layout_marginRight="@dimen/layout_margin_min"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/verdnatura_white"
android:text="@{sale.ticketFk}"
tool:text="123456789"
android:textStyle="bold"
android:textSize="@dimen/h8"
android:layout_marginRight="@dimen/layout_margin_min"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/verdnatura_white"
android:text="@string/packingType"
android:textSize="@dimen/h8"
android:layout_marginRight="@dimen/layout_margin_min"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/verdnatura_white"
android:text="@{sale.packingType}"
tool:text="123456789"
android:textStyle="bold"
android:textSize="@dimen/h8"
android:layout_marginRight="@dimen/layout_margin_min"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/verdnatura_white"
android:text="@{sale.agencyName}"
tool:text="MRW"
android:textStyle="bold"
android:textSize="@dimen/h8"
android:layout_marginRight="@dimen/layout_margin_min"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/content_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/layout_margin_min"
android:paddingBottom="@dimen/layout_margin_min"
android:background="@color/verdnatura_black">
<!--SEMAFORO=================================================-->
<LinearLayout
android:id="@+id/linearLayout3"
android:layout_width="@dimen/semaforo_width"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<View
android:id="@+id/item_article_row_semaforo_pre"
android:layout_width="match_parent"
android:layout_height="@dimen/semaforo_height"
android:background="@color/verdnatura_warm_grey"
android:layout_marginBottom="1dp"/>
<View
android:id="@+id/item_article_row_semaforo_sac"
android:layout_width="match_parent"
android:layout_height="@dimen/semaforo_height"
android:background="@color/verdnatura_warm_grey"
android:layout_marginBottom="1dp"/>
<View
android:id="@+id/item_article_row_semaforo_con"
android:layout_width="match_parent"
android:layout_height="@dimen/semaforo_height"
android:background="@color/verdnatura_warm_grey" />
</LinearLayout>
<!--CONTENIDO=================================================-->
<TextView
android:id="@+id/item_article_itemFk"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/layout_margin_min"
android:layout_marginEnd="@dimen/layout_margin_min"
android:text="@{sale.itemFk}"
tool:text="85478"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/h6"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/item_article_quantity_picked"
app:layout_constraintStart_toEndOf="@+id/linearLayout3"
app:layout_constraintTop_toTopOf="parent"
android:maxLines="1"/>
<TextView
android:id="@+id/item_article_quantity_picked"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/layout_margin_min"
android:text="@{sale.pickedQuantity}"
tool:text="0"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/h6"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/txtde"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/txtde"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/layout_margin_min"
android:text="@string/de"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/h6"
app:layout_constraintEnd_toStartOf="@+id/item_article_quantity"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/item_article_quantity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/layout_margin_min"
android:text="@{sale.quantity}"
tool:text="10"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/h6"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/item_article_quantity_line1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/layout_margin_min"
android:ellipsize="end"
android:maxLines="1"
android:text="@{sale.line1}"
tool:text="información de la linea 1"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/linearLayout3"
app:layout_constraintTop_toBottomOf="@+id/item_article_itemFk" />
<TextView
android:id="@+id/item_article_quantity_line2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/layout_margin_min"
android:ellipsize="end"
android:maxLines="1"
android:text="@{sale.line2}"
tool:text="información de la linea 2"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/linearLayout3"
app:layout_constraintTop_toBottomOf="@+id/item_article_quantity_line1" />
<TextView
android:id="@+id/item_article_quantity_line3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/layout_margin_min"
android:ellipsize="end"
android:maxLines="1"
android:text="@{sale.line3}"
tool:text="información de la linea 3"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/linearLayout3"
app:layout_constraintTop_toBottomOf="@+id/item_article_quantity_line2" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:id="@+id/layout_error"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/txt_error"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/verdnatura_white"
android:background="@color/verdnatura_red"
tool:text="Cantidad original 100"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/item_article_placements"
android:clipToPadding="false"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_placement_row"
android:background="@color/verdnatura_black_3"
tools:orientation="horizontal"/>
</LinearLayout>
</layout>

View File

@ -29,7 +29,7 @@
android:id="@+id/historico_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{item.date}"
android:text="@{item.shipped}"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:gravity="center"

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tool="http://schemas.android.com/tools">
<data>
<variable
name="item"
type="es.verdnatura.presentation.view.feature.buscaritemall.model.ItemLocationAll" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
style="@style/LayoutClickable">
<LinearLayout
android:id="@+id/item_row_layout"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/verdnatura_black_5"
android:paddingLeft="@dimen/layout_margin_min"
android:paddingRight="@dimen/layout_margin_min"
android:paddingTop="@dimen/pasilleros_margin_main_menu"
android:paddingBottom="@dimen/pasilleros_margin_main_menu">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{item.parking}"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{item.matricula}"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{item.visible}"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{item.created}"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/verdnatura_black_9"/>
</LinearLayout>
</layout>

View File

@ -61,9 +61,9 @@
<string name="Inventario">Inventario</string>
<string name="Disponible">Disponible</string>
<string name="Ubicado">Ubicado</string>
<string name="SINUBICAR">SIN UBICAR</string>
<string name="BUSCARITEM">BUSCAR ITEM</string>
<string name="MINIMO">MINIMO</string>
<string name="SINUBICAR">Sin ubicar</string>
<string name="BUSCARITEM">Buscar item</string>
<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>
@ -88,8 +88,35 @@
<string name="Actualizar">Actualizar</string>
<string name="reposicion">Reposición</string>
<string name="obtener">Obtener</string>
<string name="CANTIDAD2">CANTIDAD</string>
<string name="DARALTA">DAR DE ALTA</string>
<string name="DARBAJA">DAR DE BAJA</string>
<string name="CANTIDAD2">Cantidad</string>
<string name="DARALTA">Dar de alta</string>
<string name="DARBAJA">Dar de baja</string>
<string name="Calidad">Calidad</string>
<string name="enbreveDisponible">En breve disponible</string>
<string name="ubicado">Ubicado</string>
<string name="sinubicar">Sin ubicar</string>
<string name="altillo">Altillo</string>
<string name="packingType">Tipo embalaje</string>
<string name="Seleccionauncarro">Selecciona un carro</string>
<string name="itemShelvingRadar">Radar inventario</string>
<string name="buscarcomprador">Buscar comprador</string>
<string name="escribirparteNombre">Escribe aquí</string>
<string name="compradores">Compradores</string>
<string name="Grouping">Grouping</string>
<string name="Packing">Packing</string>
<string name="Barcode">Barcode</string>
<string name="tipodeencajado">Tipo de encajado</string>
<string name="total">Total</string>
<string name="mensajeseleccionencajado">Selecciona zona encajado :</string>
<string name="buscararticulo">Buscar artículo</string>
<string name="itemdiary">Balance del artículo</string>
<string name="getcollection">Obtener colección</string>
<string name="getticketpre">Obtener ticket previa</string>
<string name="locator">Ubicador</string>
<string name="quality">Calidad</string>
<string name="getubicaition">Buscar ítem</string>
<string name="itemPlacementSupplyGetOrder">Reposiciones</string>
<string name="faultsReview">Faltas</string>
<string name="shelvingParking_get">Parking estanterías</string>
<string name="test">Buscar item search</string>
</resources>

View File

@ -60,9 +60,9 @@
<string name="Inventario">Inventory</string>
<string name="Disponible">Available</string>
<string name="Ubicado">Located</string>
<string name="SINUBICAR">UNLOCATED</string>
<string name="BUSCARITEM">SEARCH ITEM</string>
<string name="MINIMO">MINIMUM</string>
<string name="SINUBICAR">Unlocated</string>
<string name="BUSCARITEM">Search item</string>
<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>
@ -87,8 +87,36 @@
<string name="Actualizar">Update</string>
<string name="reposicion">Replacement</string>
<string name="obtener">Get</string>
<string name="CANTIDAD2">QUANTITY</string>
<string name="DARALTA">ADD</string>
<string name="DARBAJA">REMOVE</string>
<string name="CANTIDAD2">Quantity</string>
<string name="DARALTA">Add</string>
<string name="DARBAJA">Remove</string>
<string name="Calidad">Quality</string>
<string name="enbreveDisponible">Available soon</string>
<string name="ubicado">Visible</string>
<string name="altillo">Upstairs</string>
<string name="packingType">Packing type</string>
<string name="sinubicar">Downstairs</string>
<string name="Seleccionauncarro">Select a wagon</string>
<string name="itemShelvingRadar">Shelving Radar</string>
<string name="buscarcomprador">Search buyer</string>
<string name="escribirparteNombre">Write here</string>
<string name="compradores">Buyers</string>
<string name="Grouping">Grouping</string>
<string name="Packing">Packing</string>
<string name="Barcode">Barcode</string>
<string name="tipodeencajado">Tipo de encajado</string>
<string name="total">Total</string>
<string name="mensajeseleccionencajado">Select packing type zone :</string>
<string name="buscararticulo">Search article</string>
<string name="itemdiary">Item diary</string>
<string name="getcollection">Get collection</string>
<string name="getticketpre">Get previous ticket</string>
<string name="locator">Locator</string>
<string name="quality">Quality</string>
<string name="getubicaition">Get ubication</string>
<string name="itemPlacementSupplyGetOrder">Placement supply</string>
<string name="faultsReview">Faults review</string>
<string name="shelvingParking_get">Shelving parking</string>
<string name="test">Search item test</string>
</resources>

View File

@ -20,7 +20,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.android.tools.build:gradle:4.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
@ -34,7 +34,7 @@ allprojects {
repositories {
google()
jcenter()
maven{url 'https://jitpack.io'}
}
}

View File

@ -1,6 +1,6 @@
#Thu Oct 01 06:19:26 CEST 2020
#Mon Apr 19 11:48:11 CEST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip