Versión 6.1.8.5 para subir. Todavía no lanzada.
This commit is contained in:
parent
e64109887b
commit
0a8e6e6330
|
@ -117,6 +117,9 @@
|
|||
</codeStyleSettings>
|
||||
<codeStyleSettings language="kotlin">
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
|
||||
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
|
||||
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
|
@ -4,7 +4,7 @@
|
|||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="PLATFORM" />
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="disableWrapperSourceDistributionNotification" value="true" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
|
@ -15,7 +15,6 @@
|
|||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
||||
<option name="processCode" value="true" />
|
||||
<option name="processLiterals" value="true" />
|
||||
<option name="processComments" value="true" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
|
@ -26,5 +26,10 @@
|
|||
<option name="name" value="maven" />
|
||||
<option name="url" value="https://jitpack.io" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="MavenRepo" />
|
||||
<option name="name" value="MavenRepo" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
|
@ -1,5 +1,77 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DesignSurface">
|
||||
<option name="filePathToZoomLevelMap">
|
||||
<map>
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/alpha_b_circle_outline.xml" value="0.2359375" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/alpha_f_circle_outline.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/background_oval_checked.xml" value="0.2359375" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/barcode.xml" value="0.2359375" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/barcode_scan.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_accumulate.xml" value="0.18489583333333334" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_accumulation.xml" value="0.19814814814814816" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_desactivate.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_empty.xml" value="0.13333333333333333" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_fill.xml" value="0.19814814814814816" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_full.xml" value="0.18489583333333334" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_off.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_outline.xml" value="0.22407407407407406" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/car_control.xml" value="0.22407407407407406" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/face_man_outline.xml" value="0.22708333333333333" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/filter_outline.xml" value="0.22239583333333332" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_add_black_24dp.xml" value="0.22708333333333333" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_arrow_back_black_24dp.xml" value="0.22708333333333333" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_arrow_drop_down_black_24dp.xml" value="0.22708333333333333" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_build_black_24dp.xml" value="0.22708333333333333" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_transaction.xml" value="0.22708333333333333" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_verified_user_black_24dp.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_verified_user_black_24dp_selected.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_visibility_black_24dp.xml" value="0.2546875" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_visibility_black_24dp_white.xml" value="0.2546875" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_visibility_white_24dp.xml" value="0.2546875" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/pallet_shipping.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/pallet_shipping_black.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/pallet_shipping_selected.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/qrcode_scan.xml" value="0.17395833333333333" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/activity_main.xml" value="0.17916666666666667" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_ajustes.xml" value="0.3333333333333333" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_automatic_add_item.xml" value="0.20625" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_buffer.xml" value="0.1408514492753623" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_buscar_item.xml" value="0.21014492753623187" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_collection.xml" value="0.23007246376811594" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_controlador.xml" value="0.20153985507246377" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_expedition_scan.xml" value="0.21666666666666667" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_expeditionscan_sorter.xml" value="0.196875" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_expeditionstate.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_historico.xml" value="0.1734375" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_historicovehiculo.xml" value="0.23052536231884058" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_inventary.xml" value="0.11271529888551166" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_inventary_old.xml" value="0.22604166666666667" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_item_card.xml" value="0.16666666666666666" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_itemexpeditionstate_card.xml" value="0.22" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_itemproposal.xml" value="0.22" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_login.xml" value="0.22" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_paletizador_menu.xml" value="0.13829787234042554" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_pasillero.xml" value="0.13829787234042554" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_qr.xml" value="0.19882246376811594" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_sacador_associatesmarttag.xml" value="0.22" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_smarttag_register.xml" value="0.3333333333333333" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_transferencia.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_vehiclecontrol.xml" value="0.1546875" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_vehiclecontrol_user.xml" value="0.23052536231884058" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_web.xml" value="0.2463768115942029" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_article_row.xml" value="0.4466666666666667" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_card_row.xml" value="0.2269021739130435" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_expeditionstate_row.xml" value="0.23489583333333333" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_inventary_row.xml" value="0.22604166666666667" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_pasilleros_main_menu.xml" value="0.13829787234042554" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_proposal_row.xml" value="0.22604166666666667" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_smarttag_row.xml" value="0.20153985507246377" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_worker_image.xml" value="0.23177083333333334" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/toolbar.xml" value="0.15353260869565216" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<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>
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<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" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -8,15 +8,21 @@ apply plugin: 'com.google.firebase.crashlytics'
|
|||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion "29.0.3"
|
||||
// buildToolsVersion "29.0.3"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "es.verdnatura"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
versionCode 64
|
||||
// versionName "5.4.4"
|
||||
versionName "6.1.6" //control vehiculo , visualizar y filtrar historico
|
||||
versionCode 74
|
||||
versionName "6.1.8.5" //VERSION CODE 74 . Modificado itemtrash, deprecated preferenceManager, quitados ;,puesto menu general al controlador
|
||||
//versionName "6.1.8.4.1" //VERSION CODE 73 . Modificar itemtrash
|
||||
//versionName "6.1.8.4" //VERSION CODE 72 . Se añade ExpedtionScan para el Sorter, y modificion llamadas itemtrash y collectionGetTicket.
|
||||
//versionName "6.1.8.3.1"//(VERSION CODE 71) Se añade ViewModel.collectionGet cuando se hace un collectionNew y un refresco de adapter
|
||||
//versionName "6.1.8.3" //(VERSION CODE 69) Tres campos más en pantalla cel1,cel2,cel3, obtener artículos similares con filtro, mostrar foto del sacador.
|
||||
//versionName "6.1.8.2" //(VERSIONCODE 68) Menu Operaciones buffer, pantalla mas grande en control vehiculo, deletefragments a todos los menus.
|
||||
//versionName "6.1.8.1" //(VERSIONCODE 67) Control vehiculo , visualizar y filtrar historico
|
||||
// versionName "5.4.4" //version inicial
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
|
@ -61,6 +67,12 @@ dependencies {
|
|||
implementation "com.airbnb.android:lottie:$lottieVersion"
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
|
||||
|
||||
//preferences
|
||||
implementation 'androidx.preference:preference:1.1.1'
|
||||
|
||||
//Fragments
|
||||
implementation("androidx.fragment:fragment-ktx:1.3.6")
|
||||
|
||||
|
||||
// Architecture components
|
||||
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle"
|
||||
|
@ -88,4 +100,8 @@ dependencies {
|
|||
//search
|
||||
implementation 'com.github.mirrajabi:search-dialog:1.1'
|
||||
|
||||
//logs
|
||||
implementation 'com.jakewharton.timber:timber:4.7.1'
|
||||
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,18 +1,20 @@
|
|||
{
|
||||
"version": 2,
|
||||
"version": 3,
|
||||
"artifactType": {
|
||||
"type": "APK",
|
||||
"kind": "Directory"
|
||||
},
|
||||
"applicationId": "es.verdnatura",
|
||||
"variantName": "processReleaseResources",
|
||||
"variantName": "release",
|
||||
"elements": [
|
||||
{
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"versionCode": 64,
|
||||
"versionName": "6.1.6",
|
||||
"attributes": [],
|
||||
"versionCode": 73,
|
||||
"versionName": "6.1.8.4.1",
|
||||
"outputFile": "app-release.apk"
|
||||
}
|
||||
]
|
||||
],
|
||||
"elementType": "File"
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"5.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release","dirName":""},"path":"app-release.apk","properties":{}}]
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -8,8 +8,15 @@
|
|||
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="com.zebra.provider.READ"/>
|
||||
|
||||
<queries>
|
||||
<provider android:authorities="oem_info" />
|
||||
</queries>
|
||||
|
||||
<application
|
||||
android:name=".MobileApplication"
|
||||
|
|
|
@ -2,37 +2,36 @@ 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.buffer.fragment.BufferFragmentViewModel
|
||||
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
|
||||
import es.verdnatura.presentation.view.feature.controlador.fragment.ControladorViewModel
|
||||
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoViewModel
|
||||
import es.verdnatura.presentation.view.feature.faltas.fragment.FaltasViewModel
|
||||
import es.verdnatura.presentation.view.feature.historico.fragment.HistoricoViewModel
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoViewModel
|
||||
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryViewModel
|
||||
import es.verdnatura.presentation.view.feature.login.fragment.LoginViewModel
|
||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPalletDetailViewModel
|
||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPalletViewModel
|
||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanViewModel
|
||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionTruckListViewModel
|
||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.*
|
||||
import es.verdnatura.presentation.view.feature.parking.fragment.ParkingViewModel
|
||||
import es.verdnatura.presentation.view.feature.pasillero.fragment.PasilleroViewModel
|
||||
import es.verdnatura.presentation.view.feature.precontrol.PreControladorViewModel
|
||||
import es.verdnatura.presentation.view.feature.presacador.fragment.PreSacadorViewModel
|
||||
import es.verdnatura.presentation.view.feature.qr.QrFragmentViewModel
|
||||
import es.verdnatura.presentation.view.feature.reposicion.fragment.ReposicionViewModel
|
||||
import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorViewModel
|
||||
import es.verdnatura.presentation.view.feature.shelvingparking.fragment.ShelvingParkingViewModel
|
||||
import es.verdnatura.presentation.view.feature.smarttag.sacador.fragment.SmartTagsViewModel
|
||||
import es.verdnatura.presentation.view.feature.ubicador.fragment.AutomaticAddItemViewModel
|
||||
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoViewModel
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoViewModel
|
||||
import es.verdnatura.presentation.view.feature.smarttag.sacador.AssociateTagsViewModel
|
||||
import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorViewModel
|
||||
import org.koin.android.ext.koin.androidContext
|
||||
import org.koin.androidx.viewmodel.dsl.viewModel
|
||||
import org.koin.dsl.module
|
||||
|
||||
val viewModelModule = module{
|
||||
val viewModelModule = module {
|
||||
// Login
|
||||
viewModel {
|
||||
LoginViewModel(androidContext())
|
||||
|
@ -63,7 +62,7 @@ val viewModelModule = module{
|
|||
BuscarItemAllViewModel(androidContext())
|
||||
}
|
||||
|
||||
viewModel{
|
||||
viewModel {
|
||||
PreControladorViewModel(androidContext())
|
||||
}
|
||||
|
||||
|
@ -97,6 +96,19 @@ val viewModelModule = module{
|
|||
}
|
||||
|
||||
// PALETIZADOR
|
||||
|
||||
viewModel {
|
||||
ExpeditionScanSorterViewModel(androidContext())
|
||||
}
|
||||
|
||||
viewModel {
|
||||
BufferFragmentViewModel(androidContext())
|
||||
}
|
||||
|
||||
viewModel {
|
||||
ExpeditionStateViewModel(androidContext())
|
||||
}
|
||||
|
||||
viewModel {
|
||||
ExpeditionTruckListViewModel(androidContext())
|
||||
}
|
||||
|
@ -112,6 +124,9 @@ val viewModelModule = module{
|
|||
viewModel {
|
||||
ExpeditionScanViewModel(androidContext())
|
||||
}
|
||||
viewModel {
|
||||
QrFragmentViewModel(androidContext())
|
||||
}
|
||||
|
||||
// SACADOR
|
||||
viewModel {
|
||||
|
@ -150,10 +165,10 @@ val viewModelModule = module{
|
|||
ControlVehiculoViewModel(androidContext())
|
||||
}
|
||||
|
||||
viewModel{
|
||||
viewModel {
|
||||
HistoricoVehiculoViewModel(androidContext())
|
||||
}
|
||||
viewModel{
|
||||
AssociateTagsViewModel(androidContext())
|
||||
viewModel {
|
||||
SmartTagsViewModel(androidContext())
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package es.verdnatura.domain
|
||||
import retrofit2.Retrofit
|
||||
import retrofit2.converter.gson.GsonConverterFactory
|
||||
|
||||
class ApiNodeJsUtils {
|
||||
|
||||
|
||||
companion object {
|
||||
//const val BASE_URL:String = "http://192.168.1.108:8000/"
|
||||
const val BASE_URL:String = "http://10.2.2.49:7777"
|
||||
fun getApiService():NodeJsService{
|
||||
val nodeJsRetrofit = Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(
|
||||
GsonConverterFactory.create()).build()
|
||||
return nodeJsRetrofit.create(NodeJsService::class.java)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,10 +6,11 @@ import retrofit2.converter.gson.GsonConverterFactory
|
|||
class ApiSalixUtils {
|
||||
companion object {
|
||||
//const val BASE_URL:String = "http://192.168.1.108:8000/"
|
||||
const val BASE_URL:String = "https://salix.verdnatura.es/api/"
|
||||
fun getApiService():SalixService{
|
||||
const val BASE_URL: String = "https://salix.verdnatura.es/api/"
|
||||
fun getApiService(): SalixService {
|
||||
val salixRetrofit = Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(
|
||||
GsonConverterFactory.create()).build()
|
||||
GsonConverterFactory.create()
|
||||
).build()
|
||||
return salixRetrofit.create(SalixService::class.java)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,57 +2,57 @@ package es.verdnatura.domain
|
|||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.preference.PreferenceManager
|
||||
import android.util.Log
|
||||
//import android.preference.PreferenceManager
|
||||
import androidx.preference.PreferenceManager
|
||||
import okhttp3.OkHttpClient
|
||||
import retrofit2.Retrofit
|
||||
import retrofit2.converter.gson.GsonConverterFactory
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
|
||||
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://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{
|
||||
fun getApiService(context: Context): VerdnaturaService {
|
||||
|
||||
val retrofit = Retrofit.Builder()
|
||||
.baseUrl(getBaseUrlLocal(context))
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.client(getRequestHeader())
|
||||
.client(getRequestHeader()!!)
|
||||
.build()
|
||||
return retrofit.create(VerdnaturaService::class.java)
|
||||
|
||||
}
|
||||
|
||||
fun getBaseUrlLocal(context: Context): String {
|
||||
var url = this.getDefaults("base_url",context)
|
||||
if (url.isNullOrEmpty()){
|
||||
setDefaults("base_url", BASE_URL,context)
|
||||
}else{
|
||||
if (!url.contains("http")){
|
||||
url = "https://"+url
|
||||
var url = this.getDefaults("base_url", context)
|
||||
if (url.isNullOrEmpty()) {
|
||||
setDefaults("base_url", BASE_URL, context)
|
||||
} else {
|
||||
if (!url.contains("http")) {
|
||||
url = "https://" + url
|
||||
}
|
||||
}
|
||||
|
||||
return if (url.isNullOrEmpty()) BASE_URL else url
|
||||
}
|
||||
|
||||
fun getRequestHeader(): OkHttpClient? {
|
||||
val client = OkHttpClient.Builder()
|
||||
return OkHttpClient.Builder()
|
||||
.connectTimeout(10, TimeUnit.SECONDS)
|
||||
.writeTimeout(10, TimeUnit.SECONDS)
|
||||
.readTimeout(40, TimeUnit.SECONDS)
|
||||
.build()
|
||||
return client
|
||||
}
|
||||
|
||||
fun setDefaults(key: String?, value: String?, context: Context?) {
|
||||
val preferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
val preferences: SharedPreferences =
|
||||
PreferenceManager.getDefaultSharedPreferences(context)
|
||||
val editor = preferences.edit()
|
||||
editor.putString(key, value)
|
||||
editor.commit()
|
||||
//editor.commit()
|
||||
editor.apply()
|
||||
}
|
||||
|
||||
fun getDefaults(key: String?, context: Context?): String? {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
|
||||
fun Any.toast(context: Context?, duration: Int = Toast.LENGTH_SHORT): Toast {
|
||||
|
|
|
@ -6,9 +6,8 @@ import retrofit2.Call
|
|||
|
||||
class GetAjustesUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun getSectors(usuario:String,password:String) : Call<List<SectorItemVO>> {
|
||||
return restClient!!.getSectors("json","1",usuario,password,"application/json")
|
||||
fun getSectors(usuario: String, password: String): Call<List<SectorItemVO>> {
|
||||
return restClient!!.getSectors("json", "1", usuario, password, "application/json")
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -6,10 +6,21 @@ 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()
|
||||
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)
|
||||
return restClient!!.searchItemsUbicadorAll(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params
|
||||
)
|
||||
}
|
||||
|
||||
}
|
|
@ -6,10 +6,21 @@ import retrofit2.Call
|
|||
|
||||
class GetBuscarItemUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun searchItemsUbicador(usuario:String,password:String,itemFk:String) : Call<List<ItemLocationVO>> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun searchItemsUbicador(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String
|
||||
): Call<List<ItemLocationVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
return restClient!!.searchItemsUbicador("json","1",usuario,password,"application/json",params = params)
|
||||
return restClient!!.searchItemsUbicador(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params
|
||||
)
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
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
|
||||
|
@ -9,36 +8,80 @@ import retrofit2.Call
|
|||
|
||||
class GetInventaryUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun itemShelvingRadar(usuario:String,password:String,sectorFk:String) : Call<List<ItemInventaryVO>> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun itemShelvingRadar(
|
||||
usuario: String,
|
||||
password: String,
|
||||
sectorFk: String
|
||||
): Call<List<ItemInventaryVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(sectorFk)
|
||||
return restClient!!.itemShelvingRadar("json","1",usuario,password,"application/json",params = params)
|
||||
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();
|
||||
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)
|
||||
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();
|
||||
fun faultsReview(
|
||||
usuario: String,
|
||||
password: String,
|
||||
warehouseFk: String
|
||||
): Call<List<ItemFaltasVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(warehouseFk)
|
||||
return restClient!!.faultsReview("json","1",usuario,password,"application/json",params = params)
|
||||
return restClient!!.faultsReview(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params
|
||||
)
|
||||
}
|
||||
|
||||
fun faultsReview_isChecked(usuario:String,password:String,itemFk:String,warehouseFk:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun faultsReview_isChecked(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String,
|
||||
warehouseFk: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(warehouseFk)
|
||||
return restClient!!.faultsReview_isChecked("json","1",usuario,password,"application/json",params = params)
|
||||
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")
|
||||
fun itemShelvingBuyerGet(usuario: String, password: String): Call<List<BuyerVO>> {
|
||||
return restClient!!.itemShelvingBuyerGet("json", "1", usuario, password, "application/json")
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -3,92 +3,254 @@ 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.articulo.model.ItemProposal
|
||||
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoVO
|
||||
import retrofit2.Call
|
||||
|
||||
class GetItemCardUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun getItemCard(usuario:String,password:String,itemFk:String,warehouseFk:String) : Call<ItemCardVO> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun getItemCard(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String,
|
||||
warehouseFk: String
|
||||
): Call<ItemCardVO> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(warehouseFk)
|
||||
return restClient!!.getItemCard("json","1",usuario,password,"application/json",params = params)
|
||||
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 item_getSimilar(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String,
|
||||
warehouseFk: String,
|
||||
vshipped: String,
|
||||
vIsShowedByType: String
|
||||
): Call<List<ItemProposal>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(warehouseFk)
|
||||
params.add(vshipped)
|
||||
params.add(vIsShowedByType)
|
||||
|
||||
return restClient!!.item_getSimilar(
|
||||
"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();
|
||||
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()
|
||||
params.add(itemFk)
|
||||
params.add(warehouseFk)
|
||||
params.add(newVisible)
|
||||
params.add(isTrash)
|
||||
return restClient!!.itemStockUpdate("json","1",usuario,password,"application/json",params = params)
|
||||
|
||||
//sergio: se modifica por CAU a itemTrash// Faltas también accede a itemStockUpdate ( falta comprobar porque no aparece nada más)
|
||||
//return restClient!!.itemStockUpdate("json","1",usuario,password,"application/json",params = params)
|
||||
return restClient!!.itemTrash(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemTrash(usuario:String,password:String,itemFk:String,warehouseFk:String,newVisible:String,isTrash:String ) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun itemTrash(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String,
|
||||
warehouseFk: String,
|
||||
newVisible: String,
|
||||
isTrash: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(warehouseFk)
|
||||
params.add(newVisible)
|
||||
params.add(isTrash)
|
||||
return restClient!!.itemTrash("json","1",usuario,password,"application/json",params = params)
|
||||
return restClient!!.itemTrash(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemPlacementSave(usuario:String,password:String,itemFk:String,warehouseFk:String,value:String ) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun itemPlacementSave(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String,
|
||||
warehouseFk: String,
|
||||
value: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(warehouseFk)
|
||||
params.add(value)
|
||||
return restClient!!.itemPlacementSave("json","1",usuario,password,"application/json",params = params)
|
||||
return restClient!!.itemPlacementSave(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params
|
||||
)
|
||||
}
|
||||
|
||||
fun updateGrouping(usuario:String,password:String,itemFk:String,value:String ,warehouseFk:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun updateGrouping(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String,
|
||||
value: String,
|
||||
warehouseFk: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(value)
|
||||
params.add(warehouseFk)
|
||||
return restClient!!.updateGrouping("json","1",usuario,password,"application/json",params = params)
|
||||
return restClient!!.updateGrouping(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params
|
||||
)
|
||||
}
|
||||
|
||||
fun updatePacking(usuario:String,password:String,itemFk:String,value:String ,warehouseFk:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun updatePacking(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String,
|
||||
value: String,
|
||||
warehouseFk: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(value)
|
||||
params.add(warehouseFk)
|
||||
return restClient!!.updatePacking("json","1",usuario,password,"application/json",params = params)
|
||||
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();
|
||||
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)
|
||||
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();
|
||||
fun itemSaveMin(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String,
|
||||
value: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(value)
|
||||
return restClient!!.itemSaveMin("json","1",usuario,password,"application/json",params = params)
|
||||
return restClient!!.itemSaveMin(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params
|
||||
)
|
||||
}
|
||||
|
||||
fun barcodes_edit(usuario:String,password:String,itemFk:String,value:String, delete:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun barcodes_edit(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String,
|
||||
value: String,
|
||||
delete: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(value)
|
||||
params.add(itemFk)
|
||||
params.add(delete)
|
||||
return restClient!!.barcodes_edit("json","1",usuario,password,"application/json",params = params)
|
||||
return restClient!!.barcodes_edit(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemDiary(usuario:String,password:String,itemFk:String,warehouseFk: String) : Call<List<ItemHistoricoVO>> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun itemDiary(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String,
|
||||
warehouseFk: String
|
||||
): Call<List<ItemHistoricoVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(warehouseFk)
|
||||
return restClient!!.itemDiary("json","1",usuario,password,"application/json",params = params)
|
||||
return restClient!!.itemDiary(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params
|
||||
)
|
||||
}
|
||||
}
|
|
@ -1,39 +1,105 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import es.verdnatura.presentation.view.feature.login.model.LoginDevice
|
||||
import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO
|
||||
import es.verdnatura.presentation.view.feature.login.model.SalixMessageVO
|
||||
import es.verdnatura.presentation.view.feature.login.model.SalixGrupo
|
||||
import es.verdnatura.presentation.view.feature.login.model.versionApp
|
||||
import retrofit2.Call
|
||||
|
||||
class GetLoginUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun login(usuario:String,password:String,imei:String) : Call<String>{
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
fun login(usuario: String, password: String, androiid: String): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(usuario)
|
||||
params.add(password)
|
||||
//params.add(imei)
|
||||
return restClient!!.login("json","1",usuario,password,"application/json",params)
|
||||
params.add(androiid)
|
||||
return restClient!!.login("json", "1", usuario, password, "application/json", params)
|
||||
}
|
||||
|
||||
fun salixLogin(usuario:String,password:String) : Call<LoginSalixVO>{
|
||||
return salixClient!!.login("application/json", LoginSalixVO(usuario,password))
|
||||
fun device_checkLogin(
|
||||
usuario: String,
|
||||
password: String,
|
||||
android_id: String
|
||||
): Call<LoginDevice> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(usuario)
|
||||
params.add(android_id)
|
||||
return restClient!!.device_checkLogin(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun checkVersion_old(usuario:String,password:String,version:String) : Call<Boolean> {
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
fun worker_getId(usuario: String, password: String): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
return restClient!!.worker_getId("json", "1", usuario, password, "application/json", params)
|
||||
}
|
||||
|
||||
fun deviceLog_add(
|
||||
usuario: String,
|
||||
password: String,
|
||||
app: String,
|
||||
versionApp: String,
|
||||
android_id: String
|
||||
): Call<Void> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(app)
|
||||
params.add(versionApp)
|
||||
params.add(android_id)
|
||||
return restClient!!.deviceLog_add(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun salixLogin(usuario: String, password: String): Call<LoginSalixVO> {
|
||||
return salixClient!!.login("application/json", LoginSalixVO(usuario, password))
|
||||
}
|
||||
//NODEJS TEST
|
||||
|
||||
fun nodeJsTest(
|
||||
smarttag: String,
|
||||
wagon: String,
|
||||
shelving: String
|
||||
): Call<NodeJsService.SmartTagNode> {
|
||||
return nodejsClient!!.bindShelving("application/json", "A0A3B8224DBF", "ABC", "2")
|
||||
// return nodejsClient!!.bindShelving("application/json", NodeJsService.SmartTagNode(smarttag, wagon, shelving),"A0A3B8224DBF","ABC","2")
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
return restClient!!.version("json", "1", usuario, password, "application/json", params)
|
||||
}
|
||||
|
||||
fun sendChekingPresence(token:String,workerId:Int,message:String) : Call<Boolean>{
|
||||
//SALIX MENSAJE :SERGIO: PARA NO ENVIAR MENSAJES A COMERCIALES PONGO QUE LAS MODIFICACIONES SE ENVIAN AL CANAL CREADO.
|
||||
|
||||
/* fun sendChekingPresence(token:String,workerId:Int,message:String) : Call<Boolean>{
|
||||
return salixClient!!.sendChekingPresence(content_type = "application/json", authorization = token, params = SalixMessageVO(workerId = workerId,message = message))
|
||||
}*/
|
||||
// SERGIO: PARA DESARROLLO Y PRUEBAS SE DESCOMENTA ESTAS LÍNEAS Y SE COMENTAN LAS DE ARRIBA
|
||||
fun sendChekingPresence(token: String, workerId: Int, message: String): Call<Boolean> {
|
||||
return salixClient!!.sendGroup(
|
||||
content_type = "application/json",
|
||||
authorization = token,
|
||||
params = SalixGrupo(to = "#android-test", message = message)
|
||||
)
|
||||
}
|
||||
|
||||
fun checkVersion(usuario:String,password:String,nameApp:String) : Call<versionApp> {
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
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)
|
||||
return restClient!!.getVersion("json", "1", usuario, password, "application/json", params)
|
||||
}
|
||||
|
||||
}
|
|
@ -1,74 +1,239 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import com.google.gson.JsonObject
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.*
|
||||
import retrofit2.Call
|
||||
|
||||
class GetPaletizadoresUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun expeditionTruckList(usuario:String,password:String) : Call<List<ItemExpeditionTruckVO>> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
return restClient!!.expeditionTruckList("json","1",usuario,password,"application/json")
|
||||
//buffer
|
||||
fun buffer_setTypeByName(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vBufferFk: String,
|
||||
vType: String
|
||||
): Call<Boolean> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vBufferFk)
|
||||
params.add(vType)
|
||||
return restClient!!.buffer_setTypeByName(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params
|
||||
)
|
||||
}
|
||||
|
||||
fun expeditionTruckAdd(usuario:String,password:String,vHour:String,vDescription:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
//expeditionScan opciones paletizadores
|
||||
fun expedition_scan(usuario: String, password: String, vExpeditionId: String): Call<Void> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vExpeditionId)
|
||||
return restClient!!.expedition_scan(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
//expedition
|
||||
|
||||
fun expedition_getState(
|
||||
usuario: String,
|
||||
password: String,
|
||||
expeditionFk: String
|
||||
): Call<itemExpedetionState> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(expeditionFk)
|
||||
return restClient!!.expedition_getState(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params
|
||||
)
|
||||
}
|
||||
|
||||
fun expedition_getStateJSON(
|
||||
usuario: String,
|
||||
password: String,
|
||||
expeditionFk: String
|
||||
): Call<JsonObject> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(expeditionFk)
|
||||
return restClient!!.expedition_getStateJSON(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params
|
||||
)
|
||||
}
|
||||
|
||||
fun expeditionTruckList(usuario: String, password: String): Call<List<ItemExpeditionTruckVO>> {
|
||||
// val params: ArrayList<String> = ArrayList()
|
||||
return restClient!!.expeditionTruckList("json", "1", usuario, password, "application/json")
|
||||
}
|
||||
|
||||
fun expeditionTruckAdd(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vHour: String,
|
||||
vDescription: String
|
||||
): Call<String> {
|
||||
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)
|
||||
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()
|
||||
fun expeditionPallet_List(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vTruckFk: String
|
||||
): Call<List<ItemPalletVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vTruckFk)
|
||||
return restClient!!.expeditionPallet_List("json","1",usuario,password,"application/json",params)
|
||||
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()
|
||||
fun expeditionScanAdd(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vPalletFk: String,
|
||||
vTruckFk: String
|
||||
): Call<List<ItemScanVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vPalletFk)
|
||||
params.add(vTruckFk)
|
||||
return restClient!!.expeditionScanAdd("json","1",usuario,password,"application/json",params)
|
||||
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()
|
||||
fun expeditionScanPut(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vPalletFk: String,
|
||||
vExpeditionFk: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vPalletFk)
|
||||
params.add(vExpeditionFk)
|
||||
return restClient!!.expeditionScanPut("json","1",usuario,password,"application/json",params)
|
||||
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()
|
||||
|
||||
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)
|
||||
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()
|
||||
fun expeditionPalletView(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vPalletFk: String
|
||||
): Call<List<ItemPalletViewVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vPalletFk)
|
||||
return restClient!!.expeditionPalletView("json","1",usuario,password,"application/json",params)
|
||||
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()
|
||||
fun expeditionPalletDel(usuario: String, password: String, vPalletFk: String): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vPalletFk)
|
||||
return restClient!!.expeditionPalletDel("json","1",usuario,password,"application/json",params)
|
||||
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()
|
||||
fun expeditionScanList(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vPalletFk: String
|
||||
): Call<List<ItemExpeditionScanVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vPalletFk)
|
||||
return restClient!!.expeditionScanList("json","1",usuario,password,"application/json",params)
|
||||
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()
|
||||
fun expeditionScanDel(usuario: String, password: String, vScanFk: String): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vScanFk)
|
||||
return restClient!!.expeditionScanDel("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.expeditionScanDel(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun expeditionPalletPrintSet(
|
||||
|
@ -76,11 +241,18 @@ class GetPaletizadoresUserCase(context: Context) : RestClient(context) {
|
|||
password: String,
|
||||
vPalletFk: String,
|
||||
vSectorFk: String
|
||||
) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vPalletFk)
|
||||
params.add(vSectorFk)
|
||||
return restClient!!.expeditionPalletPrintSet("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.expeditionPalletPrintSet(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,15 +6,27 @@ import retrofit2.Call
|
|||
|
||||
class GetPreControladorUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
|
||||
fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String,print:String,type:String) : Call<CollectionVO> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun collectionTicketGet(
|
||||
usuario: String,
|
||||
password: String,
|
||||
collectionFk: String,
|
||||
sectorFk: String,
|
||||
print: String,
|
||||
type: String
|
||||
): Call<CollectionVO> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(collectionFk)
|
||||
params.add(sectorFk)
|
||||
params.add(print)
|
||||
params.add(type)
|
||||
return restClient!!.collection_getTickets("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.collection_getTickets(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -6,26 +6,59 @@ import retrofit2.Call
|
|||
|
||||
class GetPreSacadorUseCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun ticketToPrePrepare(usuario:String,password:String,ticketFk:String,sectorFk:String) : Call<List<PreSacadorItemVO>> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun ticketToPrePrepare(
|
||||
usuario: String,
|
||||
password: String,
|
||||
ticketFk: String,
|
||||
sectorFk: String
|
||||
): Call<List<PreSacadorItemVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(ticketFk)
|
||||
params.add(sectorFk)
|
||||
return restClient!!.ticketToPrePrepare("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.ticketToPrePrepare(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemPlacementSupplyGetOrder(usuario:String,password:String,sectorFk:String) : Call<List<PreSacadorItemVO>> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun itemPlacementSupplyGetOrder(
|
||||
usuario: String,
|
||||
password: String,
|
||||
sectorFk: String
|
||||
): Call<List<PreSacadorItemVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(sectorFk)
|
||||
return restClient!!.itemPlacementSupplyGetOrder("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.itemPlacementSupplyGetOrder(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemPlacementSupplyCloseOrder(usuario:String,password:String,id:String,quantity:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun itemPlacementSupplyCloseOrder(
|
||||
usuario: String,
|
||||
password: String,
|
||||
id: String,
|
||||
quantity: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(id)
|
||||
params.add(quantity)
|
||||
return restClient!!.itemPlacementSupplyCloseOrder("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.itemPlacementSupplyCloseOrder(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import retrofit2.Call
|
||||
|
||||
class GetQrReaderUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun qr_getCall(
|
||||
usuario: String,
|
||||
password: String,
|
||||
call: String
|
||||
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(call)
|
||||
return restClient!!.qr_getCall(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params = params
|
||||
)
|
||||
}
|
||||
|
||||
}
|
|
@ -7,20 +7,43 @@ import retrofit2.Call
|
|||
|
||||
class GetQualityUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun itemShelvingBuyerGet(usuario:String,password:String) : Call<List<BuyerVO>> {
|
||||
return restClient!!.itemShelvingBuyerGet("json","1",usuario,password,"application/json")
|
||||
fun itemShelvingBuyerGet(usuario: String, password: String): Call<List<BuyerVO>> {
|
||||
return restClient!!.itemShelvingBuyerGet("json", "1", usuario, password, "application/json")
|
||||
}
|
||||
|
||||
fun itemShelvingBuyerTask(usuario:String,password:String, userFk: String) : Call<List<ItemBuyerVO>> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun itemShelvingBuyerTask(
|
||||
usuario: String,
|
||||
password: String,
|
||||
userFk: String
|
||||
): Call<List<ItemBuyerVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(userFk)
|
||||
return restClient!!.itemShelvingBuyerTask("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.itemShelvingBuyerTask(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemShelvingStarsUpdate(usuario:String,password:String, vId: String,vStars: String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun itemShelvingStarsUpdate(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vId: String,
|
||||
vStars: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vId)
|
||||
params.add(vStars)
|
||||
return restClient!!.itemShelvingStarsUpdate("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.itemShelvingStarsUpdate(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
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
|
||||
|
@ -10,143 +9,380 @@ import retrofit2.Call
|
|||
|
||||
class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String,print:String,type:String) : Call<CollectionVO> {
|
||||
//sergio: se quita para ir colocando collection_getTickets
|
||||
/* fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String,print:String,type:String) : Call<CollectionVO> {
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
params.add(collectionFk)
|
||||
params.add(sectorFk)
|
||||
params.add(print)
|
||||
params.add(type)
|
||||
return restClient!!.collectionTicketGet("json","1",usuario,password,"application/json",params)
|
||||
}*/
|
||||
//sergio: se cambia llamada a collection_getTickets
|
||||
|
||||
fun collectionTicketGet(
|
||||
usuario: String,
|
||||
password: String,
|
||||
collectionFk: String,
|
||||
sectorFk: String,
|
||||
print: String,
|
||||
type: String
|
||||
): Call<CollectionVO> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(collectionFk)
|
||||
params.add(sectorFk)
|
||||
params.add(print)
|
||||
params.add(type)
|
||||
return restClient!!.collection_getTickets(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun ticket_checkFullyControlled(
|
||||
usuario: String,
|
||||
password: String,
|
||||
collectionFk: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(collectionFk)
|
||||
return restClient!!.ticket_checkFullyControlled(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun collectionNew(usuario:String,password:String,sectorFk:String,carros:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
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)
|
||||
return restClient!!.collectionNew(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
fun collectionNew(
|
||||
usuario: String,
|
||||
password: String,
|
||||
sectorFk: String,
|
||||
carros: String,
|
||||
tagtype: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(sectorFk)
|
||||
params.add(carros)
|
||||
params.add(tagtype)
|
||||
return restClient!!.collectionNew(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
|
||||
fun collectionGet(usuario:String,password:String) : Call<List<CollectionVO>> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
return restClient!!.collectionGet("json","1",usuario,password,"application/json")
|
||||
}
|
||||
|
||||
fun saleTrackingReplace(usuario:String,password:String,saleFk:String,vOriginalQuantity:String,vStateFk:String,vIsChecked:String,vBuyFk:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun collectionGet(usuario: String, password: String): Call<List<CollectionVO>> {
|
||||
// val params:ArrayList<String> = ArrayList()
|
||||
return restClient!!.collectionGet("json", "1", usuario, password, "application/json")
|
||||
}
|
||||
|
||||
fun saleTrackingReplace(
|
||||
usuario: String,
|
||||
password: String,
|
||||
saleFk: String,
|
||||
vOriginalQuantity: String,
|
||||
vStateFk: String,
|
||||
vIsChecked: String,
|
||||
vBuyFk: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(saleFk)
|
||||
params.add(vOriginalQuantity)
|
||||
params.add(vStateFk)
|
||||
params.add(vIsChecked)
|
||||
params.add(vBuyFk)
|
||||
return restClient!!.saleTrackingReplace("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.saleTrackingReplace(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemPlacementSupplyAiming(usuario:String,password:String,shelvingFk:String,quantity:String,itemFk:String) : Call<List<PlacementSupplyVO>> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun itemPlacementSupplyAiming(
|
||||
usuario: String,
|
||||
password: String,
|
||||
shelvingFk: String,
|
||||
quantity: String,
|
||||
itemFk: String
|
||||
): Call<List<PlacementSupplyVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(shelvingFk)
|
||||
params.add(quantity)
|
||||
params.add(itemFk)
|
||||
return restClient!!.itemPlacementSupplyAiming("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.itemPlacementSupplyAiming(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemShelvingSaleSupplyAdd(usuario:String,password:String,itemShelvingFk:String,saleFk:String,quantity:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun itemShelvingSaleSupplyAdd(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemShelvingFk: String,
|
||||
saleFk: String,
|
||||
quantity: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemShelvingFk)
|
||||
params.add(saleFk)
|
||||
params.add(quantity)
|
||||
return restClient!!.itemShelvingSaleSupplyAdd("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.itemShelvingSaleSupplyAdd(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemShelvingPlacementSupplyAdd(usuario:String,password:String,itemShelvingFk:String,itemPlacementSupplyFk:String,quantity:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun itemShelvingPlacementSupplyAdd(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemShelvingFk: String,
|
||||
itemPlacementSupplyFk: String,
|
||||
quantity: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemShelvingFk)
|
||||
params.add(itemPlacementSupplyFk)
|
||||
params.add(quantity)
|
||||
return restClient!!.itemShelvingPlacementSupplyAdd("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.itemShelvingPlacementSupplyAdd(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun collectionStickerPrint(usuario:String,password:String,collectionFk: String,sectorFk: String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
fun collectionStickerPrint(
|
||||
usuario: String,
|
||||
password: String,
|
||||
collectionFk: String,
|
||||
sectorFk: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(collectionFk)
|
||||
params.add(sectorFk)
|
||||
return restClient!!.collectionStickerPrint("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.collectionStickerPrint(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemGetAvailable(usuario:String,password:String,itemFk: String,warehouseFk: String) : Call<ItemVO> {
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
fun itemGetAvailable(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String,
|
||||
warehouseFk: String
|
||||
): Call<ItemVO> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(warehouseFk)
|
||||
return restClient!!.itemGetAvailable("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.itemGetAvailable(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun collectionAddItem(usuario:String,password:String,itemFk: String,quantityFk: String,ticketFk: String,warehouseFk: String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
fun collectionAddItem(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String,
|
||||
quantityFk: String,
|
||||
ticketFk: String,
|
||||
warehouseFk: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(quantityFk)
|
||||
params.add(ticketFk)
|
||||
params.add(warehouseFk)
|
||||
return restClient!!.collectionAddItem("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.collectionAddItem(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun saleMove(usuario:String,password:String,saleFk: String,quantity: String,originalQuantity:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
fun saleMove(
|
||||
usuario: String,
|
||||
password: String,
|
||||
saleFk: String,
|
||||
quantity: String,
|
||||
originalQuantity: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(saleFk)
|
||||
params.add(quantity)
|
||||
params.add(originalQuantity)
|
||||
return restClient!!.saleMove("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.saleMove("json", "1", usuario, password, "application/json", params)
|
||||
}
|
||||
|
||||
fun collectionMissingTrash(usuario:String,password:String,saleFk: String,quantity: String,type:String,warehouseFk:String,originalQuantity: String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
fun collectionMissingTrash(
|
||||
usuario: String,
|
||||
password: String,
|
||||
saleFk: String,
|
||||
quantity: String,
|
||||
type: String,
|
||||
warehouseFk: String,
|
||||
originalQuantity: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(saleFk)
|
||||
params.add(quantity)
|
||||
params.add(type)
|
||||
params.add(warehouseFk)
|
||||
params.add(originalQuantity)
|
||||
return restClient!!.collectionMissingTrash("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.collectionMissingTrash(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun saleTrackingDel(usuario:String,password:String,saleFk: String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
fun saleTrackingDel(usuario: String, password: String, saleFk: String): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(saleFk)
|
||||
return restClient!!.saleTrackingDel("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.saleTrackingDel(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun collectionUpdateState(usuario:String,password:String,collectionFk: String,state : String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
fun collectionUpdateState(
|
||||
usuario: String,
|
||||
password: String,
|
||||
collectionFk: String,
|
||||
state: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(collectionFk)
|
||||
params.add(state)
|
||||
return restClient!!.collectionUpdateState("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.collectionUpdateState(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun getIdFromCode(usuario:String,password:String,code: String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
fun getIdFromCode(usuario: String, password: String, code: String): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(code)
|
||||
return restClient!!.getIdFromCode("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.getIdFromCode(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun collectionIncreaseQuantity(usuario:String,password:String,saleFk: String, quantity: String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
fun collectionIncreaseQuantity(
|
||||
usuario: String,
|
||||
password: String,
|
||||
saleFk: String,
|
||||
quantity: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(saleFk)
|
||||
params.add(quantity)
|
||||
return restClient!!.collectionIncreaseQuantity("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.collectionIncreaseQuantity(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun saleMistakeAdd(usuario:String,password:String,vSaleFk: String, vUserFk: String, vTypeFk: String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
fun saleMistakeAdd(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vSaleFk: String,
|
||||
vUserFk: String,
|
||||
vTypeFk: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vSaleFk)
|
||||
params.add(vUserFk)
|
||||
params.add(vTypeFk)
|
||||
return restClient!!.saleMistakeAdd("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.saleMistakeAdd(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun mistakeType(usuario:String,password:String) : Call<List<MistakeTypeVO>> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
return restClient!!.mistakeType("json","1",usuario,password,"application/json")
|
||||
fun mistakeType(usuario: String, password: String): Call<List<MistakeTypeVO>> {
|
||||
// val params:ArrayList<String> = ArrayList()
|
||||
return restClient!!.mistakeType("json", "1", usuario, password, "application/json")
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -6,12 +6,25 @@ import retrofit2.Call
|
|||
|
||||
class GetShelvingParkingUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun shelvingParking_get(usuario:String,password:String,vShelvingFk:String,vWarehouseFk:String,vDayRange:String) : Call<List<ItemShelvingParkingVO>> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun shelvingParking_get(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vShelvingFk: String,
|
||||
vWarehouseFk: String,
|
||||
vDayRange: String
|
||||
): Call<List<ItemShelvingParkingVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vShelvingFk)
|
||||
params.add(vWarehouseFk)
|
||||
params.add(vDayRange)
|
||||
return restClient!!.shelvingParking_get("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.shelvingParking_get(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import retrofit2.Call
|
||||
|
||||
class GetSmarttagsUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun workerShelving_add(usuario: String, password: String, shelvingFk: String): Call<Void> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(shelvingFk)
|
||||
return restClient!!.workerShelving_add(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun workerShelving_delete(usuario: String, password: String, vBarcode: String): Call<Void> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vBarcode)
|
||||
return restClient!!.workerShelving_delete(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
/* fun smartTag_nextLevel(usuario:String,password:String,vShelvingFk :String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
params.add(vShelvingFk)
|
||||
return restClient!!.smartTag_nextLevel("json","1",usuario,password,"application/json",params)
|
||||
}*/
|
||||
}
|
|
@ -6,14 +6,35 @@ import retrofit2.Call
|
|||
|
||||
class GetUbicadorUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun itemShelvingList(usuario:String,password:String,vShelvingFk:String) : Call<List<ItemUbicadorVO>> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun itemShelvingList(
|
||||
usuario: String,
|
||||
password: String,
|
||||
vShelvingFk: String
|
||||
): Call<List<ItemUbicadorVO>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(vShelvingFk)
|
||||
return restClient!!.itemShelvingList("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.itemShelvingList(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemShelvingMake(usuario:String,password:String,shelving:String,item:String,deep:String,quantity:String,packing:String,warehouse:String,level:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun itemShelvingMake(
|
||||
usuario: String,
|
||||
password: String,
|
||||
shelving: String,
|
||||
item: String,
|
||||
deep: String,
|
||||
quantity: String,
|
||||
packing: String,
|
||||
warehouse: String,
|
||||
level: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(shelving)
|
||||
params.add(item)
|
||||
params.add(deep)
|
||||
|
@ -21,11 +42,29 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) {
|
|||
params.add(packing)
|
||||
params.add(warehouse)
|
||||
params.add(level)
|
||||
return restClient!!.itemShelvingMake("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.itemShelvingMake(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemShelvingMakeEdit(usuario:String,password:String,shelving:String,item:String,deep:String,quantity:String,packing:String,warehouse:String,level:String,itemShelvingFk:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun itemShelvingMakeEdit(
|
||||
usuario: String,
|
||||
password: String,
|
||||
shelving: String,
|
||||
item: String,
|
||||
deep: String,
|
||||
quantity: String,
|
||||
packing: String,
|
||||
warehouse: String,
|
||||
level: String,
|
||||
itemShelvingFk: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(shelving)
|
||||
params.add(item)
|
||||
params.add(deep)
|
||||
|
@ -34,57 +73,134 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) {
|
|||
params.add(warehouse)
|
||||
params.add(level)
|
||||
params.add(itemShelvingFk)
|
||||
return restClient!!.itemShelvingMakeEdit("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.itemShelvingMakeEdit(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemShelvingMake_multi(usuario:String,password:String,shelving:String,items:List<String>,deep:String,warehouse:String,level:String) : Call<String> {
|
||||
val params:ArrayList<Any> = ArrayList();
|
||||
fun itemShelvingMake_multi(
|
||||
usuario: String,
|
||||
password: String,
|
||||
shelving: String,
|
||||
items: List<String>,
|
||||
deep: String,
|
||||
warehouse: String,
|
||||
level: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<Any> = ArrayList()
|
||||
params.add(shelving)
|
||||
params.add(items)
|
||||
params.add(deep)
|
||||
params.add(warehouse)
|
||||
params.add(level)
|
||||
return restClient!!.itemShelvingMake_multi("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.itemShelvingMake_multi(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun shelvingPriorityUpdate(usuario:String,password:String,priority:String,shelving:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun shelvingPriorityUpdate(
|
||||
usuario: String,
|
||||
password: String,
|
||||
priority: String,
|
||||
shelving: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(priority)
|
||||
params.add(shelving)
|
||||
return restClient!!.shelvingPriorityUpdate("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.shelvingPriorityUpdate(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun shelvingPark(usuario:String,password:String,shelving:String,parking:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun shelvingPark(
|
||||
usuario: String,
|
||||
password: String,
|
||||
shelving: String,
|
||||
parking: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(shelving)
|
||||
params.add(parking)
|
||||
return restClient!!.shelvingPark("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.shelvingPark("json", "1", usuario, password, "application/json", params)
|
||||
}
|
||||
|
||||
fun shelvingChange(usuario:String,password:String,origen:String,destino:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun shelvingChange(
|
||||
usuario: String,
|
||||
password: String,
|
||||
origen: String,
|
||||
destino: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(origen)
|
||||
params.add(destino)
|
||||
return restClient!!.shelvingChange("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.shelvingChange(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun clearShelvingList(usuario:String,password:String,shelvingFk:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun clearShelvingList(usuario: String, password: String, shelvingFk: String): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(shelvingFk)
|
||||
return restClient!!.clearShelvingList("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.clearShelvingList(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemShelvingTransfer(usuario:String,password:String,itemFk:String,shelvingFk:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun itemShelvingTransfer(
|
||||
usuario: String,
|
||||
password: String,
|
||||
itemFk: String,
|
||||
shelvingFk: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
params.add(shelvingFk)
|
||||
return restClient!!.itemShelvingTransfer("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.itemShelvingTransfer(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun itemShelvingDelete(usuario:String,password:String,itemFk:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
fun itemShelvingDelete(usuario: String, password: String, itemFk: String): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(itemFk)
|
||||
return restClient!!.itemShelvingDelete("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.itemShelvingDelete(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,32 +1,160 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoVO
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
|
||||
import retrofit2.Call
|
||||
|
||||
class GetVehicleControlTimeUserCase (context: Context) : RestClient(context) {
|
||||
class GetVehicleControlTimeUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun vehicleWarehouseTimeControl_insert(usuario:String,password:String,plateNumber:String,workerFk:String,direction:String) : Call<Boolean> {
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
fun machineWorker_add(
|
||||
usuario: String,
|
||||
password: String,
|
||||
plateNumber: String,
|
||||
workerFk: String
|
||||
): Call<Boolean> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(plateNumber)
|
||||
params.add(workerFk)
|
||||
params.add(direction)
|
||||
return restClient!!.vehicleWarehouseTimeControl_insert("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.machineWorker_add(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun machineWorker_update(
|
||||
usuario: String,
|
||||
password: String,
|
||||
plateNumber: String,
|
||||
workerFk: String
|
||||
): Call<Boolean> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(plateNumber)
|
||||
params.add(workerFk)
|
||||
return restClient!!.machineWorker_update(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun vehicleWarehouseTimeControl_checkRegister(usuario:String,password:String,userFk:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
fun machineWorker_Worker(usuario: String, password: String, userFk: String): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(userFk)
|
||||
return restClient!!.vehicleWarehouseTimeControl_checkRegister("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.machineWorker_Worker(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun vehicleWarehouseTimeControl_getHistorical(usuario:String,password:String,PlateNumber:String,nameWorker:String) : Call<List<ItemHistoricoVehiculo>> {
|
||||
val params:ArrayList<String> = ArrayList()
|
||||
fun workerMachinery_isRegistered(
|
||||
usuario: String,
|
||||
password: String,
|
||||
userFk: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(userFk)
|
||||
return restClient!!.workerMachinery_isRegistered(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun deviceProduction_getdeviceNameFromUser(
|
||||
usuario: String,
|
||||
password: String,
|
||||
userFk: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(userFk)
|
||||
return restClient!!.deviceProduction_getdeviceNameFromUser(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun machine_getWorkerPlate(usuario: String, password: String, userFk: String): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(userFk)
|
||||
return restClient!!.machine_getWorkerPlate(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun deviceProductionUser_getWorker(
|
||||
usuario: String,
|
||||
password: String,
|
||||
userFk: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(userFk)
|
||||
return restClient!!.deviceProductionUser_getWorker(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun deviceProduction_getnameDevice(
|
||||
usuario: String,
|
||||
password: String,
|
||||
userFk: String
|
||||
): Call<String> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(userFk)
|
||||
return restClient!!.deviceProduction_getnameDevice(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
fun machineWorker_getHistorical(
|
||||
usuario: String,
|
||||
password: String,
|
||||
PlateNumber: String,
|
||||
nameWorker: String
|
||||
): Call<List<ItemHistoricoVehiculo>> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(PlateNumber)
|
||||
params.add(nameWorker)
|
||||
return restClient!!.vehicleWarehouseTimeControl_getHistorical("json","1",usuario,password,"application/json",params)
|
||||
return restClient!!.machineWorker_getHistorical(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import retrofit2.Call
|
||||
import retrofit2.http.Header
|
||||
import retrofit2.http.POST
|
||||
import retrofit2.http.Path
|
||||
|
||||
interface NodeJsService {
|
||||
|
||||
/* @POST("/bindShelving")
|
||||
fun bindShelving(@Header("Content-Type") content_type: String,
|
||||
@Body params: SmartTagNode):
|
||||
Call<SmartTagNode>*/
|
||||
|
||||
//NODEJS TEST
|
||||
|
||||
// @FormUrlEncoded
|
||||
@POST("/bindShelving/{Id1}&{Id2}&{Id3}")
|
||||
fun bindShelving(
|
||||
@Header("Content-Type") content_type: String,
|
||||
@Path("Id1") id: String,
|
||||
@Path("Id2") id2: String,
|
||||
@Path("Id3") id3: String
|
||||
|
||||
):
|
||||
Call<SmartTagNode>
|
||||
|
||||
class SmartTagNode(
|
||||
var message: String = "",
|
||||
var smarttag: String = "",
|
||||
var wagon: String = "",
|
||||
var shelving: String = "",
|
||||
var isError: Boolean = false,
|
||||
var errorMessage: String = ""
|
||||
)
|
||||
|
||||
}
|
||||
|
|
@ -2,14 +2,15 @@ package es.verdnatura.domain
|
|||
|
||||
import android.content.Context
|
||||
|
||||
open class RestClient(context:Context) {
|
||||
var restClient:VerdnaturaService? = null
|
||||
var salixClient:SalixService? = null
|
||||
open class RestClient(context: Context) {
|
||||
var restClient: VerdnaturaService? = null
|
||||
var salixClient: SalixService? = null
|
||||
var nodejsClient: NodeJsService? = null
|
||||
|
||||
init {
|
||||
restClient = ApiUtils.getApiService(context)
|
||||
salixClient = ApiSalixUtils.getApiService()
|
||||
nodejsClient = ApiNodeJsUtils.getApiService()
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO
|
||||
import es.verdnatura.presentation.view.feature.login.model.SalixGrupo
|
||||
import es.verdnatura.presentation.view.feature.login.model.SalixMessageVO
|
||||
import retrofit2.Call
|
||||
import retrofit2.http.Body
|
||||
|
@ -20,4 +21,14 @@ interface SalixService {
|
|||
@Header("Authorization") authorization: String,
|
||||
@Body params: SalixMessageVO):
|
||||
Call<Boolean>
|
||||
|
||||
@POST("chats/send")
|
||||
fun sendGroup(
|
||||
@Header("Content-Type") content_type: String,
|
||||
@Header("Authorization") authorization: String,
|
||||
@Body params: SalixGrupo
|
||||
):
|
||||
Call<Boolean>
|
||||
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -23,9 +23,13 @@ import androidx.annotation.LayoutRes
|
|||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.databinding.ViewDataBinding
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.JsonObject
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.common.mediaCurrentVolume
|
||||
import es.verdnatura.presentation.common.mediaMaxVolume
|
||||
import org.json.JSONObject
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
@ -33,9 +37,10 @@ import kotlin.reflect.KClass
|
|||
|
||||
|
||||
abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelClass: KClass<V>) :
|
||||
Fragment(), TextToSpeech.OnInitListener , RecognitionListener{
|
||||
Fragment(), TextToSpeech.OnInitListener, RecognitionListener {
|
||||
|
||||
protected val TAG="VERDNATURA"
|
||||
protected val TAG = "VERDNATURA"
|
||||
protected val TD = "VERDNATURA:"
|
||||
protected val PREFS_USER = "es.verdnatura.user.prefs"
|
||||
protected val USERFK = "userFk"
|
||||
protected val USER = "user"
|
||||
|
@ -45,21 +50,24 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
protected val SECTORFK = "sectorFk"
|
||||
protected val WAREHOUSEFK = "warehouseFk"
|
||||
protected val RECORDAR = "recordar"
|
||||
protected val ANDROID_ID = "ANDROID_ID"
|
||||
protected val DEVICENAME = "devicename"
|
||||
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 BUYERID = "buyerid"
|
||||
protected val WAGON = "wagon"
|
||||
protected val TAGSTYPE = "tagstype"
|
||||
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
|
||||
private var mAudioManager: AudioManager? = null
|
||||
protected var mSpeechRecognizer: SpeechRecognizer? = null
|
||||
private var mSpeechRecognizerIntent: Intent? = null
|
||||
|
||||
|
@ -108,11 +116,11 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
|
||||
open fun setSpeak() {
|
||||
//VOZ
|
||||
textToSpeech = TextToSpeech(requireContext(),this)
|
||||
textToSpeech = TextToSpeech(requireContext(), this)
|
||||
mAudioManager = requireActivity().getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
||||
}
|
||||
|
||||
open fun restartapp(f : Fragment){
|
||||
open fun restartapp(f: Fragment) {
|
||||
val mStartActivity = Intent(context, f::class.java)
|
||||
val mPendingIntentId = 123456
|
||||
val mPendingIntent = PendingIntent.getActivity(
|
||||
|
@ -121,13 +129,13 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
mStartActivity,
|
||||
PendingIntent.FLAG_CANCEL_CURRENT
|
||||
)
|
||||
val mgr = context!!.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||
val mgr = requireContext().getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||
mgr[AlarmManager.RTC, System.currentTimeMillis() + 100] = mPendingIntent
|
||||
System.exit(0)
|
||||
}
|
||||
|
||||
|
||||
open fun initialize(){
|
||||
open fun initialize() {
|
||||
//ESCUCHA
|
||||
try {
|
||||
mSpeechRecognizer = SpeechRecognizer.createSpeechRecognizer(requireContext())
|
||||
|
@ -142,15 +150,15 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
)
|
||||
mSpeechRecognizerIntent!!.putExtra(RecognizerIntent.EXTRA_PREFER_OFFLINE, false)
|
||||
mSpeechRecognizer?.setRecognitionListener(this)
|
||||
isOnReadyForSpeech = false;
|
||||
isOnReadyForSpeech = false
|
||||
startListening()
|
||||
}catch (e:Exception){
|
||||
} catch (e: Exception) {
|
||||
cancelSpeech()
|
||||
}
|
||||
}
|
||||
|
||||
private fun initDataBinding() {
|
||||
binding = DataBindingUtil.bind<T>(view!!)!!
|
||||
binding = DataBindingUtil.bind<T>(requireView())!!
|
||||
binding.lifecycleOwner = viewLifecycleOwner
|
||||
binding.setVariable(BR.viewModel, this@BaseFragment.viewModel)
|
||||
lifecycle.addObserver(this@BaseFragment.viewModel)
|
||||
|
@ -162,11 +170,11 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
if (status == TextToSpeech.SUCCESS) {
|
||||
val spanish = Locale("es", "ES")
|
||||
textToSpeech!!.language = spanish
|
||||
textToSpeech!!.setOnUtteranceProgressListener(object: UtteranceProgressListener() {
|
||||
textToSpeech!!.setOnUtteranceProgressListener(object : UtteranceProgressListener() {
|
||||
override fun onDone(utteranceId: String?) {
|
||||
Log.i("SPEEAK","on done")
|
||||
Log.i("SPEEAK", "on done")
|
||||
requireActivity().runOnUiThread(Runnable {
|
||||
if (mSpeechRecognizer != null){
|
||||
if (mSpeechRecognizer != null) {
|
||||
mSpeechRecognizer!!.destroy()
|
||||
mSpeechRecognizer = null
|
||||
}
|
||||
|
@ -180,31 +188,31 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
}
|
||||
|
||||
override fun onStart(utteranceId: String?) {
|
||||
Log.i("SPEEAK","on start")
|
||||
Log.i("SPEEAK", "on start")
|
||||
runSound()
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}else{
|
||||
} else {
|
||||
"La voz no se ha podido iniciar".toast(requireContext())
|
||||
}
|
||||
}
|
||||
|
||||
private fun runSound(){
|
||||
private fun runSound() {
|
||||
// Get the maximum media/music volume
|
||||
val maxVolume = mAudioManager?.mediaMaxVolume
|
||||
// mAudioManager?.setMediaVolume(maxVolume!!)
|
||||
}
|
||||
|
||||
private fun muteSound() {
|
||||
if (mAudioManager?.mediaCurrentVolume != 0){
|
||||
if (mAudioManager?.mediaCurrentVolume != 0) {
|
||||
// mAudioManager?.setMediaVolume(0)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun speak(frase:String) {
|
||||
fun speak(frase: String) {
|
||||
textToSpeech!!.speak(frase, TextToSpeech.QUEUE_FLUSH, null, "frase")
|
||||
}
|
||||
|
||||
|
@ -217,7 +225,7 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
|
||||
|
||||
override fun onReadyForSpeech(params: Bundle?) {
|
||||
isOnReadyForSpeech = true;
|
||||
isOnReadyForSpeech = true
|
||||
Log.i("Speech", "onReadyForSpeech")
|
||||
}
|
||||
|
||||
|
@ -239,8 +247,8 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
if (!isOnReadyForSpeech && error == SpeechRecognizer.ERROR_NO_MATCH) {
|
||||
("Problemas con la velocidad de internet. No se puede usar la voz").toast(requireContext())
|
||||
return
|
||||
}else{
|
||||
Log.i("Speech", "onError "+error)
|
||||
} else {
|
||||
Log.i("Speech", "onError " + error)
|
||||
if (mSpeechRecognizer != null) mSpeechRecognizer!!.destroy()
|
||||
mSpeechRecognizer = null
|
||||
initialize()
|
||||
|
@ -339,7 +347,7 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
private fun requestRecordAudioPermission() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
val requiredPermission: String = Manifest.permission.RECORD_AUDIO
|
||||
val res = context!!.checkCallingOrSelfPermission(requiredPermission)
|
||||
val res = requireContext().checkCallingOrSelfPermission(requiredPermission)
|
||||
// If the user previously denied this permission then show a message explaining why
|
||||
// this permission is needed
|
||||
if (res == PackageManager.PERMISSION_DENIED) {
|
||||
|
@ -348,33 +356,86 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
}
|
||||
}
|
||||
|
||||
fun cancelSpeech(){
|
||||
if (mSpeechRecognizer != null){
|
||||
fun cancelSpeech() {
|
||||
if (mSpeechRecognizer != null) {
|
||||
mSpeechRecognizer!!.destroy()
|
||||
mSpeechRecognizer = null
|
||||
}
|
||||
}
|
||||
|
||||
fun saveBuyer(buyernickname: String) {
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER, 0)
|
||||
val prefs: SharedPreferences = requireActivity().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 prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
val editor = prefs.edit()
|
||||
editor.putString(BUYERID, buyerid)
|
||||
editor.apply()
|
||||
}
|
||||
|
||||
fun getIMEI() :String {
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||
val imei = prefs.getString("IMEI","0")
|
||||
fun getIMEI(): String {
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
val imei = prefs.getString("IMEI", "0")
|
||||
return imei.toString()
|
||||
}
|
||||
|
||||
fun getANDROIDID(): String {
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
val androidid = prefs.getString(ANDROID_ID, "0")
|
||||
return androidid.toString()
|
||||
}
|
||||
|
||||
/*open fun wordToNumber(input: String?): Int {
|
||||
fun getWagons(): Int {
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
val wagons = prefs.getInt(WAGON, 2)
|
||||
return wagons
|
||||
}
|
||||
|
||||
fun getTagsType(): String {
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
val tagstype = prefs.getString(TAGSTYPE, "Stickers")
|
||||
return tagstype.toString()
|
||||
}
|
||||
|
||||
fun getMessageFromJSON(json: String): String {
|
||||
val gson = Gson()
|
||||
var message = ""
|
||||
// val mapType = object : TypeToken<Map<String, Any>>() {}.type
|
||||
|
||||
var tutorialMap: Map<String, Any> =
|
||||
gson.fromJson(json, object : TypeToken<Map<String, Any>>() {}.type)
|
||||
tutorialMap.forEach {
|
||||
if (it.key.equals("Message")) {
|
||||
message = it.value.toString()
|
||||
}
|
||||
}
|
||||
return message
|
||||
}
|
||||
|
||||
fun getListFromJSON(json: String): List<String> {
|
||||
val gson = Gson()
|
||||
var list = mutableListOf<String>()
|
||||
|
||||
// val mapType = object : TypeToken<Map<String, Any>>() {}.type
|
||||
|
||||
var tutorialMap: Map<String, Any> =
|
||||
gson.fromJson(json, object : TypeToken<Map<String, Any>>() {}.type)
|
||||
tutorialMap.forEach {
|
||||
|
||||
list.add(it.key +":"+ it.value)
|
||||
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*open fun wordToNumber(input: String?): Int {
|
||||
var input = input
|
||||
var isValidInput = true
|
||||
var result = 0
|
||||
|
@ -461,6 +522,6 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
}
|
||||
}
|
||||
return finalResult
|
||||
}*/
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
package es.verdnatura.presentation.common
|
||||
|
||||
|
||||
|
||||
class ResponseItemVO (
|
||||
var response:String = "",
|
||||
var isError: Boolean = false,
|
||||
var errorMessage: String = ""
|
||||
)
|
||||
|
||||
class ResponseItemMachineControl (
|
||||
var response:String = "",
|
||||
var isError: Boolean = false,
|
||||
var errorMessage: String = "",
|
||||
var type: String
|
||||
)
|
|
@ -4,15 +4,18 @@ import android.graphics.drawable.Drawable
|
|||
import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO
|
||||
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.ItemProposal
|
||||
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
|
||||
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
|
||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionScanVO
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionStateRow
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
|
||||
import es.verdnatura.presentation.view.feature.smarttag.model.SmartTag
|
||||
import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO
|
||||
|
||||
interface OnOptionsSelectedListener {
|
||||
|
@ -23,6 +26,7 @@ interface OnPasillerosItemClickListener {
|
|||
fun onPasillerosItemClickListener(item: PasillerosItemVO,entryPoint:String)
|
||||
}
|
||||
|
||||
|
||||
interface OnAjustesItemClickListener {
|
||||
fun onAjustesItemClickListener(item: AjustesItemVO)
|
||||
}
|
||||
|
@ -31,11 +35,18 @@ interface OnAjustesItemClickListener {
|
|||
interface OnItemCardRowClickListener {
|
||||
fun onItemCardRowClickListener(item: ItemCardRowVO)
|
||||
}
|
||||
interface OnItemExpeditionStateRowClickListener {
|
||||
fun OnItemExpeditionStateRowClickListener(item: ItemExpeditionStateRow)
|
||||
}
|
||||
|
||||
interface OnBarcodeRowClickListener {
|
||||
fun onBarcodeRowClickListener(item: BarcodeVO)
|
||||
}
|
||||
|
||||
interface OnSmartTagRowClickListener {
|
||||
fun OnSmartTagRowClickListener(item: SmartTag)
|
||||
}
|
||||
|
||||
interface OnLocationRowClickListener {
|
||||
fun onLocationRowClickListener(item: ItemLocationVO)
|
||||
}
|
||||
|
@ -44,6 +55,10 @@ interface OnInvetoryNichoClickListener {
|
|||
fun onInvetoryNichoClickListener(item: ItemInventaryVO)
|
||||
}
|
||||
|
||||
interface OnItemProposalClickListener{
|
||||
fun onItemProposalClickListener(item: ItemProposal)
|
||||
}
|
||||
|
||||
interface OnFaltasNichoClickListener {
|
||||
fun onFaltasNichoClickListener(item: ItemFaltasVO)
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ fun Activity.hideKeyboard() {
|
|||
|
||||
fun Context.hideKeyboard(view: View) {
|
||||
val inputMethodManager = getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
val hideSoftInputFromWindow = inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0)
|
||||
inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0)
|
||||
}
|
||||
|
||||
// Extension function to change media volume programmatically
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
package es.verdnatura.presentation.view.feature.ajustes.fragment
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.content.Context.CLIPBOARD_SERVICE
|
||||
import android.content.SharedPreferences
|
||||
import android.os.Bundle
|
||||
import android.preference.PreferenceManager
|
||||
//import android.preference.PreferenceManager
|
||||
import androidx.preference.PreferenceManager
|
||||
import android.provider.Settings
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import androidx.lifecycle.Observer
|
||||
|
@ -19,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.main.activity.MainActivity
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.fragment_ajustes.*
|
||||
import kotlinx.android.synthetic.main.fragment_ajustes.splash_progress
|
||||
|
@ -27,6 +34,7 @@ import kotlinx.android.synthetic.main.fragment_login.*
|
|||
class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(AjustesViewModel::class) {
|
||||
|
||||
private var user:String? = ""
|
||||
private var userFk:String?=""
|
||||
private var password:String? = ""
|
||||
private lateinit var customDialog: CustomDialog
|
||||
private var sectorListVO:List<SectorItemVO> = listOf()
|
||||
|
@ -34,7 +42,8 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
|
|||
private var prefs: SharedPreferences? = null
|
||||
private var ajustesAdapter: AjustesAdapter? = null
|
||||
//añadido
|
||||
private var carroList:List<String> = listOf()
|
||||
private var wagonList:List<String> = listOf()
|
||||
private var tagsList:List<String> = listOf()
|
||||
|
||||
companion object {
|
||||
fun newInstance() = AjustesFragment()
|
||||
|
@ -42,21 +51,25 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
|
|||
override fun getLayoutId(): Int = R.layout.fragment_ajustes
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
prefs = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||
prefs = requireActivity().getSharedPreferences(PREFS_USER,0)
|
||||
customDialog = CustomDialog(requireContext())
|
||||
|
||||
//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())
|
||||
viewModel.inititializeDefaultAjusts(prefs!!.getString(SECTORDESCRIP,getString(R.string.Sinsector)).toString(),prefs!!.getInt(SECTORFK,0),prefs!!.getInt(WAREHOUSEFK,0),prefs!!.getString(VOZ,"NO").toString(),prefs!!.getInt(WAGON,2).toString(),prefs!!.getString(TAGSTYPE,"Amarillas").toString())
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
|
||||
override fun init() {
|
||||
activity!!.main_bottom_navigation.visibility = View.VISIBLE
|
||||
|
||||
requireActivity().main_bottom_navigation.visibility = View.VISIBLE
|
||||
user_text.setText(prefs!!.getString(USERFK,""))
|
||||
val versionName = activity!!.packageManager.getPackageInfo(activity!!.packageName,0).versionName
|
||||
val versionName = requireActivity().packageManager.getPackageInfo(requireActivity().packageName,0).versionName!!
|
||||
item_version.setText(versionName)
|
||||
user = prefs!!.getString(USER,"")
|
||||
userFk =prefs!!.getString(USERFK,"")
|
||||
password = prefs!!.getString(PASSWORD,"")
|
||||
androidid_text.setText(Settings.Secure.getString(context?.contentResolver, Settings.Secure.ANDROID_ID))
|
||||
|
||||
|
||||
txtserver.setText(this.getDefaults("base_url",this.requireContext()))
|
||||
|
@ -78,6 +91,13 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
|
|||
})
|
||||
|
||||
super.init()
|
||||
|
||||
setEvents()
|
||||
}
|
||||
|
||||
fun setEvents() {
|
||||
androidid_text.setOnClickListener { copyanddrag(androidid_text.text.toString()) }
|
||||
androidid_text.setOnLongClickListener { copyanddrag(androidid_text.text.toString()) }
|
||||
}
|
||||
|
||||
|
||||
|
@ -88,9 +108,9 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
|
|||
if (item.id == 0){
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
viewModel.getSectors(user!!,password!!)
|
||||
} else if (item.id == 1){
|
||||
activity!!.onBackPressed()
|
||||
}else if (item.id == 2){
|
||||
} else if (item.id == 5){
|
||||
requireActivity().onBackPressed()
|
||||
}else if (item.id == 1){
|
||||
// //////Log.i("VERDNATURA:","Carros pulsados")
|
||||
val listCarros : ArrayList<String> = ArrayList()
|
||||
listCarros.add("1")
|
||||
|
@ -99,7 +119,7 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
|
|||
listCarros.add("4")
|
||||
listCarros.add("5")
|
||||
listCarros.add("6")
|
||||
carroList = listCarros
|
||||
wagonList = listCarros
|
||||
|
||||
val array= arrayOfNulls<String>(listCarros.size)
|
||||
|
||||
|
@ -107,13 +127,24 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
|
|||
|
||||
// getString(R.string.Nodisponibleenestaversión).toast(requireContext())
|
||||
// getString(R.string.enbreveDisponible).toast(requireContext())
|
||||
}else if (item.id == 3){
|
||||
}else if (item.id == 2){
|
||||
val listVoz : ArrayList<String> = ArrayList()
|
||||
listVoz.add("NO")
|
||||
listVoz.add("YES")
|
||||
vozList = listVoz
|
||||
val array = arrayOfNulls<String>(listVoz.size)
|
||||
showDialogVoz(array = listVoz.toArray(array))
|
||||
|
||||
}else if (item.id == 3){
|
||||
val listTagsType : ArrayList<String> = ArrayList()
|
||||
listTagsType.add("Stickers")
|
||||
listTagsType.add("SmartTags")
|
||||
tagsList = listTagsType
|
||||
val array = arrayOfNulls<String>(listTagsType.size)
|
||||
showItemPickerType(array = listTagsType.toArray(array))
|
||||
}else if (item.id == 4){
|
||||
(activity as MainActivity).onPasillerosItemClickListener( PasillerosItemVO(title = "Control de usuario de vehículo"),userFk!!)
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -192,7 +223,7 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
|
|||
val editor = prefs!!.edit()
|
||||
editor.putString(VOZ,it)
|
||||
editor.apply()
|
||||
viewModel.ajustesitem.get(3).selected = it
|
||||
viewModel.ajustesitem.get(2).selected = it
|
||||
ajustesAdapter!!.notifyDataSetChanged()
|
||||
|
||||
return@forEach
|
||||
|
@ -215,13 +246,40 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
|
|||
builder.setTitle(getString(R.string.Seleccionauncarro))
|
||||
builder.setItems(array) { _, which ->
|
||||
val selected = array[which]
|
||||
carroList.forEach {
|
||||
wagonList.forEach {
|
||||
if (it.equals(selected)){
|
||||
val editor = prefs!!.edit()
|
||||
editor.putString(CARRO,it)
|
||||
editor.putInt(WAGON,it.toInt())
|
||||
editor.apply()
|
||||
|
||||
viewModel.ajustesitem.get(2).selected = it
|
||||
viewModel.ajustesitem.get(1).selected = it
|
||||
ajustesAdapter!!.notifyDataSetChanged()
|
||||
|
||||
return@forEach
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
val dialog = builder.create()
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
private fun showItemPickerType(array:Array<String>){
|
||||
val builder = AlertDialog.Builder(this.context)
|
||||
|
||||
|
||||
builder.setTitle(getString(R.string.typeTags))
|
||||
builder.setItems(array) { _, which ->
|
||||
val selected = array[which]
|
||||
tagsList.forEach {
|
||||
if (it.equals(selected)){
|
||||
val editor = prefs!!.edit()
|
||||
editor.putString(TAGSTYPE,it)
|
||||
editor.apply()
|
||||
|
||||
viewModel.ajustesitem.get(3).selected = it
|
||||
ajustesAdapter!!.notifyDataSetChanged()
|
||||
|
||||
return@forEach
|
||||
|
@ -250,4 +308,16 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
|
|||
}
|
||||
|
||||
|
||||
fun copyanddrag(string:String): Boolean {
|
||||
val clipboard = getActivity()?.getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
|
||||
val clip: ClipData = ClipData.newPlainText("Android_id", string)
|
||||
clipboard.setPrimaryClip(clip)
|
||||
//androidid_text.performLongClick()
|
||||
//Log.i(TD,"se copia $string")
|
||||
//getString(R.string.copied).toast(requireContext())
|
||||
//setTooltipText(androidid_text, getString(R.string.copied))
|
||||
return false
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import retrofit2.Response
|
|||
class AjustesViewModel(context: Context) : BaseViewModel() {
|
||||
|
||||
private val getAjustesUserCase:GetAjustesUserCase = GetAjustesUserCase(context)
|
||||
val version : String = "5.0.0";
|
||||
val version : String = "5.0.0"
|
||||
|
||||
private val _ajustesitem by lazy { ArrayList<AjustesItemVO>() }
|
||||
val ajustesitem: List<AjustesItemVO>
|
||||
|
@ -35,7 +35,7 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
|||
|
||||
|
||||
|
||||
fun inititializeDefaultAjusts(sectorDescrip: String,sectorFk : Int, warehouseFk : Int,vozDescrip:String,carroDescrip:String) {
|
||||
fun inititializeDefaultAjusts(sectorDescrip: String,sectorFk : Int, warehouseFk : Int,vozDescrip:String,carroDescrip:String,TypeTags:String) {
|
||||
_ajustesitem.add(
|
||||
AjustesItemVO(0,
|
||||
"Sector",
|
||||
|
@ -44,27 +44,42 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
|||
warehouseFk)
|
||||
)
|
||||
|
||||
|
||||
_ajustesitem.add(
|
||||
AjustesItemVO(1,
|
||||
"Cerrar Sesión",
|
||||
"",
|
||||
0,
|
||||
0)
|
||||
)
|
||||
_ajustesitem.add(
|
||||
AjustesItemVO(2,
|
||||
"Carros",
|
||||
carroDescrip,
|
||||
0,
|
||||
0)
|
||||
)
|
||||
_ajustesitem.add(
|
||||
AjustesItemVO(3,
|
||||
AjustesItemVO(2,
|
||||
"Voz",
|
||||
vozDescrip,
|
||||
0,
|
||||
0)
|
||||
)
|
||||
_ajustesitem.add(
|
||||
AjustesItemVO(3,
|
||||
"Tipo etiqueta",
|
||||
TypeTags,
|
||||
0,
|
||||
0)
|
||||
)
|
||||
_ajustesitem.add(
|
||||
AjustesItemVO(4,
|
||||
"Control de vehículos",
|
||||
"",
|
||||
0,
|
||||
0)
|
||||
)
|
||||
_ajustesitem.add(
|
||||
AjustesItemVO(5,
|
||||
"Cerrar Sesión",
|
||||
"",
|
||||
0,
|
||||
0)
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
package es.verdnatura.presentation.view.feature.articulo.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import es.verdnatura.databinding.ItemProposalRowBinding
|
||||
import es.verdnatura.presentation.common.OnItemProposalClickListener
|
||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemProposal
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
|
||||
class ItemProposalAdapter(
|
||||
private val items: List<ItemProposal>,
|
||||
// private val onInvetoryNichoClickListener: OnInvetoryNichoClickListener,//
|
||||
private val onItemProposalClickListener: OnItemProposalClickListener,
|
||||
private val onPasillerosItemClickListener: OnPasillerosItemClickListener
|
||||
) : RecyclerView.Adapter<ItemProposalAdapter.ItemHolder>() {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
|
||||
return ItemHolder(
|
||||
ItemProposalRowBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
)
|
||||
}
|
||||
|
||||
override fun getItemCount() = items.size
|
||||
|
||||
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
|
||||
holder.bind(items[position])
|
||||
}
|
||||
|
||||
inner class ItemHolder(
|
||||
val binding: ItemProposalRowBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
private val res = binding.root.context.resources
|
||||
fun bind(item: ItemProposal) {
|
||||
binding.apply {
|
||||
this.item = item
|
||||
if (item.longName.isNullOrEmpty()) {
|
||||
itemProducer.visibility = View.GONE
|
||||
} else {
|
||||
itemProducer.visibility = View.VISIBLE
|
||||
}
|
||||
/* itemNicho.setOnClickListener {
|
||||
onInvetoryNichoClickListener.onInvetoryNichoClickListener(item)
|
||||
}*/
|
||||
itemNicho.setOnClickListener {
|
||||
onItemProposalClickListener.onItemProposalClickListener(item)
|
||||
}
|
||||
itemFk.setOnClickListener {
|
||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = "Consultar artículo"
|
||||
), item.itemFk
|
||||
)
|
||||
}
|
||||
itemUp.setOnClickListener {
|
||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = "Buscar item"
|
||||
), item.itemFk
|
||||
)
|
||||
}
|
||||
itemDown.setOnClickListener {
|
||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = "Buscar item"
|
||||
), item.itemFk
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,7 +6,6 @@ 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
|
||||
|
@ -34,7 +33,6 @@ 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.*
|
||||
|
@ -42,6 +40,7 @@ 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.*
|
||||
import timber.log.Timber
|
||||
|
||||
class ItemCardFragment(
|
||||
var itemFk:String = ""
|
||||
|
@ -79,7 +78,7 @@ class ItemCardFragment(
|
|||
|
||||
override fun init() {
|
||||
itemcard_layout.visibility = View.GONE
|
||||
activity!!.main_bottom_navigation.visibility = View.GONE
|
||||
requireActivity().main_bottom_navigation.visibility = View.GONE
|
||||
setEvents()
|
||||
toolbar_title.text = getString(R.string.ConsultarArticulo)
|
||||
customDialog = CustomDialog(requireContext())
|
||||
|
@ -91,6 +90,9 @@ class ItemCardFragment(
|
|||
}
|
||||
setToolBar()
|
||||
super.init()
|
||||
|
||||
Timber.i("test")
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,7 +111,7 @@ class ItemCardFragment(
|
|||
}
|
||||
if (item == iconHistory){
|
||||
if (itemFk.isNullOrEmpty()){
|
||||
"Escanea un item".toast(activity!!)
|
||||
"Escanea un item".toast(requireActivity())
|
||||
}else{
|
||||
// //Log.i("VERDNATURA:","el item es ${itemInfoG!!.id}")
|
||||
//(activity as MainActivity).onPasillerosItemClickListener( PasillerosItemVO(title = "Historico"),itemFk)
|
||||
|
@ -139,7 +141,7 @@ class ItemCardFragment(
|
|||
|
||||
|
||||
backButton.setOnClickListener {
|
||||
activity!!.onBackPressed()
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
|
||||
itemcard_image.setOnClickListener {
|
||||
|
@ -151,7 +153,7 @@ class ItemCardFragment(
|
|||
}
|
||||
|
||||
private fun getItemCard(itemFk:String){
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
|
||||
user = prefs.getString(USER,"").toString()
|
||||
password = prefs.getString(PASSWORD,"").toString()
|
||||
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
|
||||
|
@ -211,8 +213,8 @@ class ItemCardFragment(
|
|||
list.forEach { item ->
|
||||
if (!item.isError){
|
||||
try {
|
||||
itemsPackingType.add(ItemPackingType(item.code,item.description));
|
||||
// //Log.i("VERDNATURA:","Nombre encajado ${item.code} : ${item.description}")
|
||||
itemsPackingType.add(ItemPackingType(item.code,item.description))
|
||||
|
||||
}catch (e:Exception){}
|
||||
}
|
||||
}}
|
||||
|
@ -235,9 +237,11 @@ class ItemCardFragment(
|
|||
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))
|
||||
listItemsRow.add(ItemCardRowVO(title = getString(R.string.SINUBICAR),value = itemInfo.enNicho,isEditable = false, action = "itemStockUpdate"))
|
||||
|
||||
//EDITABLES
|
||||
listItemsRow.add(ItemCardRowVO(title = getString(R.string.SINUBICAR),value = itemInfo.enNicho,isEditable = false, action = "itemStockUpdate"))
|
||||
|
||||
listItemsRow.add(ItemCardRowVO(title = "Artículos similares",isEditable = true, action = "itemProposal"))
|
||||
listItemsRow.add(ItemCardRowVO(title = getString(R.string.DARALTA),value = "",isEditable = true, action = "itemStockUpdateAdd"))
|
||||
listItemsRow.add(ItemCardRowVO(title = getString(R.string.DARBAJA),value = "",isEditable = true, action = "itemStockUpdateRemove"))
|
||||
listItemsRow.add(ItemCardRowVO(title = getString(R.string.BUSCARITEM),value = "",isEditable = true, action = "buscarItem"))
|
||||
|
@ -249,29 +253,47 @@ class ItemCardFragment(
|
|||
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"))
|
||||
// listItemsRow.add(ItemCardRowVO(title = "Artículos similares",value = itemInfo.itemPackingTypeFk,isEditable = true, action = "itemProposal"))
|
||||
|
||||
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"){
|
||||
if (item.action == "itemProposal"){
|
||||
|
||||
(activity as MainActivity).onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = "Buscar artículos similares"
|
||||
), itemFk
|
||||
)
|
||||
|
||||
//viewModel.getItemProposal("30244","3280137","TRUE",user=user,password=password)
|
||||
|
||||
// Log.i("VERDNATURA::", "ME HAS PULSADO")
|
||||
}
|
||||
else{
|
||||
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())
|
||||
editItemCardRow(item,customDialogInput.getValue())
|
||||
editItemCardRow(item, customDialogInput.getValue())
|
||||
customDialogInput.dismiss()
|
||||
|
||||
}.setKoButton("Cancelar"){
|
||||
}.setKoButton("Cancelar") {
|
||||
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
|
||||
customDialogInput.dismiss()
|
||||
}.setValue("").show()
|
||||
customDialogInput.getEditText().requestFocus()
|
||||
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
|
||||
customDialogInput.getEditText()
|
||||
.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
if (!customDialogInput.getValue().isNullOrEmpty())
|
||||
editItemCardRow(item,customDialogInput.getValue())
|
||||
editItemCardRow(item, customDialogInput.getValue())
|
||||
customDialogInput.setValue("")
|
||||
customDialogInput.dismiss()
|
||||
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
|
||||
|
@ -279,26 +301,33 @@ class ItemCardFragment(
|
|||
}
|
||||
false
|
||||
}
|
||||
}else if(item.action == "toBarcode"){
|
||||
} else if (item.action == "toBarcode") {
|
||||
//BARCODE ROW
|
||||
prepareBarcodeDialog(item)
|
||||
}else if(item.action == "buscarItem"){
|
||||
(activity as MainActivity).onPasillerosItemClickListener( PasillerosItemVO(title = "Buscar item"),itemFk)
|
||||
}else if(item.action == "itemStockUpdateAdd"){
|
||||
customDialogInput.setTitle(item.title!!).setDescription("Indica la cantidad a dar de alta").setOkButton("Guardar"){
|
||||
} else if (item.action == "buscarItem") {
|
||||
(activity as MainActivity).onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = "Buscar item"
|
||||
), itemFk
|
||||
)
|
||||
} else if (item.action == "itemStockUpdateAdd") {
|
||||
customDialogInput.setTitle(item.title!!)
|
||||
.setDescription("Indica la cantidad a dar de alta")
|
||||
.setOkButton("Guardar") {
|
||||
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
|
||||
editItemCardRow(item,customDialogInput.getValue())
|
||||
editItemCardRow(item, customDialogInput.getValue())
|
||||
customDialogInput.dismiss()
|
||||
|
||||
}.setKoButton("Cancelar"){
|
||||
}.setKoButton("Cancelar") {
|
||||
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
|
||||
customDialogInput.dismiss()
|
||||
}.setValue("").show()
|
||||
customDialogInput.getEditText().requestFocus()
|
||||
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
|
||||
customDialogInput.getEditText()
|
||||
.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
if (!customDialogInput.getValue().isNullOrEmpty())
|
||||
editItemCardRow(item,customDialogInput.getValue())
|
||||
editItemCardRow(item, customDialogInput.getValue())
|
||||
customDialogInput.setValue("")
|
||||
customDialogInput.dismiss()
|
||||
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
|
||||
|
@ -306,30 +335,34 @@ class ItemCardFragment(
|
|||
}
|
||||
false
|
||||
}
|
||||
}else if(item.action == "itemStockUpdateRemove"){
|
||||
customDialogInput.setTitle(item.title!!).setDescription("Indica la cantidad a dar de baja ").setOkButton("Guardar"){
|
||||
} else if (item.action == "itemStockUpdateRemove") {
|
||||
customDialogInput.setTitle(item.title!!)
|
||||
.setDescription("Indica la cantidad a dar de baja ")
|
||||
.setOkButton("Guardar") {
|
||||
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
|
||||
editItemCardRow(item,customDialogInput.getValue())
|
||||
editItemCardRow(item, customDialogInput.getValue())
|
||||
customDialogInput.dismiss()
|
||||
|
||||
}.setKoButton("Cancelar"){
|
||||
}.setKoButton("Cancelar") {
|
||||
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
|
||||
customDialogInput.dismiss()
|
||||
}.setValue("").show()
|
||||
customDialogInput.getEditText().requestFocus()
|
||||
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
|
||||
customDialogInput.getEditText()
|
||||
.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
if (!customDialogInput.getValue().isNullOrEmpty())
|
||||
editItemCardRow(item,customDialogInput.getValue())
|
||||
editItemCardRow(item, customDialogInput.getValue())
|
||||
customDialogInput.setValue("")
|
||||
customDialogInput.dismiss()
|
||||
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
itemcard_recyclerview.adapter = adapter
|
||||
|
@ -348,7 +381,8 @@ class ItemCardFragment(
|
|||
private fun editItemCardRow(item:ItemCardRowVO,value:String){
|
||||
|
||||
when (item.action){
|
||||
"itemStockUpdate" -> prepareItemStockUpdate(item,value)
|
||||
// cau:sergio itemTrash x itemStock Update . No se utiliza esta funicón
|
||||
// "itemStockUpdate" -> prepareItemStockUpdate(item,value)
|
||||
"itemStockUpdateAdd" -> prepareItemStockUpdate2(item,value)
|
||||
"itemStockUpdateRemove" -> prepareItemStockUpdate2(item,value)
|
||||
"itemPlacementSave" -> viewModel.itemPlacementSave(itemFk = itemFk, warehouseFk = warehouseFk, user = user, password = password, value = value)
|
||||
|
@ -377,7 +411,9 @@ class ItemCardFragment(
|
|||
adapter?.notifyDataSetChanged()*/
|
||||
}
|
||||
|
||||
private fun prepareItemStockUpdate(itemB:ItemCardRowVO,value:String){
|
||||
/* private fun prepareItemStockUpdate(itemB:ItemCardRowVO,value:String){
|
||||
|
||||
//sergio: cau: no se llama a esta función itemTrash itemStockUpdate
|
||||
try{
|
||||
|
||||
if (itemB.value!!.toInt() > value.toInt()) {
|
||||
|
@ -406,7 +442,7 @@ class ItemCardFragment(
|
|||
}.show()
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
private fun prepareItemStockUpdate2(itemB:ItemCardRowVO,value:String){
|
||||
try{
|
||||
|
@ -503,7 +539,7 @@ class ItemCardFragment(
|
|||
builder.setTitle(getString(R.string.mensajeseleccionencajado))
|
||||
.setItems(array
|
||||
) { dialog, position ->
|
||||
updateItemPackingType(itemsPackingType[position].code.toString());
|
||||
updateItemPackingType(itemsPackingType[position].code.toString())
|
||||
}
|
||||
|
||||
builder.create().show()
|
||||
|
|
|
@ -8,19 +8,16 @@ 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 es.verdnatura.presentation.view.feature.articulo.model.*
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
class ItemCardViewModel(context: Context) : BaseViewModel() {
|
||||
private val getItemCardUserCase:GetItemCardUserCase = GetItemCardUserCase(context)
|
||||
val version : String = "5.0.0";
|
||||
val version : String = "5.0.0"
|
||||
|
||||
private val _itemcard by lazy { MutableLiveData<ItemCardVO>() }
|
||||
val itemcard: LiveData<ItemCardVO>
|
||||
|
@ -35,6 +32,13 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
|
|||
get() = _itemspackinglist
|
||||
|
||||
|
||||
private val _itemProposallist by lazy { MutableLiveData<ItemProposalList>() }
|
||||
val itemProposallist: LiveData<ItemProposalList>
|
||||
get() = _itemProposallist
|
||||
|
||||
|
||||
|
||||
|
||||
fun getItemCard(itemFk:String,warehouseFk:String,user:String,password:String) {
|
||||
getItemCardUserCase.getItemCard(user,password,itemFk,warehouseFk).enqueue(object :Callback<ItemCardVO>{
|
||||
override fun onFailure(call: Call<ItemCardVO>, t: Throwable) {
|
||||
|
@ -52,6 +56,31 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
|
|||
})
|
||||
}
|
||||
|
||||
fun item_getSimilar(itemFk:String, warehouseFk: String, vShipped: String, vIsShowedByType:String, user:String, password:String) {
|
||||
getItemCardUserCase.item_getSimilar(user,password,itemFk,warehouseFk,vShipped,vIsShowedByType).enqueue(object :Callback<List<ItemProposal>>{
|
||||
override fun onFailure(call: Call<List<ItemProposal>>, t: Throwable) {
|
||||
val listError:ArrayList<ItemProposal> = ArrayList()
|
||||
listError.add(ItemProposal(isError = true,errorMessage = t.message!!))
|
||||
_itemProposallist.value = ItemProposalList(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<List<ItemProposal>>, response: Response<List<ItemProposal>>) {
|
||||
if (response.body() != null){
|
||||
_itemProposallist.value = response.body()?.let { ItemProposalList(it)
|
||||
}
|
||||
|
||||
}else{
|
||||
val listError:ArrayList<ItemProposal> = ArrayList()
|
||||
listError.add(ItemProposal(isError = true,errorMessage = "Error en la llamada de getItemPackingType"))
|
||||
_itemProposallist.value = ItemProposalList(listError)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
fun getItemPackingType(user:String,password:String) {
|
||||
getItemCardUserCase.getItemPackingType(user,password).enqueue(object :
|
||||
Callback<List<ItemPackingType>>{
|
||||
|
|
|
@ -0,0 +1,268 @@
|
|||
package es.verdnatura.presentation.view.feature.articulo.fragment
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.widget.TooltipCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.res.ResourcesCompat.getColor
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentInventaryBinding
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.OnItemProposalClickListener
|
||||
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.articulo.adapter.ItemProposalAdapter
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemProposal
|
||||
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
|
||||
import es.verdnatura.presentation.view.feature.inventario.fragment.SearchBuyerModel
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.fragment_buscar_item.*
|
||||
import kotlinx.android.synthetic.main.toolbar.*
|
||||
import java.text.SimpleDateFormat
|
||||
import java.time.LocalDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
class ItemProposalFragment(
|
||||
var itemFk: String = ""
|
||||
) : BaseFragment<FragmentInventaryBinding, ItemCardViewModel>(
|
||||
ItemCardViewModel::class
|
||||
) {
|
||||
|
||||
private var user = ""
|
||||
private var password = ""
|
||||
private var sectorFk = ""
|
||||
private var warehouseFk = ""
|
||||
private var adapter: ItemProposalAdapter? = null
|
||||
private lateinit var customDialogInput: CustomDialogInput
|
||||
private var listInvetory: ArrayList<ItemProposal> = ArrayList()
|
||||
private var listInvetoryAux: ArrayList<ItemProposal> = ArrayList()
|
||||
private lateinit var customDialog: CustomDialog
|
||||
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
||||
private var reload = false
|
||||
private var hideLoad = true
|
||||
private var layoutManager: LinearLayoutManager? = null
|
||||
private var firstVisiblePosition = 0
|
||||
private var filter = "TRUE"
|
||||
private var prefs: SharedPreferences? = null
|
||||
|
||||
companion object {
|
||||
fun newInstance(entryPoint: String) = ItemProposalFragment(entryPoint)
|
||||
}
|
||||
|
||||
//override fun getLayoutId(): Int = R.layout.fragment_inventary
|
||||
override fun getLayoutId(): Int = R.layout.fragment_itemproposal
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
if (context is OnPasillerosItemClickListener) pasillerosItemClickListener = context
|
||||
super.onAttach(context)
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
prefs = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
user = prefs!!.getString(USER, "").toString()
|
||||
password = prefs!!.getString(PASSWORD, "").toString()
|
||||
warehouseFk = prefs!!.getInt(WAREHOUSEFK, 60).toString()
|
||||
|
||||
viewModel.item_getSimilar(
|
||||
itemFk,
|
||||
warehouseFk,
|
||||
vShipped = currentDay(),
|
||||
vIsShowedByType = "TRUE",
|
||||
user = user,
|
||||
password = password
|
||||
)
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
private fun currentDay(): String {
|
||||
|
||||
val calendar = Calendar.getInstance()
|
||||
val format = SimpleDateFormat("yyyy-MM-dd")
|
||||
System.out.println(format.format(calendar.time))
|
||||
|
||||
/* val current = LocalDateTime.now()
|
||||
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd")
|
||||
val currentDay = current.format(formatter)*/
|
||||
|
||||
|
||||
return format.format(calendar.time)
|
||||
}
|
||||
|
||||
override fun init() {
|
||||
|
||||
customDialogInput = CustomDialogInput(requireContext())
|
||||
customDialog = CustomDialog(requireContext())
|
||||
requireActivity().main_bottom_navigation.visibility = View.GONE
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
toolbar_title.text = getString(R.string.ArticleSimilar) + ":" + itemFk
|
||||
setToolBar()
|
||||
setEvents()
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
private fun setToolBar() {
|
||||
val listIcons: ArrayList<Drawable> = ArrayList()
|
||||
val iconReload: Drawable =
|
||||
resources.getDrawable(R.drawable.ic_autorenew_black_24dp, resources.newTheme())
|
||||
val iconFilter: Drawable =
|
||||
resources.getDrawable(R.drawable.filter_outline, resources.newTheme())
|
||||
/* listIcons.add(iconReload)*/
|
||||
listIcons.add(iconFilter)
|
||||
|
||||
|
||||
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.item_getSimilar(
|
||||
itemFk,
|
||||
warehouseFk,
|
||||
vIsShowedByType = filter,
|
||||
vShipped = currentDay(),
|
||||
user = user,
|
||||
password = password
|
||||
)
|
||||
|
||||
}
|
||||
if (item == iconFilter) {
|
||||
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
firstVisiblePosition = layoutManager?.findFirstVisibleItemPosition() ?: 0
|
||||
|
||||
|
||||
if (filter.equals("TRUE")) {
|
||||
showMessage("Sin Filtrar por tipo de flor")
|
||||
filter = "FALSE"
|
||||
iconFilter.setTint(
|
||||
ContextCompat.getColor(
|
||||
context!!,
|
||||
R.color.verdnatura_white
|
||||
)
|
||||
)
|
||||
|
||||
} else {
|
||||
filter = "TRUE"
|
||||
showMessage("Filtrado por tipo de flor")
|
||||
iconFilter.setTint(
|
||||
ContextCompat.getColor(
|
||||
context!!,
|
||||
R.color.verdnatura_pumpkin_orange
|
||||
)
|
||||
)
|
||||
}
|
||||
viewModel.item_getSimilar(
|
||||
itemFk,
|
||||
warehouseFk,
|
||||
vIsShowedByType = filter,
|
||||
vShipped = currentDay(),
|
||||
user = user,
|
||||
password = password
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
toolbar_icons.layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||
|
||||
}
|
||||
|
||||
private fun showMessage(message:String){
|
||||
val mytoast = Toast.makeText(
|
||||
requireContext(),
|
||||
message,
|
||||
Toast.LENGTH_SHORT
|
||||
)
|
||||
mytoast.setGravity(Gravity.TOP or Gravity.RIGHT, 0, -100)
|
||||
mytoast.show()
|
||||
}
|
||||
private fun setEvents() {
|
||||
backButton.setOnClickListener {
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
firstVisiblePosition = layoutManager?.findFirstVisibleItemPosition() ?: 0
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (location_recyclerview.layoutManager != null) {
|
||||
if (firstVisiblePosition <= listInvetory.size) {
|
||||
location_recyclerview.layoutManager!!.scrollToPosition(firstVisiblePosition)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun observeViewModel() {
|
||||
with(viewModel) {
|
||||
|
||||
itemProposallist.observe(viewLifecycleOwner, Observer {
|
||||
if (hideLoad) {
|
||||
splash_progress.visibility = View.GONE
|
||||
} else {
|
||||
hideLoad = true
|
||||
}
|
||||
|
||||
listInvetory = ArrayList()
|
||||
listInvetoryAux = ArrayList()
|
||||
it.list.forEach {
|
||||
if (it.longName != "0") {
|
||||
listInvetory.add(it)
|
||||
listInvetoryAux.add(it)
|
||||
}
|
||||
}
|
||||
|
||||
adapter = ItemProposalAdapter(listInvetory, object : OnItemProposalClickListener {
|
||||
override fun onItemProposalClickListener(item: ItemProposal) {
|
||||
|
||||
customDialog.setTitle(item.itemFk + "\n" + item.longName + " " + item.subName)
|
||||
.setDescription("Cantidad real(" + item.available + ")")
|
||||
.setOkButton("Prueba") {
|
||||
|
||||
customDialog.dismiss()
|
||||
}.setKoButton("Cancelar") {
|
||||
// customDialogInput.dismiss()
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
|
||||
}
|
||||
}, onPasillerosItemClickListener = pasillerosItemClickListener!!)
|
||||
|
||||
location_recyclerview.adapter = adapter
|
||||
layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
location_recyclerview.layoutManager = layoutManager
|
||||
|
||||
if (firstVisiblePosition <= listInvetory.size) {
|
||||
location_recyclerview.layoutManager!!.scrollToPosition(firstVisiblePosition)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package es.verdnatura.presentation.view.feature.articulo.model
|
||||
|
||||
class ItemProposal(
|
||||
|
||||
var itemFk: String ="",
|
||||
var longName: String="",
|
||||
var subName: String="",
|
||||
var tag5: String = "",
|
||||
var value5: String="",
|
||||
var match5: String="",
|
||||
var tag6: String="",
|
||||
var value6: String="",
|
||||
var match6: String="",
|
||||
var tag7: String="",
|
||||
var value7: String="",
|
||||
var match7: String="",
|
||||
var tag8: String="",
|
||||
var value8: String="",
|
||||
var match8: String="",
|
||||
var available: String="",
|
||||
var counter: String="",
|
||||
var minQuantity: String="",
|
||||
|
||||
var isError: Boolean = false,
|
||||
var errorMessage: String = ""
|
||||
|
||||
)
|
||||
|
||||
class ItemProposalList(
|
||||
var list: List<ItemProposal> = listOf()
|
||||
)
|
|
@ -0,0 +1,142 @@
|
|||
package es.verdnatura.presentation.view.feature.buffer.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
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentBufferBinding
|
||||
import es.verdnatura.domain.ConstAndValues
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.OnCollectionSelectedListener
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import kotlinx.android.synthetic.main.fragment_controlador.*
|
||||
import kotlinx.android.synthetic.main.toolbar.*
|
||||
|
||||
class BufferFragment(
|
||||
var entryPoint: String = ""
|
||||
) : BaseFragment<FragmentBufferBinding, BufferFragmentViewModel>(BufferFragmentViewModel::class) {
|
||||
|
||||
|
||||
private var user = ""
|
||||
private var password = ""
|
||||
private var sectorFk = ""
|
||||
private var warehouseFk = ""
|
||||
private var goBack: Boolean = false
|
||||
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
|
||||
override fun getLayoutId(): Int = R.layout.fragment_buffer
|
||||
private lateinit var customDialog: CustomDialog
|
||||
private var type = ""
|
||||
|
||||
companion object {
|
||||
fun newInstance(entryPoint: String) = BufferFragment(entryPoint)
|
||||
}
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
super.onAttach(context)
|
||||
if (context is OnCollectionSelectedListener) onCollectionSelectedListener = context
|
||||
}
|
||||
|
||||
|
||||
override fun init() {
|
||||
|
||||
|
||||
// Log.i("VERDNATURA:", "entrypoint es : ${entryPoint}")
|
||||
|
||||
splash_progress.visibility = View.GONE
|
||||
customDialog = CustomDialog(requireContext())
|
||||
//toolbar_title.text = getString(R.string.verticket)
|
||||
setToolbar()
|
||||
setEvents()
|
||||
super.init()
|
||||
}
|
||||
|
||||
private fun setToolbar() {
|
||||
|
||||
toolbar_title.text = entryPoint
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
goBack = true
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val prefs: SharedPreferences = requireActivity().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()
|
||||
type = ConstAndValues.PRECHECKER
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
private fun setEvents() {
|
||||
|
||||
backButton.setOnClickListener {
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
|
||||
scan_input.requestFocus()
|
||||
scan_input.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
goBack = false
|
||||
if (!scan_input.text.isNullOrEmpty()) {
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
|
||||
if (entryPoint.equals("Vaciado buffer")){
|
||||
viewModel.buffer_setTypeByName(user,password,scan_input.text.toString(),"UNLOADING")
|
||||
}
|
||||
if (entryPoint.equals("Llenado buffer")){
|
||||
viewModel.buffer_setTypeByName(user,password,scan_input.text.toString(),"LOADING")
|
||||
}
|
||||
if (entryPoint.equals("Acumulación buffer")){
|
||||
viewModel.buffer_setTypeByName(user,password,scan_input.text.toString(),"ACCUMULATION")
|
||||
}
|
||||
if (entryPoint.equals("Desactivado buffer")){
|
||||
viewModel.buffer_setTypeByName(user,password,scan_input.text.toString(),"DISABLED")
|
||||
}
|
||||
|
||||
}
|
||||
scan_input.setText("")
|
||||
(activity as MainActivity).hideKeyboard(scan_input)
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
override fun observeViewModel() {
|
||||
|
||||
with(viewModel) {
|
||||
itembuffertype.observe(viewLifecycleOwner, Observer {
|
||||
splash_progress.visibility = View.GONE
|
||||
if (it.isError) {
|
||||
customDialog.setTitle("Error").setDescription(it.errorMessage)
|
||||
.setOkButton("Aceptar") {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
} else {
|
||||
// customDialog.setTitle("Mensaje").setDescription(it.errorMessage)
|
||||
|
||||
customDialog.setTitle("Mensaje").setDescription("Operación "+entryPoint.toLowerCase() + " realizada correctamente")
|
||||
.setOkButton("Aceptar") {
|
||||
customDialog.dismiss()
|
||||
backButton.performClick()
|
||||
}.show()
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package es.verdnatura.presentation.view.feature.buffer.fragment
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.GetPaletizadoresUserCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class BufferFragmentViewModel(context: Context) : BaseViewModel() {
|
||||
private val GetPaletizadoresUserCase: GetPaletizadoresUserCase =
|
||||
GetPaletizadoresUserCase(context)
|
||||
|
||||
|
||||
private val _itembuffertype by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val itembuffertype: LiveData<ResponseItemVO>
|
||||
get() = _itembuffertype
|
||||
|
||||
|
||||
private val _bufferresponse by lazy { MutableLiveData<Boolean>() }
|
||||
val bufferresponse: LiveData<Boolean>
|
||||
get() = _bufferresponse
|
||||
|
||||
|
||||
fun buffer_setTypeByName(user: String, password: String, vBufferFk: String, vType: String) {
|
||||
GetPaletizadoresUserCase.buffer_setTypeByName(user, password, vBufferFk, vType)
|
||||
.enqueue(object : Callback<Boolean> {
|
||||
override fun onFailure(call: Call<Boolean>, t: Throwable) {
|
||||
|
||||
|
||||
_itembuffertype.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = "Error al realizar operación con buffer.Respuesta:" + t.message!!
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Boolean>, response: Response<Boolean>) {
|
||||
// Log.i("VERDNATURA:", "la respuesta es ${response.body()!!}")
|
||||
|
||||
if (response.body() != null && response.body() == true) {
|
||||
// _bufferresponse.value = response.body()!!
|
||||
_itembuffertype.value = ResponseItemVO(
|
||||
isError = false,
|
||||
errorMessage = ""
|
||||
)
|
||||
|
||||
} else {
|
||||
//_bufferresponse.value = false
|
||||
_itembuffertype.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = "Error al realizar operación con buffer."
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ class BuscarItemFragment(
|
|||
override fun getLayoutId(): Int = R.layout.fragment_buscar_item
|
||||
|
||||
override fun init() {
|
||||
activity!!.main_bottom_navigation.visibility = View.GONE
|
||||
requireActivity().main_bottom_navigation.visibility = View.GONE
|
||||
toolbar_title.text = getString(R.string.getubicaition)
|
||||
customDialog = CustomDialog(requireContext())
|
||||
setEvents()
|
||||
|
@ -66,13 +66,13 @@ class BuscarItemFragment(
|
|||
|
||||
|
||||
backButton.setOnClickListener {
|
||||
activity!!.onBackPressed()
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun getLocations(itemFk:String){
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
|
||||
user = prefs.getString(USER,"").toString()
|
||||
password = prefs.getString(PASSWORD,"").toString()
|
||||
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
|
||||
|
|
|
@ -47,7 +47,7 @@ class BuscarItemAllFragment(
|
|||
override fun getLayoutId(): Int = R.layout.fragment_buscar_item_all
|
||||
|
||||
override fun init() {
|
||||
activity!!.main_bottom_navigation.visibility = View.GONE
|
||||
requireActivity().main_bottom_navigation.visibility = View.GONE
|
||||
toolbar_title.text = getString(R.string.getubicaition)
|
||||
customDialog = CustomDialog(requireContext())
|
||||
setEvents()
|
||||
|
@ -101,13 +101,13 @@ class BuscarItemAllFragment(
|
|||
|
||||
|
||||
backButton.setOnClickListener {
|
||||
activity!!.onBackPressed()
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun getLocations(itemFk:String){
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
|
||||
user = prefs.getString(USER,"").toString()
|
||||
password = prefs.getString(PASSWORD,"").toString()
|
||||
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
|
||||
|
|
|
@ -49,7 +49,7 @@ class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(Buyer
|
|||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
|
||||
user = prefs.getString(USER,"").toString()
|
||||
password = prefs.getString(PASSWORD,"").toString()
|
||||
sectorFk = prefs.getInt(SECTORFK,1).toString()
|
||||
|
@ -60,7 +60,7 @@ class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(Buyer
|
|||
|
||||
override fun init() {
|
||||
customDialog = CustomDialog(requireContext())
|
||||
activity!!.main_bottom_navigation.visibility = View.GONE
|
||||
requireActivity().main_bottom_navigation.visibility = View.GONE
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
toolbar_title.text = getString(R.string.quality)
|
||||
setToolBar()
|
||||
|
@ -86,7 +86,7 @@ class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(Buyer
|
|||
|
||||
private fun setEvents(){
|
||||
backButton.setOnClickListener {
|
||||
activity!!.onBackPressed()
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ class QaualityFragment(
|
|||
override fun getLayoutId(): Int = R.layout.qauality_fragment
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
|
||||
user = prefs.getString(USER,"").toString()
|
||||
password = prefs.getString(PASSWORD,"").toString()
|
||||
sectorFk = prefs.getInt(SECTORFK,1).toString()
|
||||
|
@ -67,7 +67,7 @@ class QaualityFragment(
|
|||
|
||||
override fun init() {
|
||||
customDialog = CustomDialog(requireContext())
|
||||
activity!!.main_bottom_navigation.visibility = View.GONE
|
||||
requireActivity().main_bottom_navigation.visibility = View.GONE
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
toolbar_title.text = "itemShelving_BuyerTask"
|
||||
setToolBar()
|
||||
|
@ -98,7 +98,7 @@ class QaualityFragment(
|
|||
|
||||
private fun setEvents(){
|
||||
backButton.setOnClickListener {
|
||||
activity!!.onBackPressed()
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
|
||||
//ESCANER =========
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -18,7 +18,7 @@ import retrofit2.Response
|
|||
|
||||
class CollectionViewModel(context: Context) : BaseViewModel() {
|
||||
|
||||
val emptyMessage = "La colección no tiene tickets";
|
||||
val emptyMessage = "La colección no tiene tickets"
|
||||
|
||||
private val getSacadorControladorUserCase: GetSacadorControladorUserCase = GetSacadorControladorUserCase(context)
|
||||
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context)
|
||||
|
@ -36,6 +36,12 @@ class CollectionViewModel(context: Context) : BaseViewModel() {
|
|||
val response: LiveData<ResponseItemVO>
|
||||
get() = _response
|
||||
|
||||
|
||||
private val _responsecheckfully by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responsecheckfully: LiveData<ResponseItemVO>
|
||||
get() = _responsecheckfully
|
||||
|
||||
|
||||
private val _responseNew by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseNew: LiveData<ResponseItemVO>
|
||||
get() = _responseNew
|
||||
|
@ -351,4 +357,24 @@ class CollectionViewModel(context: Context) : BaseViewModel() {
|
|||
|
||||
})
|
||||
}
|
||||
fun ticket_checkFullyControlled(usuario:String,password:String,collectionFk:String){
|
||||
getSacadorControladorUserCase.ticket_checkFullyControlled(usuario,password,collectionFk).enqueue(object :
|
||||
Callback<String> {
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
_responsecheckfully.value = ResponseItemVO(isError = true, errorMessage = "" + t.message!!)
|
||||
}
|
||||
override fun onResponse(
|
||||
call: Call<String?>,
|
||||
response: Response<String>
|
||||
) {
|
||||
|
||||
if (response.body() != "false"){
|
||||
//sergio:
|
||||
_responsecheckfully.value = ResponseItemVO(isError = false, response = response.body()!!,errorMessage = "")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import es.verdnatura.presentation.common.OnCollectionSelectedListener
|
|||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.fragment_controlador.*
|
||||
import kotlinx.android.synthetic.main.toolbar.*
|
||||
|
||||
|
@ -45,8 +46,9 @@ class ControladorFragment : BaseFragment<FragmentControladorBinding,ControladorV
|
|||
|
||||
splash_progress.visibility = View.GONE
|
||||
customDialog = CustomDialog(requireContext())
|
||||
toolbar_title.text = getString(R.string.getcollection)
|
||||
toolbar_title.text = getString(R.string.controlticket)
|
||||
setEvents()
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
|
@ -57,12 +59,14 @@ class ControladorFragment : BaseFragment<FragmentControladorBinding,ControladorV
|
|||
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||
val prefs: SharedPreferences = requireActivity().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()
|
||||
|
||||
type=ConstAndValues.CONTROLADOR
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
|
@ -74,6 +78,7 @@ class ControladorFragment : BaseFragment<FragmentControladorBinding,ControladorV
|
|||
goBack=false
|
||||
if (!scan_input.text.isNullOrEmpty()) {
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
|
||||
viewModel.collectionTicketGet(
|
||||
usuario = user,
|
||||
password = password,
|
||||
|
@ -81,7 +86,7 @@ class ControladorFragment : BaseFragment<FragmentControladorBinding,ControladorV
|
|||
collectionFk = scan_input.text.toString(),
|
||||
type = type
|
||||
)
|
||||
////Log.i("VERDNATURA:","La collection es ${scan_input.text.toString()}")
|
||||
// viewModel.ticket_checkControlled(user,password,scan_input.text.toString())
|
||||
}
|
||||
scan_input.setText("")
|
||||
(activity as MainActivity).hideKeyboard(scan_input)
|
||||
|
@ -100,12 +105,13 @@ class ControladorFragment : BaseFragment<FragmentControladorBinding,ControladorV
|
|||
customDialog.dismiss()
|
||||
}.show()
|
||||
}else{
|
||||
////Log.i("VERDNATURA:"," goback es $goBack y ${it.collectionFk}")
|
||||
|
||||
if (!goBack)navigateToCollectionList(it)
|
||||
goBack = false
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import androidx.lifecycle.LiveData
|
|||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.GetSacadorControladorUserCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import retrofit2.Call
|
||||
|
@ -16,6 +17,10 @@ class ControladorViewModel(context: Context) : BaseViewModel() {
|
|||
private val _collectionTicketList by lazy { MutableLiveData<CollectionVO>() }
|
||||
private val getSacadorControladorUserCase: GetSacadorControladorUserCase = GetSacadorControladorUserCase(context)
|
||||
|
||||
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val response: LiveData<ResponseItemVO>
|
||||
get() = _response
|
||||
|
||||
val collectionTicketList: LiveData<CollectionVO>
|
||||
get() = _collectionTicketList
|
||||
|
||||
|
@ -31,7 +36,10 @@ class ControladorViewModel(context: Context) : BaseViewModel() {
|
|||
response: Response<CollectionVO>
|
||||
) {
|
||||
if (response.body() != null){
|
||||
_collectionTicketList.value = response.body()?.let { it.map() }
|
||||
_collectionTicketList.value = response.body()?.let { it.map()
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
_collectionTicketList.value = CollectionVO(isError = true,errorMessage = "No hay tickets para sacar")
|
||||
}
|
||||
|
|
|
@ -0,0 +1,166 @@
|
|||
package es.verdnatura.presentation.view.feature.controlador.fragment
|
||||
|
||||
import android.content.Intent
|
||||
import es.verdnatura.presentation.view.feature.qr.QrFragmentViewModel
|
||||
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import android.webkit.WebChromeClient
|
||||
import android.webkit.WebSettings
|
||||
import android.webkit.WebView
|
||||
import android.webkit.WebViewClient
|
||||
import androidx.lifecycle.Observer
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentQrBinding
|
||||
import es.verdnatura.domain.ConstAndValues
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||
import kotlinx.android.synthetic.main.fragment_controlador.*
|
||||
import kotlinx.android.synthetic.main.toolbar.*
|
||||
import kotlinx.android.synthetic.main.fragment_web.*
|
||||
|
||||
|
||||
class WebFragment(
|
||||
var entryPoint: String = ""
|
||||
) : BaseFragment<FragmentQrBinding, QrFragmentViewModel>(QrFragmentViewModel::class) {
|
||||
|
||||
private var user = ""
|
||||
private var password = ""
|
||||
private var sectorFk = ""
|
||||
private var warehouseFk = ""
|
||||
private var goBack: Boolean = false
|
||||
override fun getLayoutId(): Int = R.layout.fragment_web
|
||||
private lateinit var customDialog: CustomDialog
|
||||
private var type = ""
|
||||
private var itemscaned = ""
|
||||
//private lateinit var webView: WebViewClient
|
||||
|
||||
companion object {
|
||||
fun newInstance(entryPoint: String) = WebFragment(entryPoint)
|
||||
}
|
||||
|
||||
override fun init() {
|
||||
|
||||
// splash_progress.visibility = View.GONE
|
||||
customDialog = CustomDialog(requireContext())
|
||||
setToolbar()
|
||||
//setEvents()
|
||||
setWeb()
|
||||
super.init()
|
||||
}
|
||||
|
||||
private fun setWeb() {
|
||||
// webView = WebViewClient()
|
||||
|
||||
|
||||
webView.setWebChromeClient (WebChromeClient())
|
||||
// webView.setWebViewClient (wvClient);
|
||||
webView.getSettings (). setJavaScriptEnabled (true)
|
||||
webView.getSettings (). setPluginState (WebSettings.PluginState.ON)
|
||||
val webSettings = webView.settings
|
||||
webSettings.javaScriptEnabled = true
|
||||
webSettings.domStorageEnabled = true
|
||||
webSettings.loadWithOverviewMode = true
|
||||
webSettings.useWideViewPort = true
|
||||
webSettings.builtInZoomControls = true
|
||||
webSettings.displayZoomControls = false
|
||||
webSettings.setSupportZoom(true)
|
||||
webSettings.defaultTextEncodingName = "utf-8"
|
||||
|
||||
|
||||
webView.loadUrl ("https://salix.verdnatura.es/#!/item/index")
|
||||
|
||||
val openURL = Intent(Intent.ACTION_VIEW)
|
||||
// openURL.data = Uri.parse("https://salix.verdnatura.es/#!/ticket/3271614/tracking/index")
|
||||
openURL.data = Uri.parse("https://salix.verdnatura.es/#!/item/index")
|
||||
startActivity(openURL)
|
||||
|
||||
//webView.loadUrl("http://www.google.com")
|
||||
//webView.loadUrl("https://test-salix.verdnatura.es/#!/ticket/3271614/tracking/index")
|
||||
/* webView.loadUrl("https://test-salix.verdnatura.es/")
|
||||
webView.settings.javaScriptEnabled = true
|
||||
webView.settings.setSupportZoom(true)*/
|
||||
|
||||
}
|
||||
|
||||
private fun setToolbar() {
|
||||
|
||||
toolbar_title.text = entryPoint
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
goBack = true
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val prefs: SharedPreferences = requireActivity().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()
|
||||
type = ConstAndValues.PRECHECKER
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
/* private fun setEvents() {
|
||||
|
||||
backButton.setOnClickListener {
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
|
||||
scan_input.requestFocus()
|
||||
scan_input.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
goBack = false;
|
||||
if (!scan_input.text.isNullOrEmpty()) {
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
viewModel.qr_getCall(user, password, scan_input.text.toString())
|
||||
itemscaned = scan_input.text.toString()
|
||||
}
|
||||
|
||||
}
|
||||
scan_input.setText("")
|
||||
(activity as MainActivity).hideKeyboard(scan_input)
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}*/
|
||||
|
||||
|
||||
override fun observeViewModel() {
|
||||
|
||||
with(viewModel) {
|
||||
qrresponse.observe(viewLifecycleOwner, Observer {
|
||||
//splash_progress.visibility = View.GONE
|
||||
if (it.isError) {
|
||||
|
||||
// getMessageFromJSON(it.errorMessage)
|
||||
customDialog.setTitle("Error").setDescription( it.errorMessage+ " "+itemscaned)
|
||||
.setOkButton("Aceptar") {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
} else {
|
||||
|
||||
customDialog.setTitle("Mensaje")
|
||||
.setDescription("Operación " + itemscaned + ". " + it.response)
|
||||
.setOkButton("Aceptar") {
|
||||
customDialog.dismiss()
|
||||
backButton.performClick()
|
||||
}.show()
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package es.verdnatura.presentation.view.feature.controlvehiculo.fragment
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.media.MediaPlayer
|
||||
|
@ -25,6 +26,7 @@ import es.verdnatura.presentation.view.component.CustomDialog
|
|||
import es.verdnatura.presentation.view.component.CustomDialogInput
|
||||
import es.verdnatura.presentation.view.component.CustomDialogList
|
||||
import es.verdnatura.presentation.view.component.CustomDialogThreeButtons
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoFragment
|
||||
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
|
||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
|
@ -44,9 +46,9 @@ import kotlin.collections.ArrayList
|
|||
|
||||
class ControlVehiculoFragment(
|
||||
var tagName: String = ""
|
||||
) :BaseFragment<FragmentVehiclecontrolBinding, ControlVehiculoViewModel>(
|
||||
ControlVehiculoViewModel::class) {
|
||||
|
||||
) : BaseFragment<FragmentVehiclecontrolBinding, ControlVehiculoViewModel>(
|
||||
ControlVehiculoViewModel::class
|
||||
) {
|
||||
|
||||
private var user = ""
|
||||
private var userFk = ""
|
||||
|
@ -57,13 +59,12 @@ class ControlVehiculoFragment(
|
|||
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
|
||||
override fun getLayoutId(): Int = R.layout.fragment_vehiclecontrol
|
||||
private lateinit var customDialog: CustomDialog
|
||||
//private var type = ""
|
||||
private var isWorkedTimed = "UNREGISTERED"
|
||||
|
||||
private lateinit var customDialogList: CustomDialogList
|
||||
private lateinit var customDialogInput: CustomDialogInput
|
||||
private lateinit var customDialogThreeButtons: CustomDialogThreeButtons
|
||||
|
||||
|
||||
companion object {
|
||||
fun newInstance(tagName: String) = ControlVehiculoFragment(tagName)
|
||||
}
|
||||
|
@ -73,23 +74,31 @@ class ControlVehiculoFragment(
|
|||
if (context is OnCollectionSelectedListener) onCollectionSelectedListener = context
|
||||
}
|
||||
|
||||
|
||||
override fun init() {
|
||||
|
||||
customDialog = CustomDialog(requireContext())
|
||||
customDialogList = CustomDialogList(requireContext())
|
||||
customDialogInput = CustomDialogInput(requireContext())
|
||||
customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
|
||||
goBack=false
|
||||
goBack = false
|
||||
|
||||
splash_progress.visibility = GONE
|
||||
|
||||
if (!tagName.equals(SacadorFragment.TAG)) {
|
||||
checkControlTimeVehicle()
|
||||
}
|
||||
/* if (getWagons() < 2 && !tagName.equals(SacadorFragment.TAG))
|
||||
{
|
||||
(activity as MainActivity).openFragmentPickers()
|
||||
}*/
|
||||
|
||||
setEvents()
|
||||
|
||||
if (tagName.equals(HistoricoVehiculoFragment.TAG)) {
|
||||
setToolBar("HISTORY")
|
||||
showScanner("Escanea matrícula para ver histórico", "HISTORY")
|
||||
} else {
|
||||
checkControlTimeVehicle()
|
||||
setToolBar("ALL")
|
||||
}
|
||||
setEvents()
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
|
@ -98,19 +107,35 @@ class ControlVehiculoFragment(
|
|||
super.onPause()
|
||||
}
|
||||
|
||||
private fun setToolBar(direction:String) {
|
||||
private fun setToolBar(direction: String) {
|
||||
|
||||
toolbar_title.text = getString(R.string.vehiclecontrol)
|
||||
toolbar_title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13F)
|
||||
|
||||
val listIcons: ArrayList<Drawable> = ArrayList()
|
||||
val iconHistory: Drawable = resources.getDrawable(R.drawable.ic_history_black_24dp, resources.newTheme())
|
||||
val iconHistory: Drawable =
|
||||
resources.getDrawable(R.drawable.ic_history_black_24dp, resources.newTheme())
|
||||
val iconVehicleIn: Drawable = resources.getDrawable(R.drawable.car, resources.newTheme())
|
||||
val iconVehicleOut: Drawable = resources.getDrawable(R.drawable.car_off, resources.newTheme())
|
||||
val iconVehicleOut: Drawable =
|
||||
resources.getDrawable(R.drawable.car_off, resources.newTheme())
|
||||
|
||||
listIcons.add(iconVehicleIn)
|
||||
|
||||
|
||||
if (direction.equals("OUT")) {
|
||||
listIcons.remove(iconVehicleIn)
|
||||
listIcons.add(iconVehicleOut)
|
||||
listIcons.add(iconHistory)
|
||||
}
|
||||
if (direction.equals("IN")) {
|
||||
listIcons.remove(iconVehicleOut)
|
||||
listIcons.add(iconVehicleIn)
|
||||
listIcons.add(iconHistory)
|
||||
}
|
||||
if (direction.equals("HISTORY")) {
|
||||
listIcons.remove(iconVehicleOut)
|
||||
listIcons.remove(iconVehicleIn)
|
||||
listIcons.add(iconHistory)
|
||||
}
|
||||
|
||||
|
||||
toolbar_icons.adapter = ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
|
||||
|
@ -127,14 +152,12 @@ class ControlVehiculoFragment(
|
|||
showScanner("Escanea matrícula para dejar vehículo", "OUT")
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
toolbar_icons.layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||
}
|
||||
|
||||
|
||||
private fun showScanner(description: String, action: String) {
|
||||
|
||||
customDialogInput.setTitle(getString(R.string.vehiclecontrol)).setDescription(description)
|
||||
|
@ -174,24 +197,32 @@ class ControlVehiculoFragment(
|
|||
|
||||
}
|
||||
|
||||
private fun checkControlTimeVehicle() {
|
||||
|
||||
private fun checkControlTimeVehicle(){
|
||||
|
||||
if (!goBack){ splash_progress.visibility = VISIBLE
|
||||
//Log.i("VERDNATURA:","Entramos en la llamada checkRegister")
|
||||
viewModel.vehicleWarehouseTimeControl_checkRegister(user, password, userFk)}
|
||||
|
||||
if (!goBack) {
|
||||
splash_progress.visibility = VISIBLE
|
||||
viewModel.workerMachinery_isRegistered(user, password, userFk)
|
||||
}
|
||||
}
|
||||
|
||||
private fun insertControlTimeVehicle(plateNumber: String, direction: String) {
|
||||
|
||||
if (direction.equals("HISTORY")){
|
||||
(activity as MainActivity).onPasillerosItemClickListener( PasillerosItemVO(title = "Historico Vehículo"),plateNumber)
|
||||
}else{
|
||||
if (direction.equals("HISTORY")) {
|
||||
(activity as MainActivity).onPasillerosItemClickListener(
|
||||
PasillerosItemVO(title = "Historico Vehículo"),
|
||||
plateNumber
|
||||
)
|
||||
} else if (direction.equals("IN")) {
|
||||
splash_progress.visibility = VISIBLE
|
||||
// //Log.i("VERDNATURA:","Entramos al insert")
|
||||
viewModel.vehicleWarehouseTimeControl_insert(user, password, plateNumber, userFk, direction)
|
||||
// //Log.i("VERDNATURA:", "user $user pass $password matricula $plateNumber, id $userFk, action $direction")
|
||||
viewModel.machineWorker_add(user, password, plateNumber, userFk)
|
||||
|
||||
} else if (direction.equals("OUT")) {
|
||||
viewModel.machineWorker_update(user, password, plateNumber, userFk)
|
||||
|
||||
} else if (direction.equals("")) {
|
||||
(activity as MainActivity).openFragmentPickers()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun scanRequest() {
|
||||
|
@ -209,7 +240,7 @@ class ControlVehiculoFragment(
|
|||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER, 0)
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
user = prefs.getString(USER, "").toString()
|
||||
password = prefs.getString(PASSWORD, "").toString()
|
||||
sectorFk = prefs.getInt(SECTORFK, 1).toString()
|
||||
|
@ -221,16 +252,20 @@ class ControlVehiculoFragment(
|
|||
private fun setEvents() {
|
||||
|
||||
backButton.setOnClickListener {
|
||||
activity!!.onBackPressed()
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
|
||||
scan_input.requestFocus()
|
||||
scan_input.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
if (!scan_input.text.isNullOrEmpty()) {
|
||||
////Log.i("VERDNATURA:", "Obtenido focus: ${scan_input.text.toString()}")
|
||||
|
||||
if (tagName.equals(HistoricoVehiculoFragment.TAG)) {
|
||||
showOptionsHistorical(scan_input.text.toString())
|
||||
} else {
|
||||
showOptionsVehicleControl(scan_input.text.toString())
|
||||
}
|
||||
}
|
||||
scan_input.setText("")
|
||||
(activity as MainActivity).hideKeyboard(scan_input)
|
||||
return@setOnEditorActionListener true
|
||||
|
@ -245,7 +280,8 @@ class ControlVehiculoFragment(
|
|||
|
||||
customDialogThreeButtons.setDescription("¿Qué desea hacer con el vehículo de matrícula $plate")
|
||||
.setValue(plate)
|
||||
.setOkButtonTwo("COGER") {
|
||||
if (isWorkedTimed.equals("UNREGISTERED")) {
|
||||
customDialogThreeButtons.setOkButtonTwo("COGER") {
|
||||
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
|
||||
"Vuelva a escanear".toast(requireContext())
|
||||
} else {
|
||||
|
@ -253,7 +289,10 @@ class ControlVehiculoFragment(
|
|||
customDialogThreeButtons.dismiss()
|
||||
insertControlTimeVehicle(customDialogThreeButtons.getValue(), "IN")
|
||||
}
|
||||
}.setOkButtonThree("DEJAR") {
|
||||
}
|
||||
} else {
|
||||
|
||||
customDialogThreeButtons.setOkButtonThree("DEJAR") {
|
||||
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
|
||||
"Vuelva a escanear".toast(requireContext())
|
||||
} else {
|
||||
|
@ -261,7 +300,7 @@ class ControlVehiculoFragment(
|
|||
customDialogThreeButtons.dismiss()
|
||||
insertControlTimeVehicle(customDialogThreeButtons.getValue(), "OUT")
|
||||
}
|
||||
|
||||
}
|
||||
}.setOkButtonFour("HISTÓRICO") {
|
||||
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
|
||||
"Vuelva a escanear".toast(requireContext())
|
||||
|
@ -277,10 +316,30 @@ class ControlVehiculoFragment(
|
|||
}.show()
|
||||
}
|
||||
|
||||
private fun showOptionsHistorical(plate: String) {
|
||||
|
||||
customDialogThreeButtons.custom_dialog_value.visibility = GONE
|
||||
|
||||
customDialogThreeButtons.setDescription("¿Qué desea hacer con el vehículo de matrícula $plate")
|
||||
.setValue(plate)
|
||||
|
||||
.setOkButtonFour("HISTÓRICO") {
|
||||
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
|
||||
"Vuelva a escanear".toast(requireContext())
|
||||
} else {
|
||||
customDialogThreeButtons.dismiss()
|
||||
insertControlTimeVehicle(customDialogThreeButtons.getValue(), "HISTORY")
|
||||
|
||||
}
|
||||
|
||||
}.setKoButton("Cancelar") {
|
||||
scanRequest()
|
||||
customDialogThreeButtons.dismiss()
|
||||
}.show()
|
||||
}
|
||||
|
||||
override fun observeViewModel() {
|
||||
|
||||
|
||||
with(viewModel) {
|
||||
splash_progress.visibility = GONE
|
||||
responseinsert.observe(viewLifecycleOwner, Observer {
|
||||
|
@ -289,7 +348,6 @@ class ControlVehiculoFragment(
|
|||
"Respuesta call vehicle_insert en el viewmodel es : ${it.response}"
|
||||
)
|
||||
|
||||
|
||||
if (it.isError) {
|
||||
|
||||
customDialog.setTitle("Error").setDescription(it.errorMessage)
|
||||
|
@ -307,25 +365,26 @@ class ControlVehiculoFragment(
|
|||
|
||||
} else {
|
||||
if (it.response == "true") {
|
||||
"Acción registrada correctamente".toast(context)
|
||||
//Log.i(TD,"insertado registro")
|
||||
//"Acción registrada correctamente".toast(context)
|
||||
/* customDialog.setTitle("Llamada correcta")
|
||||
.setDescription("Acción registrada satisfactoriamente")
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()*/
|
||||
//(activity as MainActivity).openFragmentPickers()
|
||||
(activity as MainActivity).openFragmentPickers()
|
||||
//(activity as MainActivity).onPasillerosItemClickListener( PasillerosItemVO(title = "Sacadores"),"CONTROL")
|
||||
checkControlTimeVehicle()
|
||||
//checkControlTimeVehicle()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
splash_progress.visibility = GONE
|
||||
})
|
||||
|
||||
responsecontrol.observe(viewLifecycleOwner, Observer {
|
||||
splash_progress.visibility=GONE;
|
||||
splash_progress.visibility = GONE
|
||||
// Log.i("VERDNATURA:","${it.response}")
|
||||
if (it.isError) {
|
||||
customDialog.setTitle("Error").setDescription(it.errorMessage)
|
||||
.setOkButton("Cerrar") {
|
||||
|
@ -339,42 +398,42 @@ class ControlVehiculoFragment(
|
|||
customDialog.dismiss()
|
||||
}.show()
|
||||
} else {
|
||||
if (it.response == "REGISTERED") {
|
||||
// setToolBar("IN")
|
||||
if (it.response.equals("1")) {
|
||||
isWorkedTimed = "REGISTERED"
|
||||
setToolBar("OUT")
|
||||
/* customDialog.setTitle("Control de vehículos")
|
||||
.setDescription("SI Tienes coche asignado")
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()*/
|
||||
if (!tagName.equals(SacadorFragment.TAG)){
|
||||
if (!tagName.equals(SacadorFragment.TAG)) {
|
||||
(activity as MainActivity).openFragmentPickers()
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
}else{
|
||||
if (it.response == "UNREGISTERED") {
|
||||
//Log.i("VERDNATURA:","${it.response}")
|
||||
if (it.response.equals("0")) {
|
||||
setToolBar("IN")
|
||||
customDialog.setTitle("Control de vehículos")
|
||||
.setDescription("Escanea la matrícula del vehículo a utillizar o elige ir sin vehículo")
|
||||
.setDescription("Escanea la matrícula del vehículo o elige sin vehículo")
|
||||
.setOkButton("Escanear vehículo") {
|
||||
customDialog.dismiss()
|
||||
showScanner("Escanea matrícula del vehículo", "IN")
|
||||
}
|
||||
.setKoButton("Sin vehículo"){
|
||||
.setKoButton("SIN VEHÍCULO") {
|
||||
customDialog.dismiss()
|
||||
insertControlTimeVehicle("", "")
|
||||
|
||||
(activity as MainActivity).openFragmentPickers()
|
||||
// getActivity()?.getFragmentManager()?.popBackStack();
|
||||
}.show()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,195 @@
|
|||
package es.verdnatura.presentation.view.feature.controlvehiculo.fragment
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import android.os.Bundle
|
||||
import android.view.View.*
|
||||
import androidx.lifecycle.Observer
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentVehiclecontrolBinding
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.loadUrl
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import kotlinx.android.synthetic.main.fragment_controlador.splash_progress
|
||||
import kotlinx.android.synthetic.main.fragment_vehiclecontrol_user.*
|
||||
import kotlinx.android.synthetic.main.toolbar.*
|
||||
|
||||
class ControlVehiculoUsuarioFragment(
|
||||
var vUserFK: String = ""
|
||||
) : BaseFragment<FragmentVehiclecontrolBinding, ControlVehiculoViewModel>(
|
||||
ControlVehiculoViewModel::class
|
||||
) {
|
||||
|
||||
private var user = ""
|
||||
private var userFk = ""
|
||||
private var password = ""
|
||||
private var sectorFk = ""
|
||||
private var warehouseFk = ""
|
||||
private var token = ""
|
||||
private var goBack: Boolean = false
|
||||
private var android_id: String = ""
|
||||
// private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
|
||||
override fun getLayoutId(): Int = R.layout.fragment_vehiclecontrol_user
|
||||
private lateinit var customDialog: CustomDialog
|
||||
|
||||
companion object {
|
||||
fun newInstance(vUserFK: String) = ControlVehiculoUsuarioFragment(vUserFK)
|
||||
}
|
||||
|
||||
override fun init() {
|
||||
toolbar_title.text = getString(R.string.vehiclecontroluser)
|
||||
|
||||
customDialog = CustomDialog(requireContext())
|
||||
|
||||
goBack = false
|
||||
|
||||
splash_progress.visibility = GONE
|
||||
setEvents()
|
||||
setControlVehicleUser()
|
||||
//sergio:se queda pendiente de revisar con javi
|
||||
// setDialog()
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
goBack = true
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
private fun setControlVehicleUser() {
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
user = prefs.getString(USER, "").toString()
|
||||
password = prefs.getString(PASSWORD, "").toString()
|
||||
token = prefs.getString(TOKEN, "").toString()
|
||||
warehouseFk = prefs.getInt(WAREHOUSEFK, 1).toString()
|
||||
android_id = getANDROIDID()
|
||||
|
||||
if (userFk.equals(vUserFK)) {
|
||||
|
||||
splash_progress.visibility = VISIBLE
|
||||
viewModel.machine_getWorkerPlate(user, password, userFk)
|
||||
viewModel.deviceProduction_getnameDevice(user, password, android_id)
|
||||
viewModel.deviceProductionUser_getWorker(user, password, android_id)
|
||||
|
||||
} else {
|
||||
userFk = vUserFK
|
||||
|
||||
user_information.visibility = INVISIBLE
|
||||
name_vehiclecontrol.visibility = INVISIBLE
|
||||
user_image.setOnClickListener({backButton.performClick()})
|
||||
|
||||
}
|
||||
user_image.loadUrl("https://salix.verdnatura.es/api/Images/user/160x160/$userFk/download?access_token=$token")
|
||||
viewModel.machine_getWorkerPlate(user, password, userFk)
|
||||
name_vehiclecontrol.text = user
|
||||
registered_vehiclecontrol.text = ""
|
||||
deviceName.text = ""
|
||||
assigned_devicename.text = ""
|
||||
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val prefs: SharedPreferences = requireActivity().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()
|
||||
userFk = prefs.getString(USERFK, "0").toString()
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
private fun setEvents() {
|
||||
|
||||
backButton.setOnClickListener {
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun setDialog(){
|
||||
/* user_image.setOnClickListener({backButton.performClick()})
|
||||
val builder = AlertDialog.Builder(requireContext())
|
||||
val inflater = layoutInflater
|
||||
val view: View = inflater.inflate(R.layout.item_worker_image, null)
|
||||
builder.setView(view)
|
||||
val imgView: ImageView = view.findViewById(R.id.workerimage) as ImageView
|
||||
imgView.loadUrl("https://salix.verdnatura.es/api/Images/user/160x160/$userFk/download?access_token=$token")
|
||||
|
||||
val dialog = builder.create()
|
||||
dialog.show()
|
||||
|
||||
*/
|
||||
/* val image = ImageView(requireContext())
|
||||
image.setImageResource(R.drawable.barcode_scan)
|
||||
|
||||
image.loadUrl("https://salix.verdnatura.es/api/Images/user/160x160/$userFk/download?access_token=$token")
|
||||
|
||||
val builderr: AlertDialog.Builder =
|
||||
AlertDialog.Builder(requireContext(),R.style.DialogTheme)
|
||||
.setMessage("Sacador:")
|
||||
.setPositiveButton("Cerrar") { dialogInterface: DialogInterface, i: Int ->
|
||||
fun onClick(dialog: DialogInterface, which: Int) {
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
.setView(image)
|
||||
builderr.create().show()
|
||||
|
||||
// image.setOnClickListener { builderr.dismiss() }*/
|
||||
|
||||
}
|
||||
|
||||
override fun observeViewModel() {
|
||||
|
||||
with(viewModel) {
|
||||
splash_progress.visibility = GONE
|
||||
|
||||
|
||||
responsemachine.observe(viewLifecycleOwner, Observer {
|
||||
splash_progress.visibility = GONE
|
||||
if (it.isError) {
|
||||
customDialog.setTitle("Error").setDescription(it.errorMessage)
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
} else {
|
||||
//sergio: se modifica el response = null. En casi todas las llamadas se utilizaba para ver si había error.
|
||||
// Ahora ya no.
|
||||
|
||||
if (it.response == null) {
|
||||
customDialog.setTitle("Error")
|
||||
.setDescription("Revisar la llamada para obtener datos del trabajador y dispositivo")
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
} else {
|
||||
if (it.response == "false") {
|
||||
|
||||
} else {
|
||||
if (it.response != null) {
|
||||
|
||||
// Log.i("VERDNATURA::", "valor devuelto ${it.response}")
|
||||
|
||||
if (it.type.equals("getnameDevice")) {
|
||||
deviceName.text = it.response
|
||||
}
|
||||
if (it.type.equals("getWorker")) {
|
||||
assigned_devicename.text = it.response
|
||||
}
|
||||
if (it.type.equals("getWorkerPlate")) {
|
||||
registered_vehiclecontrol.text = it.response
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ import androidx.lifecycle.LiveData
|
|||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.GetVehicleControlTimeUserCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.common.ResponseItemMachineControl
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
|
||||
import retrofit2.Call
|
||||
|
@ -14,7 +15,8 @@ import retrofit2.Response
|
|||
|
||||
class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
|
||||
|
||||
private val getVehicleControlTimeUserCase: GetVehicleControlTimeUserCase = GetVehicleControlTimeUserCase(context)
|
||||
private val getVehicleControlTimeUserCase: GetVehicleControlTimeUserCase =
|
||||
GetVehicleControlTimeUserCase(context)
|
||||
|
||||
private val _responseinsert by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseinsert: LiveData<ResponseItemVO>
|
||||
|
@ -24,21 +26,35 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
|
|||
val responsecontrol: LiveData<ResponseItemVO>
|
||||
get() = _responsecontrol
|
||||
|
||||
private val _responsemachine by lazy { MutableLiveData<ResponseItemMachineControl>() }
|
||||
val responsemachine: LiveData<ResponseItemMachineControl>
|
||||
get() = _responsemachine
|
||||
|
||||
|
||||
|
||||
fun vehicleWarehouseTimeControl_insert(usuario:String,password:String,PlateNumber:String,workerFk:String,Direction:String){
|
||||
getVehicleControlTimeUserCase.vehicleWarehouseTimeControl_insert(usuario,password,PlateNumber,workerFk,Direction).enqueue(object : Callback<Boolean>{
|
||||
fun machineWorker_add(
|
||||
usuario: String,
|
||||
password: String,
|
||||
PlateNumber: String,
|
||||
workerFk: String
|
||||
) {
|
||||
getVehicleControlTimeUserCase.machineWorker_add(usuario, password, PlateNumber, workerFk)
|
||||
.enqueue(object : Callback<Boolean> {
|
||||
override fun onFailure(call: Call<Boolean>, t: Throwable) {
|
||||
_responseinsert.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada de registro de vehículo")
|
||||
_responseinsert.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = "Error en la llamada de registro de vehículo"
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Boolean>, response: Response<Boolean>) {
|
||||
if (response.body() == null || response.body().toString() == "false"){
|
||||
_responseinsert.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada. Escanea matrícula de nuevo")
|
||||
}else{
|
||||
if (response.body() == null || response.body().toString() == "false") {
|
||||
_responseinsert.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = "Error en la llamada. Escanea matrícula de nuevo"
|
||||
)
|
||||
} else {
|
||||
//_response.value = ResponseItemVO(isError = false,response = response.body()!!)
|
||||
_responseinsert.value = ResponseItemVO(isError = false,response = response.body()!!.toString())
|
||||
_responseinsert.value =
|
||||
ResponseItemVO(isError = false, response = response.body()!!.toString())
|
||||
//Log.i("VERDNATURA:","Respuesta call vehicle_insert ${response.body()}")
|
||||
}
|
||||
|
||||
|
@ -47,17 +63,90 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
|
|||
})
|
||||
}
|
||||
|
||||
fun vehicleWarehouseTimeControl_checkRegister(usuario:String,password:String,userFk:String){
|
||||
getVehicleControlTimeUserCase.vehicleWarehouseTimeControl_checkRegister(usuario,password,userFk).enqueue(object : Callback<String>{
|
||||
fun machineWorker_update(
|
||||
usuario: String,
|
||||
password: String,
|
||||
PlateNumber: String,
|
||||
workerFk: String
|
||||
) {
|
||||
getVehicleControlTimeUserCase.machineWorker_update(usuario, password, PlateNumber, workerFk)
|
||||
.enqueue(object : Callback<Boolean> {
|
||||
override fun onFailure(call: Call<Boolean>, t: Throwable) {
|
||||
_responseinsert.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = "Error en la llamada de registro de vehículo"
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Boolean>, response: Response<Boolean>) {
|
||||
if (response.body() == null || response.body().toString() == "false") {
|
||||
_responseinsert.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = "Error en la llamada. Escanea matrícula de nuevo"
|
||||
)
|
||||
} else {
|
||||
//_response.value = ResponseItemVO(isError = false,response = response.body()!!)
|
||||
_responseinsert.value =
|
||||
ResponseItemVO(isError = false, response = response.body()!!.toString())
|
||||
//Log.i("VERDNATURA:","Respuesta call vehicle_insert ${response.body()}")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun machineWorker_Worker(usuario: String, password: String, userFk: String) {
|
||||
getVehicleControlTimeUserCase.machineWorker_Worker(
|
||||
usuario,
|
||||
password,
|
||||
userFk
|
||||
).enqueue(object : Callback<String> {
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
_responsecontrol.value = ResponseItemVO(isError = true,errorMessage = "Error al comprobar el control vehículo")
|
||||
_responsecontrol.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = "Error al comprobar el control vehículo"
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
if (response.body() == null){
|
||||
_responsecontrol.value = ResponseItemVO(isError = true,errorMessage = "Error al comprobar control vehículo")
|
||||
}else{
|
||||
_responsecontrol.value = ResponseItemVO(isError = false,response = response.body()!!)
|
||||
if (response.body() == null) {
|
||||
_responsecontrol.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = "Error al comprobar control vehículo"
|
||||
)
|
||||
} else {
|
||||
_responsecontrol.value =
|
||||
ResponseItemVO(isError = false, response = response.body()!!)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun workerMachinery_isRegistered(usuario: String, password: String, userFk: String) {
|
||||
getVehicleControlTimeUserCase.workerMachinery_isRegistered(
|
||||
usuario,
|
||||
password,
|
||||
userFk
|
||||
).enqueue(object : Callback<String> {
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
_responsecontrol.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = "Error al comprobar el control vehículo"
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
if (response.body() == null) {
|
||||
_responsecontrol.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = "Error al comprobar control vehículo"
|
||||
)
|
||||
} else {
|
||||
_responsecontrol.value =
|
||||
ResponseItemVO(isError = false, response = response.body()!!)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -67,5 +156,155 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
|
|||
|
||||
|
||||
|
||||
fun deviceProduction_getnameDevice(usuario: String, password: String, userFk: String) {
|
||||
getVehicleControlTimeUserCase.deviceProduction_getnameDevice(
|
||||
usuario,
|
||||
password,
|
||||
userFk
|
||||
).enqueue(object : Callback<String> {
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
// Log.i("VERDNATURA::","${t.message}")
|
||||
_responsemachine.value = ResponseItemMachineControl(
|
||||
isError = true,
|
||||
errorMessage = "Error al comprobar el nombre del dispositivo",
|
||||
type = ""
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
if (response.body() == null) {
|
||||
|
||||
/*_responsemachine.value = ResponseItemMachineControl(
|
||||
isError = true,
|
||||
errorMessage = "Error al comprobar el nombre del dispositivo",
|
||||
type = ""
|
||||
)*/
|
||||
} else {
|
||||
_responsemachine.value =
|
||||
ResponseItemMachineControl(
|
||||
isError = false,
|
||||
response = response.body()!!,
|
||||
type = "getnameDevice"
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun deviceProductionUser_getWorker(usuario: String, password: String, userFk: String) {
|
||||
getVehicleControlTimeUserCase.deviceProductionUser_getWorker(
|
||||
usuario,
|
||||
password,
|
||||
userFk
|
||||
).enqueue(object : Callback<String> {
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
_responsemachine.value = ResponseItemMachineControl(
|
||||
isError = true,
|
||||
errorMessage = "Error al comprobar usuario del dispositivo",
|
||||
type = ""
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
if (response.body() == null) {
|
||||
/* _responsemachine.value = ResponseItemMachineControl(
|
||||
isError = true,
|
||||
errorMessage = "Error al comprobar usuario del dispositivo",
|
||||
type = ""
|
||||
)*/
|
||||
} else {
|
||||
_responsemachine.value =
|
||||
ResponseItemMachineControl(
|
||||
isError = false,
|
||||
response = response.body()!!,
|
||||
type = "getWorker"
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun deviceProduction_getdeviceNameFromUser(usuario: String, password: String, userFk: String) {
|
||||
getVehicleControlTimeUserCase.deviceProduction_getdeviceNameFromUser(
|
||||
usuario,
|
||||
password,
|
||||
userFk
|
||||
).enqueue(object : Callback<String> {
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
_responsemachine.value = ResponseItemMachineControl(
|
||||
isError = true,
|
||||
errorMessage = "Error al comprobar el trabajador del dispositivo",
|
||||
type = ""
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
if (response.body() == null) {
|
||||
_responsemachine.value = ResponseItemMachineControl(
|
||||
isError = true,
|
||||
errorMessage = "Error al comprobar el trabajador del dispositivo",
|
||||
type = ""
|
||||
)
|
||||
} else {
|
||||
_responsemachine.value =
|
||||
ResponseItemMachineControl(
|
||||
isError = false,
|
||||
response = response.body()!!,
|
||||
type = "getdeviceNameFromUser"
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun machine_getWorkerPlate(usuario: String, password: String, userFk: String) {
|
||||
getVehicleControlTimeUserCase.machine_getWorkerPlate(
|
||||
usuario,
|
||||
password,
|
||||
userFk
|
||||
).enqueue(object : Callback<String> {
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
|
||||
// Log.i("VERDNATURA::","Error ${t.message}")
|
||||
_responsemachine.value = ResponseItemMachineControl(
|
||||
isError = true,
|
||||
errorMessage = " Error al comprobar el trabajador si ha cogido el vehículo",
|
||||
type = ""
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
if (response.body() == null) {
|
||||
ResponseItemMachineControl(
|
||||
isError = false,
|
||||
response = response.body()!!,
|
||||
type = "getWorkerPlate"
|
||||
)
|
||||
//sergio: se modifica el response = null. En casi todas las llamadas se utilizaba para ver si había error.
|
||||
// Ahora ya no.
|
||||
/* _responsemachine.value = ResponseItemMachineControl(
|
||||
isError = true,
|
||||
errorMessage = "Error al comprobar el trabajador si ha cogido el vehículo",
|
||||
type = ""
|
||||
)*/
|
||||
} else {
|
||||
_responsemachine.value =
|
||||
ResponseItemMachineControl(
|
||||
isError = false,
|
||||
response = response.body()!!,
|
||||
type = "getWorkerPlate"
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
}
|
|
@ -52,7 +52,7 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
|
|||
override fun getLayoutId(): Int = R.layout.fragment_faltas
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
|
||||
user = prefs.getString(USER,"").toString()
|
||||
password = prefs.getString(PASSWORD,"").toString()
|
||||
sectorFk = prefs.getInt(SECTORFK,1).toString()
|
||||
|
@ -63,7 +63,7 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
|
|||
|
||||
override fun init() {
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
activity!!.main_bottom_navigation.visibility = View.GONE
|
||||
requireActivity().main_bottom_navigation.visibility = View.GONE
|
||||
toolbar_title.text = getString(R.string.faultsReview)
|
||||
setToolBar()
|
||||
|
||||
|
@ -98,7 +98,7 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
|
|||
|
||||
private fun setEvents(){
|
||||
backButton.setOnClickListener {
|
||||
activity!!.onBackPressed()
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
|
||||
filter_itemFk.setOnKeyListener { v, keyCode, event ->
|
||||
|
|
|
@ -1,12 +1,20 @@
|
|||
package es.verdnatura.presentation.view.feature.historico.fragment
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Color
|
||||
import android.graphics.Color.*
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.util.Log
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.widget.TooltipCompat
|
||||
import androidx.core.content.ContextCompat.getColor
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.R.color.verdnatura_pumpkin_orange
|
||||
import es.verdnatura.R.color.verdnatura_white
|
||||
import es.verdnatura.databinding.FragmentHistoricoBinding
|
||||
import es.verdnatura.domain.notNull
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
|
@ -26,96 +34,145 @@ import kotlinx.android.synthetic.main.toolbar.*
|
|||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
|
||||
class HistoricoFragment(
|
||||
var itemFk:String = ""
|
||||
var itemFk: String = ""
|
||||
) : BaseFragment<FragmentHistoricoBinding, HistoricoViewModel>(
|
||||
HistoricoViewModel::class) {
|
||||
HistoricoViewModel::class
|
||||
) {
|
||||
|
||||
private var user = ""
|
||||
private var password = ""
|
||||
private var sectorFk = ""
|
||||
private var warehouseFk = ""
|
||||
private var adapter : HistoricoAdapter? = null
|
||||
private var adapter: HistoricoAdapter? = null
|
||||
private lateinit var customDialogInput: CustomDialogInput
|
||||
private lateinit var customDialog: CustomDialog
|
||||
private var listHistoric:ArrayList<ItemHistoricoVO> = ArrayList()
|
||||
private var listHistoryAux:ArrayList<ItemHistoricoVO> = ArrayList()
|
||||
private var filter:String=""
|
||||
private var listHistoric: ArrayList<ItemHistoricoVO> = ArrayList()
|
||||
private var listHistoryAux: ArrayList<ItemHistoricoVO> = ArrayList()
|
||||
private var filter: String = ""
|
||||
|
||||
companion object {
|
||||
fun newInstance(entryPoint:String) = HistoricoFragment(entryPoint)
|
||||
fun newInstance(entryPoint: String) = HistoricoFragment(entryPoint)
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.fragment_historico
|
||||
|
||||
override fun init() {
|
||||
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()
|
||||
val prefs: SharedPreferences = requireActivity().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()
|
||||
customDialogInput = CustomDialogInput(requireContext())
|
||||
customDialog = CustomDialog(requireContext())
|
||||
activity!!.main_bottom_navigation.visibility = View.GONE
|
||||
filter="all"
|
||||
viewModel.itemDiary(user,password,itemFk,warehouseFk)
|
||||
toolbar_title.text = getString(R.string.itemdiary)
|
||||
requireActivity().main_bottom_navigation.visibility = View.GONE
|
||||
filter = "all"
|
||||
viewModel.itemDiary(user, password, itemFk, warehouseFk)
|
||||
toolbar_title.text = getString(R.string.itemdiary) + ":" + itemFk
|
||||
setToolBar()
|
||||
setEvents()
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
private fun setToolBar(){
|
||||
val listIcons:ArrayList<Drawable> = ArrayList()
|
||||
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
|
||||
val iconGargabe : Drawable = resources.getDrawable(R.drawable.alpha_b_circle_outline,resources.newTheme())
|
||||
val iconFault : Drawable = resources.getDrawable(R.drawable.alpha_f_circle_outline,resources.newTheme())
|
||||
fun generateColorStateList(
|
||||
uncheckedColor: Int = Color.WHITE,
|
||||
checkedColor: Int = verdnatura_pumpkin_orange
|
||||
|
||||
|
||||
): ColorStateList {
|
||||
val states = arrayOf(
|
||||
|
||||
intArrayOf(-android.R.attr.state_pressed),
|
||||
intArrayOf(android.R.attr.state_pressed)
|
||||
|
||||
)
|
||||
val colors = intArrayOf(
|
||||
|
||||
uncheckedColor,
|
||||
checkedColor
|
||||
|
||||
)
|
||||
return ColorStateList(states, colors)
|
||||
}
|
||||
|
||||
private fun setToolBar() {
|
||||
val listIcons: ArrayList<Drawable> = ArrayList()
|
||||
val iconReload: Drawable =
|
||||
resources.getDrawable(R.drawable.ic_transaction, resources.newTheme())
|
||||
val iconGargabe: Drawable =
|
||||
resources.getDrawable(R.drawable.alpha_b_circle_outline, resources.newTheme())
|
||||
val iconFault: Drawable =
|
||||
resources.getDrawable(R.drawable.alpha_f_circle_outline, resources.newTheme())
|
||||
|
||||
listIcons.add(iconGargabe)
|
||||
listIcons.add(iconFault)
|
||||
listIcons.add(iconReload)
|
||||
|
||||
toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
|
||||
|
||||
toolbar_icons.adapter = ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
|
||||
|
||||
override fun onOptionsItemSelected(item: Drawable) {
|
||||
if (item == iconReload){
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
filter="all"
|
||||
viewModel.itemDiary(user,password,itemFk,warehouseFk)
|
||||
|
||||
}
|
||||
if (item == iconGargabe){
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
viewModel.itemDiary(user,password,itemFk,warehouseFk)
|
||||
filter="basura"
|
||||
//showFilterItems("basura")
|
||||
|
||||
}
|
||||
if (item == iconFault){
|
||||
if (item == iconReload) {
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
viewModel.itemDiary(user,password,itemFk,warehouseFk)
|
||||
filter="falta"
|
||||
// showFilterItems("falta")
|
||||
viewModelwithFilter("all")
|
||||
// TooltipCompat.setTooltipText(view!!, "Recarga");
|
||||
// view?.let { TooltipCompat.setTooltipText(it, "Recarga") };
|
||||
/* val mytoast = Toast.makeText(
|
||||
context,
|
||||
"Toast Message",
|
||||
Toast.LENGTH_SHORT
|
||||
)
|
||||
mytoast.setGravity(Gravity.TOP or Gravity.RIGHT, 0, -100)
|
||||
mytoast.show()*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (item == iconGargabe) {
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
viewModelwithFilter("contenedor")
|
||||
view?.performLongClick()
|
||||
|
||||
}
|
||||
if (item == iconFault) {
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
viewModelwithFilter("falta")
|
||||
|
||||
|
||||
}
|
||||
for (it in listIcons) {
|
||||
if (it != item) {
|
||||
it.setTint(getColor(context!!, verdnatura_white))
|
||||
}
|
||||
}
|
||||
item.setTint(getColor(context!!, verdnatura_pumpkin_orange))
|
||||
view?.performLongClick()
|
||||
}
|
||||
|
||||
})
|
||||
toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||
toolbar_icons.layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||
|
||||
}
|
||||
|
||||
private fun viewModelwithFilter(keyfilter: String) {
|
||||
filter = keyfilter
|
||||
viewModel.itemDiary(user, password, itemFk, warehouseFk)
|
||||
}
|
||||
|
||||
private fun setEvents(){
|
||||
private fun setEvents() {
|
||||
backButton.setOnClickListener {
|
||||
activity!!.onBackPressed()
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
|
||||
filter_nameordateitem.setOnKeyListener { v, keyCode, event ->
|
||||
// //Log.i("VERDNATURA:","El key a filtrar ${filter_nameordateitem.text.toString()}")
|
||||
if (filter_nameordateitem.text.toString().isNullOrEmpty()){
|
||||
if (listHistoric.size != listHistoryAux.size){
|
||||
if (filter_nameordateitem.text.toString().isNullOrEmpty()) {
|
||||
if (listHistoric.size != listHistoryAux.size) {
|
||||
listHistoric.removeAll(listHistoryAux)
|
||||
listHistoryAux.forEach {
|
||||
listHistoric.add(it)
|
||||
|
@ -123,10 +180,16 @@ class HistoricoFragment(
|
|||
adapter!!.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
}else{
|
||||
} else {
|
||||
listHistoric.removeAll(listHistoryAux)
|
||||
listHistoryAux.forEach {
|
||||
if (it.name!=null && (it.name.contains(filter_nameordateitem.text.toString(),true))){
|
||||
|
||||
|
||||
if (it.name != null && (it.name.contains(
|
||||
filter_nameordateitem.text.toString(),
|
||||
true
|
||||
))
|
||||
) {
|
||||
//Log.i("VERDNATURA:","si contiene ${filter_nameordateitem.text.toString()}")
|
||||
listHistoric.add(it)
|
||||
|
||||
|
@ -143,12 +206,12 @@ class HistoricoFragment(
|
|||
}
|
||||
|
||||
override fun observeViewModel() {
|
||||
with(viewModel){
|
||||
with(viewModel) {
|
||||
loadHistoricoList.observe(viewLifecycleOwner, Observer { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
|
||||
splash_progress.visibility = View.GONE
|
||||
listToAdapter(it.list,filter)
|
||||
listToAdapter(it.list, filter)
|
||||
// //Log.i("VERDNATURA:","el total original es ${it.list.size}")
|
||||
/* adapter = HistoricoAdapter(it.list)
|
||||
historico_recyclerview.adapter = adapter
|
||||
|
@ -161,19 +224,20 @@ class HistoricoFragment(
|
|||
}
|
||||
|
||||
|
||||
private fun listToAdapter(lista:List<ItemHistoricoVO>,filter:String){
|
||||
private fun listToAdapter(lista: List<ItemHistoricoVO>, filter: String) {
|
||||
|
||||
listHistoric.clear()
|
||||
listHistoryAux.clear()
|
||||
lista.forEach {
|
||||
|
||||
if (filter.equals("all")){
|
||||
if (filter.equals("all")) {
|
||||
listHistoric.add(it)
|
||||
listHistoryAux.add(it)
|
||||
}else{
|
||||
if ((it.name!=null) && (it.name.contains(filter,true))){
|
||||
// listHistoryAux.add(it)
|
||||
} else {
|
||||
|
||||
if ((it.name != null) && (it.name.contains(filter, true))) {
|
||||
listHistoric.add(it)
|
||||
listHistoryAux.add(it)
|
||||
// listHistoryAux.add(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,19 +245,22 @@ class HistoricoFragment(
|
|||
|
||||
adapter = HistoricoAdapter(listHistoric)
|
||||
historico_recyclerview.adapter = adapter
|
||||
historico_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
historico_recyclerview.layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
|
||||
listHistoryAux.addAll(listHistoric)
|
||||
// //Log.i("VERDNATURA:","el total de aux es ${listHistoryAux.size}")
|
||||
////Log.i("VERDNATURA:","el total de histor es ${listHistoric.size}")
|
||||
|
||||
}
|
||||
|
||||
private fun navigateToToday(it:ItemHistoricoListVO){
|
||||
private fun navigateToToday(it: ItemHistoricoListVO) {
|
||||
var positionToday = 0
|
||||
val sdf = SimpleDateFormat("yyyy-MM-dd")
|
||||
val currentDate = sdf.format(Date())
|
||||
|
||||
for (item in it.list){
|
||||
if (currentDate == item.shipped){
|
||||
for (item in it.list) {
|
||||
if (currentDate == item.shipped) {
|
||||
break
|
||||
}
|
||||
positionToday += 1
|
||||
|
|
|
@ -36,7 +36,7 @@ class HistoricoVehiculoAdapter (
|
|||
this.item = item
|
||||
val sdf = SimpleDateFormat("yyyy-MM-dd")
|
||||
val currentDate = sdf.format(Date())
|
||||
if (currentDate == item.timed){
|
||||
if (currentDate == item.inTimed){
|
||||
historicoDate.setBackgroundColor(res.getColor(R.color.verdnatura_pumpkin_orange))
|
||||
}else{
|
||||
historicoDate.setBackgroundColor(res.getColor(R.color.verdnatura_black_5))
|
||||
|
|
|
@ -16,6 +16,7 @@ import es.verdnatura.presentation.view.component.CustomDialog
|
|||
import es.verdnatura.presentation.view.component.CustomDialogInput
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.adapter.HistoricoVehiculoAdapter
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculoList
|
||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.fragment_historicovehiculo.*
|
||||
import kotlinx.android.synthetic.main.fragment_historicovehiculo.splash_progress
|
||||
|
@ -46,8 +47,9 @@ class HistoricoVehiculoFragment (
|
|||
override fun getLayoutId(): Int = R.layout.fragment_historicovehiculo
|
||||
|
||||
|
||||
override fun init() {
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||
override fun init()
|
||||
{
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
|
||||
user = prefs.getString(USER,"").toString()
|
||||
userFk=prefs.getString(USERFK,"").toString()
|
||||
password = prefs.getString(PASSWORD,"").toString()
|
||||
|
@ -55,12 +57,12 @@ class HistoricoVehiculoFragment (
|
|||
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
|
||||
customDialogInput = CustomDialogInput(requireContext())
|
||||
customDialog = CustomDialog(requireContext())
|
||||
activity!!.main_bottom_navigation.visibility = View.GONE
|
||||
requireActivity().main_bottom_navigation.visibility = View.GONE
|
||||
|
||||
|
||||
////Log.i("VERDNATURA:","la matricula es $numberPlate")
|
||||
//sergio: revisar entrypoint
|
||||
viewModel.vehicleWarehouseTimeControl_getHistorical(user,password,numberPlate,userFk)
|
||||
viewModel.machineWorker_getHistorical(user,password,numberPlate,userFk)
|
||||
toolbar_title.text = getString(R.string.vehiclediary)
|
||||
setEvents()
|
||||
super.init()
|
||||
|
@ -69,10 +71,8 @@ class HistoricoVehiculoFragment (
|
|||
|
||||
private fun setEvents(){
|
||||
backButton.setOnClickListener {
|
||||
activity!!.onBackPressed()
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
override fun observeViewModel() {
|
||||
|
@ -96,7 +96,7 @@ class HistoricoVehiculoFragment (
|
|||
val currentDate = sdf.format(Date())
|
||||
|
||||
for (item in it.list){
|
||||
if (currentDate == item.timed){
|
||||
if (currentDate == item.inTimed){
|
||||
break
|
||||
}
|
||||
positionToday += 1
|
||||
|
|
|
@ -26,8 +26,8 @@ class HistoricoVehiculoViewModel (context: Context) : BaseViewModel() {
|
|||
val loadHistoricoVehiculoList = Transformations.map(_historicovehiculoList) { Event(it) }
|
||||
|
||||
|
||||
fun vehicleWarehouseTimeControl_getHistorical(usuario:String,password:String,plateNumber:String,nameWorker:String){
|
||||
GetVehicleControlTimeUserCase.vehicleWarehouseTimeControl_getHistorical(usuario,password,plateNumber,nameWorker).enqueue(object :
|
||||
fun machineWorker_getHistorical(usuario:String,password:String,plateNumber:String,nameWorker:String){
|
||||
GetVehicleControlTimeUserCase.machineWorker_getHistorical(usuario,password,plateNumber,nameWorker).enqueue(object :
|
||||
Callback<List<ItemHistoricoVehiculo>> {
|
||||
override fun onFailure(call: Call<List<ItemHistoricoVehiculo>>, t: Throwable) {
|
||||
val listError:ArrayList<ItemHistoricoVehiculo> = ArrayList()
|
||||
|
|
|
@ -3,9 +3,9 @@ package es.verdnatura.presentation.view.feature.historicovehiculo.model
|
|||
|
||||
|
||||
class ItemHistoricoVehiculo (
|
||||
var timed:String = "",
|
||||
var workerFk:String = "",
|
||||
var direction:String = "",
|
||||
var inTimed:String = "", //timed
|
||||
var workerName:String = "",
|
||||
var outTimed:String = "",//direction
|
||||
var isError:Boolean = false,
|
||||
var errorMessage:String = ""
|
||||
)
|
||||
|
|
|
@ -69,7 +69,7 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
|
|||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
prefs = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||
prefs = requireActivity().getSharedPreferences(PREFS_USER,0)
|
||||
user = prefs!!.getString(USER,"").toString()
|
||||
password = prefs!!.getString(PASSWORD,"").toString()
|
||||
sectorFk = prefs!!.getInt(SECTORFK,1).toString()
|
||||
|
@ -108,7 +108,7 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
|
|||
|
||||
customDialogInput = CustomDialogInput(requireContext())
|
||||
customDialog = CustomDialog(requireContext())
|
||||
activity!!.main_bottom_navigation.visibility = View.GONE
|
||||
requireActivity().main_bottom_navigation.visibility = View.GONE
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
toolbar_title.text = getString(R.string.itemShelvingRadar)
|
||||
setToolBar()
|
||||
|
@ -152,7 +152,7 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
|
|||
|
||||
private fun setEvents(){
|
||||
backButton.setOnClickListener {
|
||||
activity!!.onBackPressed()
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
|
||||
filter_itemFk.setOnKeyListener { v, keyCode, event ->
|
||||
|
@ -224,12 +224,11 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
|
|||
adapter = InventoryAdapter(listInvetory,object: OnInvetoryNichoClickListener{
|
||||
override fun onInvetoryNichoClickListener(item: ItemInventaryVO) {
|
||||
|
||||
//sergio: cambiad customdialogInput pòr customdialog 6.1.4
|
||||
////Log.i("VERDNATURA:","A tirar tanto")
|
||||
//sergio: cambiado customdialogInput pòr customdialog 6.1.4
|
||||
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.itemTrash(item.itemFk,warehouseFk,user,password,item.nicho,"0")
|
||||
//viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,"0","0")
|
||||
// viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0")
|
||||
changeOfflineValue(item)
|
||||
// customDialogInput.dismiss()
|
||||
|
|
|
@ -9,8 +9,6 @@ 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
|
||||
|
@ -123,8 +121,37 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun itemStockUpdate(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String){
|
||||
//sergio: se modifica por CAU a itemTrash
|
||||
// https://cau.verdnatura.es/scp/tickets.php?id=21043 al nuevo procedimiento itemTrash
|
||||
getItemCardUserCase.itemStockUpdate(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : Callback<String>{
|
||||
//getItemCardUserCase.itemTrash(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : Callback<String>{
|
||||
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar STOCK "+itemFk+ " Respuesta:"+t.message!!)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
if (response.body() == null){
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemStockUpdate")
|
||||
}else{
|
||||
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
//sergio: se modifica por CAU a itemTrash
|
||||
fun itemTrash(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String){
|
||||
|
||||
|
||||
getItemCardUserCase.itemTrash(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : Callback<String>{
|
||||
|
||||
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar STOCK "+itemFk+ " Respuesta:"+t.message!!)
|
||||
}
|
||||
|
@ -142,5 +169,4 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
|
|||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,28 +1,19 @@
|
|||
package es.verdnatura.presentation.view.feature.login.activity
|
||||
|
||||
import android.app.admin.DeviceAdminReceiver
|
||||
import android.content.Context
|
||||
import android.net.wifi.WifiManager
|
||||
import android.os.Build
|
||||
import android.provider.Settings
|
||||
import android.util.Log
|
||||
import androidx.annotation.RequiresApi
|
||||
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.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.feature.login.fragment.LoginFragment
|
||||
|
||||
|
||||
class LoginActivity : BaseActivity<ActivityLoginBinding>() {
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.activity_login
|
||||
private lateinit var customDialog: CustomDialog
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
override fun getLayoutId(): Int = R.layout.activity_login
|
||||
|
||||
override fun init() {
|
||||
|
||||
/* val crashButton = Button(this)
|
||||
crashButton.text = "Crash!"
|
||||
crashButton.setOnClickListener {
|
||||
|
@ -32,141 +23,8 @@ class LoginActivity : BaseActivity<ActivityLoginBinding>() {
|
|||
addContentView(crashButton, ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT))*/
|
||||
/*
|
||||
val admin = DeviceAdminReceiver()
|
||||
val devicepolicymanager = admin.getManager(applicationContext)
|
||||
val name1 = admin.getWho(applicationContext)
|
||||
//Log.i("VERDNATURA:", "mac ${name1.className}")
|
||||
if (devicepolicymanager.isAdminActive(name1)) {
|
||||
val mac_address = devicepolicymanager.getWifiMacAddress(name1)
|
||||
//Log.i("VERDNATURA:", "mac $mac_address")
|
||||
}
|
||||
|
||||
|
||||
val id: String = Settings.Secure.getString(contentResolver, Settings.Secure.ANDROID_ID)
|
||||
// var c= Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);
|
||||
var myIMEI: String? = null
|
||||
try {
|
||||
|
||||
val tm = applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager
|
||||
|
||||
|
||||
myIMEI = tm.connectionInfo.toString()
|
||||
|
||||
}catch (ex:Exception) {
|
||||
//Log.i("VERDNATURA:", "el wifi_id $id ")
|
||||
|
||||
}
|
||||
|
||||
///////
|
||||
var a = Settings.Secure.getString(getContentResolver(), "bluetooth_name")
|
||||
//Log.i("VERDNATURA:", "el nombre es $a")
|
||||
try {
|
||||
var b = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
android.os.Build.getSerial()
|
||||
} else {
|
||||
|
||||
|
||||
}
|
||||
//Log.i("VERDNATURA:", "el numSerie es $b")
|
||||
|
||||
} catch (e: Exception) {
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
addFragment(LoginFragment.newInstance(),R.id.main_frame_layout,LoginFragment.TAG)
|
||||
addFragment(LoginFragment.newInstance(), R.id.main_frame_layout, LoginFragment.TAG)
|
||||
}
|
||||
}
|
||||
// val id: String = Settings.Secure.getString(contentResolver, Settings.Secure.ANDROID_ID)
|
||||
// var c= Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);
|
||||
// //Log.i("VERDNATURA:","el android_id $c")
|
||||
/*SERGIO: PARA CUANDO SE AVERIGUE EL TEMA DE ANDROID_ID:
|
||||
|
||||
requestReadPhoneStatePermission() */
|
||||
|
||||
/* private fun requestReadPhoneStatePermission(){
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
val requiredPermission: String = Manifest.permission.READ_PHONE_STATE
|
||||
val res = this!!.checkCallingOrSelfPermission(requiredPermission)
|
||||
if (res == PackageManager.PERMISSION_DENIED) {
|
||||
requestPermissions(arrayOf(requiredPermission), 102)
|
||||
}else{
|
||||
addFragment(LoginFragment.newInstance(),R.id.main_frame_layout,LoginFragment.TAG)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun onRequestPermissionsResult(
|
||||
requestCode: Int,
|
||||
permissions: Array<out String>,
|
||||
grantResults: IntArray
|
||||
) {
|
||||
if (requestCode==102 && (grantResults[0]==PackageManager.PERMISSION_GRANTED)){
|
||||
get_IMEI()
|
||||
addFragment(LoginFragment.newInstance(),R.id.main_frame_layout,LoginFragment.TAG)
|
||||
}
|
||||
|
||||
if (requestCode==102 && (grantResults[0]==PackageManager.PERMISSION_DENIED)){
|
||||
customDialog = CustomDialog(this)
|
||||
customDialog.setTitle(getString(R.string.Error)).setDescription(getString(R.string.mensajeadvertenciaIMEI))
|
||||
.setOkButton(getString(R.string.Close)) {
|
||||
|
||||
customDialog.dismiss()
|
||||
finish()
|
||||
}.show()
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun get_IMEI()
|
||||
{
|
||||
|
||||
var myIMEI: String? = null
|
||||
try
|
||||
{
|
||||
|
||||
val tm = getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
myIMEI=tm.getImei()
|
||||
} else{
|
||||
myIMEI=tm.getDeviceId()
|
||||
}
|
||||
|
||||
if (myIMEI != null)
|
||||
{
|
||||
saveIMEI(myIMEI)
|
||||
//Log.i("VERDNATURA:","Guardamos $myIMEI")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
catch (ex:Exception) {
|
||||
//Log.i("VERDNATURA:", "Error ${ex.message.toString()}")
|
||||
customDialog = CustomDialog(this)
|
||||
customDialog.setTitle(getString(R.string.Error))
|
||||
.setDescription(getString(R.string.mensajenoimei))
|
||||
.setOkButton(getString(R.string.Close)) {
|
||||
customDialog.dismiss()
|
||||
addFragment(LoginFragment.newInstance(),R.id.main_frame_layout,LoginFragment.TAG)
|
||||
}.show()
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
fun saveIMEI(myIMEI:String) {
|
||||
val prefs: SharedPreferences = this!!.getSharedPreferences("es.verdnatura.user.prefs", 0)
|
||||
val editor = prefs.edit()
|
||||
editor.putString("IMEI", myIMEI)
|
||||
editor.apply()
|
||||
}
|
||||
|
||||
}*/
|
||||
|
|
|
@ -1,41 +1,39 @@
|
|||
package es.verdnatura.presentation.view.feature.login.fragment
|
||||
|
||||
|
||||
import android.app.AlarmManager
|
||||
import android.app.PendingIntent
|
||||
import android.content.Context
|
||||
import android.content.Context.TELEPHONY_SERVICE
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import android.content.pm.PackageInfo
|
||||
import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.preference.PreferenceManager
|
||||
import android.telephony.TelephonyManager
|
||||
import android.util.Log
|
||||
//import android.preference.PreferenceManager
|
||||
import androidx.preference.PreferenceManager
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.content.ContextCompat.checkSelfPermission
|
||||
import androidx.core.content.ContextCompat.getSystemService
|
||||
import androidx.lifecycle.Observer
|
||||
import android.provider.Settings
|
||||
import android.util.Log
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentLoginBinding
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.hideKeyboard
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.feature.login.activity.LoginActivity
|
||||
import es.verdnatura.presentation.view.feature.login.model.LoginDevice
|
||||
import es.verdnatura.presentation.view.feature.login.model.LoginItemVO
|
||||
import es.verdnatura.presentation.view.feature.login.model.workerId
|
||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||
import kotlinx.android.synthetic.main.fragment_ajustes.*
|
||||
import kotlinx.android.synthetic.main.fragment_login.*
|
||||
import kotlinx.android.synthetic.main.fragment_login.splash_progress
|
||||
|
||||
import java.lang.Boolean.TRUE
|
||||
|
||||
class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginViewModel::class) {
|
||||
|
||||
private lateinit var customDialog: CustomDialog
|
||||
|
||||
companion object {
|
||||
fun newInstance() = LoginFragment()
|
||||
}
|
||||
|
@ -44,16 +42,24 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
|
||||
override fun init() {
|
||||
|
||||
|
||||
customDialog = CustomDialog(requireContext())
|
||||
saveIdentifiers()
|
||||
checkUser()
|
||||
|
||||
|
||||
|
||||
button_login.setOnClickListener(View.OnClickListener {
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
// //Log.i("VERDNATURA:","el imei pasado al login es ${getIMEI()}")
|
||||
viewModel.login(edittext_username.text.toString(), edittext_password.text.toString(),getIMEI())
|
||||
// Log.i(TD,"el imei pasado al login es ${getANDROIDID()}")
|
||||
/* viewModel.login(
|
||||
edittext_username.text.toString(),
|
||||
edittext_password.text.toString(),
|
||||
getANDROIDID()
|
||||
)*/
|
||||
|
||||
|
||||
viewModel.device_checkLogin(
|
||||
edittext_username.text.toString(),
|
||||
edittext_password.text.toString(),
|
||||
getANDROIDID()
|
||||
)
|
||||
|
||||
})
|
||||
|
||||
|
@ -71,7 +77,7 @@ 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
|
||||
//sergio: deberia lanzar la funcion nueva creada por mi restartapp de BaseFragment. Pero no vuelve a arrancar
|
||||
restartapp()
|
||||
return@OnKeyListener false
|
||||
|
||||
|
@ -80,15 +86,38 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
})
|
||||
|
||||
|
||||
textview_welcome.setOnLongClickListener {
|
||||
edittext_server.isEnabled = TRUE
|
||||
true
|
||||
}
|
||||
|
||||
//NODEJS TEST
|
||||
// Log.i("VERDNATURA:","NODEJS in")
|
||||
// viewModel.nodeJsTest("A0A3B8224DBF","ABC","1")
|
||||
|
||||
private fun checkUser(){
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER, 0)
|
||||
if (prefs.getBoolean(RECORDAR, false)){
|
||||
}
|
||||
|
||||
private fun saveIdentifiers() {
|
||||
|
||||
val resolver = requireActivity().contentResolver
|
||||
|
||||
val AndroidId: String = Settings.Secure.getString(resolver, Settings.Secure.ANDROID_ID)
|
||||
var deviceName = Settings.Secure.getString(resolver, "bluetooth_name")
|
||||
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
val editor = prefs.edit()
|
||||
editor.putString(ANDROID_ID, AndroidId)
|
||||
editor.putString(DEVICENAME, deviceName)
|
||||
editor.apply()
|
||||
|
||||
}
|
||||
|
||||
private fun checkUser() {
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
if (prefs.getBoolean(RECORDAR, false)) {
|
||||
edittext_username.setText(prefs.getString(USER, ""))
|
||||
edittext_password.setText(prefs.getString(PASSWORD, ""))
|
||||
if (edittext_password.text.toString().isNotEmpty()){
|
||||
if (edittext_password.text.toString().isNotEmpty()) {
|
||||
switch_remember.isChecked = true
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +125,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
}
|
||||
|
||||
override fun observeViewModel() {
|
||||
with(viewModel){
|
||||
with(viewModel) {
|
||||
|
||||
versionappitem.observe(viewLifecycleOwner, Observer {
|
||||
splash_progress.visibility = View.INVISIBLE
|
||||
|
@ -109,8 +138,9 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
splash_progress.visibility = View.VISIBLE
|
||||
if (it.version.equals(getInfoVersionNameApp())) {
|
||||
splash_progress.visibility = View.INVISIBLE
|
||||
goToMain()}
|
||||
else {
|
||||
goToMain()
|
||||
} else {
|
||||
|
||||
customDialog.setTitle(getString(R.string.Actualizar))
|
||||
.setDescription(getString(R.string.updatemng)).setOkButton(
|
||||
getString(
|
||||
|
@ -118,13 +148,95 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
)
|
||||
) {
|
||||
val openURL = Intent(Intent.ACTION_VIEW)
|
||||
openURL.data = Uri.parse("https://app.verdnatura.es/bin/vn-picking.apk")
|
||||
openURL.data =
|
||||
Uri.parse("https://app.verdnatura.es/bin/vn-picking.apk")
|
||||
startActivity(openURL)
|
||||
}.setKoButton("Cancelar") {
|
||||
|
||||
}
|
||||
if (it.IsVersionCritical == 1) {
|
||||
customDialog.setDescription("Se requiere actualizar la app para que funcione correctamente.")
|
||||
} else {
|
||||
customDialog.setKoButton("Cancelar") {
|
||||
customDialog.dismiss()
|
||||
goToMain()
|
||||
}
|
||||
}
|
||||
customDialog.show()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
logindevice.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.vIsAuthorized.equals("0")) {
|
||||
splash_progress.visibility = View.INVISIBLE
|
||||
// Log.i("VERDNATURA:",it.vMessage)
|
||||
|
||||
customDialog.setTitle("Error").setDescription(it.vMessage!!)
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
// goToMain()
|
||||
}.show()
|
||||
|
||||
} else {
|
||||
//sergio: se añade el log
|
||||
viewModel.worker_getId(
|
||||
edittext_username.text.toString(),
|
||||
edittext_password.text.toString()
|
||||
)
|
||||
deviceLog_add(
|
||||
edittext_username.text.toString(),
|
||||
edittext_password.text.toString(),
|
||||
"warehouse",
|
||||
getInfoVersionNameApp(),
|
||||
getANDROIDID()
|
||||
)
|
||||
|
||||
splash_progress.visibility = View.INVISIBLE
|
||||
//saveUserFkPref(it)
|
||||
if (switch_remember.isChecked) {
|
||||
saveRemember(true)
|
||||
} else {
|
||||
saveRemember(false)
|
||||
}
|
||||
|
||||
saveUserAccesPref(
|
||||
edittext_username.text.toString(),
|
||||
edittext_password.text.toString()
|
||||
)
|
||||
|
||||
|
||||
if (it.vIsAuthorized.equals("1") && it.vMessage.isNullOrEmpty()) {
|
||||
// Log.i("VERDNATURA", "Sin mensaje")
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
loginSalix(
|
||||
user = edittext_username.text.toString(),
|
||||
password = edittext_password.text.toString()
|
||||
)
|
||||
|
||||
}
|
||||
if (it.vIsAuthorized.equals("1") && !it.vMessage.isNullOrEmpty()) {
|
||||
|
||||
customDialog.setTitle("Mensaje").setDescription(it.vMessage)
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
loginSalix(
|
||||
user = edittext_username.text.toString(),
|
||||
password = edittext_password.text.toString()
|
||||
)
|
||||
}.show()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -133,6 +245,22 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
})
|
||||
|
||||
|
||||
|
||||
workerId.observe(viewLifecycleOwner, Observer {
|
||||
splash_progress.visibility = View.INVISIBLE
|
||||
if (!it.isError) {
|
||||
saveUserFkPref(it.Id.toString())
|
||||
}
|
||||
/* customDialog.setTitle("Error").setDescription(it.errorMessage)
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
} else {
|
||||
saveUserFkPref(it.Id.toString())
|
||||
}*/
|
||||
|
||||
})
|
||||
|
||||
loginitem.observe(viewLifecycleOwner, Observer {
|
||||
splash_progress.visibility = View.INVISIBLE
|
||||
if (it.isError) {
|
||||
|
@ -153,6 +281,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
edittext_username.text.toString(),
|
||||
edittext_password.text.toString()
|
||||
)
|
||||
|
||||
loginSalix(
|
||||
user = edittext_username.text.toString(),
|
||||
password = edittext_password.text.toString()
|
||||
|
@ -160,6 +289,23 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
}
|
||||
|
||||
})
|
||||
|
||||
devicelogresponse.observe(viewLifecycleOwner, Observer {
|
||||
splash_progress.visibility = View.INVISIBLE
|
||||
if (it.isError) {
|
||||
customDialog.setTitle("Error")
|
||||
.setDescription(it.errorMessage)
|
||||
.setOkButton(
|
||||
"Aceptar"
|
||||
) {
|
||||
customDialog.dismiss()
|
||||
getVersion()
|
||||
}.show()
|
||||
} else {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
loginsalixitem.observe(viewLifecycleOwner, Observer {
|
||||
splash_progress.visibility = View.INVISIBLE
|
||||
if (it.isError) {
|
||||
|
@ -210,56 +356,63 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
}
|
||||
|
||||
private fun getInfoVersionNameApp(): String {
|
||||
val manager: PackageManager = context!!.getPackageManager()
|
||||
val info: PackageInfo = manager.getPackageInfo(context!!.getPackageName(), 0)
|
||||
val manager: PackageManager = requireContext().packageManager
|
||||
val info: PackageInfo = manager.getPackageInfo(requireContext().packageName, 0)
|
||||
return info.versionName
|
||||
}
|
||||
|
||||
private fun saveTokenPref(token: String){
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER, 0)
|
||||
private fun saveTokenPref(token: String) {
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
val editor = prefs.edit()
|
||||
editor.putString(TOKEN, token)
|
||||
editor.apply()
|
||||
}
|
||||
|
||||
private fun saveUserFkPref(loginitem: LoginItemVO){
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER, 0)
|
||||
private fun saveUserFkPref(loginitem: LoginItemVO) {
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
val editor = prefs.edit()
|
||||
editor.putString(USERFK, loginitem.id)
|
||||
editor.apply()
|
||||
}
|
||||
|
||||
private fun saveUserAccesPref(user: String, password: String){
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER, 0)
|
||||
private fun saveUserFkPref(workerId: String) {
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
val editor = prefs.edit()
|
||||
editor.putString(USERFK, workerId)
|
||||
editor.apply()
|
||||
}
|
||||
|
||||
private fun saveUserAccesPref(user: String, password: String) {
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
val editor = prefs.edit()
|
||||
editor.putString(USER, user)
|
||||
editor.putString(PASSWORD, password)
|
||||
editor.apply()
|
||||
}
|
||||
|
||||
private fun saveRemember(remember: Boolean){
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER, 0)
|
||||
private fun saveRemember(remember: Boolean) {
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
val editor = prefs.edit()
|
||||
editor.putBoolean(RECORDAR, remember)
|
||||
editor.apply()
|
||||
}
|
||||
|
||||
private fun goToMain(){
|
||||
private fun goToMain() {
|
||||
val intent = Intent(activity, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
requireActivity().finish()
|
||||
}
|
||||
|
||||
private fun getVersion(){
|
||||
private fun getVersion() {
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
viewModel.checkVersion(
|
||||
user = edittext_username.text.toString(),
|
||||
password = edittext_password.text.toString(),
|
||||
nameApp = "warehouse")
|
||||
// version = versionName)
|
||||
nameApp = "warehouse"
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
fun setDefaults(key: String?, value: String?, context: Context?) {
|
||||
val preferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
val editor = preferences.edit()
|
||||
|
@ -273,7 +426,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
}
|
||||
|
||||
// sergio:creada restart en BaseFragment para AjustesFragment...
|
||||
fun restartapp(){
|
||||
fun restartapp() {
|
||||
val mStartActivity = Intent(context, LoginActivity::class.java)
|
||||
val mPendingIntentId = 123456
|
||||
val mPendingIntent = PendingIntent.getActivity(
|
||||
|
@ -282,7 +435,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
mStartActivity,
|
||||
PendingIntent.FLAG_CANCEL_CURRENT
|
||||
)
|
||||
val mgr = context!!.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||
val mgr = requireContext().getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||
mgr[AlarmManager.RTC, System.currentTimeMillis() + 100] = mPendingIntent
|
||||
System.exit(0)
|
||||
}
|
||||
|
|
|
@ -4,91 +4,243 @@ import android.content.Context
|
|||
import android.util.Log
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.google.gson.Gson
|
||||
import es.verdnatura.domain.GetLoginUserCase
|
||||
import es.verdnatura.domain.NodeJsService
|
||||
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.errorMessage
|
||||
import es.verdnatura.presentation.view.feature.login.model.versionApp
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import es.verdnatura.presentation.view.feature.login.model.*
|
||||
import org.json.JSONObject
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
import java.lang.Boolean.FALSE
|
||||
import java.lang.Boolean.TRUE
|
||||
|
||||
class LoginViewModel(context: Context) : BaseViewModel() {
|
||||
|
||||
private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase(context)
|
||||
|
||||
|
||||
private val _loginitem by lazy { MutableLiveData<LoginItemVO> ()}
|
||||
val loginitem : LiveData<LoginItemVO>
|
||||
private val _loginitem by lazy { MutableLiveData<LoginItemVO>() }
|
||||
val loginitem: LiveData<LoginItemVO>
|
||||
get() = _loginitem
|
||||
|
||||
private val _loginsalixitem by lazy { MutableLiveData<LoginSalixVO> ()}
|
||||
val loginsalixitem : LiveData<LoginSalixVO>
|
||||
private val _loginsalixitem by lazy { MutableLiveData<LoginSalixVO>() }
|
||||
val loginsalixitem: LiveData<LoginSalixVO>
|
||||
get() = _loginsalixitem
|
||||
|
||||
|
||||
private val _version by lazy { MutableLiveData<Boolean> ()}
|
||||
val version : LiveData<Boolean>
|
||||
private val _version by lazy { MutableLiveData<Boolean>() }
|
||||
val version: LiveData<Boolean>
|
||||
get() = _version
|
||||
|
||||
private val _devicelogresponse by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val devicelogresponse: LiveData<ResponseItemVO>
|
||||
get() = _devicelogresponse
|
||||
|
||||
//sergio: nueva version para actualizar
|
||||
private val _versionappitem by lazy { MutableLiveData<versionApp> ()}
|
||||
val versionappitem : LiveData<versionApp>
|
||||
private val _versionappitem by lazy { MutableLiveData<versionApp>() }
|
||||
val versionappitem: LiveData<versionApp>
|
||||
get() = _versionappitem
|
||||
|
||||
fun login(user:String,password:String,imei:String){
|
||||
getLoginUserCase.login(user,password,imei).enqueue(object : Callback<String>{
|
||||
private val _logindevice by lazy { MutableLiveData<LoginDevice>() }
|
||||
val logindevice: LiveData<LoginDevice>
|
||||
get() = _logindevice
|
||||
|
||||
private val _workerId by lazy { MutableLiveData<workerId>() }
|
||||
val workerId: LiveData<workerId>
|
||||
get() = _workerId
|
||||
|
||||
private val _nodejs by lazy { MutableLiveData<NodeJsService.SmartTagNode>() }
|
||||
val nodejs: LiveData<NodeJsService.SmartTagNode>
|
||||
get() = _nodejs
|
||||
|
||||
|
||||
fun login(user: String, password: String, androiid: String) {
|
||||
getLoginUserCase.login(user, password, androiid).enqueue(object : Callback<String> {
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
|
||||
var loginItemVO:LoginItemVO?
|
||||
if (response.raw().code() == 555){
|
||||
var message=response.raw().message().toString()
|
||||
var loginItemVO: LoginItemVO?
|
||||
if (response.raw().code() == 555) {
|
||||
var message = response.raw().message().toString()
|
||||
|
||||
if (message.contains("autorizado")){
|
||||
loginItemVO = LoginItemVO(id = "0",isError = true, errorMessage = "Usuario no autorizado para este dispositivo")
|
||||
}else{ loginItemVO = LoginItemVO(id = "0",isError = true, errorMessage = "Usuario o contraseña incorrectos")}
|
||||
if (message.contains("autorizado")) {
|
||||
loginItemVO = LoginItemVO(
|
||||
id = "0",
|
||||
isError = true,
|
||||
errorMessage = "Usuario no autorizado para este dispositivo"
|
||||
)
|
||||
} else {
|
||||
loginItemVO = LoginItemVO(
|
||||
id = "0",
|
||||
isError = true,
|
||||
errorMessage = "Usuario o contraseña incorrectos"
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
}else if (!response.body().isNullOrEmpty()){
|
||||
} else if (!response.body().isNullOrEmpty()) {
|
||||
loginItemVO = response.body()?.let { LoginItemVO(id = it) }
|
||||
}else{
|
||||
loginItemVO = LoginItemVO(id = "0",isError = true,errorMessage = "Error desconocido")
|
||||
} else {
|
||||
loginItemVO =
|
||||
LoginItemVO(id = "0", isError = true, errorMessage = "Error desconocido")
|
||||
}
|
||||
|
||||
_loginitem.value = loginItemVO!!
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
val loginItemVO : LoginItemVO? = LoginItemVO(id = "0",isError = true, errorMessage = t.message!!)
|
||||
val loginItemVO: LoginItemVO? =
|
||||
LoginItemVO(id = "0", isError = true, errorMessage = t.message!!)
|
||||
_loginitem.value = loginItemVO
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun loginSalix(user:String,password:String){
|
||||
getLoginUserCase.salixLogin(user,password).enqueue(object : Callback<LoginSalixVO>{
|
||||
fun loginSalix(user: String, password: String) {
|
||||
getLoginUserCase.salixLogin(user, password).enqueue(object : Callback<LoginSalixVO> {
|
||||
override fun onResponse(call: Call<LoginSalixVO>, response: Response<LoginSalixVO>) {
|
||||
|
||||
var loginSalixVO:LoginSalixVO?
|
||||
if(response.body() != null){
|
||||
loginSalixVO = response.body()?.token?.let { LoginSalixVO(user,password, it,isError = false,errorMessage = "") }
|
||||
}else{
|
||||
loginSalixVO = LoginSalixVO(user,password,isError = true,errorMessage = "Error al conectar con salix")
|
||||
var loginSalixVO: LoginSalixVO?
|
||||
if (response.body() != null) {
|
||||
loginSalixVO = response.body()?.token?.let {
|
||||
LoginSalixVO(
|
||||
user,
|
||||
password,
|
||||
it,
|
||||
isError = false,
|
||||
errorMessage = ""
|
||||
)
|
||||
}
|
||||
} else {
|
||||
loginSalixVO = LoginSalixVO(
|
||||
user,
|
||||
password,
|
||||
isError = true,
|
||||
errorMessage = "Error al conectar con salix"
|
||||
)
|
||||
}
|
||||
|
||||
_loginsalixitem.value = loginSalixVO
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<LoginSalixVO>, t: Throwable) {
|
||||
val loginSalixVO = LoginSalixVO(user,password, "",isError = true,errorMessage = t.message!!)
|
||||
val loginSalixVO =
|
||||
LoginSalixVO(user, password, "", isError = true, errorMessage = t.message!!)
|
||||
_loginsalixitem.value = loginSalixVO
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
fun device_checkLogin(user: String, password: String, android_id: String) {
|
||||
getLoginUserCase.device_checkLogin(user, password, android_id)
|
||||
.enqueue(object : Callback<LoginDevice> {
|
||||
override fun onResponse(call: Call<LoginDevice>, response: Response<LoginDevice>) {
|
||||
|
||||
var loginDevice: LoginDevice?
|
||||
|
||||
if (response.raw().code() == 555) {
|
||||
var message = response.raw().message().toString()
|
||||
loginDevice = LoginDevice(
|
||||
isError = true,
|
||||
errorMessage = "Usuario o contraseña incorrectos."
|
||||
)
|
||||
} else {
|
||||
|
||||
if (response.body() != null) {
|
||||
|
||||
loginDevice = response.body()?.let {
|
||||
|
||||
LoginDevice(
|
||||
it.vMessage, it.vIsAuthorized,
|
||||
isError = false,
|
||||
errorMessage = ""
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
loginDevice = LoginDevice(
|
||||
isError = true,
|
||||
errorMessage = "Error al intentar hacer login."
|
||||
)
|
||||
}
|
||||
}
|
||||
_logindevice.value = loginDevice
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<LoginDevice>, t: Throwable) {
|
||||
val loginDevice =
|
||||
LoginDevice("", "", isError = true, errorMessage = t.message!!)
|
||||
_logindevice.value = loginDevice
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun worker_getId(user: String, password: String) {
|
||||
getLoginUserCase.worker_getId(user, password)
|
||||
.enqueue(object : Callback<String> {
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
|
||||
var workerId: workerId?
|
||||
|
||||
|
||||
if (response.body() != null) {
|
||||
|
||||
workerId = workerId(
|
||||
response.body().toString(),
|
||||
isError = false,
|
||||
errorMessage = ""
|
||||
)
|
||||
|
||||
} else {
|
||||
workerId = workerId(
|
||||
isError = true,
|
||||
errorMessage = "Error al intentar obtener el id."
|
||||
)
|
||||
}
|
||||
|
||||
_workerId.value = workerId
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
val workerId =
|
||||
workerId(isError = true, errorMessage = t.message!!)
|
||||
_workerId.value = workerId
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun deviceLog_add(user: String, password: String, app: String, versionApp: String, android_id: String
|
||||
) {
|
||||
getLoginUserCase.deviceLog_add(user, password, app, versionApp, android_id)
|
||||
.enqueue(object : Callback<Void> {
|
||||
override fun onResponse(call: Call<Void>, response: Response<Void>) {
|
||||
|
||||
if (!response.isSuccessful) {
|
||||
|
||||
messageError(response.message())
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<Void>, t: Throwable) {
|
||||
|
||||
messageError(t.message!!)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun messageError(message: String) {
|
||||
_devicelogresponse.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = "Error al realizar llamada a devicelog. Descripción del error:" + message
|
||||
)
|
||||
}
|
||||
|
||||
/*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>) {
|
||||
|
@ -105,25 +257,95 @@ class LoginViewModel(context: Context) : BaseViewModel() {
|
|||
})
|
||||
}*/
|
||||
//sergio:checkVersion new
|
||||
fun checkVersion(user:String,password:String,nameApp:String){
|
||||
getLoginUserCase.checkVersion(user,password,nameApp).enqueue(object : Callback<versionApp>{
|
||||
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?
|
||||
var versionApp: versionApp?
|
||||
|
||||
if (response.body() != null) {
|
||||
|
||||
versionApp = response.body()?.let {
|
||||
|
||||
versionApp(
|
||||
it.appname,
|
||||
it.version,
|
||||
it.IsVersionCritical,
|
||||
isError = false,
|
||||
errorMessage = ""
|
||||
)
|
||||
|
||||
|
||||
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
|
||||
|
||||
} 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!!)
|
||||
val versionApp =
|
||||
versionApp(nameApp, "", isError = true, errorMessage = t.message!!)
|
||||
_versionappitem.value = versionApp
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun nodeJsTest(smarttag: String, wagon: String,shelving:String) {
|
||||
getLoginUserCase.nodeJsTest(smarttag, wagon,shelving)
|
||||
.enqueue(object : Callback<NodeJsService.SmartTagNode> {
|
||||
override fun onResponse(call: Call<NodeJsService.SmartTagNode>, response: Response<NodeJsService.SmartTagNode>) {
|
||||
|
||||
var workerId: NodeJsService.SmartTagNode?
|
||||
|
||||
|
||||
/* if (response.isSuccessful()){
|
||||
Log.i("VERDNATURA::","OK")
|
||||
}
|
||||
|
||||
if (!response.errorBody().toString().isEmpty()){
|
||||
|
||||
}*/
|
||||
|
||||
if (response.body() != null) {
|
||||
Log.i("VERDNATURA::","el valor nodejs no es nulo ")
|
||||
workerId = NodeJsService.SmartTagNode(
|
||||
response.body().toString(),
|
||||
isError = false,
|
||||
errorMessage = ""
|
||||
)
|
||||
|
||||
} else {
|
||||
workerId = NodeJsService.SmartTagNode(
|
||||
isError = true,
|
||||
errorMessage = "Error al llamar al servicio Node."
|
||||
)
|
||||
Log.i("VERDNATURA::","el valor nodejs es NULL")
|
||||
}
|
||||
|
||||
_nodejs.value = workerId
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<NodeJsService.SmartTagNode>, t: Throwable) {
|
||||
val workerId =
|
||||
NodeJsService.SmartTagNode(isError = true, errorMessage = t.message!!)
|
||||
|
||||
// Log.i("VERDNATURA::","el error nodejs es "+t.message+"--"+t.cause.toString()+"--"+t.stackTrace.toString())
|
||||
|
||||
_nodejs.value = workerId
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,30 +1,55 @@
|
|||
package es.verdnatura.presentation.view.feature.login.model
|
||||
|
||||
class LoginItemVO (
|
||||
val id:String = "",
|
||||
var isError:Boolean = false,
|
||||
var errorMessage:String = ""
|
||||
|
||||
|
||||
class LoginItemVO(
|
||||
val id: String = "",
|
||||
var isError: Boolean = false,
|
||||
var errorMessage: String = ""
|
||||
)
|
||||
|
||||
class LoginSalixVO (
|
||||
val user:String = "",
|
||||
val password:String = "",
|
||||
val token:String = "",
|
||||
var isError:Boolean = false,
|
||||
var errorMessage:String = ""
|
||||
class LoginSalixVO(
|
||||
val user: String = "",
|
||||
val password: String = "",
|
||||
val token: String = "",
|
||||
var isError: Boolean = false,
|
||||
var errorMessage: String = ""
|
||||
)
|
||||
|
||||
class SalixMessageVO (
|
||||
val workerId:Int = 0,
|
||||
val message:String = "",
|
||||
val token:String = "",
|
||||
var isError:Boolean = false,
|
||||
var errorMessage:String = ""
|
||||
class SalixMessageVO(
|
||||
val workerId: Int = 0,
|
||||
val message: String = "",
|
||||
val token: String = "",
|
||||
var isError: Boolean = false,
|
||||
var errorMessage: String = ""
|
||||
)
|
||||
|
||||
class SalixGrupo(
|
||||
val to: String = "",
|
||||
val message: String = ""
|
||||
|
||||
)
|
||||
|
||||
|
||||
class versionApp(
|
||||
val appname:String="",
|
||||
val version:String="",
|
||||
var isError:Boolean = false,
|
||||
val errorMessage:String=""
|
||||
val appname: String = "",
|
||||
val version: String = "",
|
||||
var IsVersionCritical: Int = 0,
|
||||
var isError: Boolean = false,
|
||||
var errorMessage: String = ""
|
||||
)
|
||||
|
||||
class LoginDevice(
|
||||
val vMessage: String? = "",
|
||||
val vIsAuthorized: String = "",
|
||||
var isError: Boolean = false,
|
||||
var errorMessage: String = ""
|
||||
|
||||
)
|
||||
|
||||
class workerId(
|
||||
val Id: String? = "",
|
||||
var isError: Boolean = false,
|
||||
var errorMessage: String = ""
|
||||
|
||||
)
|
|
@ -1,11 +1,11 @@
|
|||
package es.verdnatura.presentation.view.feature.main.activity
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import android.util.Log
|
||||
import android.view.Menu
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import es.verdnatura.BuildConfig
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.ActivityMainBinding
|
||||
import es.verdnatura.domain.ConstAndValues.MAINACTIVITY
|
||||
|
@ -14,21 +14,22 @@ 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.articulo.fragment.ItemProposalFragment
|
||||
import es.verdnatura.presentation.view.feature.buffer.fragment.BufferFragment
|
||||
import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemFragment
|
||||
import es.verdnatura.presentation.view.feature.calidad.fragment.BuyersFragment
|
||||
import es.verdnatura.presentation.view.feature.calidad.fragment.QaualityFragment
|
||||
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragment
|
||||
import es.verdnatura.presentation.view.feature.controlador.fragment.ControladorFragment
|
||||
import es.verdnatura.presentation.view.feature.controlador.fragment.WebFragment
|
||||
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoFragment
|
||||
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoUsuarioFragment
|
||||
import es.verdnatura.presentation.view.feature.faltas.fragment.FaltasFragment
|
||||
import es.verdnatura.presentation.view.feature.historico.fragment.HistoricoFragment
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoFragment
|
||||
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryFragment
|
||||
import es.verdnatura.presentation.view.feature.main.model.ItemMenuVO
|
||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPalletDetailFragment
|
||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPalletFragment
|
||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanFragment
|
||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionTruckListFragment
|
||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.*
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
|
||||
import es.verdnatura.presentation.view.feature.parking.fragment.ParkingFragment
|
||||
|
@ -36,71 +37,134 @@ import es.verdnatura.presentation.view.feature.pasillero.fragment.PasilleroFragm
|
|||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
import es.verdnatura.presentation.view.feature.precontrol.PreControladorFragment
|
||||
import es.verdnatura.presentation.view.feature.presacador.fragment.PreSacadorFragment
|
||||
import es.verdnatura.presentation.view.feature.qr.QrFragment
|
||||
import es.verdnatura.presentation.view.feature.reposicion.fragment.ReposicionFragment
|
||||
import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorFragment
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import es.verdnatura.presentation.view.feature.shelvingparking.fragment.ShelvingParkingFragment
|
||||
import es.verdnatura.presentation.view.feature.smarttag.register.RegisterSmartTagsFragment
|
||||
import es.verdnatura.presentation.view.feature.smarttag.sacador.fragment.AssociateSmartTagsFragment
|
||||
import es.verdnatura.presentation.view.feature.ubicador.fragment.AutomaticAddItemFragment
|
||||
import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorFragment
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import timber.log.Timber
|
||||
|
||||
|
||||
class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClickListener,
|
||||
OnTruckClickListener, OnPalletClickListener,OnComprobarPalletViewClickListener,OnCollectionSelectedListener,OnBuyerSelectedListener {
|
||||
class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickListener,
|
||||
OnTruckClickListener, OnPalletClickListener, OnComprobarPalletViewClickListener,
|
||||
OnCollectionSelectedListener, OnBuyerSelectedListener {
|
||||
|
||||
private var lastBottomMenuItemSelected: ItemMenuVO? = null
|
||||
private lateinit var customDialog: CustomDialog
|
||||
var firstItem : ItemMenuVO? = null
|
||||
var firstItem: ItemMenuVO? = null
|
||||
var fm = supportFragmentManager
|
||||
var TAG="MainActivity"
|
||||
var TAG = "MainActivity"
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.activity_main
|
||||
|
||||
|
||||
override fun init() {
|
||||
customDialog = CustomDialog(this)
|
||||
setBottomMenu()
|
||||
if(haveSector()) addFragment(PasilleroFragment.newInstance(),R.id.main_frame_layout, PasilleroFragment.TAG,false)
|
||||
else addFragment(AjustesFragment.newInstance(),R.id.main_frame_layout, AjustesFragment.TAG,false)
|
||||
if (haveSector()) addFragment(
|
||||
PasilleroFragment.newInstance("Verdnatura"),
|
||||
R.id.main_frame_layout,
|
||||
PasilleroFragment.TAG,
|
||||
false
|
||||
)
|
||||
else addFragment(
|
||||
AjustesFragment.newInstance(),
|
||||
R.id.main_frame_layout,
|
||||
AjustesFragment.TAG,
|
||||
false
|
||||
)
|
||||
|
||||
// sergio: de esta manera se eliminan los logs de lanzamiento
|
||||
if (BuildConfig.DEBUG) {
|
||||
Timber.plant(Timber.DebugTree())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private fun haveSector() : Boolean{
|
||||
val prefs: SharedPreferences = getSharedPreferences("es.verdnatura.user.prefs",0)
|
||||
val sectorFk = prefs.getInt("sectorFk",-1)
|
||||
private fun haveSector(): Boolean {
|
||||
val prefs: SharedPreferences = getSharedPreferences("es.verdnatura.user.prefs", 0)
|
||||
val sectorFk = prefs.getInt("sectorFk", -1)
|
||||
return sectorFk != -1
|
||||
}
|
||||
|
||||
private fun setBottomMenu(){
|
||||
private fun setBottomMenu() {
|
||||
val bottomMenu = main_bottom_navigation
|
||||
bottomMenu.itemIconTintList = null
|
||||
GlobalScope.launch(Dispatchers.Main){
|
||||
val bottomMenuItems : ArrayList<ItemMenuVO> = ArrayList()
|
||||
GlobalScope.launch(Dispatchers.Main) {
|
||||
val bottomMenuItems: ArrayList<ItemMenuVO> = ArrayList()
|
||||
|
||||
bottomMenuItems.add(ItemMenuVO(0,title = getString(R.string.Pasilleros),defaultImage = ContextCompat.getDrawable(
|
||||
applicationContext,R.drawable.ic_device_hub_black_24dp),selectedImage = ContextCompat.getDrawable(
|
||||
applicationContext,R.drawable.ic_device_hub_black_24dp_selected)))
|
||||
bottomMenuItems.add(
|
||||
ItemMenuVO(
|
||||
0,
|
||||
title = getString(R.string.Pasilleros),
|
||||
defaultImage = ContextCompat.getDrawable(
|
||||
applicationContext, R.drawable.ic_device_hub_black_24dp
|
||||
),
|
||||
selectedImage = ContextCompat.getDrawable(
|
||||
applicationContext, R.drawable.ic_device_hub_black_24dp_selected
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
bottomMenuItems.add(ItemMenuVO(1,title = getString(R.string.Sacadores),defaultImage = ContextCompat.getDrawable(
|
||||
applicationContext,R.drawable.ic_local_florist_black_24dp),selectedImage = ContextCompat.getDrawable(
|
||||
applicationContext,R.drawable.ic_local_florist_black_24dp_selected)))
|
||||
bottomMenuItems.add(
|
||||
ItemMenuVO(
|
||||
1,
|
||||
title = getString(R.string.Sacadores),
|
||||
defaultImage = ContextCompat.getDrawable(
|
||||
applicationContext, R.drawable.ic_local_florist_black_24dp
|
||||
),
|
||||
selectedImage = ContextCompat.getDrawable(
|
||||
applicationContext, R.drawable.ic_local_florist_black_24dp_selected
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
bottomMenuItems.add(ItemMenuVO(2,title = getString(R.string.Controladores),defaultImage = ContextCompat.getDrawable(
|
||||
applicationContext,R.drawable.ic_verified_user_black_24dp),selectedImage = ContextCompat.getDrawable(
|
||||
applicationContext,R.drawable.ic_verified_user_black_24dp_selected)))
|
||||
bottomMenuItems.add(
|
||||
ItemMenuVO(
|
||||
2,
|
||||
title = getString(R.string.Controladores),
|
||||
defaultImage = ContextCompat.getDrawable(
|
||||
applicationContext, R.drawable.ic_verified_user_black_24dp
|
||||
),
|
||||
selectedImage = ContextCompat.getDrawable(
|
||||
applicationContext, R.drawable.ic_verified_user_black_24dp_selected
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
bottomMenuItems.add(ItemMenuVO(3,title = getString(R.string.Paletizadores),defaultImage = ContextCompat.getDrawable(
|
||||
applicationContext,R.drawable.ic_local_shipping_black_24dp),selectedImage = ContextCompat.getDrawable(
|
||||
applicationContext,R.drawable.ic_local_shipping_black_24dp_selected)))
|
||||
bottomMenuItems.add(
|
||||
ItemMenuVO(
|
||||
3,
|
||||
title = getString(R.string.Paletizadores),
|
||||
defaultImage = ContextCompat.getDrawable(
|
||||
applicationContext, R.drawable.pallet_shipping_black
|
||||
),
|
||||
selectedImage = ContextCompat.getDrawable(
|
||||
applicationContext, R.drawable.pallet_shipping_selected
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
bottomMenuItems.add(ItemMenuVO(4,title = getString(R.string.Ajustes),defaultImage = ContextCompat.getDrawable(
|
||||
applicationContext,R.drawable.ic_build_black_24dp),selectedImage = ContextCompat.getDrawable(
|
||||
applicationContext,R.drawable.ic_build_black_24dp_selected)))
|
||||
|
||||
bottomMenuItems.add(
|
||||
ItemMenuVO(
|
||||
4,
|
||||
title = getString(R.string.Ajustes),
|
||||
defaultImage = ContextCompat.getDrawable(
|
||||
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 {
|
||||
|
@ -108,13 +172,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
|||
}
|
||||
|
||||
|
||||
if(haveSector()){
|
||||
if (haveSector()) {
|
||||
// Select first item by default
|
||||
firstItem = bottomMenuItems.first()
|
||||
bottomMenu.selectedItemId = firstItem!!.id
|
||||
bottomMenu.menu.findItem(firstItem!!.id).icon = firstItem!!.selectedImage
|
||||
lastBottomMenuItemSelected = firstItem
|
||||
}else{
|
||||
} else {
|
||||
// Select last item by default
|
||||
val lastItem = bottomMenuItems.last()
|
||||
bottomMenu.selectedItemId = lastItem.id
|
||||
|
@ -136,34 +200,64 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
|||
|
||||
when (selectedItemMenu?.title) {
|
||||
getString(R.string.Pasilleros) -> {
|
||||
fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
delete_Fragments()
|
||||
addFragment(PasilleroFragment.newInstance(),R.id.main_frame_layout, PasilleroFragment.TAG,false)
|
||||
addFragment(
|
||||
PasilleroFragment.newInstance("Verdnatura"),
|
||||
R.id.main_frame_layout,
|
||||
PasilleroFragment.TAG,
|
||||
false
|
||||
)
|
||||
true
|
||||
}
|
||||
getString(R.string.Sacadores) -> {
|
||||
fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
delete_Fragments()
|
||||
// addFragment(SacadorFragment.newInstance(),R.id.main_frame_layout, SacadorFragment.TAG,false)
|
||||
addFragment(ControlVehiculoFragment.newInstance(MAINACTIVITY),R.id.main_frame_layout, MAINACTIVITY.TAG,false)
|
||||
addFragment(
|
||||
ControlVehiculoFragment.newInstance(MAINACTIVITY),
|
||||
R.id.main_frame_layout,
|
||||
MAINACTIVITY.TAG,
|
||||
false
|
||||
)
|
||||
true
|
||||
}
|
||||
getString(R.string.Controladores) -> {
|
||||
fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
addFragment(ControladorFragment.newInstance(),R.id.main_frame_layout, ControladorFragment.TAG,false)
|
||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
delete_Fragments()
|
||||
addFragment(
|
||||
ControladorFragment.newInstance(),
|
||||
R.id.main_frame_layout,
|
||||
ControladorFragment.TAG,
|
||||
false
|
||||
)
|
||||
|
||||
true
|
||||
}
|
||||
getString(R.string.Paletizadores) -> {
|
||||
fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
addFragment(ExpeditionTruckListFragment.newInstance(),R.id.main_frame_layout, ExpeditionTruckListFragment.TAG,false)
|
||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
delete_Fragments()
|
||||
//addFragment(ExpeditionTruckListFragment.newInstance(),R.id.main_frame_layout, ExpeditionTruckListFragment.TAG,false)
|
||||
addFragment(
|
||||
PasilleroFragment.newInstance("Paletizadores"),
|
||||
R.id.main_frame_layout,
|
||||
PasilleroFragment.TAG,
|
||||
false
|
||||
)
|
||||
|
||||
true
|
||||
}
|
||||
getString(R.string.Ajustes) -> {
|
||||
fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
addFragment(AjustesFragment.newInstance(),R.id.main_frame_layout, AjustesFragment.TAG,false)
|
||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
delete_Fragments()
|
||||
addFragment(
|
||||
AjustesFragment.newInstance(),
|
||||
R.id.main_frame_layout,
|
||||
AjustesFragment.TAG,
|
||||
false
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
else -> false
|
||||
}
|
||||
|
||||
|
@ -177,9 +271,9 @@ 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
|
||||
///Log.i("VERDNATURA:", "si esta ${it.tag.toString()}")
|
||||
var fragment: Fragment? = supportFragmentManager.findFragmentByTag(it.tag.toString())
|
||||
if (fragment != null) supportFragmentManager
|
||||
.beginTransaction().remove(fragment)
|
||||
.commit()
|
||||
}
|
||||
|
@ -187,24 +281,58 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
|||
|
||||
override fun onPasillerosItemClickListener(item: PasillerosItemVO, entryPoint: String) {
|
||||
|
||||
|
||||
when (item.title){
|
||||
when (item.title) {
|
||||
|
||||
"Asociar Sacador SmartTags" -> {
|
||||
addFragmentOnTop(AssociateTagsFragment.newInstance(entryPoint))
|
||||
addFragmentOnTop(AssociateSmartTagsFragment.newInstance(getString(R.string.SmarttagAssociate)))
|
||||
}
|
||||
|
||||
"Registrar SmartTags" -> {
|
||||
addFragmentOnTop(RegisterSmartTagsFragment.newInstance(entryPoint))
|
||||
}
|
||||
|
||||
//BUFFERS
|
||||
"Paletizar" -> {
|
||||
addFragmentOnTop(ExpeditionTruckListFragment.newInstance())
|
||||
}
|
||||
"Consultar expedición" -> {
|
||||
// addFragment(ExpeditionStateFragment.newInstance(entryPoint),R.id.main_frame_layout, ExpeditionTruckListFragment.TAG,false)
|
||||
addFragmentOnTop(ExpeditionStateFragment.newInstance(entryPoint))
|
||||
}
|
||||
"Escanear expedición" -> {
|
||||
addFragmentOnTop(ExpeditionScanSorterFragment.newInstance(item.title))
|
||||
}
|
||||
|
||||
"Gestión de buffers" -> {
|
||||
addFragmentOnTop(PasilleroFragment.newInstance("Gestión de buffer"))
|
||||
}
|
||||
|
||||
"Control de usuario de vehículo" -> {
|
||||
addFragmentOnTop(ControlVehiculoUsuarioFragment.newInstance(entryPoint))
|
||||
}
|
||||
|
||||
"Pre Sacador" -> {
|
||||
addFragmentOnTop(PreSacadorFragment.newInstance())
|
||||
}
|
||||
"Ver Ticket" -> {
|
||||
addFragmentOnTop(PreControladorFragment.newInstance())
|
||||
}
|
||||
"Historial del vehículo" -> {
|
||||
addFragmentOnTop(ControlVehiculoFragment.newInstance(HistoricoVehiculoFragment.TAG))
|
||||
// fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
// addFragment(HistoricoVehiculoFragment.newInstance(entryPoint),R.id.main_frame_layout, ControladorFragment.TAG,false)
|
||||
}
|
||||
"Reposición" -> {
|
||||
addFragmentOnTop(ReposicionFragment.newInstance())
|
||||
}
|
||||
"Consultar artículo" -> {
|
||||
addFragmentOnTop(ItemCardFragment.newInstance(entryPoint))
|
||||
}
|
||||
//sergio:no visible desde el menú inicio
|
||||
"Buscar artículos similares" -> {
|
||||
addFragmentOnTop(ItemProposalFragment.newInstance(entryPoint))
|
||||
}
|
||||
|
||||
"Parking" -> {
|
||||
addFragmentOnTop(ParkingFragment.newInstance())
|
||||
}
|
||||
|
@ -214,14 +342,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
|||
// "Buscar item full" -> {
|
||||
// addFragmentOnTop(BuscarItemAllFragment.newInstance(entryPoint))
|
||||
// }
|
||||
|
||||
"Historico" -> {
|
||||
addFragmentOnTop(HistoricoFragment.newInstance(entryPoint))
|
||||
}
|
||||
|
||||
//segio: esta opción no se muestra, solo es accesible para añadir fragmentos de otras partes.
|
||||
"Historico Vehículo" -> {
|
||||
addFragmentOnTop(HistoricoVehiculoFragment.newInstance(entryPoint))
|
||||
// fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
// addFragment(HistoricoVehiculoFragment.newInstance(entryPoint),R.id.main_frame_layout, ControladorFragment.TAG,false)
|
||||
}
|
||||
"Inventario" -> {
|
||||
addFragmentOnTop(InventaryFragment.newInstance())
|
||||
|
@ -245,15 +372,35 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
|||
addFragmentOnTop(SacadorFragment.newInstance())
|
||||
}
|
||||
|
||||
|
||||
//Web fragment
|
||||
"Visor web" -> {
|
||||
addFragmentOnTop(WebFragment.newInstance("Visor web"))
|
||||
}
|
||||
Log.i("Item: ",item.title)
|
||||
//Menu qr
|
||||
"Lector Qr" -> {
|
||||
addFragmentOnTop(QrFragment.newInstance("Lector Qr"))
|
||||
}
|
||||
|
||||
//Menu buffer
|
||||
"Vaciado buffer" -> {
|
||||
addFragmentOnTop(BufferFragment.newInstance("Vaciado buffer"))
|
||||
}
|
||||
"Llenado buffer" -> {
|
||||
addFragmentOnTop(BufferFragment.newInstance("Llenado buffer"))
|
||||
}
|
||||
"Acumulación buffer" -> {
|
||||
addFragmentOnTop(BufferFragment.newInstance("Acumulación buffer"))
|
||||
}
|
||||
"Desactivado buffer" -> {
|
||||
addFragmentOnTop(BufferFragment.newInstance("Desactivado buffer"))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun addFragmentOnTop(fragment: Fragment?) {
|
||||
|
||||
|
||||
supportFragmentManager
|
||||
.beginTransaction()
|
||||
.replace(R.id.main_frame_layout, fragment!!)
|
||||
|
@ -261,21 +408,23 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
|||
.commitAllowingStateLoss()
|
||||
}
|
||||
|
||||
|
||||
override fun onBackPressed() {
|
||||
|
||||
try{
|
||||
try {
|
||||
fm.executePendingTransactions()
|
||||
}catch (e:Exception){}
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
|
||||
if (fm.backStackEntryCount > 0) {
|
||||
|
||||
fm.popBackStackImmediate()
|
||||
|
||||
}else {
|
||||
customDialog.setTitle("Cerrar sesión").setDescription("¿Estás seguro de cerrar la sesión?").setOkButton("Salir"){
|
||||
} else {
|
||||
customDialog.setTitle("Cerrar sesión")
|
||||
.setDescription("¿Estás seguro de cerrar la sesión?").setOkButton("Salir") {
|
||||
customDialog.dismiss()
|
||||
finish()
|
||||
|
||||
}.setKoButton("Cancelar") {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
|
@ -285,12 +434,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
|||
|
||||
override fun onTruckClickListener(item: ItemExpeditionTruckVO, entryPoint: String) {
|
||||
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 onPalletClickListener(itemTruck: ItemExpeditionTruckVO, itemPallet: ItemPalletVO) {
|
||||
addFragmentOnTop(ExpeditionScanFragment.newInstance(itemTruck, itemPallet))
|
||||
|
||||
}
|
||||
|
||||
|
@ -299,14 +447,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
|||
itemPallet: ItemPalletVO
|
||||
) {
|
||||
|
||||
addFragmentOnTop(ExpeditionPalletDetailFragment.newInstance(itemTruck,itemPallet))
|
||||
addFragmentOnTop(ExpeditionPalletDetailFragment.newInstance(itemTruck, itemPallet))
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun onCollectionSelected(collection: CollectionVO,type:String) {
|
||||
override fun onCollectionSelected(collection: CollectionVO, type: String) {
|
||||
// fm.popBackStack()
|
||||
addFragmentOnTop(CollectionFragment.newInstance(collection,type))
|
||||
addFragmentOnTop(CollectionFragment.newInstance(collection, type))
|
||||
|
||||
}
|
||||
|
||||
|
@ -314,19 +461,38 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
|||
addFragmentOnTop(QaualityFragment.newInstance(userFk))
|
||||
}
|
||||
|
||||
fun onVehicleSelected(tag:String) {
|
||||
fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
addFragmentOnTop(ControlVehiculoFragment.newInstance(tag))
|
||||
fun onVehicleSelected(tag: String) {
|
||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
addFragment(
|
||||
ControlVehiculoFragment.newInstance(tag),
|
||||
R.id.main_frame_layout,
|
||||
ControlVehiculoFragment.TAG,
|
||||
false
|
||||
)
|
||||
//sergio: de esta manera la llamada del fragment no se vuelve a repetir.
|
||||
// addFragmentOnTop(ControlVehiculoFragment.newInstance(tag))
|
||||
}
|
||||
|
||||
fun openFragmentPickers(){
|
||||
fun openFragmentPickers() {
|
||||
//delete_Fragments()
|
||||
fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
addFragment(SacadorFragment.newInstance(),R.id.main_frame_layout, SacadorFragment.TAG,false)
|
||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
addFragment(
|
||||
SacadorFragment.newInstance(),
|
||||
R.id.main_frame_layout,
|
||||
SacadorFragment.TAG,
|
||||
false
|
||||
)
|
||||
//addFragmentOnTop(SacadorFragment.newInstance())
|
||||
|
||||
}
|
||||
|
||||
fun openFragmentExpeditionState() {
|
||||
//delete_Fragments()
|
||||
// fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
// addFragment(ExpeditionStateFragment.newInstance("main"),R.id.main_frame_layout, ExpeditionStateFragment.TAG,false)
|
||||
|
||||
addFragmentOnTop(ExpeditionStateFragment.newInstance("main"))
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package es.verdnatura.presentation.view.feature.paletizador.adapter
|
||||
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import es.verdnatura.databinding.ItemExpeditionstateRowBinding
|
||||
import es.verdnatura.presentation.common.OnItemExpeditionStateRowClickListener
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionStateRow
|
||||
|
||||
class ExpeditionStateAdapter (
|
||||
private val items: List<ItemExpeditionStateRow>,
|
||||
private val OnItemExpeditionStateRowClickListener: OnItemExpeditionStateRowClickListener
|
||||
): RecyclerView.Adapter<ExpeditionStateAdapter.ItemHolder> () {
|
||||
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
|
||||
return ItemHolder(
|
||||
//ItemCardRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
|
||||
ItemExpeditionstateRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
|
||||
)
|
||||
}
|
||||
|
||||
override fun getItemCount() =items.size
|
||||
|
||||
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
|
||||
holder.bind(items[position])
|
||||
if (items[position].isEditable){
|
||||
holder.binding.root.setOnClickListener {
|
||||
OnItemExpeditionStateRowClickListener.OnItemExpeditionStateRowClickListener(items[position])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ItemHolder(
|
||||
val binding: ItemExpeditionstateRowBinding
|
||||
) : RecyclerView.ViewHolder(binding.root){
|
||||
private val res = binding.root.context.resources
|
||||
fun bind(item: ItemExpeditionStateRow) {
|
||||
binding.apply {
|
||||
if (item.barcodes.isNotEmpty()){
|
||||
item.value = ""
|
||||
item.barcodes.forEach {
|
||||
item.value = item.value + it.code + "\n"
|
||||
}
|
||||
}
|
||||
this.item = item
|
||||
/* if (item.isEditable){
|
||||
itemImage.visibility = View.VISIBLE
|
||||
itemRowLayout.setBackgroundColor(res.getColor(R.color.verdnatura_black_5))
|
||||
}else{
|
||||
itemImage.visibility = View.INVISIBLE
|
||||
itemRowLayout.setBackgroundColor(res.getColor(R.color.verdnatura_black_9))
|
||||
}*/
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -59,7 +59,7 @@ class ExpeditionPalletDetailFragment(
|
|||
override fun getLayoutId(): Int = R.layout.fragment_expedition_pallet_detail
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
|
||||
user = prefs.getString(USER,"").toString()
|
||||
password = prefs.getString(PASSWORD,"").toString()
|
||||
sectorFk = prefs.getInt(SECTORFK,1).toString()
|
||||
|
@ -74,7 +74,7 @@ class ExpeditionPalletDetailFragment(
|
|||
customDialogList = CustomDialogList(requireContext())
|
||||
expedition_pallet_detail_pallet.text = "Pallet "+itemPallet!!.Pallet
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
activity!!.main_bottom_navigation.visibility = View.GONE
|
||||
requireActivity().main_bottom_navigation.visibility = View.GONE
|
||||
toolbar_title.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino
|
||||
setToolBar()
|
||||
setEvents()
|
||||
|
@ -84,11 +84,11 @@ class ExpeditionPalletDetailFragment(
|
|||
|
||||
private fun setEvents(){
|
||||
backButton.setOnClickListener {
|
||||
activity!!.onBackPressed()
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
|
||||
button_ok.setOnClickListener {
|
||||
activity!!.onBackPressed()
|
||||
requireActivity().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
|
||||
|
@ -131,7 +131,7 @@ class ExpeditionPalletDetailFragment(
|
|||
val df = SimpleDateFormat("yyyy-mm-dd HH:mm")
|
||||
val df2 = SimpleDateFormat("HH:mm")
|
||||
c.time = df.parse(date)
|
||||
return df2.format(c.time);
|
||||
return df2.format(c.time)
|
||||
}
|
||||
|
||||
override fun observeViewModel() {
|
||||
|
@ -146,7 +146,7 @@ class ExpeditionPalletDetailFragment(
|
|||
customDialog.dismiss()
|
||||
}.show()
|
||||
}else{
|
||||
activity!!.onBackPressed()
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ class ExpeditionPalletFragment(
|
|||
override fun getLayoutId(): Int = R.layout.fragment_expedition_pallet
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
|
||||
user = prefs.getString(USER,"").toString()
|
||||
password = prefs.getString(PASSWORD,"").toString()
|
||||
sectorFk = prefs.getInt(SECTORFK,1).toString()
|
||||
|
@ -84,7 +84,7 @@ class ExpeditionPalletFragment(
|
|||
customDialog = CustomDialog(requireContext())
|
||||
customDialogList = CustomDialogList(requireContext())
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
activity!!.main_bottom_navigation.visibility = View.GONE
|
||||
requireActivity().main_bottom_navigation.visibility = View.GONE
|
||||
toolbar_title.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino
|
||||
setToolBar()
|
||||
setEvents()
|
||||
|
@ -95,7 +95,7 @@ class ExpeditionPalletFragment(
|
|||
|
||||
private fun setEvents(){
|
||||
backButton.setOnClickListener {
|
||||
activity!!.onBackPressed()
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ class ExpeditionPalletFragment(
|
|||
val df = SimpleDateFormat("yyyy-mm-dd HH:mm")
|
||||
val df2 = SimpleDateFormat("HH:mm")
|
||||
c.time = df.parse(date)
|
||||
return df2.format(c.time);
|
||||
return df2.format(c.time)
|
||||
}
|
||||
|
||||
override fun observeViewModel() {
|
||||
|
@ -155,12 +155,12 @@ class ExpeditionPalletFragment(
|
|||
|
||||
if (it.response=="0") {
|
||||
|
||||
//"Rutas iguales ${it.response}".toast(activity!!)
|
||||
//"Rutas iguales ${it.response}".toast(requireActivity())
|
||||
////Log.i("VERDNATURA:","Rutas iguales")
|
||||
}
|
||||
if (it.response=="1"){
|
||||
mperror?.start()
|
||||
// "Resultado llamada $it.response".toast(activity!!)
|
||||
// "Resultado llamada $it.response".toast(requireActivity())
|
||||
////Log.i("VERDNATURA:","Rutas distintas")
|
||||
|
||||
}}
|
||||
|
@ -234,7 +234,7 @@ class ExpeditionPalletFragment(
|
|||
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());
|
||||
viewModel.checkRouteExpeditionScanPut(user,password,it.list.get(0).palletFk,customDialogList.getValue())
|
||||
}else{
|
||||
if (mperror != null) mperror!!.start()
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
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
|
||||
|
|
|
@ -68,7 +68,7 @@ class ExpeditionScanFragment (
|
|||
override fun getLayoutId(): Int = R.layout.fragment_expedition_scan
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
|
||||
user = prefs.getString(USER,"").toString()
|
||||
password = prefs.getString(PASSWORD,"").toString()
|
||||
sectorFk = prefs.getInt(SECTORFK,1).toString()
|
||||
|
@ -84,7 +84,7 @@ class ExpeditionScanFragment (
|
|||
customDialogTwoButtons = CustomDialogTwoButtons(requireContext())
|
||||
expedition_scan_detail_pallet.text = "Pallet "+itemPalletVO!!.Pallet
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
activity!!.main_bottom_navigation.visibility = View.GONE
|
||||
requireActivity().main_bottom_navigation.visibility = View.GONE
|
||||
toolbar_title.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino
|
||||
setToolBar()
|
||||
setEvents()
|
||||
|
@ -94,7 +94,7 @@ class ExpeditionScanFragment (
|
|||
|
||||
private fun setEvents(){
|
||||
backButton.setOnClickListener {
|
||||
activity!!.onBackPressed()
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ class ExpeditionScanFragment (
|
|||
val df = SimpleDateFormat("yyyy-mm-dd HH:mm")
|
||||
val df2 = SimpleDateFormat("HH:mm")
|
||||
c.time = df.parse(date)
|
||||
return df2.format(c.time);
|
||||
return df2.format(c.time)
|
||||
}
|
||||
|
||||
override fun observeViewModel() {
|
||||
|
@ -157,12 +157,12 @@ class ExpeditionScanFragment (
|
|||
|
||||
if (it.response=="0") {
|
||||
|
||||
//"Rutas iguales ${it.response}".toast(activity!!)
|
||||
//"Rutas iguales ${it.response}".toast(requireActivity())
|
||||
////Log.i("VERDNATURA:","Rutas iguales")
|
||||
}
|
||||
if (it.response=="1"){
|
||||
mperror?.start()
|
||||
// "Resultado llamada $it.response".toast(activity!!)
|
||||
// "Resultado llamada $it.response".toast(requireActivity())
|
||||
// customDialog.setTitle("Rutas distintas").setDescription(it.response).setOkButton("Cerrar"){
|
||||
// customDialog.dismiss()
|
||||
// }.show()
|
||||
|
@ -214,7 +214,8 @@ class ExpeditionScanFragment (
|
|||
}
|
||||
|
||||
private fun showScanExpeditions(it: ItemScanList){
|
||||
//Log.i("VERDNATURA:","muestra expediciones y a escanear")
|
||||
//sergio para smarttags:
|
||||
// Log.i("VERDNATURA:","muestra expediciones y a escanear")
|
||||
listExpeditions = ArrayList()
|
||||
splash_progress.visibility = View.GONE
|
||||
it.list.forEach {
|
||||
|
@ -302,7 +303,7 @@ class ExpeditionScanFragment (
|
|||
|
||||
private fun checkRouteExpeditionScanPut(user: String, password: String, palletFk: String, expedition: String){
|
||||
|
||||
viewModel.checkRouteExpeditionScanPut(user,password,palletFk,expedition);
|
||||
viewModel.checkRouteExpeditionScanPut(user,password,palletFk,expedition)
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,175 @@
|
|||
package es.verdnatura.presentation.view.feature.paletizador.fragment
|
||||
|
||||
import android.content.SharedPreferences
|
||||
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
|
||||
import es.verdnatura.databinding.FragmentExpeditionscanSorterBinding
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.*
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.component.CustomDialogList
|
||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||
import es.verdnatura.presentation.view.feature.smarttag.adapter.SmartTagAdapter
|
||||
import es.verdnatura.presentation.view.feature.smarttag.model.SmartTag
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.component_custom_three_dialog.*
|
||||
import kotlinx.android.synthetic.main.fragment_collection.*
|
||||
import kotlinx.android.synthetic.main.fragment_controlador.*
|
||||
import kotlinx.android.synthetic.main.fragment_controlador.splash_progress
|
||||
import kotlinx.android.synthetic.main.fragment_expedition_scan.*
|
||||
import kotlinx.android.synthetic.main.fragment_login.*
|
||||
import kotlinx.android.synthetic.main.fragment_sacador.*
|
||||
import kotlinx.android.synthetic.main.fragment_sacador_associatesmarttag.*
|
||||
import kotlinx.android.synthetic.main.toolbar.*
|
||||
|
||||
class ExpeditionScanSorterFragment(
|
||||
var entryPoint: String = ""
|
||||
) : BaseFragment<FragmentExpeditionscanSorterBinding, ExpeditionScanSorterViewModel>(
|
||||
ExpeditionScanSorterViewModel::class
|
||||
) {
|
||||
|
||||
private var user = ""
|
||||
private var password = ""
|
||||
private var goBack: Boolean = false
|
||||
override fun getLayoutId(): Int = R.layout.fragment_expeditionscan_sorter
|
||||
private lateinit var customDialog: CustomDialog
|
||||
private lateinit var customDialogList: CustomDialogList
|
||||
private var listExpeditionScan: ArrayList<SmartTag> = ArrayList()
|
||||
private var expeditionScanAdapter: SmartTagAdapter? = null
|
||||
private var itemScaned: String = ""
|
||||
|
||||
companion object {
|
||||
fun newInstance(entryPoint: String) = ExpeditionScanSorterFragment(entryPoint)
|
||||
}
|
||||
|
||||
override fun init() {
|
||||
|
||||
customDialog = CustomDialog(requireContext())
|
||||
customDialogList = CustomDialogList(requireContext())
|
||||
|
||||
goBack = false
|
||||
requireActivity().main_bottom_navigation.visibility = GONE
|
||||
splash_progress.visibility = GONE
|
||||
|
||||
setEvents()
|
||||
setToolBar()
|
||||
showExpeditionScan()
|
||||
super.init()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
goBack = true
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
private fun setToolBar() {
|
||||
|
||||
toolbar_title.text = entryPoint
|
||||
|
||||
}
|
||||
|
||||
private fun expeditionscan(ExpeditionScan: String) {
|
||||
|
||||
splash_progress.visibility = VISIBLE
|
||||
viewModel.expedition_scan(user, password, ExpeditionScan)
|
||||
itemScaned = ExpeditionScan
|
||||
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
user = prefs.getString(USER, "").toString()
|
||||
password = prefs.getString(PASSWORD, "").toString()
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
}
|
||||
|
||||
private fun setEvents() {
|
||||
|
||||
backButton.setOnClickListener {
|
||||
requireActivity().onBackPressed()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun observeViewModel() {
|
||||
|
||||
with(viewModel) {
|
||||
splash_progress.visibility = GONE
|
||||
responsescan.observe(viewLifecycleOwner, Observer {
|
||||
|
||||
if (it.isError) {
|
||||
|
||||
customDialog.setTitle("Error").setDescription(it.errorMessage)
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
} else {
|
||||
|
||||
listExpeditionScan.add(SmartTag(itemScaned, itemScaned))
|
||||
customDialogList.setDescription("Total:" + listExpeditionScan.size)
|
||||
expeditionScanAdapter!!.notifyItemInserted(listExpeditionScan.size-1)
|
||||
customDialogList.setValue("")
|
||||
|
||||
}
|
||||
splash_progress.visibility = GONE
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun showExpeditionScan() {
|
||||
|
||||
customDialogList.setTitle("Escanea expediciones que no han pasado por el Sorter")
|
||||
.setOkButton("Finalizar") {
|
||||
|
||||
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
|
||||
|
||||
/* if (listExpeditionScan.size > 0) {
|
||||
customDialogList.dismiss()
|
||||
backButton.performClick()
|
||||
|
||||
} else {*/
|
||||
customDialogList.dismiss()
|
||||
backButton.performClick()
|
||||
|
||||
// }
|
||||
|
||||
}.setValue("").show()
|
||||
|
||||
|
||||
customDialogList.getEditText().requestFocus()
|
||||
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
|
||||
|
||||
customDialogList.getEditText().setOnEditorActionListener { _, actionId, _ ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) {
|
||||
if (customDialogList.getValue().isNotEmpty()) {
|
||||
expeditionscan(customDialogList.getValue())
|
||||
}
|
||||
customDialogList.setValue("")
|
||||
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
expeditionScanAdapter =
|
||||
SmartTagAdapter(listExpeditionScan, object : OnSmartTagRowClickListener {
|
||||
override fun OnSmartTagRowClickListener(item: SmartTag) {
|
||||
}
|
||||
}, showDelete = false)
|
||||
customDialogList.getRecyclerView().adapter = expeditionScanAdapter
|
||||
customDialogList.getRecyclerView().layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package es.verdnatura.presentation.view.feature.paletizador.fragment
|
||||
|
||||
import android.content.Context
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.GetPaletizadoresUserCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class ExpeditionScanSorterViewModel(context: Context) : BaseViewModel() {
|
||||
|
||||
private val GetPaletizadoresUserCase: GetPaletizadoresUserCase = GetPaletizadoresUserCase(context)
|
||||
|
||||
private val _responsescan by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responsescan: LiveData<ResponseItemVO>
|
||||
get() = _responsescan
|
||||
|
||||
|
||||
fun expedition_scan(usuario:String,password:String,vExpeditionId:String){
|
||||
GetPaletizadoresUserCase.expedition_scan(usuario,password,vExpeditionId).enqueue(object : Callback<Void>{
|
||||
override fun onFailure(call: Call<Void>, t: Throwable) {
|
||||
|
||||
_responsescan.value = messageError(t.message!!,"expedition_scan")
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Void>, response: Response<Void>) {
|
||||
|
||||
if (!response.isSuccessful){
|
||||
_responsescan.value = messageError(response.message(),"expedition_scan")
|
||||
}else{
|
||||
_responsescan.value = ResponseItemVO(isError = false,response = response.message()!!)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun messageError(message: String,call: String ): ResponseItemVO {
|
||||
return ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = "Error al llamar a " + call + " . Descripción del error:" + message
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
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
|
||||
|
|
|
@ -0,0 +1,174 @@
|
|||
package es.verdnatura.presentation.view.feature.paletizador.fragment
|
||||
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
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.FragmentExpeditionstateBinding
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.OnItemExpeditionStateRowClickListener
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.feature.imageview.activity.ImageViewActivity
|
||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||
import es.verdnatura.presentation.view.feature.paletizador.adapter.ExpeditionStateAdapter
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionStateRow
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.itemExpedetionState
|
||||
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.edit_itemFk
|
||||
import kotlinx.android.synthetic.main.fragment_item_card.itemcard_image
|
||||
import kotlinx.android.synthetic.main.fragment_item_card.itemcard_layout
|
||||
import kotlinx.android.synthetic.main.fragment_item_card.splash_progress
|
||||
import kotlinx.android.synthetic.main.fragment_itemexpeditionstate_card.*
|
||||
import kotlinx.android.synthetic.main.toolbar.*
|
||||
|
||||
class ExpeditionStateFragment(
|
||||
var entryPoint: String = ""
|
||||
) : BaseFragment<FragmentExpeditionstateBinding, ExpeditionStateViewModel>(ExpeditionStateViewModel::class) {
|
||||
|
||||
private var urlLarge: String = ""
|
||||
private var titleImage: String = ""
|
||||
private var user = ""
|
||||
private var password = ""
|
||||
private var warehouseFk = ""
|
||||
private var adapter: ExpeditionStateAdapter? = null
|
||||
private var listItemsRow: ArrayList<ItemExpeditionStateRow> = ArrayList()
|
||||
private var itemScan = ""
|
||||
|
||||
companion object {
|
||||
fun newInstance(entryPoint: String) = ExpeditionStateFragment(entryPoint)
|
||||
}
|
||||
|
||||
private lateinit var customDialog: CustomDialog
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.fragment_itemexpeditionstate_card
|
||||
|
||||
override fun init() {
|
||||
itemcard_layout.visibility = View.GONE
|
||||
customDialog = CustomDialog(requireContext())
|
||||
|
||||
setEvents()
|
||||
setToolBar(getString(R.string.ExpeditionState))
|
||||
super.init()
|
||||
}
|
||||
|
||||
|
||||
private fun setToolBar(title: String) {
|
||||
toolbar_title.text = title
|
||||
}
|
||||
|
||||
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()) {
|
||||
getExpedtionState(edit_itemFk.text.toString())
|
||||
itemScan = edit_itemFk.text.toString()
|
||||
}
|
||||
edit_itemFk.setText("")
|
||||
(activity as MainActivity).hideKeyboard(edit_itemFk)
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
|
||||
backButton.setOnClickListener {
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
|
||||
itemcard_image.setOnClickListener {
|
||||
val i: Intent = Intent(activity, ImageViewActivity::class.java)
|
||||
i.putExtra("url", urlLarge)
|
||||
i.putExtra("title", titleImage)
|
||||
startActivity(i)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun getExpedtionState(expeditionFk: String) {
|
||||
val prefs: SharedPreferences = requireActivity().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.expedition_getStateJSON(expeditionFk, user!!, password!!)
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun observeViewModel() {
|
||||
with(viewModel) {
|
||||
// itemcard.observe(viewLifecycleOwner, Observer {
|
||||
itemexpedition.observe(viewLifecycleOwner, Observer {
|
||||
splash_progress.visibility = View.GONE
|
||||
if (it.isError) {
|
||||
itemcard_layout.visibility = View.GONE
|
||||
toolbar_title.text = "Estado de la expedición"
|
||||
customDialog.setTitle("Error")
|
||||
.setDescription("No se ha podido obtener el estado de la expedición escaneada. ")
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
} else {
|
||||
|
||||
if (it != null) {
|
||||
itemcard_layout.visibility = View.VISIBLE
|
||||
setItemExpeditionState(it)
|
||||
|
||||
|
||||
} else {
|
||||
itemcard_layout.visibility = View.GONE
|
||||
toolbar_title.text = "Estado de la expedición"
|
||||
customDialog.setTitle("Sin resultados")
|
||||
.setDescription("No hemos podido encontrar el estado de la expedición.")
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun setItemExpeditionState(itemInfo: itemExpedetionState) {
|
||||
setToolBar(getString(R.string.expedition) + itemScan)
|
||||
|
||||
listItemsRow = ArrayList()
|
||||
for (i in itemInfo.list) {
|
||||
listItemsRow.add(
|
||||
ItemExpeditionStateRow(
|
||||
title = i.key,
|
||||
value = i.value.replace(".0",""),
|
||||
isEditable = false
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
adapter = ExpeditionStateAdapter(listItemsRow, object :
|
||||
OnItemExpeditionStateRowClickListener {
|
||||
override fun OnItemExpeditionStateRowClickListener(item: ItemExpeditionStateRow) {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
itemexpeditionstate_recyclerview.adapter = adapter
|
||||
itemexpeditionstate_recyclerview.layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,191 @@
|
|||
package es.verdnatura.presentation.view.feature.paletizador.fragment
|
||||
|
||||
|
||||
import android.content.Context
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.airbnb.lottie.parser.IntegerParser
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.JsonObject
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import es.verdnatura.domain.GetPaletizadoresUserCase
|
||||
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.ItemPackingTypeList
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.itemExpedetionState
|
||||
//import es.verdnatura.presentation.view.feature.paletizador.model.itemExpeditionDynamicsList
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.itemsExpeditionDynamics
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
|
||||
class ExpeditionStateViewModel(context: Context) : BaseViewModel() {
|
||||
private val GetPaletizadoresUserCase: GetPaletizadoresUserCase =
|
||||
GetPaletizadoresUserCase(context)
|
||||
val version: String = "5.0.0"
|
||||
|
||||
private val _itemcard by lazy { MutableLiveData<ItemCardVO>() }
|
||||
val itemcard: LiveData<ItemCardVO>
|
||||
get() = _itemcard
|
||||
|
||||
|
||||
private val _itemexpeditionlist by lazy { MutableLiveData<itemExpedetionState>() }
|
||||
val itemexpeditionlist: LiveData<itemExpedetionState>
|
||||
get() = _itemexpeditionlist
|
||||
|
||||
|
||||
private val _itemexpedition by lazy { MutableLiveData<itemExpedetionState>() }
|
||||
val itemexpedition: LiveData<itemExpedetionState>
|
||||
get() = _itemexpedition
|
||||
|
||||
|
||||
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val response: LiveData<ResponseItemVO>
|
||||
get() = _response
|
||||
|
||||
private val _itemspackinglist by lazy { MutableLiveData<ItemPackingTypeList>() }
|
||||
val itemspackinglist: LiveData<ItemPackingTypeList>
|
||||
get() = _itemspackinglist
|
||||
|
||||
private val _itemsExpeditionlist by lazy { MutableLiveData<ItemPackingTypeList>() }
|
||||
val itemsExpeditionlist: LiveData<ItemPackingTypeList>
|
||||
get() = _itemsExpeditionlist
|
||||
|
||||
|
||||
|
||||
|
||||
/* fun expedition_getState(expeditionFk: String, user: String, password: String) {
|
||||
GetPaletizadoresUserCase.expedition_getState(user, password, expeditionFk)
|
||||
.enqueue(object : Callback<itemExpedetionState> {
|
||||
|
||||
|
||||
|
||||
|
||||
override fun onFailure(call: Call<itemExpedetionState>, t: Throwable) {
|
||||
_itemexpedition.value = itemExpedetionState(
|
||||
isError = true,
|
||||
errorMessage = "Error al obtener " + expeditionFk + " Respuesta:" + t.message!!
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<itemExpedetionState>,
|
||||
response: Response<itemExpedetionState>
|
||||
) {
|
||||
if (response.body() != null) {
|
||||
_itemexpedition.value = response.body()!!
|
||||
|
||||
Log.i(
|
||||
"VERDNATURA:",
|
||||
"el resultado sin JSOBJECT es ${response.body().toString()}"
|
||||
)
|
||||
} else {
|
||||
_itemexpedition.value = itemExpedetionState(
|
||||
isError = true,
|
||||
errorMessage = "Error al obtener el estado de la expedición"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}*/
|
||||
|
||||
fun expedition_getStateJSON(expeditionFk: String, user: String, password: String) {
|
||||
GetPaletizadoresUserCase.expedition_getStateJSON(user, password, expeditionFk)
|
||||
.enqueue(object : Callback<JsonObject> {
|
||||
override fun onFailure(call: Call<JsonObject>, t: Throwable) {
|
||||
|
||||
var listProperties: MutableList<itemsExpeditionDynamics> = mutableListOf()
|
||||
|
||||
_itemexpedition.value = itemExpedetionState(
|
||||
isError = true,
|
||||
errorMessage = "Error al obtener " + expeditionFk + " Respuesta:" + t.message!!, list= listProperties
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<JsonObject>, response: Response<JsonObject>) {
|
||||
|
||||
|
||||
var listProperties: MutableList<itemsExpeditionDynamics> = mutableListOf()
|
||||
|
||||
if (response.body() != null) {
|
||||
|
||||
Log.i(
|
||||
"VERDNATURA:",
|
||||
"El resultado con JSONOBJECT es ${response.body()}"
|
||||
)
|
||||
//var list = getListFromJSON(response.body()!!.asJsonObject)
|
||||
listProperties=getListFromJSON(response.body()!!.asJsonObject)
|
||||
/* for (i in list) {
|
||||
/* if (TextUtils.isDigitsOnly(i.value)){
|
||||
(i.value.toInt())
|
||||
println("Convertido" + i.key + i.value.toInt())
|
||||
}else{println(i.key + i.value)}*/
|
||||
println("esta en " + i.value.indexOf(".0"))
|
||||
if (i.value.indexOf(".0")>-1){
|
||||
println(java.lang.String.format(i.value,"%i"))
|
||||
}
|
||||
// println("Sin convertir :" + i.key + java.lang.String.format(i.value.replace(".0","")))
|
||||
}*/
|
||||
|
||||
_itemexpedition.value = itemExpedetionState(
|
||||
isError = false,
|
||||
errorMessage = "Error al obtener el estado de la expedición",list = listProperties)
|
||||
|
||||
let {
|
||||
Log.i(
|
||||
"VERDNATURA:",
|
||||
"El resultado con JSONOBJECT es ${it.toString()}"
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
_itemexpedition.value = itemExpedetionState(
|
||||
isError = true,
|
||||
errorMessage = "Error al obtener el estado de la expedición",list = listProperties
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
/* private fun jsonToMap(json: JsonObject): Map<String, String> {
|
||||
val map: MutableMap<String, String> = linkedMapOf()
|
||||
for (key in js("Object").keys(json)) {
|
||||
map.put(key, json[key] as String)
|
||||
}
|
||||
return map
|
||||
}*/
|
||||
fun getListFromJSON(json: JsonObject): MutableList<itemsExpeditionDynamics> {
|
||||
val gson = Gson()
|
||||
var list = mutableListOf<itemsExpeditionDynamics>()
|
||||
|
||||
// val mapType = object : TypeToken<Map<String, Any>>() {}.type
|
||||
|
||||
var expeditionState: Map<String, Any> =
|
||||
gson.fromJson(json, object : TypeToken<Map<String, Any>>() {}.type)
|
||||
expeditionState.forEach {
|
||||
|
||||
list.add(itemsExpeditionDynamics(key=it.key,value=it.value.toString()))
|
||||
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -15,11 +15,13 @@ import es.verdnatura.domain.notNull
|
|||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||
import es.verdnatura.presentation.common.OnTruckClickListener
|
||||
import es.verdnatura.presentation.common.TAG
|
||||
import es.verdnatura.presentation.view.component.CustomDialogHour
|
||||
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.ExpeditionListAdapter
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckList
|
||||
import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorFragment
|
||||
import kotlinx.android.synthetic.main.fragment_expedition_truck_list.*
|
||||
import kotlinx.android.synthetic.main.toolbar.*
|
||||
import java.text.SimpleDateFormat
|
||||
|
@ -52,7 +54,7 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
|
|||
override fun getLayoutId(): Int = R.layout.fragment_expedition_truck_list
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
|
||||
user = prefs.getString(USER,"").toString()
|
||||
password = prefs.getString(PASSWORD,"").toString()
|
||||
sectorFk = prefs.getInt(SECTORFK,1).toString()
|
||||
|
@ -75,8 +77,13 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
|
|||
val listIcons:ArrayList<Drawable> = ArrayList()
|
||||
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
|
||||
val iconPlus : Drawable = resources.getDrawable(R.drawable.ic_add_black_24dp,resources.newTheme())
|
||||
val iconState : Drawable = resources.getDrawable(R.drawable.ic_visibility_white_24dp,resources.newTheme())
|
||||
|
||||
listIcons.add(iconState)
|
||||
listIcons.add(iconReload)
|
||||
listIcons.add(iconPlus)
|
||||
|
||||
|
||||
toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
|
||||
override fun onOptionsItemSelected(item: Drawable) {
|
||||
if (item == iconReload){
|
||||
|
@ -85,6 +92,9 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
|
|||
}else if(item == iconPlus){
|
||||
addTruck()
|
||||
}
|
||||
if (item == iconState){
|
||||
(activity as MainActivity).openFragmentExpeditionState()
|
||||
}
|
||||
}
|
||||
})
|
||||
toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package es.verdnatura.presentation.view.feature.paletizador.model
|
||||
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
||||
|
||||
class ItemExpeditionTruckVO (
|
||||
var truckFk:String = "",
|
||||
var ETD:String = "",
|
||||
|
@ -13,3 +16,42 @@ class ItemExpeditionTruckList(
|
|||
var list: List<ItemExpeditionTruckVO> = listOf()
|
||||
)
|
||||
|
||||
class itemExpedetionState(
|
||||
/* var ticket: String = "",
|
||||
var cliente : String = "",
|
||||
var ciudad : String = "",
|
||||
var provincia : String ="",
|
||||
var zonaTicket : String = "",
|
||||
var zonaRuta : String = "",
|
||||
var ruta : String ="",
|
||||
var ubicacion : String="",
|
||||
var ETD : String="",
|
||||
var camion : String="",
|
||||
var ticketsPendientes : String= "",
|
||||
var etiquetasTotales : String = "",
|
||||
var etiquetasEscaneadas : String="",*/
|
||||
var isError:Boolean = false,
|
||||
var errorMessage:String = "",
|
||||
var list:MutableList<itemsExpeditionDynamics>
|
||||
|
||||
)
|
||||
|
||||
class itemsExpeditionDynamics(
|
||||
var key: String = "",
|
||||
var value:String = ""
|
||||
)
|
||||
/*
|
||||
class itemExpeditionDynamicsList(
|
||||
var list: List<itemsExpeditionDynamics> = listOf()
|
||||
)
|
||||
|
||||
class itemExpedetionStateList (
|
||||
var list: List<itemExpedetionState> = listOf()
|
||||
)*/
|
||||
class ItemExpeditionStateRow (
|
||||
var title:String? = "",
|
||||
var value:String? = "",
|
||||
var isEditable:Boolean = true,
|
||||
var action:String = "",
|
||||
var barcodes: List<BarcodeVO> = listOf()
|
||||
)
|
||||
|
|
|
@ -63,7 +63,7 @@ class ParkingFragment : BaseFragment<FragmentParkingBinding,ParkingViewModel>(Pa
|
|||
}
|
||||
|
||||
backButton.setOnClickListener {
|
||||
activity!!.onBackPressed()
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ class ParkingFragment : BaseFragment<FragmentParkingBinding,ParkingViewModel>(Pa
|
|||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
|
||||
user = prefs.getString(USER,"").toString()
|
||||
password = prefs.getString(PASSWORD,"").toString()
|
||||
sectorFk = prefs.getInt(SECTORFK,1).toString()
|
||||
|
|
|
@ -13,12 +13,14 @@ import kotlinx.android.synthetic.main.activity_main.*
|
|||
import kotlinx.android.synthetic.main.fragment_pasillero.*
|
||||
import kotlinx.android.synthetic.main.toolbar.*
|
||||
|
||||
class PasilleroFragment : BaseFragment<FragmentPasilleroBinding,PasilleroViewModel>(PasilleroViewModel::class){
|
||||
class PasilleroFragment(
|
||||
var tagName: String = ""
|
||||
) : BaseFragment<FragmentPasilleroBinding, PasilleroViewModel>(PasilleroViewModel::class) {
|
||||
|
||||
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
||||
|
||||
companion object {
|
||||
fun newInstance() = PasilleroFragment()
|
||||
fun newInstance(tagName: String) = PasilleroFragment(tagName)
|
||||
}
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
|
@ -29,26 +31,42 @@ class PasilleroFragment : BaseFragment<FragmentPasilleroBinding,PasilleroViewMod
|
|||
override fun getLayoutId(): Int = R.layout.fragment_pasillero
|
||||
|
||||
override fun init() {
|
||||
activity!!.main_bottom_navigation.visibility = View.VISIBLE
|
||||
toolbar_title.text = "Verdnatura"
|
||||
requireActivity().main_bottom_navigation.visibility = View.VISIBLE
|
||||
// toolbar_title.text = "Paletizadores"
|
||||
toolbar_title.text = tagName
|
||||
backButton.visibility = View.GONE
|
||||
super.init()
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
||||
if (tagName.equals("Verdnatura")) {
|
||||
viewModel.inititializeDefaultData()
|
||||
}
|
||||
|
||||
if (tagName.equals("Paletizadores")) {
|
||||
viewModel.inititializeDefaultPallet()
|
||||
|
||||
}
|
||||
|
||||
if (tagName.equals("Gestión de buffer")) {
|
||||
viewModel.inititializeDefaultBuffer()
|
||||
|
||||
}
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
override fun observeViewModel() {
|
||||
with(viewModel){
|
||||
pasilleros_items.adapter = PasillerosAdapter(pasillerositem,pasillerosItemClickListener!!)
|
||||
pasilleros_items.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
with(viewModel) {
|
||||
|
||||
pasilleros_items.adapter =
|
||||
PasillerosAdapter(pasillerositem, pasillerosItemClickListener!!)
|
||||
pasilleros_items.layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
}
|
||||
|
||||
super.observeViewModel()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package es.verdnatura.presentation.view.feature.pasillero.fragment
|
||||
|
||||
|
||||
import android.content.Context
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
|
@ -11,16 +10,24 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
|
|||
val pasillerositem: List<PasillerosItemVO>
|
||||
get() = _pasillerositem
|
||||
|
||||
|
||||
fun inititializeDefaultData() {
|
||||
|
||||
/* _pasillerositem.add(
|
||||
PasillerosItemVO(20,
|
||||
R.drawable.barcode_scan,
|
||||
"Visor web",R.string.SmarttagAssociate)
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(20,
|
||||
R.drawable.ic_loyalty_black_24dp,
|
||||
R.drawable.barcode_scan,
|
||||
"Asociar Sacador SmartTags",R.string.SmarttagAssociate)
|
||||
)
|
||||
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(21,
|
||||
R.drawable.barcode,
|
||||
"Registrar SmartTags",R.string.SmarttagRegister)
|
||||
)
|
||||
*/
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(7,
|
||||
R.drawable.ic_streetview_black_24dp,
|
||||
|
@ -28,33 +35,58 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
|
|||
)
|
||||
//sergio para que aparezca el nuevo menu
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(10,
|
||||
PasillerosItemVO(
|
||||
10,
|
||||
R.drawable.ic_visibility_black_24dp,
|
||||
"Ver Ticket",R.string.verticket)
|
||||
"Ver Ticket", R.string.verticket
|
||||
)
|
||||
)
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(7,
|
||||
PasillerosItemVO(
|
||||
22,
|
||||
R.drawable.car_info,
|
||||
"Historial del vehículo", R.string.vehiclediary
|
||||
)
|
||||
)
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
7,
|
||||
R.drawable.ic_baseline_all_inbox_24,
|
||||
"Reposición",R.string.reposicion)
|
||||
"Reposición", R.string.reposicion
|
||||
)
|
||||
)
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(0,
|
||||
PasillerosItemVO(
|
||||
0,
|
||||
R.drawable.ic_loyalty_black_24dp,
|
||||
"Consultar artículo",R.string.ConsultarArticulo)
|
||||
"Consultar artículo", R.string.ConsultarArticulo
|
||||
)
|
||||
)
|
||||
/* _pasillerositem.add(
|
||||
PasillerosItemVO(30,
|
||||
R.drawable.ic_loyalty_black_24dp,
|
||||
"Consultar expedición",R.string.ExpeditionState)
|
||||
)*/
|
||||
|
||||
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(6,
|
||||
PasillerosItemVO(
|
||||
6,
|
||||
R.drawable.ic_local_parking_orange_24dp,
|
||||
"Parking",R.string.Parking)
|
||||
"Parking", R.string.Parking
|
||||
)
|
||||
)
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(2,
|
||||
PasillerosItemVO(
|
||||
2,
|
||||
R.drawable.ic_visibility_black_24dp,
|
||||
"Buscar item",R.string.BuscarItem)
|
||||
"Buscar item", R.string.BuscarItem
|
||||
)
|
||||
)
|
||||
|
||||
//sergio: pruebas cau item buscar
|
||||
|
@ -65,37 +97,124 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
|
|||
)*/
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(1,
|
||||
PasillerosItemVO(
|
||||
1,
|
||||
R.drawable.ic_dashboard_black_24dp,
|
||||
"Ubicador",R.string.Ubicador)
|
||||
"Ubicador", R.string.Ubicador
|
||||
)
|
||||
)
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(3,
|
||||
PasillerosItemVO(
|
||||
3,
|
||||
R.drawable.ic_spa_black_24dp,
|
||||
"Inventario",R.string.Inventario)
|
||||
"Inventario", R.string.Inventario
|
||||
)
|
||||
)
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(4,
|
||||
PasillerosItemVO(
|
||||
4,
|
||||
R.drawable.ic_move_to_inbox_black_24dp,
|
||||
"Faltas",R.string.Faltas)
|
||||
"Faltas", R.string.Faltas
|
||||
)
|
||||
)
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(5,
|
||||
PasillerosItemVO(
|
||||
5,
|
||||
R.drawable.ic_send_black_24dp,
|
||||
"Shelving Parking",R.string.ShelvingParking)
|
||||
"Shelving Parking", R.string.ShelvingParking
|
||||
)
|
||||
)
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(8,
|
||||
PasillerosItemVO(
|
||||
8,
|
||||
R.drawable.ic_baseline_star_24,
|
||||
"Calidad",R.string.Calidad)
|
||||
"Calidad", R.string.Calidad
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
}
|
||||
|
||||
fun inititializeDefaultPallet() {
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
30,
|
||||
R.drawable.pallet_shipping_selected,
|
||||
"Paletizar", R.string.PalletMake
|
||||
)
|
||||
)
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
31,
|
||||
R.drawable.ic_visibility_black_24dp,
|
||||
"Consultar expedición", R.string.ExpeditionState
|
||||
)
|
||||
)
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
40,
|
||||
R.drawable.barcode_scan,
|
||||
"Escanear expedición", R.string.ExpeditionScan
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
32,
|
||||
R.drawable.buffer_outline,
|
||||
"Gestión de buffers", R.string.BuffersManegement
|
||||
)
|
||||
)
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
33,
|
||||
R.drawable.qrcode_scan,
|
||||
"Lector Qr", R.string.QrReader
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
fun inititializeDefaultBuffer() {
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
30,
|
||||
R.drawable.buffer_empty,
|
||||
"Vaciado buffer", R.string.bufferempty
|
||||
)
|
||||
)
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
31,
|
||||
R.drawable.buffer_fill,
|
||||
"Llenado buffer", R.string.bufferfill
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
32,
|
||||
R.drawable.buffer_accumulation,
|
||||
"Acumulación buffer", R.string.bufferaccumulate
|
||||
)
|
||||
)
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
31,
|
||||
R.drawable.buffer_off,
|
||||
"Desactivado buffer", R.string.bufferoff
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,4 +5,5 @@ class PasillerosItemVO (
|
|||
var iconResource: Int = 0,
|
||||
val title: String = "",
|
||||
val titleToShow:Int = 0
|
||||
|
||||
)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue