Merge branch 'dev_6078'

# Conflicts:
#	app/build.gradle
This commit is contained in:
Sergio De la torre 2024-10-21 12:18:12 +02:00
commit bdbe219549
54 changed files with 2218 additions and 2379 deletions

View File

@ -4,75 +4,71 @@
<uses-feature <uses-feature
android:name="android.hardware.telephony" android:name="android.hardware.telephony"
android:required="false" /> android:required="false" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CALL_PHONE" /> <uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.PREVENT_POWER_KEY" /> <uses-permission android:name="android.permission.PREVENT_POWER_KEY" />
<uses-permission android:name="android.permission.LAUNCH_APPS" /> <uses-permission android:name="android.permission.LAUNCH_APPS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!--
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"
tools:ignore="ProtectedPermissions" />
<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> <application
<provider android:authorities="oem_info" /> android:name=".MobileApplication"
</queries>--> android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<activity
android:name=".presentation.view.feature.articulo.fragment.ImageViewActivity"
android:configChanges="orientation"
android:screenOrientation="portrait" />
<activity
android:name=".presentation.view.feature.restaurant.RestaurantActivity"
android:configChanges="orientation"
android:screenOrientation="portrait" />
<activity
android:name=".presentation.view.feature.main.activity.MainActivity"
android:configChanges="orientation"
android:exported="true"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name=".presentation.view.feature.delivery.activity.SignedActivity"
android:configChanges="orientation"
android:exported="true"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name=".presentation.view.feature.login.activity.LoginActivity"
android:configChanges="orientation"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<application <category android:name="android.intent.category.LAUNCHER" />
android:name=".MobileApplication" </intent-filter>
android:allowBackup="true" <intent-filter>
android:icon="@mipmap/ic_launcher" <action android:name="android.intent.action.SEND" />
android:label="@string/app_name" <category android:name="android.intent.category.DEFAULT" />
android:roundIcon="@mipmap/ic_launcher_round" <data android:mimeType="image/*" />
android:supportsRtl="true" </intent-filter>
android:theme="@style/AppTheme" </activity>
android:usesCleartextTraffic="true">
<activity android:name=".presentation.view.feature.articulo.fragment.ImageViewActivity" android:configChanges="orientation"
android:screenOrientation="portrait"/>
<activity
android:name=".presentation.view.feature.main.activity.MainActivity"
android:windowSoftInputMode="stateHidden|adjustResize"
android:configChanges="orientation"
android:screenOrientation="portrait"
android:exported="true"/>
<activity
android:name=".presentation.view.feature.delivery.activity.SignedActivity"
android:windowSoftInputMode="stateHidden|adjustResize"
android:configChanges="orientation"
android:screenOrientation="portrait"
android:exported="true"/>
<activity
android:name=".presentation.view.feature.login.activity.LoginActivity"
android:configChanges="orientation"
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <provider
</intent-filter> android:name="androidx.core.content.FileProvider"
<intent-filter> android:authorities="${applicationId}.provider"
<action android:name="android.intent.action.SEND" /> android:exported="false"
<category android:name="android.intent.category.DEFAULT" /> android:grantUriPermissions="true">
<data android:mimeType="image/*" /> <meta-data
</intent-filter> android:name="android.support.FILE_PROVIDER_PATHS"
</activity> android:resource="@xml/file_paths" />
<provider </provider>
android:name="androidx.core.content.FileProvider" </application>
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
</manifest> </manifest>

View File

@ -20,6 +20,7 @@ import es.verdnatura.domain.ConstAndValues.BASE_URL_SALIX
import es.verdnatura.domain.ConstAndValues.ENTRYID import es.verdnatura.domain.ConstAndValues.ENTRYID
import es.verdnatura.domain.ConstAndValues.ENTRYOBSERVATIONORIGINAL import es.verdnatura.domain.ConstAndValues.ENTRYOBSERVATIONORIGINAL
import es.verdnatura.domain.ConstAndValues.ENTRYOBSERVATIONS import es.verdnatura.domain.ConstAndValues.ENTRYOBSERVATIONS
import es.verdnatura.domain.ConstAndValues.ITEMPACKING
import es.verdnatura.domain.ConstAndValues.NUMBEROFWAGONS import es.verdnatura.domain.ConstAndValues.NUMBEROFWAGONS
import es.verdnatura.domain.ConstAndValues.PRINTERFK import es.verdnatura.domain.ConstAndValues.PRINTERFK
import es.verdnatura.domain.ConstAndValues.PRINTERFKDEFAULT import es.verdnatura.domain.ConstAndValues.PRINTERFKDEFAULT
@ -28,6 +29,7 @@ import es.verdnatura.domain.ConstAndValues.RESERVATIONMODE
import es.verdnatura.domain.ConstAndValues.SECTORDESCRIP import es.verdnatura.domain.ConstAndValues.SECTORDESCRIP
import es.verdnatura.domain.ConstAndValues.SECTORFK import es.verdnatura.domain.ConstAndValues.SECTORFK
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.SECTORISONRESERVATIONMODE
import es.verdnatura.domain.ConstAndValues.SUPPLIERID import es.verdnatura.domain.ConstAndValues.SUPPLIERID
import es.verdnatura.domain.ConstAndValues.SUPPLIERNAME import es.verdnatura.domain.ConstAndValues.SUPPLIERNAME
import es.verdnatura.domain.ConstAndValues.TRAINNAME import es.verdnatura.domain.ConstAndValues.TRAINNAME
@ -36,6 +38,7 @@ import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WORKFORMSELECTED import es.verdnatura.domain.ConstAndValues.WORKFORMSELECTED
import es.verdnatura.presentation.view.feature.login.model.OperatorSalix import es.verdnatura.presentation.view.feature.login.model.OperatorSalix
import es.verdnatura.presentation.view.feature.login.model.WorkForms import es.verdnatura.presentation.view.feature.login.model.WorkForms
import es.verdnatura.presentation.view.feature.login.model.WorkerData
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
@ -98,10 +101,90 @@ class DataStoreLocal(var mobileApplication: MobileApplication) {
editDataStoreKey( editDataStoreKey(
NUMBEROFWAGONS, operator.numberOfWagons NUMBEROFWAGONS, operator.numberOfWagons
) )
editDataStoreKey( editDataStoreKey(
RESERVATIONMODE, operator.isOnReservationMode ITEMPACKING,
if (operator.itemPackingTypeFk != null) operator.itemPackingTypeFk.toString() else ""
) )
editDataStoreKey(
RESERVATIONMODE, operator.isOnReservationMode
)
}
//Tarea 6868
suspend fun saveWorkerData(operator: WorkerData) {
editDataStoreKey(
SECTORFK, if (operator.sector != null) {
operator.sector.id
} else {
SECTORFKDEFAULT
}
)
if (operator.sector?.isOnReservationMode != null) {
editDataStoreKey(
SECTORISONRESERVATIONMODE,
operator.sector.isOnReservationMode
)
} else {
mobileApplication.dataStore.edit { preferences ->
preferences.remove(stringPreferencesKey(SECTORISONRESERVATIONMODE))
}
}
editDataStoreKey(
WAREHOUSEFK, if (operator.sector != null) {
operator.sector.warehouseFk
} else {
WAREHOUSEFKDEFAULT
}
)
editDataStoreKey(
SECTORDESCRIP, if (operator.sector != null) {
operator.sector.description
} else {
mobileApplication.getString(R.string.Sinsector)
}
)
editDataStoreKey(
PRINTERFK, if (operator.printer != null) {
operator.printer.id
} else {
PRINTERFKDEFAULT
}
)
editDataStoreKey(
PRINTERNAME, if (operator.printer != null) {
operator.printer.name
} else {
mobileApplication.getString(R.string.printerWithout)
}
)
editDataStoreKey(
TRAINNAME, if (operator.train != null) {
operator.train.name
} else {
""
}
)
editDataStoreKey(
NUMBEROFWAGONS, operator.numberOfWagons
)
editDataStoreKey(
RESERVATIONMODE, operator.isOnReservationMode
)
}
suspend fun isPreferenceExists(key: String): Boolean {
val preferencesKey = booleanPreferencesKey(key)
val preferences = mobileApplication.dataStore.data.first()
return preferences.contains(preferencesKey)
} }
inline fun <reified T> readDataStoreKey(key: String): T { inline fun <reified T> readDataStoreKey(key: String): T {

View File

@ -7,7 +7,9 @@ import es.verdnatura.presentation.view.feature.buffer.fragment.BufferFragmentVie
import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemViewModel import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemViewModel
import es.verdnatura.presentation.view.feature.category.ChangeCategoryViewModel import es.verdnatura.presentation.view.feature.category.ChangeCategoryViewModel
import es.verdnatura.presentation.view.feature.claim.fragment.ubication.ClaimViewModel import es.verdnatura.presentation.view.feature.claim.fragment.ubication.ClaimViewModel
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionCheckerViewModel
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionViewModel import es.verdnatura.presentation.view.feature.collection.fragment.CollectionViewModel
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionViewModelCheckerPreviosNew
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoViewModel import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoViewModel
import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewModel import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewModel
import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleViewModel import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleViewModel
@ -137,6 +139,12 @@ val viewModelModule = module {
viewModel { viewModel {
CollectionViewModel(androidContext()) CollectionViewModel(androidContext())
} }
viewModel {
CollectionViewModelCheckerPreviosNew(androidContext())
}
viewModel {
CollectionCheckerViewModel(androidContext())
}
viewModel { viewModel {
ParkingViewModel(androidContext()) ParkingViewModel(androidContext())

View File

@ -12,13 +12,13 @@ object ConstAndValues {
const val SERIALNUMBER = "SERIALNUMBER" const val SERIALNUMBER = "SERIALNUMBER"
const val ON_CHECKING = "ON_CHECKING" const val ON_CHECKING = "ON_CHECKING"
const val PRECHECKER = "PRECHECKER" const val PRECHECKER = "PRECHECKER"
const val PRECHECKERNEW = "PRECHECKERNEW"
const val MAINACTIVITY = "MAIN" const val MAINACTIVITY = "MAIN"
const val VERTICKET = "SHOWTICKET" const val VERTICKET = "SHOWTICKET"
const val SECTORFKDEFAULT = -1 const val SECTORFKDEFAULT = -1
const val PRINTERFKDEFAULT = -1 const val PRINTERFKDEFAULT = -1
const val WAREHOUSEFKDEFAULT = 60 const val WAREHOUSEFKDEFAULT = 60
const val SECTORFK = "sectorFk" const val SECTORFK = "sectorFk"
const val SECTORISONRESERVATIONMODE = "sectorIsOnReservationMode"
const val TAG = "VERDNATURA::" const val TAG = "VERDNATURA::"
const val USERFK = "userFk" const val USERFK = "userFk"
const val USER = "user" const val USER = "user"
@ -27,6 +27,7 @@ object ConstAndValues {
const val TTL = "ttl" const val TTL = "ttl"
const val TOKENCREATED = "tokenCreated" const val TOKENCREATED = "tokenCreated"
const val SECTORDESCRIP = "sectordescrip" const val SECTORDESCRIP = "sectordescrip"
const val HOLDPOSITION = "holdPosition"
const val NUMBEROFWAGONS = "operatorNumberOfWagons" const val NUMBEROFWAGONS = "operatorNumberOfWagons"
const val PRINTERNAME = "printername" const val PRINTERNAME = "printername"
const val PRINTERFK = "printerFk" const val PRINTERFK = "printerFk"
@ -67,11 +68,6 @@ object ConstAndValues {
const val LIMITRECORDSSHELVINGLOG = 50 const val LIMITRECORDSSHELVINGLOG = 50
const val RESERVATIONMODE = "operatorReservationMode" const val RESERVATIONMODE = "operatorReservationMode"
const val MODELWORKERTYPEACTIVITY = "APP" const val MODELWORKERTYPEACTIVITY = "APP"
val ACTIONNAMES = listOf(
"STOP",
"ON_CHECKING",
"Delivery"
)
} }

View File

@ -3,6 +3,7 @@ package es.verdnatura.domain
import com.google.gson.JsonObject import com.google.gson.JsonObject
import es.verdnatura.presentation.common.ExpeditionPrintOut import es.verdnatura.presentation.common.ExpeditionPrintOut
import es.verdnatura.presentation.common.ItemBarCodeSalix import es.verdnatura.presentation.common.ItemBarCodeSalix
import es.verdnatura.presentation.common.ItemShelving
import es.verdnatura.presentation.common.PackingSiteSalix import es.verdnatura.presentation.common.PackingSiteSalix
import es.verdnatura.presentation.common.SaleTrackingSalix import es.verdnatura.presentation.common.SaleTrackingSalix
import es.verdnatura.presentation.common.TicketState import es.verdnatura.presentation.common.TicketState
@ -36,8 +37,6 @@ import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventoryParking import es.verdnatura.presentation.view.feature.inventario.model.ItemInventoryParking
import es.verdnatura.presentation.view.feature.login.model.AccessConfigSalix import es.verdnatura.presentation.view.feature.login.model.AccessConfigSalix
import es.verdnatura.presentation.view.feature.login.model.DataUserSalix import es.verdnatura.presentation.view.feature.login.model.DataUserSalix
import es.verdnatura.presentation.view.feature.login.model.LoginApp
import es.verdnatura.presentation.view.feature.login.model.LoginAppData
import es.verdnatura.presentation.view.feature.login.model.LoginDevice 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.LoginSalixVO
import es.verdnatura.presentation.view.feature.login.model.NameWorker import es.verdnatura.presentation.view.feature.login.model.NameWorker
@ -45,6 +44,7 @@ import es.verdnatura.presentation.view.feature.login.model.OperatorAdd
import es.verdnatura.presentation.view.feature.login.model.OperatorSalix import es.verdnatura.presentation.view.feature.login.model.OperatorSalix
import es.verdnatura.presentation.view.feature.login.model.RenewToken import es.verdnatura.presentation.view.feature.login.model.RenewToken
import es.verdnatura.presentation.view.feature.login.model.VersionApp import es.verdnatura.presentation.view.feature.login.model.VersionApp
import es.verdnatura.presentation.view.feature.login.model.WorkerData
import es.verdnatura.presentation.view.feature.packaging.model.EntrySalix import es.verdnatura.presentation.view.feature.packaging.model.EntrySalix
import es.verdnatura.presentation.view.feature.packaging.model.ItemSupplier import es.verdnatura.presentation.view.feature.packaging.model.ItemSupplier
import es.verdnatura.presentation.view.feature.packaging.model.NotificationQueue import es.verdnatura.presentation.view.feature.packaging.model.NotificationQueue
@ -105,8 +105,8 @@ interface SalixService {
@POST("Devices/handleUser") @POST("Devices/handleUser")
fun handleUser( fun handleUser(
@Body params: LoginApp @Body params: MutableMap<String, Any>
): Call<LoginAppData> ): Call<WorkerData>
@GET("VnUsers/getCurrentUserData") @GET("VnUsers/getCurrentUserData")
fun getCurrentUserData( fun getCurrentUserData(
@ -218,6 +218,12 @@ interface SalixService {
@Query("schema") schema: String = "vn", @Query("params") params: Any? = null @Query("schema") schema: String = "vn", @Query("params") params: Any? = null
): Call<Any> ): Call<Any>
@POST("Applications/itemShelvingSale_deleteAdded/execute-proc")
fun itemShelvingSaleDeleteAdded(
@Query("schema") schema: String = "vn",
@Query("params") params: Any? = null
): Call<Any>
@POST("Applications/collection_get/execute-proc") @POST("Applications/collection_get/execute-proc")
fun collectionGet( fun collectionGet(
@Query("schema") schema: String = "vn", @Query("params") params: Any? = null @Query("schema") schema: String = "vn", @Query("params") params: Any? = null
@ -504,6 +510,11 @@ interface SalixService {
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn" @Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
): Call<Any> ): Call<Any>
@POST("Applications/saleTracking_sectorCollectionAddPrevOK/execute-proc")
fun saleTrackingSectorCollectionAddPrevOK(
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
): Call<Any>
@POST("Applications/machine_getWorkerPlate/execute-proc") @POST("Applications/machine_getWorkerPlate/execute-proc")
fun machineGetWorkerPlate( fun machineGetWorkerPlate(
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn" @Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
@ -854,8 +865,11 @@ interface SalixService {
@GET("Suppliers") @GET("Suppliers")
fun getSuppliers( fun getSuppliers(
@Query("filter") filter: String = """{"fields":{"id":true,"name":true},"order":"name ASC","where":{"isActive":1,"name":{"neq":null}}, "include":[{"relation":"contacts","scope":{"fields":["email"],"where":{"email":{"neq":null}}}}]}""" @Query("filter") filter: String
): Call<List<Supplier>>
@GET("Suppliers/getWithPackaging")
fun getWithPackaging(
): Call<List<Supplier>> ): Call<List<Supplier>>
@GET("Entries") @GET("Entries")
@ -966,6 +980,11 @@ interface SalixService {
@Path("id") id: Number, @Body params: Any @Path("id") id: Number, @Body params: Any
): Call<Any> ): Call<Any>
@GET("ItemShelvings/{id}")
fun itemShelvingGet(
@Path("id") id: Number
): Call<ItemShelving>
@POST("ItemShelvingSales/itemShelvingSale_addByCollection") @POST("ItemShelvingSales/itemShelvingSale_addByCollection")
fun itemShelvingSaleAddByCollection( fun itemShelvingSaleAddByCollection(
@Body params: Any, @Body params: Any,
@ -997,6 +1016,21 @@ interface SalixService {
@Body params: Any @Body params: Any
): Call<Unit> ): Call<Unit>
@POST("Expeditions/deleteExpeditions")
fun deleteExpedition(
@Body params: Any
): Call<Any>
@GET("ExpeditionStates/findOne")
fun findExpedition(
@Query("filter") filter: String
): Call<Any>
@GET("ExpeditionStateTypes/findOne")
fun getExpeditionStateTypeId(
@Query("filter") filter: String
): Call<Any>
@POST("WorkerMistakes") @POST("WorkerMistakes")
fun workerMistakesAdd( fun workerMistakesAdd(
@Body workerMistake: WorkerMistakeSalix @Body workerMistake: WorkerMistakeSalix

View File

@ -1,7 +1,10 @@
package es.verdnatura.presentation.base package es.verdnatura.presentation.base
import android.content.Context import android.content.Context
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.os.Bundle import android.os.Bundle
import android.provider.Settings
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@ -143,6 +146,24 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(
tool.backButton.visibility = View.INVISIBLE tool.backButton.visibility = View.INVISIBLE
} }
fun getInfoVersionNameApp(): String {
val manager: PackageManager = requireContext().packageManager
val info: PackageInfo = manager.getPackageInfo(requireContext().packageName, 0)
mobileApplication.versionName = info.versionName
return info.versionName
}
fun getDevicePDA(): Int? {
return try {
Settings.Global.getString(
mobileApplication.contentResolver, Settings.Global.DEVICE_NAME
).toInt()
} catch (ex: Exception) {
null
}
}
} }
fun database(myContext: Context): DeliveryDatabase { fun database(myContext: Context): DeliveryDatabase {

View File

@ -38,11 +38,19 @@ data class ItemShelvingSaleSalix(
var isItemShelvingSaleEmpty: Boolean? var isItemShelvingSaleEmpty: Boolean?
) )
data class ItemShelving(
var id: Int,
var itemFk: Int,
var shelvingFk: String,
var position: Int,
var quantity: Int
)
data class ItemShelvingSalix( data class ItemShelvingSalix(
var visible: Int, var visible: Int,
var packing: Int?, var packing: Int?,
var grouping: Int?, var grouping: Int?,
var available : Int? var available: Int?
) )
@ -65,12 +73,13 @@ data class CollectionItemSalix(
var warehouseFk: Int var warehouseFk: Int
) )
//Tarea 6889 //Tarea 6889
data class ItemAddSale( data class ItemAddSale(
var barcode: String, var barcode: String,
var quantity: Int, var quantity: Int,
) )
data class TicketState( data class TicketState(
val ticketFk: Int = 0, val ticketFk: Int = 0,
@ -82,8 +91,9 @@ data class TicketState(
val username: String = "" val username: String = ""
) )
} }
data class ExpeditionPrintOut( data class ExpeditionPrintOut(
val expeditionFk:Long, val expeditionFk: Long,
val itemFk:Int, val itemFk: Int,
val isChecked: Boolean val isChecked: Boolean
) )

View File

@ -267,6 +267,10 @@ interface OnTicketClickSaleListener {
fun onTicketClickListener(sale: Sale) fun onTicketClickListener(sale: Sale)
} }
interface OnSaleReserveClickListener {
fun onSaleReserveListener(sale: Sale)
}
interface OnBuyerSelectedListener { interface OnBuyerSelectedListener {
fun onBuyerSelected(userFk: String) fun onBuyerSelected(userFk: String)
} }

View File

@ -1,8 +1,11 @@
package es.verdnatura.presentation.view.feature.ajustes.fragment package es.verdnatura.presentation.view.feature.ajustes.fragment
import android.app.AlertDialog import android.app.AlertDialog
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.graphics.Color import android.graphics.Color
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@ -13,6 +16,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentAjustesBinding import es.verdnatura.databinding.FragmentAjustesBinding
import es.verdnatura.domain.ConstAndValues.ANDROID_ID import es.verdnatura.domain.ConstAndValues.ANDROID_ID
import es.verdnatura.domain.ConstAndValues.HOLDPOSITION
import es.verdnatura.domain.ConstAndValues.ITEMPACKING import es.verdnatura.domain.ConstAndValues.ITEMPACKING
import es.verdnatura.domain.ConstAndValues.MENUBYDEFAULTSELECTED import es.verdnatura.domain.ConstAndValues.MENUBYDEFAULTSELECTED
import es.verdnatura.domain.ConstAndValues.NUMBEROFWAGONS import es.verdnatura.domain.ConstAndValues.NUMBEROFWAGONS
@ -99,14 +103,14 @@ class AjustesFragment :
getString(R.string.version) + ":\t" + getString(R.string.version) + ":\t" +
requireActivity().packageManager.getPackageInfo( requireActivity().packageManager.getPackageInfo(
requireActivity().packageName, 0 requireActivity().packageName, 0
).versionName!! + "\n" + ).versionName!! + "(${getVersionCode()})" + "\n" +
getString(R.string.user) + ":\t" + getString(R.string.user) + ":\t" +
mobileApplication.userName + "\n" + mobileApplication.userName + "\n" +
getString(R.string.androidid) + ":\t" + getString(R.string.androidid) + ":\t" +
mobileApplication.dataStoreApp.readDataStoreKey<String>( mobileApplication.dataStoreApp.readDataStoreKey<String>(
ANDROID_ID ANDROID_ID
) + "\n" + ) + "\n" +
if (!mobileApplication.serialNumber.isNullOrBlank() ) { if (!mobileApplication.serialNumber.isNullOrBlank()) {
getString(R.string.serialNumber) + "\t" + getString(R.string.serialNumber) + "\t" +
mobileApplication.serialNumber mobileApplication.serialNumber
} else "" } else ""
@ -122,6 +126,27 @@ class AjustesFragment :
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
} }
private fun getVersionCode(): Long {
val context = requireContext()
val packageManager: PackageManager = context.packageManager
val packageInfo: PackageInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
packageManager.getPackageInfo(
context.packageName,
PackageManager.PackageInfoFlags.of(0)
)
} else {
@Suppress("DEPRECATION")
packageManager.getPackageInfo(context.packageName, 0)
}
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
packageInfo.longVersionCode
} else {
@Suppress("DEPRECATION")
packageInfo.versionCode.toLong()
}
}
override fun observeViewModel() { override fun observeViewModel() {
with(viewModel) { with(viewModel) {
@ -241,6 +266,7 @@ class AjustesFragment :
.setDescription(getString(R.string.Noprinters)) .setDescription(getString(R.string.Noprinters))
.setOkButton(getString(R.string.Close)) { .setOkButton(getString(R.string.Close)) {
customDialog.dismiss() customDialog.dismiss()
handleUserCall()
}.show() }.show()
} }
@ -271,19 +297,40 @@ class AjustesFragment :
private fun getUserData() { private fun getUserData() {
loginViewModel = LoginViewModel(requireActivity().applicationContext) loginViewModel = LoginViewModel(requireActivity().applicationContext)
try { /* try {
loginViewModel.operatorGetData(mobileApplication.userId!!) loginViewModel.operatorGetData(mobileApplication.userId!!)
} catch (_: Exception) { } catch (_: Exception) {
ma.messageWithSound( ma.messageWithSound(
message = getString(R.string.errorGetData), isError = true, isPlayed = true message = getString(R.string.errorGetData), isError = true, isPlayed = true
) )
} }
loginViewModel.workerOperator.observe(this@AjustesFragment) { iti -> loginViewModel.workerOperator.observe(this@AjustesFragment) { iti ->
runBlocking { mobileApplication.dataStoreApp.saveDataOperator(iti) } runBlocking { mobileApplication.dataStoreApp.saveDataOperator(iti) }
}*/
handleUserCall()
loginViewModel.handleUserResponse.observe(this@AjustesFragment) { iti ->
runBlocking { mobileApplication.dataStoreApp.saveWorkerData(iti) }
} }
setSettings() setSettings()
} }
private fun handleUserCall() {
val jsonData = mutableMapOf<String, Any>(
"androidId" to mobileApplication.androidId,
"nameApp" to getString(R.string.nameApp),
"versionApp" to getInfoVersionNameApp()
)
loginViewModel.handleUser(if (getDevicePDA() != null) {
jsonData.apply {
this["deviceId"] = getDevicePDA().toString() // Añadir nuevo campo
}
} else {
jsonData
}
)
}
private fun showMenuByDefault() { private fun showMenuByDefault() {
pasilleroViewModel.inititializeDefaultDataInit() pasilleroViewModel.inititializeDefaultDataInit()
@ -311,9 +358,10 @@ class AjustesFragment :
mobileApplication.dataStoreApp.readDataStoreKey<String>(ITEMPACKING), mobileApplication.dataStoreApp.readDataStoreKey<String>(ITEMPACKING),
menuDefault = mobileApplication.dataStoreApp.readDataStoreKey( menuDefault = mobileApplication.dataStoreApp.readDataStoreKey(
MENUBYDEFAULTSELECTED MENUBYDEFAULTSELECTED
) ),
holdPosition = mobileApplication.dataStoreApp.readDataStoreKey<Boolean>(HOLDPOSITION),
) )
} }
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
} }
@ -483,6 +531,7 @@ class AjustesFragment :
labelerFk = id labelerFk = id
) )
settingsAdapter!!.notifyItemChanged(2) settingsAdapter!!.notifyItemChanged(2)
handleUserCall()
} }

View File

@ -65,7 +65,8 @@ class AjustesViewModel(val context: Context) : BaseViewModel(context) {
printerSelected: String, printerSelected: String,
train: String?, train: String?,
itemPackingType: String?, itemPackingType: String?,
menuDefault: String menuDefault: String,
holdPosition: Boolean = false
) { ) {
_settingsItem.clear() _settingsItem.clear()
_settingsItem.add( _settingsItem.add(
@ -99,6 +100,15 @@ class AjustesViewModel(val context: Context) : BaseViewModel(context) {
action = false action = false
) )
) )
/*Tarea 5443
_settingsItem.add(
AjustesItemVO(
"Bajar línea al revisar",
holdPosition = holdPosition,
action = true
)
)*/
_settingsItem.add( _settingsItem.add(
AjustesItemVO( AjustesItemVO(
context.getString(R.string.vehicleControl), action = true context.getString(R.string.vehicleControl), action = true

View File

@ -8,7 +8,8 @@ class AjustesItemVO(
var sectorFk: Int? = null, var sectorFk: Int? = null,
var printerFk: Int? = null, var printerFk: Int? = null,
var printerSelected: String? = null, var printerSelected: String? = null,
var action: Boolean var action: Boolean,
var holdPosition: Boolean = false
) )
class SectorItemVO( class SectorItemVO(
@ -28,7 +29,7 @@ class PrintersList(
class Printers( class Printers(
var id: Int, var id: Int,
var name: String, var name: String,
var sector:Sector? var sector: Sector?
) )

View File

@ -68,9 +68,16 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
warehouseFk: Int, warehouseFk: Int,
shipped: String, shipped: String,
isShowedByType: Boolean, isShowedByType: Boolean,
daysInforward: Int = 0,
) { ) {
salix.getItemSimilar( salix.getItemSimilar(
params = arrayListOf(itemFk, warehouseFk, shipped, isShowedByType).formatWithQuotes() params = arrayListOf(
itemFk,
warehouseFk,
shipped,
isShowedByType,
daysInforward
).formatWithQuotes()
).enqueue(object : SalixCallback<List<ItemProposal>>(context) { ).enqueue(object : SalixCallback<List<ItemProposal>>(context) {
override fun onSuccess(response: Response<List<ItemProposal>>) { override fun onSuccess(response: Response<List<ItemProposal>>) {
_itemProposalList.value = response.body()?.let { _itemProposalList.value = response.body()?.let {
@ -196,7 +203,7 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
} }
fun getAddress() { fun getAddress() {
salix.getAddress("""{"where":{"type":"internal"}, "include": [ { "relation": "address", "scope": { "fields": { "nickname": true } } } ] }""") salix.getAddress("""{"where":{"type": { "neq": "external"}}, "include": [ { "relation": "address", "scope": { "fields": { "nickname": true } } } ] }""")
.enqueue(object : SalixCallback<List<AddressLoses>>(context) { .enqueue(object : SalixCallback<List<AddressLoses>>(context) {
override fun onSuccess(response: Response<List<AddressLoses>>) { override fun onSuccess(response: Response<List<AddressLoses>>) {
_addressLosesList.value = response.body()?.let { AddressLosesList(it) } _addressLosesList.value = response.body()?.let { AddressLosesList(it) }

View File

@ -5,15 +5,20 @@ import android.view.inputmethod.EditorInfo
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentGeneralBlackBinding import es.verdnatura.databinding.FragmentGeneralBlackBinding
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.ExpeditionPrintOut
import es.verdnatura.presentation.common.OnCollectionSelectedListener import es.verdnatura.presentation.common.OnCollectionSelectedListener
import es.verdnatura.presentation.common.hideKeyboard
import es.verdnatura.presentation.common.itemScanValue
import es.verdnatura.presentation.view.component.CustomDialogInput import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionSalix
import es.verdnatura.presentation.view.feature.delivery.model.Expeditions
import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewModel
class BoxPickingFragment(var title: String) : class BoxPickingFragment(var title: String) :
BaseFragment<FragmentGeneralBlackBinding, BoxPickingViewModel>(BoxPickingViewModel::class) { BaseFragment<FragmentGeneralBlackBinding, DeliveryViewModel>(DeliveryViewModel::class) {
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
private var isBoxScanned: Boolean = false private var isBoxScanned: Boolean = false
private lateinit var customDialogInput: CustomDialogInput private lateinit var customDialogInput: CustomDialogInput
private var codeStateId: Number = 0
override fun getLayoutId(): Int = R.layout.fragment_general_black override fun getLayoutId(): Int = R.layout.fragment_general_black
companion object { companion object {
@ -25,6 +30,7 @@ class BoxPickingFragment(var title: String) :
binding.mainToolbar.toolbarTitle.text = title binding.mainToolbar.toolbarTitle.text = title
setEvents() setEvents()
customDialogInput = CustomDialogInput(requireContext()) customDialogInput = CustomDialogInput(requireContext())
viewModel.getExpeditionStateId("CHECKED")
super.init() super.init()
} }
@ -36,15 +42,28 @@ class BoxPickingFragment(var title: String) :
binding.scanInput.hint = getString(R.string.scanLabelExpedition) binding.scanInput.hint = getString(R.string.scanLabelExpedition)
binding.scanInput.requestFocus() binding.scanInput.requestFocus()
binding.scanInput.setOnEditorActionListener { _, actionId, _ -> binding.scanInput.setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!binding.scanInput.text.isNullOrEmpty()) { if (!binding.scanInput.text.isNullOrEmpty()) {
try { try {
showScanBarcode(binding.scanInput.text.toString().toLong())
}catch (ex:Exception){
ma.messageWithSound(message =getString(R.string.itemNotValid), isError = true, isPlayed = true, isToasted = false)
}
viewModel.findExpedition(
expedition = itemScanValue(
binding.scanInput.text.toString(),
arrayOf("expedition"),
"id"
).toString().toLong(),
expeditionStateId = codeStateId
)
} catch (ex: Exception) {
ma.messageWithSound(
message = getString(R.string.itemNotValid),
isError = true,
isPlayed = true,
isToasted = false
)
}
} }
binding.scanInput.setText("") binding.scanInput.setText("")
@ -65,6 +84,7 @@ class BoxPickingFragment(var title: String) :
expeditionFk = expeditionFk, expeditionFk = expeditionFk,
customDialogInput.getValue() customDialogInput.getValue()
) )
} }
customDialogInput.dismiss() customDialogInput.dismiss()
} }
@ -76,15 +96,15 @@ class BoxPickingFragment(var title: String) :
}.setValue("").show() }.setValue("").show()
customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ -> customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (customDialogInput.getValue().isNotEmpty()) { if (customDialogInput.getValue().isNotEmpty()) {
viewModel.isBoxPickingInPrintOut( viewModel.isBoxPickingInPrintOut(
expeditionFk = expeditionFk, expeditionFk = expeditionFk,
customDialogInput.getValue() itemScanValue(
customDialogInput.getValue(), arrayOf("buy"), "more"
).toString()
) )
} }
customDialogInput.dismiss() customDialogInput.dismiss()
@ -97,40 +117,61 @@ class BoxPickingFragment(var title: String) :
} catch (ex: Exception) { } catch (ex: Exception) {
getString(R.string.errorInput) getString(R.string.errorInput)
} }
customDialogInput.getEditText().requestFocus()
} }
override fun observeViewModel() { override fun observeViewModel() {
with(viewModel) { with(viewModel) {
/*isBoxPickingInPrintOut.observe(viewLifecycleOwner) { responseExpeditionStateId.observe(viewLifecycleOwner) {
codeStateId = it
}
responseFindExpeditionId.observe(viewLifecycleOwner) { it ->
if (it != 0) {
showScanBarcode(it.toLong())
} else {
ma.messageWithSound( ma.messageWithSound(
message = getString(R.string.errorInput), getString(
isError = !it, R.string.errorBoxPicking
isPlayed = true, ), isError = true, isPlayed = true, isToasted = true
isToasted = null
) )
binding.scanInput.requestFocus() }
}
responseStateAdd.observe(viewLifecycleOwner) {
if (it) {
ma.messageWithSound(message = "", isPlayed = true, isError = false)
customDialogInput.dismiss()
binding.scanInput.requestFocus()
}
}
}*/
//Tarea 7751
isBoxPickingInPrintOut.observe(viewLifecycleOwner) { isBoxPickingInPrintOut.observe(viewLifecycleOwner) {
if (it.isChecked){ if (it.expeditionFk.toInt() == 0) {
ma.messageWithSound( ma.messageWithSound(
message = getString(R.string.errorBoxPicking), message = getString(R.string.errorBoxpicking),
isError = true, isError = true,
isPlayed = true, isPlayed = true,
isToasted = false isToasted = false
) )
}else{ } else {
viewModel.updateExpeditionPrint(it.expeditionFk, expeditionPrintOut = ExpeditionPrintOut(it.expeditionFk,it.itemFk, true)) viewModel.expeditionStateAddSalix(
expeditions = Expeditions(
arrayListOf(
ExpeditionSalix(
expeditionFk = it.expeditionFk.toInt(),
stateCode = "CHECKED",
isScanned = 1
)
)
)
)
}
}
binding.scanInput.requestFocus() binding.scanInput.requestFocus()
hideKeyboard()
} }
responseCode.observe(viewLifecycleOwner) { responseCode.observe(viewLifecycleOwner) {
ma.messageWithSound( ma.messageWithSound(

View File

@ -12,8 +12,11 @@ import retrofit2.Response
class BoxPickingViewModel(val context: Context) : BaseViewModel(context) { class BoxPickingViewModel(val context: Context) : BaseViewModel(context) {
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix) private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
/*private val _isBoxPickingInPrintOut by lazy { MutableLiveData<Boolean>() } /*private val _isBoxPickingInPrintOut by lazy { MutableLiveData<Boolean>() }
val isBoxPickingInPrintOut: LiveData<Boolean> = _isBoxPickingInPrintOut*/ val isBoxPickingInPrintOut: LiveData<Boolean> = _isBoxPickingInPrintOut*/
private val _responseFindExpeditionId by lazy { MutableLiveData<Number>() }
val responseFindExpeditionId: LiveData<Number> = _responseFindExpeditionId
//Tarea 7751 //Tarea 7751
private val _isBoxPickingInPrintOut by lazy { MutableLiveData<ExpeditionPrintOut>() } private val _isBoxPickingInPrintOut by lazy { MutableLiveData<ExpeditionPrintOut>() }
@ -28,16 +31,16 @@ class BoxPickingViewModel(val context: Context) : BaseViewModel(context) {
salix.isBoxPickingInPrintOut( salix.isBoxPickingInPrintOut(
filter = """{"where":{"expeditionFk":$expeditionFk,"itemFk":$itemFk}}""" filter = """{"where":{"expeditionFk":$expeditionFk,"itemFk":$itemFk}}"""
/* ).enqueue(object : SalixCallback<Any>(context) { /* ).enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) { override fun onSuccess(response: Response<Any>) {
_isBoxPickingInPrintOut.value = true _isBoxPickingInPrintOut.value = true
} }
override fun onError(t: Throwable) { override fun onError(t: Throwable) {
_isBoxPickingInPrintOut.value = false _isBoxPickingInPrintOut.value = false
} }
})*/ })*/
//Tarea 7751 //Tarea 7751
//isChecked //isChecked
).enqueue(object : SalixCallback<ExpeditionPrintOut>(context) { ).enqueue(object : SalixCallback<ExpeditionPrintOut>(context) {
@ -45,8 +48,9 @@ class BoxPickingViewModel(val context: Context) : BaseViewModel(context) {
override fun onSuccess(response: Response<ExpeditionPrintOut>) { override fun onSuccess(response: Response<ExpeditionPrintOut>) {
_isBoxPickingInPrintOut.value = response.body() _isBoxPickingInPrintOut.value = response.body()
} }
override fun onError(t: Throwable) { override fun onError(t: Throwable) {
_isBoxPickingInPrintOut.value = ExpeditionPrintOut(0,0,false) _isBoxPickingInPrintOut.value = ExpeditionPrintOut(0, 0, false)
} }
}) })
@ -70,8 +74,30 @@ class BoxPickingViewModel(val context: Context) : BaseViewModel(context) {
} }
}) })
} }
fun findExpedition(expedition: Number, expeditionStateId: Number) {
salix.findExpedition(
filter = """{"where":
{
"expeditionFk":$expedition,
"typeFk":$expeditionStateId
}
}""".trimMargin()
).enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
_responseFindExpeditionId.value = 0
}
override fun onError(t: Throwable) {
_responseFindExpeditionId.value = expedition
}
})
}
fun updateExpeditionPrint(expeditionFk: Long, expeditionPrintOut: ExpeditionPrintOut) { fun updateExpeditionPrint(expeditionFk: Long, expeditionPrintOut: ExpeditionPrintOut) {
salix.update(expeditionFk, expeditionPrintOut) salix.update(expeditionFk, expeditionPrintOut)
.enqueue(object : SalixCallback<ExpeditionPrintOut>(context) { .enqueue(object : SalixCallback<ExpeditionPrintOut>(context) {
}) })

View File

@ -6,6 +6,9 @@ import android.graphics.Color
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.View.GONE
import android.view.View.INVISIBLE
import android.view.View.VISIBLE
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.content.ContextCompat.getColor import androidx.core.content.ContextCompat.getColor
import androidx.core.graphics.drawable.DrawableCompat import androidx.core.graphics.drawable.DrawableCompat
@ -14,13 +17,14 @@ import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.SaleRowFragmentBinding import es.verdnatura.databinding.SaleRowFragmentBinding
import es.verdnatura.domain.ConstAndValues.PREITEMPICKERTEST import es.verdnatura.domain.ConstAndValues.PREITEMPICKERTEST
import es.verdnatura.domain.ConstAndValues.PREPARED
import es.verdnatura.domain.ConstAndValues.SACADOR import es.verdnatura.domain.ConstAndValues.SACADOR
import es.verdnatura.domain.toast import es.verdnatura.domain.toast
import es.verdnatura.presentation.common.OnMistakeClickListener import es.verdnatura.presentation.common.OnMistakeClickListener
import es.verdnatura.presentation.common.OnPackingClickSaleListener import es.verdnatura.presentation.common.OnPackingClickSaleListener
import es.verdnatura.presentation.common.OnPasillerosItemClickListener import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.common.OnQuantityClickSaleListener
import es.verdnatura.presentation.common.OnSaleClickSaleListener import es.verdnatura.presentation.common.OnSaleClickSaleListener
import es.verdnatura.presentation.common.OnSaleReserveClickListener
import es.verdnatura.presentation.common.OnTicketClickSaleListener import es.verdnatura.presentation.common.OnTicketClickSaleListener
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import es.verdnatura.presentation.view.feature.sacador.model.Sale import es.verdnatura.presentation.view.feature.sacador.model.Sale
@ -28,12 +32,12 @@ import es.verdnatura.presentation.view.feature.sacador.model.Sale
class SaleAdapterNew( class SaleAdapterNew(
private val items: List<Sale>, private val items: List<Sale>,
private val onPasillerosItemClickListener: OnPasillerosItemClickListener, private val onPasillerosItemClickListener: OnPasillerosItemClickListener,
private val onQuantityClick: OnQuantityClickSaleListener,
private val onSaleClickListener: OnSaleClickSaleListener, private val onSaleClickListener: OnSaleClickSaleListener,
private val onMistakeClickListener: OnMistakeClickListener, private val onMistakeClickListener: OnMistakeClickListener,
private val onPackingClick: OnPackingClickSaleListener, private val onPackingClick: OnPackingClickSaleListener,
private var onTicketClick: OnTicketClickSaleListener? = null, private var onTicketClick: OnTicketClickSaleListener? = null,
private var saleAdapter: SaleAdapterNew? = null, private var saleAdapter: SaleAdapterNew? = null,
private var onReserveSaleClick: OnSaleReserveClickListener? = null,
private var type: String? = null, private var type: String? = null,
) : RecyclerView.Adapter<SaleAdapterNew.AjustesItemHolder>() { ) : RecyclerView.Adapter<SaleAdapterNew.AjustesItemHolder>() {
@ -66,7 +70,7 @@ class SaleAdapterNew(
) : RecyclerView.ViewHolder(binding.root) { ) : RecyclerView.ViewHolder(binding.root) {
fun bind(sale: Sale) { fun bind(sale: Sale) {
binding.apply { binding.apply {
// if (sale.reservedQuantity == null) sale.reservedQuantity = 0 // if (sale.reservedQuantity == null) sale.reservedQuantity = 0
val childLayoutManager = val childLayoutManager =
LinearLayoutManager(context!!, RecyclerView.HORIZONTAL, false) LinearLayoutManager(context!!, RecyclerView.HORIZONTAL, false)
@ -118,49 +122,52 @@ class SaleAdapterNew(
itemArticleFirstAccumulate.setOnClickListener { itemArticleFirstAccumulate.setOnClickListener {
//onQuantityClick.onQuantityClick(sale) //onQuantityClick.onQuantityClick(sale)
} }
itemFirstToPicker.setOnClickListener { /* itemFirstToPicker.setOnClickListener {
onPackingClick.onPackingClick(sale) onPackingClick.onPackingClick(sale)
} }/* quantityReserved.setOnClickListener {
quantityReserved.setOnClickListener { onQuantityClick.onQuantityClick(sale)
onQuantityClick.onQuantityClick(sale) }*/*/
}
linearLayoutItem.setOnClickListener { linearLayoutItem.setOnClickListener {
println("El ticket es ${sale.ticketFk}")
if (onTicketClick != null) { if (onTicketClick != null) {
onTicketClick!!.onTicketClickListener(sale) onTicketClick!!.onTicketClickListener(sale)
} }
} }
println("type es $type")
imageErrorMessage.setOnClickListener { imageErrorMessage.setOnClickListener {
// onMistakeClickListener.onMistakeClickListener(sale) // onMistakeClickListener.onMistakeClickListener(sale)
} }
//ERROR //ERROR
println("Sacador sale item ${sale.itemFk} sale ${sale.saleFk} cantidad ${sale.saleQuantity} original ${sale.originalQuantity}")
if (sale.originalQuantity != sale.saleQuantity && sale.originalQuantity != null && !sale.isParent) { if (sale.originalQuantity != sale.saleQuantity && sale.originalQuantity != null && !sale.isParent) {
layoutError.visibility = View.VISIBLE layoutError.visibility = VISIBLE
txtError.text = txtError.text =
binding.root.context.getString(R.string.originalQuantity) + sale.originalQuantity binding.root.context.getString(R.string.originalQuantity) + sale.originalQuantity
} else { } else {
layoutError.visibility = View.GONE layoutError.visibility = GONE
} }
binding.deleteReserve.visibility = if (sale.isAdded == 1) VISIBLE else INVISIBLE
if (sale.isAdded == 1) { if (sale.isAdded == 1) {
layoutError.visibility = View.VISIBLE layoutError.visibility = VISIBLE
txtError.text = binding.root.context.getString(R.string.newItem) txtError.text = binding.root.context.getString(R.string.newItem)
binding.deleteReserve.setOnClickListener {
onReserveSaleClick!!.onSaleReserveListener(sale)
}
} }
paintTicketcolor(sale.rgb, binding.itemTicketColor.background) paintTicketcolor(sale.rgb, binding.itemTicketColor.background)
if (sale.isAdded == 1 && sale.reservedQuantity != sale.saleQuantity) { /*if (sale.isAdded == 1 && sale.reservedQuantity != sale.saleQuantity) {
layoutError.visibility = View.GONE layoutError.visibility = GONE
} }*/
if (isExpanded) { if (isExpanded) {
@ -203,7 +210,9 @@ class SaleAdapterNew(
txtdeNew.visibility = View.VISIBLE txtdeNew.visibility = View.VISIBLE
itemArticleQuantityPicked.visibility = View.VISIBLE itemArticleQuantityPicked.visibility = View.VISIBLE
itemArticleQuantityLine3.visibility = View.VISIBLE*/ itemArticleQuantityLine3.visibility = View.VISIBLE*/
if (type != SACADOR) {
imageErrorMessage.visibility = View.GONE
if (type != SACADOR && type != PREITEMPICKERTEST) {
val colorRes = val colorRes =
if (sale.hasMistake == true) R.color.verdnatura_red_salix else R.color.verdnatura_black if (sale.hasMistake == true) R.color.verdnatura_red_salix else R.color.verdnatura_black
imageErrorMessage.imageTintList = imageErrorMessage.imageTintList =
@ -221,7 +230,6 @@ class SaleAdapterNew(
adapter = SaleAdapterNew( adapter = SaleAdapterNew(
sale.sonSales, sale.sonSales,
onPasillerosItemClickListener, onPasillerosItemClickListener,
onQuantityClick,
onSaleClickListener, onSaleClickListener,
onMistakeClickListener, onMistakeClickListener,
onPackingClick onPackingClick
@ -271,7 +279,8 @@ class SaleAdapterNew(
val textToConcat2: String val textToConcat2: String
val result2: Int = sale.accumulatedQuantity % (sale.packing ?: sale.saleQuantity + 1) val result2: Int =
sale.accumulatedQuantity % (sale.packing ?: sale.saleQuantity + 1)
if (result2 != 0) { if (result2 != 0) {
textToConcat2 = textToConcat2 =
"${(sale.saleQuantity - sale.accumulatedQuantity) / (sale.grouping ?: 1)} x ${sale.grouping ?: "1"}" "${(sale.saleQuantity - sale.accumulatedQuantity) / (sale.grouping ?: 1)} x ${sale.grouping ?: "1"}"
@ -315,12 +324,19 @@ class SaleAdapterNew(
"${sale.reservedQuantity} de ${sale.saleQuantity}" "${sale.reservedQuantity} de ${sale.saleQuantity}"
if (sale.isPicked == 1) { if (sale.isPicked == 1) {
contentLayout.setBackgroundColor( if (type == PREPARED) {
//lolass contentLayout.setBackgroundColor(
getColor( getColor(
context!!, R.color.verdnatura_dark_sky_blue context!!, R.color.verdnatura_orange_salix
)
) )
) } else {
contentLayout.setBackgroundColor(
getColor(
context!!, R.color.verdnatura_dark_sky_blue
)
)
}
} else { } else {
contentLayout.setBackgroundColor( contentLayout.setBackgroundColor(
getColor( getColor(
@ -330,10 +346,14 @@ class SaleAdapterNew(
} }
binding.itemParkingCode.text = if (type == PREITEMPICKERTEST) binding.itemParkingCode.text =
sale.parkingCodePrevia else sale.parkingCode // if (type == PREITEMPICKERTEST) sale.parkingCodePrevia else sale.parkingCode
sale.parkingCodePrevia
println("parkingCodePrevia ${sale.parkingCodePrevia}")
println("parkingCode ${sale.parkingCode}")
this.sale = sale this.sale = sale
} }
@ -344,13 +364,11 @@ class SaleAdapterNew(
if (color.isNullOrBlank()) { if (color.isNullOrBlank()) {
DrawableCompat.setTint( DrawableCompat.setTint(
backgroundDrawableTicket, backgroundDrawableTicket, Color.TRANSPARENT
Color.TRANSPARENT
) )
} else { } else {
DrawableCompat.setTint( DrawableCompat.setTint(
backgroundDrawableTicket, backgroundDrawableTicket, Color.parseColor(color)
Color.parseColor(color)
) )
} }

View File

@ -146,7 +146,7 @@ class CollectionFragment(
mperror = MediaPlayer.create((activity as MainActivity), R.raw.error) mperror = MediaPlayer.create((activity as MainActivity), R.raw.error)
mpok = MediaPlayer.create((activity as MainActivity), R.raw.ok) mpok = MediaPlayer.create((activity as MainActivity), R.raw.ok)
if (type.equals(CONTROLADOR)) { if (type.equals(CONTROLADOR) && collection.collectionFk != 0) {
//sergio: comprueba si viene de la pantalla de controlador //sergio: comprueba si viene de la pantalla de controlador
//Tarea #4280 //Tarea #4280
viewModel.ticketIsOutClosureZone( viewModel.ticketIsOutClosureZone(
@ -162,7 +162,7 @@ class CollectionFragment(
} }
if (collection.tickets.isEmpty()) { if (collection.tickets.isEmpty() && collection.collectionFk != 0) {
viewModel.collectionTicketGet( viewModel.collectionTicketGet(
collection.collectionFk, collection.collectionFk,
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK), mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
@ -179,7 +179,6 @@ class CollectionFragment(
} }
override fun init() { override fun init() {
customDialogList = CustomDialogList(requireContext()) customDialogList = CustomDialogList(requireContext())
customDialogInput = CustomDialogInput(requireContext()) customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
@ -204,12 +203,15 @@ class CollectionFragment(
private fun setToolBar() { private fun setToolBar() {
binding.mainToolbar.toolbarSubtitle.visibility = VISIBLE binding.mainToolbar.toolbarSubtitle.visibility = VISIBLE
binding.mainToolbar.toolbarIcons.visibility = VISIBLE binding.mainToolbar.toolbarIcons.visibility =
if (type == CONTROLADOR && collection.collectionFk == 0) GONE else VISIBLE
binding.mainToolbar.backButton.visibility = VISIBLE binding.mainToolbar.backButton.visibility = VISIBLE
collection.collectionFk.let { collection.collectionFk.let {
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString() binding.mainToolbar.toolbarTitle.text =
if (collection.collectionFk != 0) collection.collectionFk.toString() else {
getString(R.string.controlticket)
}
} }
val listIcons: ArrayList<ImageView> = ArrayList() val listIcons: ArrayList<ImageView> = ArrayList()
val iconPrint = ImageView(context) val iconPrint = ImageView(context)
iconPrint.setImageResource(R.drawable.ic_print_black_24dp) iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
@ -406,7 +408,7 @@ class CollectionFragment(
binding.scanInput.setOnEditorActionListener { v, actionId, event -> binding.scanInput.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {//ID=0 ACTION_NEXT ID=5 ACTION_UNESPECEFIED) if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {//ID=0 ACTION_NEXT ID=5 ACTION_UNESPECEFIED)
if (!binding.scanInput.text.toString().isNullOrEmpty()) { if (!binding.scanInput.text.toString().isNullOrEmpty()) {
binding.mainToolbar.toolbarIcons.visibility = VISIBLE
//sergio:para ver si ha marcado dos veces el mismo ticket //sergio:para ver si ha marcado dos veces el mismo ticket
binding.scanInput.setText(textScanned_filterDouble(binding.scanInput.text!!.toString())) binding.scanInput.setText(textScanned_filterDouble(binding.scanInput.text!!.toString()))
@ -438,7 +440,6 @@ class CollectionFragment(
} }
buttonPushedGetCollection = false buttonPushedGetCollection = false
} }
binding.scanInput.setText("") binding.scanInput.setText("")
hideKeyboards() hideKeyboards()
@ -525,18 +526,19 @@ class CollectionFragment(
} }
}) })
responseParking.observe(viewLifecycleOwner, Observer { loadParking.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull { it ->
if (!goBack) { if (!goBack) {
ma.messageWithSound( ma.messageWithSound(
if (it.isError) it.errorMessage else getString(R.string.Aparcado), if (it.isError) it.errorMessage else getString(R.string.Aparcado),
it.isError, it.isError,
true true
) )
}
} }
}
})
responsePrint.observe(viewLifecycleOwner, Observer { responsePrint.observe(viewLifecycleOwner, Observer {
@ -575,22 +577,24 @@ class CollectionFragment(
} }
responseSaleGroup.observe(viewLifecycleOwner, Observer { loadResponseSaleGroup.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull {
if (it.isError) { if (it.isError) {
ma.messageWithSound(it.errorMessage, true, true) ma.messageWithSound(it.errorMessage, true, true)
} else { } else {
ma.messageWithSound(getString(R.string.previousCollected), false, true) ma.messageWithSound(getString(R.string.previousCollected), false, true)
viewModel.collectionTicketGet( viewModel.collectionTicketGet(
collection.collectionFk, collection.collectionFk,
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK), mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
print = "0", print = "0",
type type
) )
}
} }
}) }
placementSuppleyList.observe(viewLifecycleOwner, Observer { placementSuppleyList.observe(viewLifecycleOwner, Observer {
if (!goBack) printShelvingResult(it) if (!goBack) printShelvingResult(it)
@ -603,33 +607,34 @@ class CollectionFragment(
goBack = false goBack = false
}) })
responseNew.observe(viewLifecycleOwner, Observer { loadAddNew.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull { it ->
// if (!goBack) { // if (!goBack) {
if (it.isError) { if (it.isError) {
customDialog.setTitle(getString(R.string.disponibility)) customDialog.setTitle(getString(R.string.disponibility))
.setDescription(getString(R.string.errorCollectionNew) + it.errorMessage) .setDescription(getString(R.string.errorCollectionNew) + it.errorMessage)
.setKoButton(getString(R.string.close)) { .setKoButton(getString(R.string.close)) {
scanRequest() scanRequest()
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()
} else { } else {
if (!goBack) { if (!goBack) {
viewModel.collectionTicketGet( viewModel.collectionTicketGet(
collection.collectionFk, collection.collectionFk,
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK), mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
print = "0", print = "0",
type type
) )
}
} }
goBack = false
} }
}
goBack = false
})
responseCode.observe(viewLifecycleOwner, Observer { responseCode.observe(viewLifecycleOwner, Observer {
@ -655,71 +660,76 @@ class CollectionFragment(
goBack2 = false goBack2 = false
}) })
responseTicketState.observe(viewLifecycleOwner) { loadTicketState.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull { it ->
if (!goBack) { if (!goBack) {
if ((it.code == "ON_CHECKING" || it.code == "CHECKED") && it.user.id != mobileApplication.userId) { if ((it.code == "ON_CHECKING" || it.code == "CHECKED") && it.user.id != mobileApplication.userId) {
var customDialogWarningChecking = CustomDialog(requireContext()) var customDialogWarningChecking = CustomDialog(requireContext())
customDialogWarningChecking.setTitle(getString(R.string.info)) customDialogWarningChecking.setTitle(getString(R.string.info))
customDialogWarningChecking.setDescription( customDialogWarningChecking.setDescription(
if (it.code == "ON_CHECKING") { if (it.code == "ON_CHECKING") {
getString(R.string.checkingByUser, it.user.username) getString(R.string.checkingByUser, it.user.username)
} else { } else {
getString(R.string.checkedByUser, it.user.username) getString(R.string.checkedByUser, it.user.username)
} }
).setOkButton(getString(R.string.aware)) { ).setOkButton(getString(R.string.aware)) {
customDialogWarningChecking.dismiss() customDialogWarningChecking.dismiss()
}.show() }.show()
}
} }
} }
} }
responseTicketClosure.observe(viewLifecycleOwner, Observer { loadTicketClousure.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull { it ->
if (!goBack) {
if (it.response.toBoolean()) {
var customDialogWarning = CustomDialog(requireContext())
customDialogWarning.setTitle(getString(R.string.urgentWarning))
customDialogWarning.setDescription(getString(R.string.ticketWarning))
.setOkButton(getString(R.string.aware)) {
customDialogWarning.dismiss()
}.show()
}
}
})
responseIncQuantity.observe(viewLifecycleOwner, Observer {
if (it.isError) {
ma.messageWithSound(it.errorMessage, isError = true, true)
} else {
if (!goBack) { if (!goBack) {
incresaseSuccesful() if (it.response.toBoolean()) {
} else { var customDialogWarning = CustomDialog(requireContext())
goBack = false customDialogWarning.setTitle(getString(R.string.urgentWarning))
customDialogWarning.setDescription(getString(R.string.ticketWarning))
.setOkButton(getString(R.string.aware)) {
customDialogWarning.dismiss()
}.show()
}
} }
} }
}
}) loadIncQuantity.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull { it ->
responseSaleMistakeAdd.observe(viewLifecycleOwner, Observer {
if (!goBack) {
if (it.isError) { if (it.isError) {
ma.messageWithSound(it.errorMessage, isError = true, true) ma.messageWithSound(it.errorMessage, isError = true, true)
} else { } else {
ma.messageWithSound( if (!goBack) {
getString(R.string.errorRegistered), isError = false, false incresaseSuccesful()
) } else {
goBack = true goBack = false
}
} }
} }
}) }
loadSaleMistakeAdd.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull { it ->
if (!goBack) {
if (it.isError) {
ma.messageWithSound(it.errorMessage, isError = true, true)
} else {
ma.messageWithSound(
getString(R.string.errorRegistered), isError = false, false
)
goBack = true
}
}
}
}
mistakeList.observe(viewLifecycleOwner, Observer { mistakeList.observe(viewLifecycleOwner, Observer {

View File

@ -6,6 +6,8 @@ import android.graphics.drawable.Drawable
import android.media.MediaPlayer import android.media.MediaPlayer
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.os.Parcelable import android.os.Parcelable
import android.text.InputType import android.text.InputType
import android.util.Log import android.util.Log
@ -123,6 +125,7 @@ class CollectionFragmentPicker(
private var itemShelvingTracking_mark: Int = 0 private var itemShelvingTracking_mark: Int = 0
private var recylerViewState: Parcelable? = null private var recylerViewState: Parcelable? = null
private var isScanned: Boolean? = null private var isScanned: Boolean? = null
private var myPosition: Int = 0
private lateinit var myGroupList: List<SaleVO> private lateinit var myGroupList: List<SaleVO>
private var canChangeState = true private var canChangeState = true
@ -288,6 +291,9 @@ class CollectionFragmentPicker(
when (type) { when (type) {
CONTROLADOR -> markLine(indice, type) CONTROLADOR -> markLine(indice, type)
SACADOR -> { SACADOR -> {
//jose antonio
myPosition = myGroupList.indexOfFirst { it.saleGroupFk == saleGroupScanned }
println("previa $saleGroupScanned posicion $myPosition")
viewModel.saleTrackingAddPreparedSaleGroup( viewModel.saleTrackingAddPreparedSaleGroup(
saleGroupScanned.toInt() saleGroupScanned.toInt()
) )
@ -546,7 +552,7 @@ class CollectionFragmentPicker(
ma.messageWithSound(it.errorMessage, true, true) ma.messageWithSound(it.errorMessage, true, true)
} else { } else {
ma.messageWithSound(getString(R.string.previousCollected), false, true) ma.messageWithSound(getString(R.string.previousCollected), false, true)
viewModel.collectionTicketGet( viewModel.collectionTicketGet(
collection.collectionFk, collection.collectionFk,
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK), mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
@ -835,6 +841,7 @@ class CollectionFragmentPicker(
} else { } else {
// pintar línea // pintar línea
saleAdapter!!.notifyDataSetChanged() saleAdapter!!.notifyDataSetChanged()
myPosition = storedPosition
ReviewQuantityForRefreshingAndSorting( ReviewQuantityForRefreshingAndSorting(
sales[storedPosition].quantity!!.toInt(), sales[storedPosition].quantity!!.toInt(),
@ -1378,6 +1385,13 @@ class CollectionFragmentPicker(
} }
isMarking = true isMarking = true
setTotalLines() setTotalLines()
val handler = Handler(Looper.getMainLooper())
handler.postDelayed({
val inputMethodManager =
requireContext().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
inputMethodManager.hideSoftInputFromWindow(binding.scanInput.windowToken, 0)
}, 300L)
} }
private fun checkStateParent() { private fun checkStateParent() {
@ -1415,7 +1429,7 @@ class CollectionFragmentPicker(
} }
private fun setListPosition(position: Int, isFromBack: Boolean) { private fun setListPosition(position: Int, isFromBack: Boolean) {
lm!!.scrollToPositionWithOffset(storedBackPosition, 0) lm!!.scrollToPositionWithOffset(myPosition, 0)
// lm!!.scrollToPositionWithOffset(position, 0) // lm!!.scrollToPositionWithOffset(position, 0)
/* storedPosition = position /* storedPosition = position
@ -1523,6 +1537,7 @@ class CollectionFragmentPicker(
} }
} }
storedBackPosition = position storedBackPosition = position
myPosition = position
setListPosition(position, false) setListPosition(position, false)
if (type != PRECHECKER) { if (type != PRECHECKER) {

View File

@ -32,7 +32,6 @@ import es.verdnatura.presentation.common.OnMistakeClickListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.OnPackingClickSaleListener import es.verdnatura.presentation.common.OnPackingClickSaleListener
import es.verdnatura.presentation.common.OnPasillerosItemClickListener import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.common.OnQuantityClickSaleListener
import es.verdnatura.presentation.common.OnSaleClickSaleListener import es.verdnatura.presentation.common.OnSaleClickSaleListener
import es.verdnatura.presentation.common.OnTicketClickSaleListener import es.verdnatura.presentation.common.OnTicketClickSaleListener
import es.verdnatura.presentation.common.ToolBarAdapterTooltip import es.verdnatura.presentation.common.ToolBarAdapterTooltip
@ -345,18 +344,28 @@ class CollectionFragmentPickerNew(
} }
} }
responseExistsItemShelvingSale.observe(viewLifecycleOwner) { loadExistsResponse.observe(viewLifecycleOwner) { event ->
if (!goBack) { event.getContentIfNotHandled().notNull {
if (it.exists) {
markLine(it.position, it.quantity, true) getString(R.string.updateSalesReserve).toast(
} else { requireContext()
)
updateScreen()
}
}
loadFindItemShelvingResponse.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull {
if (it.shelvingFk != myGroupList[it.position].code) {
getString(R.string.updateSalesReserve).toast( getString(R.string.updateSalesReserve).toast(
requireContext() requireContext()
) )
viewModel.collectionTicketGetSalix(collection.collectionFk, false) updateScreen()
} else {
markLine(it.position, it.quantity, true)
} }
} }
} }
responseParking.observe(viewLifecycleOwner) { responseParking.observe(viewLifecycleOwner) {
@ -398,46 +407,37 @@ class CollectionFragmentPickerNew(
responseConfirmReservedItemShelvingSale.observe(viewLifecycleOwner) { responseConfirmReservedItemShelvingSale.observe(viewLifecycleOwner) {
if (it.isError) {
ma.messageWithSound(
it.errorMessage,
isError = true,
isPlayed = true
)
}
if (!it.isError) {
myGroupList[positionConfirm].isPicked = 1
saleAdapter!!.notifyDataSetChanged()
lm!!.scrollToPositionWithOffset(storedPosition, 0)
viewModel.collectionTicketGetSalix(
collection.collectionFk, print = false
)
}
}
responseItemShelvingSale.observe(viewLifecycleOwner) {
myGroupList[positionConfirm].isPicked = 1 myGroupList[positionConfirm].isPicked = 1
myGroupList[positionConfirm].reservedQuantity = quantityConfirm saleAdapter!!.notifyDataSetChanged()
viewModel.collectionTicketGetSalix( lm!!.scrollToPositionWithOffset(storedPosition, 0)
collection.collectionFk, print = false /* viewModel.collectionTicketGetSalix(
) collection.collectionFk, print = false
lm!!.scrollToPositionWithOffset(positionConfirm, 0) )*/
ma.messageWithSound(
getString(R.string.operationSuccess), it.isError, !it.isError, isToasted = false
)
} }
responseItemShelvingSaleUnPicked.observe(viewLifecycleOwner) {
myGroupList[positionUnmarked].isPicked = 1 /*
myGroupList[positionUnmarked].reservedQuantity = quantityConfirm responseItemShelvingSale.observe(viewLifecycleOwner) {
viewModel.collectionTicketGetSalix( myGroupList[positionConfirm].isPicked = 1
collection.collectionFk, print = false myGroupList[positionConfirm].reservedQuantity = quantityConfirm
) viewModel.collectionTicketGetSalix(
lm!!.scrollToPositionWithOffset(positionUnmarked, 0) collection.collectionFk, print = false
ma.messageWithSound( )
getString(R.string.operationSuccess), it.isError, !it.isError, isToasted = false lm!!.scrollToPositionWithOffset(positionConfirm, 0)
) ma.messageWithSound(
getString(R.string.operationSuccess), it.isError, !it.isError, isToasted = false
)
}*/
loadUnpicked.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull {
myGroupList[positionUnmarked].isPicked = 0
myGroupList[positionUnmarked].reservedQuantity = quantityConfirm
saleAdapter!!.notifyItemChanged(positionUnmarked)
lm!!.scrollToPositionWithOffset(positionUnmarked, 0)
}
} }
responseItemShelvingSaleGroup.observe(viewLifecycleOwner) { responseItemShelvingSaleGroup.observe(viewLifecycleOwner) {
@ -512,24 +512,7 @@ class CollectionFragmentPickerNew(
saleAdapter = SaleAdapterNew( saleAdapter = SaleAdapterNew(
myGroupList, myGroupList,
pasillerosItemClickListener!!, pasillerosItemClickListener!!,
object : OnQuantityClickSaleListener {
override fun onQuantityClick(sale: Sale) {
sales.forEachIndexed { index, saleVO ->
if (saleVO.saleFk == sale.saleFk) {
if (sale.isPicked == 1) {
showErrorMessage(
title = getString(R.string.info),
text = getString(R.string.unmarkForModify)
)
}
}
}
}
},
object : OnSaleClickSaleListener { object : OnSaleClickSaleListener {
override fun onSaleClick(mySale: Sale) { override fun onSaleClick(mySale: Sale) {
myGroupList.forEachIndexed { index, sale -> myGroupList.forEachIndexed { index, sale ->
@ -886,13 +869,22 @@ class CollectionFragmentPickerNew(
}.setOkButtonTwo(getString(R.string.no)) { }.setOkButtonTwo(getString(R.string.no)) {
scanRequest() scanRequest()
customDialogThreeButtonsQuantity.dismiss() customDialogThreeButtonsQuantity.dismiss()
if (quantity == 0) { viewModel.itemShelvingSaleExists(
viewModel.itemShelvingSaleExists( myGroupList[position].itemShelvingSaleFk,
myGroupList[position].itemShelvingSaleFk, position, quantity myGroupList[position].itemShelvingFk,
) position,
} else { quantity
markLine(position, quantity, true) )
} /* if (quantity == 0) {
viewModel.itemShelvingSaleExists(
myGroupList[position].itemShelvingSaleFk,
myGroupList[position].itemShelvingFk,
position,
quantity
)
} else {
markLine(position, quantity, true)
}*/
}.setKoButton(getString(R.string.cancel)) { }.setKoButton(getString(R.string.cancel)) {
scanRequest() scanRequest()
customDialogThreeButtonsQuantity.dismiss() customDialogThreeButtonsQuantity.dismiss()
@ -1170,7 +1162,8 @@ class CollectionFragmentPickerNew(
origin = value[0].origin, origin = value[0].origin,
size = value[0].size, size = value[0].size,
itemShelvingSaleFk = value[0].itemShelvingSaleFk, itemShelvingSaleFk = value[0].itemShelvingSaleFk,
longName = value[0].parkingCode ?: "" longName = value[0].parkingCode ?: "",
itemShelvingFk = 0
) )
//prime elemento//hay que hacer una copia si no queda la referencia //prime elemento//hay que hacer una copia si no queda la referencia

View File

@ -14,7 +14,7 @@ import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemExistsItemShelvingSale import es.verdnatura.presentation.common.ItemShelving
import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.common.SaleTrackingReplaceSalix import es.verdnatura.presentation.common.SaleTrackingReplaceSalix
import es.verdnatura.presentation.common.SaleTrackingSalix import es.verdnatura.presentation.common.SaleTrackingSalix
@ -44,14 +44,20 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val collectionTicketList: LiveData<CollectionVO> val collectionTicketList: LiveData<CollectionVO>
get() = _collectionTicketList get() = _collectionTicketList
private val _responseCollectionId by lazy { MutableLiveData<Int>() } private val _responseExistsItemShelvingSale by lazy { MutableLiveData<Boolean>() }
val responseCollectionId: LiveData<Int> val responseExistsItemShelvingSale: LiveData<Boolean>
get() = _responseCollectionId
private val _responseExistsItemShelvingSale by lazy { MutableLiveData<ResponseItemExistsItemShelvingSale>() }
val responseExistsItemShelvingSale: LiveData<ResponseItemExistsItemShelvingSale>
get() = _responseExistsItemShelvingSale get() = _responseExistsItemShelvingSale
val loadExistsResponse: LiveData<Event<Boolean>> =
_responseExistsItemShelvingSale.map { Event(it) }
private val _responseItemShelvingFind by lazy { MutableLiveData<ItemShelving>() }
val responseItemShelvingFind: LiveData<ItemShelving>
get() = _responseItemShelvingFind
val loadFindItemShelvingResponse: LiveData<Event<ItemShelving>> =
_responseItemShelvingFind.map { Event(it) }
private val _collectionTicketSalix by lazy { MutableLiveData<CollectionTicket>() } private val _collectionTicketSalix by lazy { MutableLiveData<CollectionTicket>() }
val collectionTicketSalix: LiveData<CollectionTicket> val collectionTicketSalix: LiveData<CollectionTicket>
get() = _collectionTicketSalix get() = _collectionTicketSalix
@ -63,10 +69,6 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val loadCollectionTicketSalix: LiveData<Event<CollectionTicket>> = val loadCollectionTicketSalix: LiveData<Event<CollectionTicket>> =
_collectionTicketSalix.map { Event(it) } _collectionTicketSalix.map { Event(it) }
private val _collectionTicketListLocal by lazy { MutableLiveData<CollectionTicket>() }
val collectionTicketListLocal: LiveData<CollectionTicket>
get() = _collectionTicketListLocal
private val _placementSuppleyList by lazy { MutableLiveData<PlacementSupplyListVO>() } private val _placementSuppleyList by lazy { MutableLiveData<PlacementSupplyListVO>() }
val placementSuppleyList: LiveData<PlacementSupplyListVO> val placementSuppleyList: LiveData<PlacementSupplyListVO>
get() = _placementSuppleyList get() = _placementSuppleyList
@ -78,6 +80,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
private val _responseSaleMistakeAdd by lazy { MutableLiveData<ResponseItemVO>() } private val _responseSaleMistakeAdd by lazy { MutableLiveData<ResponseItemVO>() }
val responseSaleMistakeAdd: LiveData<ResponseItemVO> val responseSaleMistakeAdd: LiveData<ResponseItemVO>
get() = _responseSaleMistakeAdd get() = _responseSaleMistakeAdd
val loadSaleMistakeAdd: LiveData<Event<ResponseItemVO>> =
_responseSaleMistakeAdd.map { Event(it) }
private val _responseItemShelvingSaleSupplyAdd by lazy { MutableLiveData<ResponseItemVO>() } private val _responseItemShelvingSaleSupplyAdd by lazy { MutableLiveData<ResponseItemVO>() }
val responseItemShelvingSaleSupplyAdd: LiveData<ResponseItemVO> val responseItemShelvingSaleSupplyAdd: LiveData<ResponseItemVO>
@ -91,33 +95,38 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val responseSaleTracking_mark: LiveData<ResponseItemVO> val responseSaleTracking_mark: LiveData<ResponseItemVO>
get() = _responseSaleTracking_mark get() = _responseSaleTracking_mark
private val _responseConfirmReservedItemShelvingSale by lazy { MutableLiveData<ResponseItemVO>() } private val _responseConfirmReservedItemShelvingSale by lazy { MutableLiveData<Boolean>() }
val responseConfirmReservedItemShelvingSale: LiveData<ResponseItemVO> val responseConfirmReservedItemShelvingSale: LiveData<Boolean>
get() = _responseConfirmReservedItemShelvingSale get() = _responseConfirmReservedItemShelvingSale
val loadPicked: LiveData<Event<Boolean>> =
_responseConfirmReservedItemShelvingSale.map { Event(it) }
private val _responseItemShelvingSale by lazy { MutableLiveData<ResponseItemVO>() } private val _responseItemShelvingSale by lazy { MutableLiveData<ResponseItemVO>() }
val responseItemShelvingSale: LiveData<ResponseItemVO> val responseItemShelvingSale: LiveData<ResponseItemVO>
get() = _responseItemShelvingSale get() = _responseItemShelvingSale
private val _responseItemShelvingSaleUnPicked by lazy { MutableLiveData<ResponseItemVO>() } private val _responseItemShelvingSaleUnPicked by lazy { MutableLiveData<Boolean>() }
val responseItemShelvingSaleUnPicked: LiveData<ResponseItemVO> val responseItemShelvingSaleUnPicked: LiveData<Boolean>
get() = _responseItemShelvingSaleUnPicked get() = _responseItemShelvingSaleUnPicked
val loadUnpicked: LiveData<Event<ResponseItemVO>> = val loadUnpicked: LiveData<Event<Boolean>> = _responseItemShelvingSaleUnPicked.map { Event(it) }
_responseItemShelvingSaleUnPicked.map { Event(it) }
private val _responseCollectionAddItem by lazy { MutableLiveData<ResponseItemVO>() } private val _responseCollectionAddItem by lazy { MutableLiveData<Boolean>() }
val responseCollectionAddItem: LiveData<ResponseItemVO> val responseCollectionAddItem: LiveData<Boolean>
get() = _responseCollectionAddItem get() = _responseCollectionAddItem
private val _responseConfirmReservedUpdate by lazy { MutableLiveData<ResponseItemVO>() } private val _responseItemShelvingSaleDelete by lazy { MutableLiveData<Boolean>() }
val responseConfirmReservedUpdate: LiveData<ResponseItemVO> val responseItemShelvingSaleDelete: LiveData<Boolean> = _responseItemShelvingSaleDelete
get() = _responseConfirmReservedUpdate val loadResponseDelete: LiveData<Event<Boolean>> =
_responseItemShelvingSaleDelete.map { Event(it) }
private val _responseParking by lazy { MutableLiveData<ResponseItemVO>() } private val _responseParking by lazy { MutableLiveData<ResponseItemVO>() }
val responseParking: LiveData<ResponseItemVO> val responseParking: LiveData<ResponseItemVO>
get() = _responseParking get() = _responseParking
val loadParking: LiveData<Event<ResponseItemVO>> = _responseParking.map { Event(it) }
private val _responsePrint by lazy { MutableLiveData<ResponseItemVO>() } private val _responsePrint by lazy { MutableLiveData<ResponseItemVO>() }
val responsePrint: LiveData<ResponseItemVO> val responsePrint: LiveData<ResponseItemVO>
get() = _responsePrint get() = _responsePrint
@ -133,6 +142,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
private val _responseTicketState by lazy { MutableLiveData<TicketState>() } private val _responseTicketState by lazy { MutableLiveData<TicketState>() }
val responseTicketState: LiveData<TicketState> = _responseTicketState val responseTicketState: LiveData<TicketState> = _responseTicketState
val loadTicketState: LiveData<Event<TicketState>> = _responseTicketState.map { Event(it) }
private val _responseUsedShelves by lazy { MutableLiveData<ResponseItemVO>() } private val _responseUsedShelves by lazy { MutableLiveData<ResponseItemVO>() }
val responseUsedShelves: LiveData<ResponseItemVO> val responseUsedShelves: LiveData<ResponseItemVO>
get() = _responseUsedShelves get() = _responseUsedShelves
@ -141,26 +152,23 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val responseSaleGroup: LiveData<ResponseItemVO> val responseSaleGroup: LiveData<ResponseItemVO>
get() = _responseSaleGroup get() = _responseSaleGroup
val loadResponseSaleGroup: LiveData<Event<ResponseItemVO>> =
_responseSaleGroup.map { Event(it) }
private val _responseItemShelvingSaleGroup by lazy { MutableLiveData<ResponseItemVO>() } private val _responseItemShelvingSaleGroup by lazy { MutableLiveData<ResponseItemVO>() }
val responseItemShelvingSaleGroup: LiveData<ResponseItemVO> val responseItemShelvingSaleGroup: LiveData<ResponseItemVO>
get() = _responseItemShelvingSaleGroup get() = _responseItemShelvingSaleGroup
private val _responsecheckfully by lazy { MutableLiveData<ResponseItemVO>() }
val responsecheckfully: LiveData<ResponseItemVO>
get() = _responsecheckfully
private val _responseTicketClosure by lazy { MutableLiveData<ResponseItemVO>() } private val _responseTicketClosure by lazy { MutableLiveData<ResponseItemVO>() }
val responseTicketClosure: LiveData<ResponseItemVO> val responseTicketClosure: LiveData<ResponseItemVO>
get() = _responseTicketClosure get() = _responseTicketClosure
val loadTicketClousure: LiveData<Event<ResponseItemVO>> =
_responseTicketClosure.map { Event(it) }
private val _responseCollectionUnchecked by lazy { MutableLiveData<ResponseItemVO>() } private val _responseCollectionUnchecked by lazy { MutableLiveData<ResponseItemVO>() }
val responseCollectionUnchecked: LiveData<ResponseItemVO> val responseCollectionUnchecked: LiveData<ResponseItemVO>
get() = _responseCollectionUnchecked get() = _responseCollectionUnchecked
/* private val _responseMissingTrash by lazy { MutableLiveData<ResponseItemVO>() }
val responseMissingTrash: LiveData<ResponseItemVO>
get() = _responseMissingTrash*/
private val _responseSplit by lazy { MutableLiveData<ResponseItemVO>() } private val _responseSplit by lazy { MutableLiveData<ResponseItemVO>() }
val responseSplit: LiveData<ResponseItemVO> val responseSplit: LiveData<ResponseItemVO>
get() = _responseSplit get() = _responseSplit
@ -169,6 +177,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val responseNew: LiveData<ResponseItemVO> val responseNew: LiveData<ResponseItemVO>
get() = _responseNew get() = _responseNew
val loadAddNew: LiveData<Event<ResponseItemVO>> = _responseNew.map { Event(it) }
private val _responseCode by lazy { MutableLiveData<Int?>() } private val _responseCode by lazy { MutableLiveData<Int?>() }
val responseCode: LiveData<Int?> val responseCode: LiveData<Int?>
get() = _responseCode get() = _responseCode
@ -176,6 +186,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
private val _responseIncQuantity by lazy { MutableLiveData<ResponseItemVO>() } private val _responseIncQuantity by lazy { MutableLiveData<ResponseItemVO>() }
val responseIncQuantity: LiveData<ResponseItemVO> val responseIncQuantity: LiveData<ResponseItemVO>
get() = _responseIncQuantity get() = _responseIncQuantity
val loadIncQuantity: LiveData<Event<ResponseItemVO>> = _responseIncQuantity.map { Event(it) }
private val _mistakeList by lazy { MutableLiveData<MistakeTypeListVO>() } private val _mistakeList by lazy { MutableLiveData<MistakeTypeListVO>() }
val mistakeList: LiveData<MistakeTypeListVO> val mistakeList: LiveData<MistakeTypeListVO>
@ -187,7 +198,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val loadResponseDel: LiveData<Event<ResponseItemVO>> = _responseDel.map { Event(it) } val loadResponseDel: LiveData<Event<ResponseItemVO>> = _responseDel.map { Event(it) }
val loadResponseAddItem: LiveData<Event<ResponseItemVO>> = val loadResponseAddItem: LiveData<Event<Boolean>> =
_responseCollectionAddItem.map { Event(it) } _responseCollectionAddItem.map { Event(it) }
val loadResponseSaleTrackingMark: LiveData<Event<ResponseItemVO>> = val loadResponseSaleTrackingMark: LiveData<Event<ResponseItemVO>> =
@ -301,7 +312,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
} }
fun itemShelvingSaleExists( fun itemShelvingSaleExists(
itemShelvingSaleFk: Number, position: Int, quantity: Int itemShelvingSaleFk: Number, itemShelvingFk: Number, position: Int, quantity: Int
) { ) {
salix.itemShelvingSaleExists( salix.itemShelvingSaleExists(
@ -309,9 +320,39 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
).enqueue(object : SalixCallback<JsonObject>(context) { ).enqueue(object : SalixCallback<JsonObject>(context) {
override fun onSuccess(response: Response<JsonObject>) { override fun onSuccess(response: Response<JsonObject>) {
_responseExistsItemShelvingSale.value = ResponseItemExistsItemShelvingSale(
if (response.body()!!.entrySet().first().value.asBoolean) {
itemShelvingGet(itemShelvingFk, position, quantity)
} else {
_responseExistsItemShelvingSale.value = false
}
/*_responseExistsItemShelvingSale.value = ResponseItemExistsItemShelvingSale(
response.body()!!.entrySet().first().value.asBoolean, position, quantity response.body()!!.entrySet().first().value.asBoolean, position, quantity
)*/
}
})
}
fun itemShelvingGet(
itemShelvingFk: Number, position: Int, quantity: Int
) {
salix.itemShelvingGet(
id = itemShelvingFk
).enqueue(object : SalixCallback<ItemShelving>(context) {
override fun onSuccess(response: Response<ItemShelving>) {
val itemShelving: ItemShelving = response.body()!!
itemShelving.position = position
itemShelving.quantity = quantity
_responseItemShelvingFind.value = ItemShelving(
itemShelving.id,
itemFk = itemShelving.itemFk,
shelvingFk = itemShelving.shelvingFk,
position = position,
quantity = quantity
) )
} }
}) })
} }
@ -394,32 +435,33 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
) { ) {
salix.itemShelvingSaleSetquantitySalix( salix.itemShelvingSaleSetquantitySalix(
params = arrayListOf(itemShelvingSaleFk, quantity, isItemShelvingSaleEmpty, sectorFk) params = arrayListOf(itemShelvingSaleFk, quantity, isItemShelvingSaleEmpty, sectorFk)
//salix.itemShelvingSaleSetQuantity(
// params = ItemShelvingSaleSalix(itemShelvingSaleFk, quantity, isItemShelvingSaleEmpty)
).enqueue(object : SalixCallback<Any>(context) { ).enqueue(object : SalixCallback<Any>(context) {
override fun onError(t: Throwable) {
_responseConfirmReservedItemShelvingSale.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onSuccess(response: Response<Any>) { override fun onSuccess(response: Response<Any>) {
if (!response.isSuccessful) { _responseConfirmReservedItemShelvingSale.value = true
_responseConfirmReservedItemShelvingSale.value = ResponseItemVO(
isError = true, errorMessage = getMessageFromAllResponse( if (isItemShelvingSaleEmpty == true)
nameofFunction(this), response.message() _responseCollectionAddItem.value = true
)
)
} else {
_responseConfirmReservedItemShelvingSale.value =
ResponseItemVO(isError = false, response = "")
}
} }
}) })
} }
fun itemShelvingSaleDeleteIsAdded(
itemShelvingSale: Number
) {
salix.itemShelvingSaleDeleteAdded(
params = arrayListOf(
itemShelvingSale
)
).enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
_responseCollectionAddItem.value = true
}
})
}
fun collectionAddWithReservation( fun collectionAddWithReservation(
item: Int, quantity: Int, ticketSelected: Int, saleGroupFk: Int?, sectorFk: Int? item: Int, quantity: Int, ticketSelected: Int, saleGroupFk: Int?, sectorFk: Int?
) { ) {
@ -429,44 +471,9 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
) )
).enqueue(object : SalixCallback<Any>(context) { ).enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) { override fun onSuccess(response: Response<Any>) {
_responseCollectionAddItem.value = ResponseItemVO(isError = false, response = "") _responseCollectionAddItem.value = true
} }
/* override fun onError(t: Throwable) {
_responseCollectionAddItem.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}*/
})
}
fun confirmItemShelvingReservedUpdate(
itemShelvingSaleFk: Int, isPicked: Boolean
) {
salix.itemShelvingsReservedUpdate(
id = itemShelvingSaleFk, params = hashMapOf("isPicked" to isPicked)
).enqueue(object : SalixCallback<Any>(context) {
override fun onError(t: Throwable) {
_responseConfirmReservedUpdate.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onSuccess(response: Response<Any>) {
if (!response.isSuccessful) {
_responseConfirmReservedUpdate.value = ResponseItemVO(
isError = true, errorMessage = getMessageFromAllResponse(
nameofFunction(this), response.message()
)
)
} else {
_responseConfirmReservedUpdate.value =
ResponseItemVO(isError = false, response = "")
}
}
}) })
} }
@ -562,15 +569,10 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
itemShelvingSaleFk itemShelvingSaleFk
) )
).enqueue(object : SalixCallback<Unit>(context) { ).enqueue(object : SalixCallback<Unit>(context) {
override fun onError(t: Throwable) {
_responseItemShelvingSaleUnPicked.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onSuccess(response: Response<Unit>) { override fun onSuccess(response: Response<Unit>) {
_responseItemShelvingSaleUnPicked.value = ResponseItemVO(isError = false) _responseItemShelvingSaleUnPicked.value = true
super.onSuccess(response)
} }
}) })
} }
@ -592,7 +594,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
override fun onSuccess(response: Response<Unit>) { override fun onSuccess(response: Response<Unit>) {
//Tarea 7926 //Tarea 7926
updateParkingFromSaleGroup(saleGroupFk) // updateParkingFromSaleGroup(saleGroupFk)
_responseSaleGroup.value = ResponseItemVO(isError = false) _responseSaleGroup.value = ResponseItemVO(isError = false)
} }
}) })
@ -602,13 +604,11 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
saleGroupFk: Number saleGroupFk: Number
) { ) {
salix.saleGroupUpdate( salix.saleGroupUpdate(
id = saleGroupFk, id = saleGroupFk, params = hashMapOf("parkingFk" to null)
params = hashMapOf("parkingFk" to null) ).enqueue(object : SalixCallback<Any>(context) {
) override fun onSuccess(response: Response<Any>) {
.enqueue(object : SalixCallback<Any>(context) { }
override fun onSuccess(response: Response<Any>) { })
}
})
} }
fun itemShelvingSaleSetSaleGroup( fun itemShelvingSaleSetSaleGroup(
@ -671,20 +671,19 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
SaleTrackingDelSalix( SaleTrackingDelSalix(
saleFk = saleFk, stateCodes = listOf("CHECKED", "OK", "PREPARED") saleFk = saleFk, stateCodes = listOf("CHECKED", "OK", "PREPARED")
) )
) ).enqueue(object : SalixCallback<Any>(context) {
.enqueue(object : SalixCallback<Any>(context) { override fun onError(t: Throwable) {
override fun onError(t: Throwable) { _responseDel.value = ResponseItemVO(
_responseDel.value = ResponseItemVO( isError = true,
isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) )
) }
}
override fun onSuccess(response: Response<Any>) { override fun onSuccess(response: Response<Any>) {
_responseDel.value = _responseDel.value =
ResponseItemVO(isError = false, response = response.message()) ResponseItemVO(isError = false, response = response.message())
} }
}) })
} }
fun itemShelvingUpdateFromSale( fun itemShelvingUpdateFromSale(
@ -746,13 +745,12 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
} }
fun getIdFromCodeSalix(code: String) { fun getIdFromCodeSalix(code: String) {
getItemFromBarcodeUseCase.execute(code) getItemFromBarcodeUseCase.execute(code).enqueue(object : SalixCallback<Int?>(context) {
.enqueue(object : SalixCallback<Int?>(context) { override fun onSuccess(response: Response<Int?>) {
override fun onSuccess(response: Response<Int?>) { _responseCode.value = response.body()
_responseCode.value = response.body()
} }
}) })
} }
fun collectionIncreaseQuantitySalix( fun collectionIncreaseQuantitySalix(
@ -785,9 +783,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
salix.saleMistakeAdd( salix.saleMistakeAdd(
SaleMistakeSalix( SaleMistakeSalix(
userFk = (context as MobileApplication).userId!!, userFk = (context as MobileApplication).userId!!, saleFk = saleFk, typeFk = typeFk
saleFk = saleFk,
typeFk = typeFk
) )
).enqueue(object : SalixCallback<Any>(context) { ).enqueue(object : SalixCallback<Any>(context) {
override fun onError(t: Throwable) { override fun onError(t: Throwable) {
@ -807,25 +803,23 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
} }
fun mistakeType() { fun mistakeType() {
salix.getMistakeTypes() salix.getMistakeTypes().enqueue(object : SalixCallback<List<MistakeTypeVO>>(context) {
.enqueue(object : SalixCallback<List<MistakeTypeVO>>(context) { override fun onSuccess(response: Response<List<MistakeTypeVO>>) {
override fun onSuccess(response: Response<List<MistakeTypeVO>>) { if (response.body() != null) {
if (response.body() != null) { _mistakeList.value = response.body()?.let { MistakeTypeListVO(it) }
_mistakeList.value = } else {
response.body()?.let { MistakeTypeListVO(it) }
} else {
val listError: ArrayList<MistakeTypeVO> = ArrayList()
listError.add(MistakeTypeVO(0, ""))
_mistakeList.value = MistakeTypeListVO(listError)
}
}
override fun onError(t: Throwable) {
val listError: ArrayList<MistakeTypeVO> = ArrayList() val listError: ArrayList<MistakeTypeVO> = ArrayList()
listError.add(MistakeTypeVO(0, "")) listError.add(MistakeTypeVO(0, ""))
_mistakeList.value = MistakeTypeListVO(listError) _mistakeList.value = MistakeTypeListVO(listError)
} }
}) }
override fun onError(t: Throwable) {
val listError: ArrayList<MistakeTypeVO> = ArrayList()
listError.add(MistakeTypeVO(0, ""))
_mistakeList.value = MistakeTypeListVO(listError)
}
})
} }
fun ticketIsOutClosureZone( fun ticketIsOutClosureZone(
@ -885,9 +879,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
override fun onSuccess(response: Response<Any>) { override fun onSuccess(response: Response<Any>) {
_responseTicketClosure.value = ResponseItemVO( _responseTicketClosure.value = ResponseItemVO(
isError = false, isError = false, response = response.body()!!.toString(), errorMessage = ""
response = response.body()!!.toString(),
errorMessage = ""
) )
} }
@ -913,9 +905,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
if (response.body() != null) { if (response.body() != null) {
_responseCollectionUnchecked.value = ResponseItemVO( _responseCollectionUnchecked.value = ResponseItemVO(
isError = false, isError = false, response = response.body()!!, errorMessage = ""
response = response.body()!!,
errorMessage = ""
) )
} else { } else {
_responseCollectionUnchecked.value = ResponseItemVO( _responseCollectionUnchecked.value = ResponseItemVO(
@ -979,4 +969,28 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}) })
} }
fun saleTrackingSectorCollectionAddPrevOK(
sectorCollectionFk: Int
) {
salix.saleTrackingSectorCollectionAddPrevOK(arrayListOf(sectorCollectionFk))
.enqueue(object : SalixCallback<Any>(context) {
override fun onError(t: Throwable) {
_responseSaleAddPrevOK.value = ResponseItemVO(
isError = true, errorMessage = getMessageFromAllResponse(
nameofFunction(this), t.message!!
)
)
}
override fun onSuccess(response: Response<Any>) {
_responseSaleAddPrevOK.value = ResponseItemVO(
isError = false, errorMessage = "" + getMessageFromAllResponse(
nameofFunction(this), response.message()
)
)
}
})
}
} }

View File

@ -31,7 +31,6 @@ class ControladorFragment :
} }
override fun init() { override fun init() {
binding.scanInput.visibility = VISIBLE binding.scanInput.visibility = VISIBLE
binding.mainToolbar.toolbarTitle.text = getString(R.string.controlticket) binding.mainToolbar.toolbarTitle.text = getString(R.string.controlticket)
setEvents() setEvents()
@ -107,7 +106,7 @@ class ControladorFragment :
} }
responseTicketState.observe( responseTicketState.observe(
viewLifecycleOwner viewLifecycleOwner
) { ) {
if ((it.code == "ON_CHECKING" || it.code == "CHECKED") && it.user.id != mobileApplication.userId) { if ((it.code == "ON_CHECKING" || it.code == "CHECKED") && it.user.id != mobileApplication.userId) {
val customDialogWarning = CustomDialog(requireContext()) val customDialogWarning = CustomDialog(requireContext())

View File

@ -182,11 +182,13 @@ class LoadUnloadFragment(
for (l in list) { for (l in list) {
mlist.add( mlist.add(
ExpeditionSalix( ExpeditionSalix(
expeditionFk = l.id, stateCode = if (l.code != state && l.code != "FOUND") { expeditionFk = l.id,
stateCode = if (l.code != state && l.code != "FOUND" && l.code != "DELIVERED") {
"LOST" "LOST"
} else { } else {
l.code l.code
}, isScanned = l.isScanned },
isScanned = l.isScanned
) )
) )
} }
@ -459,7 +461,9 @@ class LoadUnloadFragment(
binding.expeditionloadunloadRecyclerview.layoutManager = binding.expeditionloadunloadRecyclerview.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
binding.mainToolbar.toolbarSubtitle.text = getString( binding.mainToolbar.toolbarSubtitle.text = getString(
R.string.summaryCount, myList.filter { it.code == state }.size, myList.size R.string.summaryCount,
myList.filter { it.code == state || it.code == "DELIVERED" }.size,
myList.size
) )
setListPosition(myList) setListPosition(myList)

View File

@ -152,7 +152,7 @@ class SummaryFragment(
) { ) {
val listExpedition = list.filter { it.addressFk == address }.map { l -> val listExpedition = list.filter { it.addressFk == address }.map { l ->
ExpeditionSalix( ExpeditionSalix(
expeditionFk = l.id, stateCode = if (l.code == state) { expeditionFk = l.id, stateCode = if (l.code == state && l.code != "DELIVERED") {
state state
} else { } else {
"FOUND" "FOUND"

View File

@ -27,7 +27,7 @@ class Expeditions(
class ExpeditionSalix( class ExpeditionSalix(
val expeditionFk: Number, val expeditionFk: Number,
val stateCode: String?, val stateCode: String? = null,
val isScanned: Int? = 0 val isScanned: Int? = 0
) )

View File

@ -6,8 +6,10 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.map import androidx.lifecycle.map
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.domain.SalixCallback import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.common.Event import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ExpeditionPrintOut
import es.verdnatura.presentation.common.ResponseSign import es.verdnatura.presentation.common.ResponseSign
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicketList import es.verdnatura.presentation.view.feature.delivery.model.ClientTicketList
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicketSalix import es.verdnatura.presentation.view.feature.delivery.model.ClientTicketSalix
@ -36,6 +38,13 @@ import java.io.File
class DeliveryViewModel(val context: Context) : BaseViewModel(context) { class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
private val _isBoxPickingInPrintOut by lazy { MutableLiveData<ExpeditionPrintOut>() }
val isBoxPickingInPrintOut: LiveData<ExpeditionPrintOut> = _isBoxPickingInPrintOut
private val _responseCode by lazy { MutableLiveData<Boolean>() }
val responseCode: LiveData<Boolean> = _responseCode
private val _expeditionInfoList by lazy { MutableLiveData<ExpeditionInfoList>() } private val _expeditionInfoList by lazy { MutableLiveData<ExpeditionInfoList>() }
val expeditionInfoList: LiveData<ExpeditionInfoList> = _expeditionInfoList val expeditionInfoList: LiveData<ExpeditionInfoList> = _expeditionInfoList
@ -64,6 +73,15 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
val responseStateAdd: LiveData<Boolean> val responseStateAdd: LiveData<Boolean>
get() = _responseStateAdd get() = _responseStateAdd
private val _responseExpeditionStateId by lazy { MutableLiveData<Number>() }
val responseExpeditionStateId: LiveData<Number> = _responseExpeditionStateId
private val _responseFindExpeditionId by lazy { MutableLiveData<Number>() }
val responseFindExpeditionId: LiveData<Number> = _responseFindExpeditionId
private val _responseDeleteExpedition by lazy { MutableLiveData<Boolean>() }
val responseDeleteExpedition: LiveData<Boolean> = _responseDeleteExpedition
private val _responseUpdateRoute by lazy { MutableLiveData<Boolean>() } private val _responseUpdateRoute by lazy { MutableLiveData<Boolean>() }
val responseUpdateRoute: LiveData<Boolean> val responseUpdateRoute: LiveData<Boolean>
get() = _responseUpdateRoute get() = _responseUpdateRoute
@ -206,8 +224,6 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
} }
fun expeditionStateAddSalix(expeditions: Any) { fun expeditionStateAddSalix(expeditions: Any) {
// No se quita ResponseItem ya que en caso de fallo hay que guardar datos
salix.addExpeditionState(expeditions).enqueue(object : SalixCallback<Unit>(context) { salix.addExpeditionState(expeditions).enqueue(object : SalixCallback<Unit>(context) {
override fun onSuccess(response: Response<Unit>) { override fun onSuccess(response: Response<Unit>) {
super.onSuccess(response) super.onSuccess(response)
@ -228,6 +244,53 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
}) })
} }
fun findExpedition(expedition: Number, expeditionStateId: Number) {
salix.findExpedition(
filter = """{"where":
{
"expeditionFk":$expedition,
"typeFk":$expeditionStateId
}
}""".trimMargin()
).enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
_responseFindExpeditionId.value = 0
}
override fun onError(t: Throwable) {
_responseFindExpeditionId.value = expedition
}
})
}
fun deleteExpedition(expeditionIds: ArrayList<Number>) {
salix.deleteExpedition(
hashMapOf("expeditionIds" to expeditionIds)
).enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
super.onSuccess(response)
_responseDeleteExpedition.value = true
}
})
}
fun getExpeditionStateId(stateCode: String) {
salix.getExpeditionStateTypeId(
filter = """{"where":{"code":"$stateCode"}}""".trimMargin()
).enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
_responseExpeditionStateId.value =
response.body()?.toString()?.let { JSONObject(it).getInt("id") }
}
})
}
fun getInfoFreelance( fun getInfoFreelance(
userId: Int userId: Int
) { ) {
@ -393,6 +456,45 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
}) })
} }
fun isBoxPickingInPrintOut(expeditionFk: Long, barcode: String) {
getItemFromBarcodeUseCase.execute(barcode).enqueue(object : SalixCallback<Int?>(context) {
override fun onSuccess(response: Response<Int?>) {
if (response.body() != null) {
isBoxPickingOk(
itemFk = response.body().toString().toLong(),
expeditionFk = expeditionFk
)
} else {
_responseCode.value = false
}
}
})
}
fun isBoxPickingOk(
expeditionFk: Long, itemFk: Long
) {
salix.isBoxPickingInPrintOut(
filter = """{"where":{"expeditionFk":$expeditionFk,"itemFk":$itemFk}}"""
).enqueue(object : SalixCallback<ExpeditionPrintOut>(context) {
override fun onSuccess(response: Response<ExpeditionPrintOut>) {
_isBoxPickingInPrintOut.value = response.body()
}
override fun onError(t: Throwable) {
_isBoxPickingInPrintOut.value = ExpeditionPrintOut(0, 0, false)
}
})
}
} }
fun createJSONObject(listTickets: MutableList<Ticket>, note: String): String { fun createJSONObject(listTickets: MutableList<Ticket>, note: String): String {

View File

@ -2,8 +2,6 @@ package es.verdnatura.presentation.view.feature.login.fragment
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Intent import android.content.Intent
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.net.Uri import android.net.Uri
import android.provider.Settings import android.provider.Settings
import android.view.View.GONE import android.view.View.GONE
@ -37,6 +35,7 @@ import es.verdnatura.presentation.view.component.CustomDialogInputThreeValues
import es.verdnatura.presentation.view.component.CustomDialogList import es.verdnatura.presentation.view.component.CustomDialogList
import es.verdnatura.presentation.view.feature.login.adapter.WorkFormAdapter import es.verdnatura.presentation.view.feature.login.adapter.WorkFormAdapter
import es.verdnatura.presentation.view.feature.login.model.WorkForms import es.verdnatura.presentation.view.feature.login.model.WorkForms
import es.verdnatura.presentation.view.feature.login.model.WorkerData
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import java.util.Date import java.util.Date
@ -64,6 +63,7 @@ class LoginFragment(private var imageUri: Uri?) :
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
customDialogInput = CustomDialogInput(requireContext()) customDialogInput = CustomDialogInput(requireContext())
//createFolderSerial() //createFolderSerial()
setSwitch()
saveIdentifiers() saveIdentifiers()
checkUser() checkUser()
binding.buttonLogin.setOnClickListener { binding.buttonLogin.setOnClickListener {
@ -72,31 +72,12 @@ class LoginFragment(private var imageUri: Uri?) :
password = binding.edittextPassword.text.toString() password = binding.edittextPassword.text.toString()
) )
//Tarea 6868
/* viewModel.loginApp(
LoginApp(
user = binding.edittextUsername.text.toString(),
password = binding.edittextPassword.text.toString(),
deviceId = getDevicePDA(),
androidId = mobileApplication.dataStoreApp.readDataStoreKey(ANDROID_ID),
versionApp = getInfoVersionNameApp(),
nameApp = getString(R.string.nameApp),
)
)*/
}
}
if (mobileApplication.dataStoreApp.readDataStoreKey<String>(TOKEN) if (mobileApplication.dataStoreApp.readDataStoreKey<String>(TOKEN)
.isNotBlank() && binding.switchRemember.isChecked .isNotBlank() && binding.switchRemember.isChecked
) { ) {
if (getDevicePDA() != null) { handleUserCall()
viewModel.getSerialNumber(getDevicePDA()!!)
} else {
viewModel.getCurrentUserData(
getString(R.string.logAppName),
getInfoVersionNameApp(),
mobileApplication.dataStoreApp.readDataStoreKey(ANDROID_ID),
)
}
} }
@ -143,25 +124,46 @@ class LoginFragment(private var imageUri: Uri?) :
} }
binding.edittextUsername.requestFocus() binding.edittextUsername.requestFocus()
binding.textviewRememberPassword.setOnLongClickListener { }
if (getDevicePDA() == 19591) {
binding.edittextUsername.setText("sergiodt") private fun handleUserCall() {
binding.edittextPassword.setText("delatorre.1234") val jsonData = mutableMapOf<String, Any>(
"androidId" to mobileApplication.androidId,
"nameApp" to getString(R.string.nameApp),
"versionApp" to getInfoVersionNameApp()
)
viewModel.handleUser(if (getDevicePDA() != null) {
jsonData.apply {
this["deviceId"] = getDevicePDA().toString() // Añadir nuevo campo
} }
true } else {
jsonData
}
)
}
private fun setSwitch() {
binding.switchRemember.setOnCheckedChangeListener { _, isChecked ->
runBlocking {
mobileApplication.dataStoreApp.editDataStoreKey(
REMEMBER, isChecked
)
}
} }
} }
private fun getDevicePDA(): Int? { /* private fun getDevicePDA(): Int? {
return try { return try {
Settings.Global.getString( Settings.Global.getString(
mobileApplication.contentResolver, Settings.Global.DEVICE_NAME mobileApplication.contentResolver, Settings.Global.DEVICE_NAME
).toInt() ).toInt()
} catch (ex: Exception) { } catch (ex: Exception) {
null null
} }
} }*/
/* private fun createFolderSerial() { /* private fun createFolderSerial() {
@ -311,7 +313,7 @@ class LoginFragment(private var imageUri: Uri?) :
private fun checkUser() { private fun checkUser() {
if (mobileApplication.dataStoreApp.readDataStoreKey(REMEMBER)) { if (mobileApplication.dataStoreApp.readDataStoreKey<Boolean>(REMEMBER)) {
binding.edittextUsername.setText( binding.edittextUsername.setText(
mobileApplication.dataStoreApp.readDataStoreKey<String>( mobileApplication.dataStoreApp.readDataStoreKey<String>(
@ -330,9 +332,53 @@ class LoginFragment(private var imageUri: Uri?) :
} }
private fun reviewVersion(it: WorkerData) {
if (it.version == getInfoVersionNameApp()) {
goToMain()
} else {
if (binding.edittextServer.text.toString() == "Producción") {
mobileApplication.clearApplicationData()
}
customDialog.setTitle(getString(R.string.Actualizar))
.setDescription(getString(R.string.updatemng)).setOkButton(
getString(
R.string.Actualizar
)
) {
try {
val openURL = Intent(Intent.ACTION_VIEW)
openURL.data = Uri.parse(it.url)
startActivity(openURL)
} catch (ex: Exception) {
getString(R.string.problemUpdate).toast(requireActivity())
}
}
if (it.isVersionCritical) {
customDialog.setDescription(getString(R.string.updatecritical))
} else {
customDialog.setKoButton(getString(R.string.cancel)) {
customDialog.dismiss()
goToMain()
}
}
customDialog.show()
}
}
override fun observeViewModel() { override fun observeViewModel() {
with(viewModel) { with(viewModel) {
handleUserResponse.observe(viewLifecycleOwner) {
runBlocking {
mobileApplication.dataStoreApp.saveWorkerData(
it
)
}
reviewVersion(it)
}
versionAppItem.observe(viewLifecycleOwner) { versionAppItem.observe(viewLifecycleOwner) {
if (it.version == getInfoVersionNameApp()) { if (it.version == getInfoVersionNameApp()) {
@ -382,8 +428,8 @@ class LoginFragment(private var imageUri: Uri?) :
if (it.vIsAuthorized == "0") { if (it.vIsAuthorized == "0") {
customDialog.setTitle(getString(R.string.error)) customDialog.setTitle(getString(R.string.error)).setDescription(it.vMessage!!)
.setDescription(it.vMessage!!).setOkButton(getString(R.string.close)) { .setOkButton(getString(R.string.close)) {
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()
@ -424,19 +470,6 @@ class LoginFragment(private var imageUri: Uri?) :
} }
} }
/* devicelogresponse.observe(viewLifecycleOwner) {
if (it.isError) {
customDialog.setTitle(getString(R.string.error)).setDescription(it.errorMessage)
.setOkButton(
getString(R.string.accept)
) {
customDialog.dismiss()
getVersion()
}.show()
}
}*/
loginSalixItem.observe(viewLifecycleOwner) { loginSalixItem.observe(viewLifecycleOwner) {
@ -483,15 +516,8 @@ class LoginFragment(private var imageUri: Uri?) :
) )
} }
if (getDevicePDA() != null) { //Tarea 6868
viewModel.getSerialNumber(getDevicePDA()!!) handleUserCall()
} else {
viewModel.getCurrentUserData(
getString(R.string.logAppName),
getInfoVersionNameApp(),
mobileApplication.dataStoreApp.readDataStoreKey(ANDROID_ID),
)
}
} }
} }
@ -524,12 +550,12 @@ class LoginFragment(private var imageUri: Uri?) :
Firebase.crashlytics.setUserId(userName) Firebase.crashlytics.setUserId(userName)
} }
private fun getInfoVersionNameApp(): String { /* private fun getInfoVersionNameApp(): String {
val manager: PackageManager = requireContext().packageManager val manager: PackageManager = requireContext().packageManager
val info: PackageInfo = manager.getPackageInfo(requireContext().packageName, 0) val info: PackageInfo = manager.getPackageInfo(requireContext().packageName, 0)
mobileApplication.versionName = info.versionName mobileApplication.versionName = info.versionName
return info.versionName return info.versionName
} }*/
private fun saveTokenPref(token: String, ttl: Long) { private fun saveTokenPref(token: String, ttl: Long) {

View File

@ -21,14 +21,13 @@ import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.Device
import es.verdnatura.presentation.view.feature.login.model.AccessConfigSalix import es.verdnatura.presentation.view.feature.login.model.AccessConfigSalix
import es.verdnatura.presentation.view.feature.login.model.AccessConfigSalixList import es.verdnatura.presentation.view.feature.login.model.AccessConfigSalixList
import es.verdnatura.presentation.view.feature.login.model.DataUserSalix import es.verdnatura.presentation.view.feature.login.model.DataUserSalix
import es.verdnatura.presentation.view.feature.login.model.LoginApp
import es.verdnatura.presentation.view.feature.login.model.LoginAppData
import es.verdnatura.presentation.view.feature.login.model.LoginDevice 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.LoginSalixVO
import es.verdnatura.presentation.view.feature.login.model.OperatorAdd import es.verdnatura.presentation.view.feature.login.model.OperatorAdd
import es.verdnatura.presentation.view.feature.login.model.OperatorSalix import es.verdnatura.presentation.view.feature.login.model.OperatorSalix
import es.verdnatura.presentation.view.feature.login.model.RenewToken import es.verdnatura.presentation.view.feature.login.model.RenewToken
import es.verdnatura.presentation.view.feature.login.model.VersionApp import es.verdnatura.presentation.view.feature.login.model.VersionApp
import es.verdnatura.presentation.view.feature.login.model.WorkerData
import es.verdnatura.presentation.view.feature.paletizador.model.ItemsExpeditionDynamics import es.verdnatura.presentation.view.feature.paletizador.model.ItemsExpeditionDynamics
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import retrofit2.Response import retrofit2.Response
@ -40,8 +39,8 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) {
val loginSalixItem: LiveData<LoginSalixVO> val loginSalixItem: LiveData<LoginSalixVO>
get() = _loginSalixItem get() = _loginSalixItem
private val _loginApp by lazy { MutableLiveData<LoginAppData>() } private val _handleUserResponse by lazy { MutableLiveData<WorkerData>() }
val loginApp: LiveData<LoginAppData> = _loginApp val handleUserResponse: LiveData<WorkerData> = _handleUserResponse
private val _serialNumber by lazy { MutableLiveData<String?>() } private val _serialNumber by lazy { MutableLiveData<String?>() }
val serialNumber: LiveData<String?> = _serialNumber val serialNumber: LiveData<String?> = _serialNumber
@ -133,27 +132,17 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) {
}) })
} }
fun loginApp( fun handleUser(
login: LoginApp, login: MutableMap<String, Any>
) {
) { salix.handleUser(login).enqueue(object : SalixCallback<WorkerData>(context) {
salix.handleUser(login).enqueue(object : SalixCallback<LoginAppData>(context) { override fun onSuccess(response: Response<WorkerData>) {
override fun onSuccess(response: Response<LoginAppData>) { app.userName = response.body()?.nickname
app.userId = response.body()?.id
_loginApp.value = response.body() app.serialNumber = response.body()?.serialNumber
_handleUserResponse.value = response.body()
} }
override fun onError(t: Throwable) {/* val loginSalixVO = LoginAppData(
user,
password,
"",
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this), t.message!!
)
)
_loginSalixItem.value = loginSalixVO*/
}
}) })
} }

View File

@ -10,35 +10,31 @@ class LoginSalixVO(
var errorMessage: String = "" var errorMessage: String = ""
) )
data class LoginApp( data class WorkerData(
val user: String,
val password: String,
val deviceId: Int?,
val androidId: String,
val versionApp: String,
val nameApp: String
)
data class LoginAppData(
val id: Int,
val token: String,
val ttl: Long,
val numberOfWagons: Int, val numberOfWagons: Int,
var warehouseFk: Int, val trainFk: Int,
val itemPackingTypeFk: String, val itemPackingTypeFk: String,
val warehouseFk: Int,
val labelerFk: Int,
val sectorFk: Int,
val sector: Sector?,
val printer: Printer, val printer: Printer,
val train: Train, val train: Train,
val sector: Sector, val id: Int,
val name: String, val name: String,
val nickname: String, val nickname: String,
val serialNumber: String,
val isVersionCritical: Boolean, val isVersionCritical: Boolean,
val version: String, val version: String,
val vIsAuthorized: String, val url: String?,
val vMessage: String, val message: String?,
val serialNumber: String,
val isOnReservationMode: Boolean = false
) )
data class Printer(val id: Int, val name: String)
data class Train(val id: Int, val name: String)
class DataUserSalix( class DataUserSalix(
val id: Int? = null, val id: Int? = null,
val name: String = "", val name: String = "",
@ -76,12 +72,10 @@ data class Sector(
val id: Int = 0, val id: Int = 0,
val description: String = "", val description: String = "",
val warehouseFk: Int = 0, val warehouseFk: Int = 0,
val backupPrinterFk: Int? val backupPrinterFk: Int?,
val isOnReservationMode: Boolean? = false
) )
data class Printer(val id: Int, val name: String)
data class Train(val id: Int, val name: String)
class AccessConfigSalix( class AccessConfigSalix(
val id: Number = 0, val id: Number = 0,
val renewPeriod: Long = 0, val renewPeriod: Long = 0,

View File

@ -20,14 +20,16 @@ import com.google.android.material.navigation.NavigationBarView
import es.verdnatura.MobileApplication import es.verdnatura.MobileApplication
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.ActivityMainBinding import es.verdnatura.databinding.ActivityMainBinding
import es.verdnatura.domain.ConstAndValues.CONTROLADOR
import es.verdnatura.domain.ConstAndValues.MAINACTIVITY import es.verdnatura.domain.ConstAndValues.MAINACTIVITY
import es.verdnatura.domain.ConstAndValues.MENUBYDEFAULTSELECTED import es.verdnatura.domain.ConstAndValues.MENUBYDEFAULTSELECTED
import es.verdnatura.domain.ConstAndValues.PRECHECKERNEW
import es.verdnatura.domain.ConstAndValues.PREITEMPICKER import es.verdnatura.domain.ConstAndValues.PREITEMPICKER
import es.verdnatura.domain.ConstAndValues.PREITEMPICKERTEST
import es.verdnatura.domain.ConstAndValues.PRINTERFK import es.verdnatura.domain.ConstAndValues.PRINTERFK
import es.verdnatura.domain.ConstAndValues.PRINTERFKDEFAULT import es.verdnatura.domain.ConstAndValues.PRINTERFKDEFAULT
import es.verdnatura.domain.ConstAndValues.RENEWINTERVAL import es.verdnatura.domain.ConstAndValues.RENEWINTERVAL
import es.verdnatura.domain.ConstAndValues.RENEWPERIOD import es.verdnatura.domain.ConstAndValues.RENEWPERIOD
import es.verdnatura.domain.ConstAndValues.SACADOR
import es.verdnatura.domain.ConstAndValues.SECTORFK import es.verdnatura.domain.ConstAndValues.SECTORFK
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.TOKEN import es.verdnatura.domain.ConstAndValues.TOKEN
@ -63,13 +65,12 @@ import es.verdnatura.presentation.view.feature.claim.fragment.reubication.fragme
import es.verdnatura.presentation.view.feature.claim.fragment.reubication.model.Reubication import es.verdnatura.presentation.view.feature.claim.fragment.reubication.model.Reubication
import es.verdnatura.presentation.view.feature.claim.fragment.ubication.ClaimUbicationFragment import es.verdnatura.presentation.view.feature.claim.fragment.ubication.ClaimUbicationFragment
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragment import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragment
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentChecker
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentCheckerPreviousNew
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPicker import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPicker
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPickerNew
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPickerPreviousNew import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPickerPreviousNew
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPreChecker import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPreChecker
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPreCheckerNew
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionShowTicketFragment import es.verdnatura.presentation.view.feature.collection.fragment.CollectionShowTicketFragment
import es.verdnatura.presentation.view.feature.controlador.fragment.ControladorFragment
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoFragment import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoFragment
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoUsuarioFragment import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoUsuarioFragment
import es.verdnatura.presentation.view.feature.delivery.fragments.InfoFragment import es.verdnatura.presentation.view.feature.delivery.fragments.InfoFragment
@ -96,6 +97,7 @@ import es.verdnatura.presentation.view.feature.packaging.fragment.PackagingSumma
import es.verdnatura.presentation.view.feature.packaging.fragment.SupplierFragment import es.verdnatura.presentation.view.feature.packaging.fragment.SupplierFragment
import es.verdnatura.presentation.view.feature.packingHolland.fragment.PackingHollandFragment import es.verdnatura.presentation.view.feature.packingHolland.fragment.PackingHollandFragment
import es.verdnatura.presentation.view.feature.paletizador.fragment.CmrExpeditionPalletFragment import es.verdnatura.presentation.view.feature.paletizador.fragment.CmrExpeditionPalletFragment
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionDeleteFragment
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPalletDetailFragment 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.ExpeditionPalletFragment
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPreparedStateFragment import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPreparedStateFragment
@ -116,6 +118,7 @@ import es.verdnatura.presentation.view.feature.precontrol.PreControladorFragment
import es.verdnatura.presentation.view.feature.presacador.fragment.EndSacadorFragment import es.verdnatura.presentation.view.feature.presacador.fragment.EndSacadorFragment
import es.verdnatura.presentation.view.feature.presacador.fragment.SectorCollectionReserveFragment import es.verdnatura.presentation.view.feature.presacador.fragment.SectorCollectionReserveFragment
import es.verdnatura.presentation.view.feature.qr.QrFragment import es.verdnatura.presentation.view.feature.qr.QrFragment
import es.verdnatura.presentation.view.feature.restaurant.RestaurantActivity
import es.verdnatura.presentation.view.feature.roadmap.fragment.RoadMapListFragment import es.verdnatura.presentation.view.feature.roadmap.fragment.RoadMapListFragment
import es.verdnatura.presentation.view.feature.roadmap.fragment.RoadMapSettingsFragment import es.verdnatura.presentation.view.feature.roadmap.fragment.RoadMapSettingsFragment
import es.verdnatura.presentation.view.feature.roadmap.fragment.StopMapListFragment import es.verdnatura.presentation.view.feature.roadmap.fragment.StopMapListFragment
@ -513,8 +516,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
} }
getString(R.string.historicals) -> { getString(R.string.historicals) -> {
addFragmentOnTop( addFragmentOnTop(
PasilleroFragment.newInstance(itemTitle, isInitMenu = false), PasilleroFragment.newInstance(itemTitle, isInitMenu = false)
) )
} }
@ -536,19 +540,36 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
) )
} }
getString(R.string.titleChecker) -> {/* mainActivityViewmodel.workerActivityAdd( getString(R.string.titleChecker) -> {
WorkerActionSalix(
workerFk = mobileApplication!!.userId!!,
workerActivityTypeFk = "ON_CHECKING",
inTimed = (LocalDate.now()).toString()
)
)*/
addFragmentOnTop(ControladorFragment.newInstance()) // Ya no se utiliza : addFragmentOnTop(ControladorFragment.newInstance())
if (mobileApplication.userId == 19591) {
println("Revisando nueva")
addFragmentOnTop(
CollectionFragmentChecker.newInstance(
CollectionVO(collectionFk = 0),
type = CONTROLADOR
)
)
} else {
println("Revisando vieja")
addFragmentOnTop(
CollectionFragment.newInstance(
CollectionVO(collectionFk = 0),
type = CONTROLADOR
)
)
}
/* addFragmentOnTop(
CollectionFragment.newInstance(
CollectionVO(collectionFk = 0),
type = CONTROLADOR
)
)*/
} }
getString(R.string.titleCorridors) -> { getString(R.string.titleCorridors) -> {
mainActivityPasilleroViewModel.workerActivityAdd(CodeWorkerAction.ON_PREPARATION)
addFragmentOnTop( addFragmentOnTop(
PasilleroFragment.newInstance(itemTitle, isInitMenu = false), PasilleroFragment.newInstance(itemTitle, isInitMenu = false),
) )
@ -658,7 +679,12 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
//Tarea 7855 //Tarea 7855
getString(R.string.scanPreparedExpedition) -> { getString(R.string.scanPreparedExpedition) -> {
addFragmentOnTop(ExpeditionPreparedStateFragment.newInstance()) addFragmentOnTop(
ExpeditionPreparedStateFragment.newInstance(
"PREPARED",
getString(R.string.scanExpeditions)
)
)
} }
getString(R.string.titleAuto) -> { getString(R.string.titleAuto) -> {
@ -674,11 +700,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
}*/ }*/
getString(R.string.titlePickers) -> { getString(R.string.titlePickers) -> {
//addFragmentOnTop(SacadorFragment.newInstance()) mainActivityPasilleroViewModel.workerActivityAdd(CodeWorkerAction.ON_PREPARATION)
addFragmentOnTop(ControlVehiculoFragment.newInstance("")) addFragmentOnTop(SacadorFragment.newInstance("PREPARED"))
//addFragmentOnTop(ControlVehiculoFragment.newInstance(""))
} }
"Sacador Test" -> { "Sacador Test" -> {
mainActivityPasilleroViewModel.workerActivityAdd(CodeWorkerAction.ON_PREPARATION)
addFragmentOnTop(SacadorFragmentNew.newInstance("PREPARED")) addFragmentOnTop(SacadorFragmentNew.newInstance("PREPARED"))
} }
@ -721,13 +749,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
addFragmentOnTop(PreControladorFragment.newInstance()) addFragmentOnTop(PreControladorFragment.newInstance())
} }
getString(R.string.titlePreControlTest) -> { getString(R.string.preControlNew) -> {
addFragmentOnTop( addFragmentOnTop(CollectionFragmentCheckerPreviousNew.newInstance())
CollectionFragmentPreCheckerNew.newInstance(
null,
type = PRECHECKERNEW
)
)
} }
getString(R.string.titleShelvingHistorical) -> { getString(R.string.titleShelvingHistorical) -> {
@ -747,6 +770,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
addFragmentOnTop(WorkermistakeFragment.newInstance(itemTitle)) addFragmentOnTop(WorkermistakeFragment.newInstance(itemTitle))
} }
getString(R.string.deleteExpedition) -> {
addFragmentOnTop(ExpeditionDeleteFragment.newInstance(itemTitle))
}
getString(R.string.titlePackingMistake) -> { getString(R.string.titlePackingMistake) -> {
addFragmentOnTop(PackingMistakeFragment.newInstance(itemTitle)) addFragmentOnTop(PackingMistakeFragment.newInstance(itemTitle))
} }
@ -803,6 +830,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
addFragmentOnTop(PackingHollandFragment.newInstance(itemTitle)) addFragmentOnTop(PackingHollandFragment.newInstance(itemTitle))
} }
getString(R.string.titleRestaurant) -> {
val i = Intent(this, RestaurantActivity::class.java)
startActivity(i)
}
getString(R.string.titleDelivery) -> { getString(R.string.titleDelivery) -> {
mainActivityPasilleroViewModel.workerActivityAdd(CodeWorkerAction.DELIVERY) mainActivityPasilleroViewModel.workerActivityAdd(CodeWorkerAction.DELIVERY)
addFragmentOnTop( addFragmentOnTop(
@ -900,6 +932,12 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
getString(R.string.reviewBoxPicking) -> { getString(R.string.reviewBoxPicking) -> {
addFragmentOnTop(BoxPickingFragment.newInstance(itemTitle)) addFragmentOnTop(BoxPickingFragment.newInstance(itemTitle))
/* addFragmentOnTop(
ExpeditionPreparedStateFragment.newInstance(
"CHECKED",
getString(item.title)
)
)*/
} }
getString(R.string.pickerHelper) -> { getString(R.string.pickerHelper) -> {
@ -1009,23 +1047,28 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
collection: CollectionTicket, type: String, hasPicking: Boolean, hasToAdd: Boolean collection: CollectionTicket, type: String, hasPicking: Boolean, hasToAdd: Boolean
) { ) {
when (type) { when (type) {
"PREITEMPICKERTEST" -> { PREITEMPICKERTEST -> {
println("test presacador") println("test presacador")
//addFragmentOnTop(EndSacadorFragment.newInstance(collection, type)) //addFragmentOnTop(EndSacadorFragment.newInstance(collection, type))
addFragmentOnTop( addFragmentOnTop(
SectorCollectionReserveFragment.newInstance( SectorCollectionReserveFragment.newInstance(
"PREITEMPICKERTEST", collection.collectionFk, hasToAdd type, collection.collectionFk, hasToAdd
) )
) )
} }
//Misma pantalla para los dos scador y prescador
else -> { SACADOR -> {
addFragmentOnTop( addFragmentOnTop(
CollectionFragmentPickerNew.newInstance( CollectionFragmentPickerPreviousNew.newInstance(
collection, type, hasPicking collection, type, hasPicking
) )
) )
/* addFragmentOnTop(
CollectionFragmentPickerNew.newInstance(
collection, type, hasPicking
)
)*/
} }
} }
@ -1054,6 +1097,15 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
addFragmentOnTop(CollectionFragmentPicker.newInstance(collection, type)) addFragmentOnTop(CollectionFragmentPicker.newInstance(collection, type))
} }
// Ya no pasa por aquí el revisar se ha quitado la pantalla intermedia ControladorFragment para ver si así va mejor.
CONTROLADOR -> {
/* addFragmentOnTop(
CollectionFragmentChecker.newInstance(collection, type),
name = "CollectionFragmentChecker"
)*/
addFragmentOnTop(CollectionFragment.newInstance(collection, type))
}
else -> { else -> {
addFragmentOnTop(CollectionFragment.newInstance(collection, type)) addFragmentOnTop(CollectionFragment.newInstance(collection, type))
} }

View File

@ -59,7 +59,8 @@ class SupplierViewModel(val context: Context) : BaseViewModel(context) {
val loadEntryAdd: LiveData<Event<Boolean>> = _entryAdd.map { Event(it) } val loadEntryAdd: LiveData<Event<Boolean>> = _entryAdd.map { Event(it) }
fun getSuppliers() { fun getSuppliers() {
salix.getSuppliers().enqueue(object : SalixCallback<List<Supplier>>(context) { salix.getWithPackaging(
).enqueue(object : SalixCallback<List<Supplier>>(context) {
override fun onSuccess(response: Response<List<Supplier>>) { override fun onSuccess(response: Response<List<Supplier>>) {
_supplierList.value = response.body()?.let { SupplierList(it) } _supplierList.value = response.body()?.let { SupplierList(it) }

View File

@ -0,0 +1,148 @@
package es.verdnatura.presentation.view.feature.paletizador.fragment
import android.content.pm.ActivityInfo
import android.os.Bundle
import android.view.KeyEvent
import android.view.View
import android.view.inputmethod.EditorInfo
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentAutomaticAddExpeditionBinding
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnAutomaticItemClickListener
import es.verdnatura.presentation.common.itemScanValue
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionSalix
import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewModel
import es.verdnatura.presentation.view.feature.ubicador.adapter.AutomaticAdapter
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
class ExpeditionDeleteFragment(var title: String = "") :
BaseFragment<FragmentAutomaticAddExpeditionBinding, DeliveryViewModel>(
DeliveryViewModel::class
) {
private var adapter: AutomaticAdapter? = null
private var contador = 0
private var isScanned = false
private val listExpeditions: ArrayList<ExpeditionSalix> = arrayListOf()
private var expeditionStateTypeId: Number = 0
companion object {
fun newInstance(title: String) = ExpeditionDeleteFragment(title = title)
fun newInstance() = ExpeditionDeleteFragment()
}
override fun getLayoutId(): Int = R.layout.fragment_automatic_add_expedition
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
activity?.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT
}
override fun onDestroyView() {
super.onDestroyView()
activity?.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
}
override fun init() {
ma.hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text = title
setEvents()
setViews()
setToolBar()
super.init()
}
private fun setToolBar() {
binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE
}
private fun setSubtitle() {
binding.mainToolbar.toolbarSubtitle.text =
getString(R.string.countNumber, getString(R.string.label), listExpeditions.size)
}
private fun setViews() {
adapter =
AutomaticAdapter(listExpeditions.map { it.expeditionFk.toLong() } as ArrayList<Long>,
object : OnAutomaticItemClickListener {
override fun onAutomaticItemClickListener(position: Int) {
if (listExpeditions.size > position) {
listExpeditions.removeAt(position)
}
adapter!!.updateItems(listExpeditions.map { it.expeditionFk.toLong() } as ArrayList<Long>)
setSubtitle()
}
})
binding.itemsRecyclerview.adapter = adapter
binding.itemsRecyclerview.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
}
private fun setEvents() {
binding.editMatricula.requestFocus()
binding.editMatricula.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
isScanned =
event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
if (binding.editMatricula.text.toString().isNotEmpty()) {
try {
val itemScaned = itemScanValue(
textScanned_filterDouble(binding.editMatricula.text.toString()),
arrayOf("expedition"),
"id"
).toString().toLong()
if (!(listExpeditions.any { it.expeditionFk == itemScaned })) {
listExpeditions.add(
ExpeditionSalix(
expeditionFk = itemScaned,
)
)
binding.itemsRecyclerview.scrollToPosition(0)
adapter!!.updateItems(listExpeditions.map { it.expeditionFk.toLong() } as ArrayList<Long>)
} else {
ma.messageWithSound(
message = "Caja ya escaneada",
isError = true,
isPlayed = true,
isToasted = true
)
}
} catch (ex: Exception) {
ma.messageWithSound(ex.message.toString(), isError = true, isPlayed = true)
}
}
binding.editMatricula.setText("")
ma.hideKeyboard(binding.editMatricula)
return@setOnEditorActionListener true
} else {
ma.messageWithSound(
getString(R.string.diferentAction), isError = true, isPlayed = true
)
}
return@setOnEditorActionListener false
}
binding.buttonFinalizar.setOnClickListener {
if (listExpeditions.isNotEmpty()) viewModel.deleteExpedition(listExpeditions.map { it.expeditionFk } as ArrayList<Number>) else ma.onMyBackPressed()
}
binding.mainToolbar.backButton.setOnClickListener {
ma.onMyBackPressed()
}
}
override fun observeViewModel() {
with(viewModel) {
responseDeleteExpedition.observe(viewLifecycleOwner) {
ma.onMyBackPressed()
}
}
}
}

View File

@ -1,5 +1,7 @@
package es.verdnatura.presentation.view.feature.paletizador.fragment package es.verdnatura.presentation.view.feature.paletizador.fragment
import android.content.pm.ActivityInfo
import android.os.Bundle
import android.view.KeyEvent import android.view.KeyEvent
import android.view.View import android.view.View
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
@ -15,7 +17,7 @@ import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewM
import es.verdnatura.presentation.view.feature.ubicador.adapter.AutomaticAdapter import es.verdnatura.presentation.view.feature.ubicador.adapter.AutomaticAdapter
@Suppress("UNUSED_ANONYMOUS_PARAMETER") @Suppress("UNUSED_ANONYMOUS_PARAMETER")
class ExpeditionPreparedStateFragment : class ExpeditionPreparedStateFragment(var codeState: String = "PREPARED", var title: String = "") :
BaseFragment<FragmentAutomaticAddExpeditionBinding, DeliveryViewModel>( BaseFragment<FragmentAutomaticAddExpeditionBinding, DeliveryViewModel>(
DeliveryViewModel::class DeliveryViewModel::class
) { ) {
@ -24,19 +26,33 @@ class ExpeditionPreparedStateFragment :
private var contador = 0 private var contador = 0
private var isScanned = false private var isScanned = false
private val listExpeditions: ArrayList<ExpeditionSalix> = arrayListOf() private val listExpeditions: ArrayList<ExpeditionSalix> = arrayListOf()
private var expeditionStateTypeId: Number = 0
companion object { companion object {
fun newInstance(codeState: String, title: String) =
ExpeditionPreparedStateFragment(codeState = codeState, title = title)
fun newInstance() = ExpeditionPreparedStateFragment() fun newInstance() = ExpeditionPreparedStateFragment()
} }
override fun getLayoutId(): Int = R.layout.fragment_automatic_add_expedition override fun getLayoutId(): Int = R.layout.fragment_automatic_add_expedition
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
activity?.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT
}
override fun onDestroyView() {
super.onDestroyView()
activity?.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
}
override fun init() { override fun init() {
ma.hideBottomNavigation(View.GONE) ma.hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text = getString(R.string.scanExpeditions) binding.mainToolbar.toolbarTitle.text = title
setEvents() setEvents()
setViews() setViews()
setToolBar() setToolBar()
viewModel.getExpeditionStateId(codeState)
super.init() super.init()
} }
@ -46,7 +62,7 @@ class ExpeditionPreparedStateFragment :
private fun setSubtitle() { private fun setSubtitle() {
binding.mainToolbar.toolbarSubtitle.text = binding.mainToolbar.toolbarSubtitle.text =
getString(R.string.countNumber, getString(R.string.label), contador) getString(R.string.countNumber, getString(R.string.label), listExpeditions.size)
} }
private fun setViews() { private fun setViews() {
@ -54,12 +70,12 @@ class ExpeditionPreparedStateFragment :
AutomaticAdapter(listExpeditions.map { it.expeditionFk.toLong() } as ArrayList<Long>, AutomaticAdapter(listExpeditions.map { it.expeditionFk.toLong() } as ArrayList<Long>,
object : OnAutomaticItemClickListener { object : OnAutomaticItemClickListener {
override fun onAutomaticItemClickListener(position: Int) { override fun onAutomaticItemClickListener(position: Int) {
contador -= 1
setSubtitle()
if (listExpeditions.size > position) { if (listExpeditions.size > position) {
listExpeditions.removeAt(position) listExpeditions.removeAt(position)
} }
adapter!!.updateItems(listExpeditions.map { it.expeditionFk.toLong() } as ArrayList<Long>) adapter!!.updateItems(listExpeditions.map { it.expeditionFk.toLong() } as ArrayList<Long>)
setSubtitle()
} }
}) })
binding.itemsRecyclerview.adapter = adapter binding.itemsRecyclerview.adapter = adapter
@ -75,21 +91,25 @@ class ExpeditionPreparedStateFragment :
isScanned = isScanned =
event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
if (binding.editMatricula.text.toString().isNotEmpty()) { if (binding.editMatricula.text.toString().isNotEmpty()) {
contador += 1
setSubtitle()
try { try {
val itemScaned = itemScanValue(
listExpeditions.add( textScanned_filterDouble(binding.editMatricula.text.toString()),
ExpeditionSalix( arrayOf("expedition"),
expeditionFk = itemScanValue( "id"
textScanned_filterDouble(binding.editMatricula.text.toString()), ).toString().toLong()
arrayOf("expedition"), if (!(listExpeditions.any { it.expeditionFk == itemScaned })) {
"id" viewModel.findExpedition(
).toString().toLong(), stateCode = "PREPARED", isScanned = 0 itemScaned, expeditionStateTypeId
) )
) binding.itemsRecyclerview.scrollToPosition(0)
adapter!!.updateItems(listExpeditions.map { it.expeditionFk.toLong() } as ArrayList<Long>) } else {
binding.itemsRecyclerview.scrollToPosition(0) ma.messageWithSound(
message = getString(R.string.boxDuplicated),
isError = true,
isPlayed = true,
isToasted = true
)
}
} catch (ex: Exception) { } catch (ex: Exception) {
ma.messageWithSound(ex.message.toString(), isError = true, isPlayed = true) ma.messageWithSound(ex.message.toString(), isError = true, isPlayed = true)
} }
@ -108,12 +128,12 @@ class ExpeditionPreparedStateFragment :
} }
binding.buttonFinalizar.setOnClickListener { binding.buttonFinalizar.setOnClickListener {
if (listExpeditions.isNotEmpty())
if (listExpeditions.isNotEmpty()) viewModel.expeditionStateAddSalix( viewModel.expeditionStateAddSalix(
Expeditions( Expeditions(
listExpeditions listExpeditions
) )
) else ma.onMyBackPressed() ) else ma.onMyBackPressed()
} }
binding.mainToolbar.backButton.setOnClickListener { binding.mainToolbar.backButton.setOnClickListener {
@ -126,8 +146,34 @@ class ExpeditionPreparedStateFragment :
responseStateAdd.observe(viewLifecycleOwner) { responseStateAdd.observe(viewLifecycleOwner) {
ma.onMyBackPressed() ma.onMyBackPressed()
} }
responseExpeditionStateId.observe(viewLifecycleOwner) {
expeditionStateTypeId = it
}
responseFindExpeditionId.observe(viewLifecycleOwner) {
if (it != 0) {
listExpeditions.add(
ExpeditionSalix(
expeditionFk = it,
stateCode = codeState,
isScanned = if (isScanned) 1 else 0
)
)
setSubtitle()
adapter!!.updateItems(listExpeditions.map { it.expeditionFk.toLong() } as ArrayList<Long>)
} else {
ma.messageWithSound(
if (codeState == "PREPARED") getString(R.string.expeditionPrepared) else getString(
R.string.errorBoxPicking
),
isError = true,
isPlayed = true,
isToasted = true
)
}
}
} }
} }
} }

View File

@ -39,7 +39,6 @@ class PasilleroFragment(
override fun init() { override fun init() {
ma.hideBottomNavigation(View.VISIBLE) ma.hideBottomNavigation(View.VISIBLE)
if (getString(R.string.main) == tagName) { if (getString(R.string.main) == tagName) {
val myWorkSelected: String = mobileApplication.dataStoreApp.readDataStoreKey( val myWorkSelected: String = mobileApplication.dataStoreApp.readDataStoreKey(
@ -47,7 +46,7 @@ class PasilleroFragment(
) )
binding.mainToolbarDesign.layoutTool.visibility = View.GONE binding.mainToolbarDesign.layoutTool.visibility = View.GONE
if ( myWorkSelected != "Producción" && myWorkSelected != "") { if (myWorkSelected != "Producción" && myWorkSelected != "") {
binding.pasillerosItems.setBackgroundColor(Color.RED) binding.pasillerosItems.setBackgroundColor(Color.RED)
binding.mainToolbarDesign.toolbarTitle.setBackgroundColor(Color.RED) binding.mainToolbarDesign.toolbarTitle.setBackgroundColor(Color.RED)
binding.mainToolbarDesign.toolbarTitle.text = binding.mainToolbarDesign.toolbarTitle.text =
@ -88,9 +87,8 @@ class PasilleroFragment(
).ifBlank { tagName } ).ifBlank { tagName }
when (showMenu) { when (showMenu) {
getString(R.string.titleCorridors) -> { getString(R.string.titleCorridors) ->
viewModel.inititializeDefaultData() viewModel.inititializeDefaultData()
}
getString(R.string.titlePalletizers) -> viewModel.inititializeDefaultPallet() getString(R.string.titlePalletizers) -> viewModel.inititializeDefaultPallet()
getString(R.string.titleBufferManegement) -> viewModel.inititializeDefaultBuffer() getString(R.string.titleBufferManegement) -> viewModel.inititializeDefaultBuffer()
@ -117,7 +115,7 @@ class PasilleroFragment(
PasillerosItemVO( PasillerosItemVO(
R.drawable.ic_picker_ui, R.drawable.ic_picker_ui,
R.string.titlePickers, R.string.titlePickers,
R.string.titlePickersDescrip R.string.titlePickersDescrip
) )
) )
@ -127,7 +125,7 @@ class PasilleroFragment(
viewModel.inititializeDefaultDataInit() viewModel.inititializeDefaultDataInit()
} }
} }
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }

View File

@ -5,11 +5,13 @@ import android.content.Context
import es.verdnatura.MobileApplication import es.verdnatura.MobileApplication
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.domain.ConstAndValues.RESERVATIONMODE import es.verdnatura.domain.ConstAndValues.RESERVATIONMODE
import es.verdnatura.domain.ConstAndValues.SECTORISONRESERVATIONMODE
import es.verdnatura.domain.SalixCallback import es.verdnatura.domain.SalixCallback
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.view.feature.pasillero.model.CodeWorkerAction import es.verdnatura.presentation.view.feature.pasillero.model.CodeWorkerAction
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import es.verdnatura.presentation.view.feature.pasillero.model.WorkerActionSalix import es.verdnatura.presentation.view.feature.pasillero.model.WorkerActionSalix
import kotlinx.coroutines.runBlocking
import retrofit2.Response import retrofit2.Response
class PasilleroViewModel(context: Context) : BaseViewModel(context) { class PasilleroViewModel(context: Context) : BaseViewModel(context) {
@ -21,7 +23,19 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
val userId = (contextApp as MobileApplication).userId val userId = (contextApp as MobileApplication).userId
private val isOnReservationMode = private val isOnReservationMode =
(contextApp as MobileApplication).dataStoreApp.readDataStoreKey<Boolean>(RESERVATIONMODE) (contextApp as MobileApplication).dataStoreApp.readDataStoreKey<Boolean>(RESERVATIONMODE)
private val isOnReservationModeSector =
(contextApp as MobileApplication).dataStoreApp.readDataStoreKey<Boolean?>(
SECTORISONRESERVATIONMODE
)
private var existSectorOnReservationMode: Boolean = false
init {
runBlocking {
existSectorOnReservationMode =
(contextApp as MobileApplication).dataStoreApp.isPreferenceExists((SECTORISONRESERVATIONMODE))
}
}
fun inititializeDefaultData() { fun inititializeDefaultData() {
workerActivityAdd(CodeWorkerAction.STORAGE) workerActivityAdd(CodeWorkerAction.STORAGE)
_pasillerositem.add( _pasillerositem.add(
@ -61,13 +75,13 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
) )
//tarea 7855 //tarea 7855
/* _pasillerositem.add( _pasillerositem.add(
PasillerosItemVO( PasillerosItemVO(
R.drawable.ic_scan_prepared, R.drawable.ic_scan_prepared,
R.string.scanPreparedExpedition), R.string.scanPreparedExpedition,
R.string.scanPreparedExpedition) R.string.scanPreparedExpedition
) )
)*/ )
_pasillerositem.add( _pasillerositem.add(
@ -257,30 +271,30 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
R.string.titleCorridorsDescrip R.string.titleCorridorsDescrip
) )
) )
//precontrol //sacador
_pasillerositem.add( if (isOnReservationModeSector == true || (!existSectorOnReservationMode && isOnReservationMode)) {
PasillerosItemVO(
R.drawable.ic_picker_ui, R.string.titlePickers, R.string.titlePickersDescrip
)
)
//val working_in_testMenu = false
if (userId == 19591) {
_pasillerositem.add( _pasillerositem.add(
PasillerosItemVO( PasillerosItemVO(
R.drawable.ic_picker_ui, R.string.sacador_test, R.string.sacador_test R.drawable.ic_picker_ui, R.string.sacador_test, R.string.sacador_test
) )
) )
if (userId == 19591) { } else {
_pasillerositem.add( _pasillerositem.add(
PasillerosItemVO( PasillerosItemVO(
R.drawable.ic_picker_helper, R.drawable.ic_picker_ui, R.string.titlePickers, R.string.titlePickersDescrip
R.string.pickerHelper,
R.string.pickerHelperDescrip
)
) )
} )
}
if (userId == 19591) {
_pasillerositem.add(
PasillerosItemVO(
R.drawable.ic_picker_helper,
R.string.pickerHelper,
R.string.pickerHelperDescrip
)
)
} }
_pasillerositem.add( _pasillerositem.add(
@ -393,9 +407,8 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
fun inititializeDefaultPrevia() { fun inititializeDefaultPrevia() {
workerActivityAdd(CodeWorkerAction.PREVIOUS) workerActivityAdd(CodeWorkerAction.PREVIOUS)
//lolass
if (isOnReservationMode) { if (isOnReservationModeSector == true || (!existSectorOnReservationMode && isOnReservationMode)) {
// if (userId == 19591 || userId == 18404 || userId == 9) {
_pasillerositem.add( _pasillerositem.add(
PasillerosItemVO( PasillerosItemVO(
R.drawable.ic_previous_presacador, R.drawable.ic_previous_presacador,
@ -403,7 +416,6 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
R.string.titlePickerDescrip R.string.titlePickerDescrip
) )
) )
//}
} else { } else {
_pasillerositem.add( _pasillerositem.add(
PasillerosItemVO( PasillerosItemVO(
@ -423,15 +435,16 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
) )
) )
/* Para preControl de reservas, faltan cosas no se puede todavía.
if (userId == 19591) { if (userId == 19591) {
_pasillerositem.add( _pasillerositem.add(
PasillerosItemVO( PasillerosItemVO(
R.drawable.ic_previous_precontrol, R.drawable.ic_previous_precontrol, R.string.preControlNew,
R.string.titlePreControlTest,
R.string.titlePreControlDescrip R.string.preControlNew
) )
) )
} }*/
_pasillerositem.add( _pasillerositem.add(
PasillerosItemVO( PasillerosItemVO(
@ -451,6 +464,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
) )
) )
_pasillerositem.add( _pasillerositem.add(
PasillerosItemVO( PasillerosItemVO(
R.drawable.ic_review_boxpicking, R.drawable.ic_review_boxpicking,
@ -465,7 +479,13 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
) )
) )
_pasillerositem.add(
PasillerosItemVO(
R.drawable.ic_delete_expedition,
R.string.deleteExpedition,
R.string.deleleExpeditionDescrip
)
)
_pasillerositem.add( _pasillerositem.add(
@ -480,6 +500,14 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
fun inititializeDefaultOther() { fun inititializeDefaultOther() {
_pasillerositem.add(
PasillerosItemVO(
R.drawable.ic_restaurant,
R.string.titleRestaurant,
R.string.resturantDescrip
)
)
_pasillerositem.add( _pasillerositem.add(
PasillerosItemVO( PasillerosItemVO(
R.drawable.ic_packaging, R.string.titlePackingHolland, R.string.titleUbicatorDescrip R.drawable.ic_packaging, R.string.titlePackingHolland, R.string.titleUbicatorDescrip

View File

@ -11,7 +11,6 @@ import es.verdnatura.R
import es.verdnatura.databinding.FragmentGeneralBlackBinding import es.verdnatura.databinding.FragmentGeneralBlackBinding
import es.verdnatura.domain.ConstAndValues import es.verdnatura.domain.ConstAndValues
import es.verdnatura.domain.notNull import es.verdnatura.domain.notNull
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnBarcodeRowClickListener import es.verdnatura.presentation.common.OnBarcodeRowClickListener
import es.verdnatura.presentation.common.OnCollectionTicketSelectedListener import es.verdnatura.presentation.common.OnCollectionTicketSelectedListener
@ -38,6 +37,8 @@ class SectorCollectionReserveFragment(
private var listSaleGroupAdapter: BarcodeAdapter? = null private var listSaleGroupAdapter: BarcodeAdapter? = null
private var onBack = false private var onBack = false
private var isReserved = false private var isReserved = false
private var listTickets: ArrayList<BarcodeVO> = ArrayList()
private var listTicketsAdapter: BarcodeAdapter? = null
val listIcons: ArrayList<ImageView> = ArrayList() val listIcons: ArrayList<ImageView> = ArrayList()
@ -146,9 +147,18 @@ class SectorCollectionReserveFragment(
try { try {
//Reservar colección //Reservar colección
if (!hasToAdd) { if (!hasToAdd) {
/* if (listTickets.isNotEmpty()) {
listTickets.forEach { item ->
viewModel.getReserveBySectorCollection(item.code!!.toInt())
}
}*/
viewModel.getReserveBySectorCollection(collectionFk) viewModel.getReserveBySectorCollection(collectionFk)
} else { } else {
gotoPicker() hasToAdd = false
viewModel.getReserveBySectorCollection(collectionFk)
//gotoPicker()
} }
} catch (ex: Exception) { } catch (ex: Exception) {
ma.messageWithSound( ma.messageWithSound(
@ -235,27 +245,27 @@ class SectorCollectionReserveFragment(
} }
binding.scanInput.requestFocus() binding.scanInput.requestFocus()
binding.scanInput.setOnEditorActionListener { v, actionId, event -> /* binding.scanInput.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (binding.scanInput.text.toString().isNotEmpty()) { if (binding.scanInput.text.toString().isNotEmpty()) {
try { try {
navigateToCollectionList(binding.scanInput.text.toString().toInt()) navigateToCollectionList(binding.scanInput.text.toString().toInt())
} catch (ex: Exception) { } catch (ex: Exception) {
ex.message!!.toast(requireContext()) ex.message!!.toast(requireContext())
} }
binding.scanInput.setText("") binding.scanInput.setText("")
ma.hideKeyboard(binding.scanInput) ma.hideKeyboard(binding.scanInput)
} }
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
return@setOnEditorActionListener false return@setOnEditorActionListener false
} }*/
} }
@ -310,7 +320,7 @@ class SectorCollectionReserveFragment(
listSaleGroupAdapter!!.notifyItemInserted(listSalesGroup.size - 1) listSaleGroupAdapter!!.notifyItemInserted(listSalesGroup.size - 1)
if (hasToAdd) { if (hasToAdd) {
viewModel.getReserveBySaleGroup(it) // viewModel.getReserveBySaleGroup(it)
} }
} }
} }

View File

@ -0,0 +1,61 @@
package es.verdnatura.presentation.view.feature.restaurant
import android.view.View
import android.widget.Button
import com.google.gson.Gson
import com.google.zxing.BarcodeFormat
import com.journeyapps.barcodescanner.BarcodeEncoder
import es.verdnatura.R
import es.verdnatura.databinding.ActivityRestaurantViewBinding
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseActivity
import es.verdnatura.presentation.view.feature.restaurant.model.UserMenu
class RestaurantActivity : BaseActivity<ActivityRestaurantViewBinding>() {
override fun getLayoutId(): Int = R.layout.activity_restaurant_view
override fun init() {
binding.mainToolbar.toolbarTitle.text = getString(R.string.selectMenu)
/* try {
binding.imgView.loadUrl(intent.getStringExtra(getString(R.string.url))!!)
} catch (ex: Exception) {
getString(R.string.errorImage).toast(this)
finish()
}*/
binding.mainToolbar.backButton.setOnClickListener {
finish()
}
}
fun generateQr(view: View) {
binding.imageQr.visibility = View.VISIBLE
binding.txtOption.visibility = View.VISIBLE
binding.txtOption.text = (view as Button).text.toString()
val userMenu = UserMenu(
user = mobileApplication.userId!!,
menu_id = view.tag.toString().toInt(),
menu = view.text.toString(),
name = mobileApplication.userName!!
)
try {
val barcodeEncoder = BarcodeEncoder()
val bitmap = barcodeEncoder.encodeBitmap(
Gson().toJson(userMenu),
BarcodeFormat.QR_CODE,
400,
400
)
val imageViewQrCode = binding.imageQr
imageViewQrCode.setImageBitmap(bitmap)
} catch (e: Exception) {
e.toString().toast(this)
}
}
private fun showQr() {
}
}

View File

@ -0,0 +1,8 @@
package es.verdnatura.presentation.view.feature.restaurant.model
data class UserMenu(
val user: Int,
val menu_id: Int,
val menu: String,
val name: String
)

View File

@ -101,7 +101,7 @@ class SacadorFragment(
iconPrint.tooltipText = getTooltip(R.drawable.ic_print_black_24dp) iconPrint.tooltipText = getTooltip(R.drawable.ic_print_black_24dp)
if (type == "PREPARED") { if (type == "PREPARED") {
listIcons.add(iconVehicleIn) //listIcons.add(iconVehicleIn)
} else { } else {
listIcons.add(iconPrint) listIcons.add(iconPrint)
} }

View File

@ -27,8 +27,7 @@ import java.util.Calendar
class SacadorFragmentNew( class SacadorFragmentNew(
var type: String var type: String
) : ) : BaseFragment<FragmentSacadorBinding, SacadorViewModel>(SacadorViewModel::class) {
BaseFragment<FragmentSacadorBinding, SacadorViewModel>(SacadorViewModel::class) {
private var onCollectionSelectedListener: OnCollectionTicketSelectedListener? = null private var onCollectionSelectedListener: OnCollectionTicketSelectedListener? = null
private var goBack: Boolean = false private var goBack: Boolean = false
@ -107,7 +106,7 @@ class SacadorFragmentNew(
iconPrint.tooltipText = getTooltip(R.drawable.ic_print_black_24dp) iconPrint.tooltipText = getTooltip(R.drawable.ic_print_black_24dp)
if (type == "PREPARED") { if (type == "PREPARED") {
listIcons.add(iconVehicleIn) // listIcons.add(iconVehicleIn)
} else { } else {
listIcons.add(iconPrint) listIcons.add(iconPrint)
} }
@ -122,12 +121,10 @@ class SacadorFragmentNew(
iconAdd.drawable -> { iconAdd.drawable -> {
if (type == "PREPARED") { if (type == "PREPARED") {
if (hasSector()) if (hasSector()) viewModel.collection_assignNew(
viewModel.collection_assignNew(
) )
} else { } else {
if (hasSector()) if (hasSector()) viewModel.sectorCollectionNew(
viewModel.sectorCollectionNew(
mobileApplication.dataStoreApp.readDataStoreKey( mobileApplication.dataStoreApp.readDataStoreKey(
SECTORFK SECTORFK
) )
@ -151,8 +148,7 @@ class SacadorFragmentNew(
customDialogInput.setInputText(InputType.TYPE_CLASS_NUMBER) customDialogInput.setInputText(InputType.TYPE_CLASS_NUMBER)
customDialogInput.setTitle(getString(R.string.printTicket)) customDialogInput.setTitle(getString(R.string.printTicket))
customDialogInput.setDescription(getString(R.string.printPreviousGroup)) customDialogInput.setDescription(getString(R.string.printPreviousGroup)).setValue("")
.setValue("")
.setOkButton(getString(R.string.print)) { .setOkButton(getString(R.string.print)) {
print() print()
@ -178,8 +174,7 @@ class SacadorFragmentNew(
private fun print() { private fun print() {
try { try {
if (customDialogInput.getValue().isNotEmpty() if (customDialogInput.getValue().isNotEmpty()) {
) {
if (ma.havePrinter()) { if (ma.havePrinter()) {
viewModel.ticketPrintLabelPrevious(customDialogInput.getValue().toInt()) viewModel.ticketPrintLabelPrevious(customDialogInput.getValue().toInt())
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>( (getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(
@ -224,7 +219,8 @@ class SacadorFragmentNew(
it.list.forEach { it.list.forEach {
//lolass //lolass
var myDate = getCalendarForDateMinusOneDay(requireContext()).convertToDateString() var myDate =
getCalendarForDateMinusOneDay(requireContext()).convertToDateString()
if (!it.created.contains(myDate)) { if (!it.created.contains(myDate)) {
myCollectionsList.add(CollectionTicket(it.collectionFk, it.created)) myCollectionsList.add(CollectionTicket(it.collectionFk, it.created))
} }
@ -236,11 +232,20 @@ class SacadorFragmentNew(
response.observe(viewLifecycleOwner) { response.observe(viewLifecycleOwner) {
if (it.isError) { if (it.isError) {
ma.messageWithSound(it.errorMessage, isError = true, isPlayed = false) ma.messageWithSound(
it.errorMessage,
isError = true,
isPlayed = true,
isToasted = true
)
} else { } else {
if (it.response.isNotBlank()) { if (it.response.isNotBlank()) {
addCollectionToList(it.response.toInt()) if (collectionsList.isNotEmpty()) {
addCollectionToList(it.response.toInt())
} else {
callBack(type)
}
} else { } else {
when (type) { when (type) {
@ -306,8 +311,7 @@ class SacadorFragmentNew(
if (isNew) { if (isNew) {
collectionsList.add( collectionsList.add(
CollectionTicket( CollectionTicket(
collectionFk = collection, collectionFk = collection, created = getString(R.string.newCreated)
created = getString(R.string.newCreated)
) )
) )
} else { } else {
@ -319,6 +323,7 @@ class SacadorFragmentNew(
} }
adapter?.notifyDataSetChanged() adapter?.notifyDataSetChanged()
} }
private fun hasSector(): Boolean { private fun hasSector(): Boolean {
return if (ma.haveSector()) { return if (ma.haveSector()) {
true true

View File

@ -123,7 +123,6 @@ class SacadorViewModel(val context: Context) : BaseViewModel(context) {
fun collection_assignNew() { fun collection_assignNew() {
salix.collectionAssigned() salix.collectionAssigned()
// silex.collection_assign()
.enqueue( .enqueue(
object : object :
SalixCallback<Int>(context) { SalixCallback<Int>(context) {

View File

@ -30,6 +30,7 @@ data class Ticket(
data class Sale( data class Sale(
val itemShelvingSaleFk: Int, val itemShelvingSaleFk: Int,
val itemShelvingFk: Int,
val ticketFk: Int, val ticketFk: Int,
val saleGroupFk: Int?, val saleGroupFk: Int?,
val saleFk: Int, val saleFk: Int,

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorPrimary">
<path
android:fillColor="@android:color/white"
android:pathData="M560,680L120,680L120,280L840,280L840,400Q826,400 811,400Q796,400 780,400Q775,400 770,400Q765,400 760,400L760,360L200,360L200,600L560,600Q560,605 560,610Q560,615 560,620Q560,636 560,651Q560,666 560,680ZM200,600L200,600L200,360L200,360L200,600Q200,600 200,600Q200,600 200,600ZM640,704L724,620L640,536L696,480L780,564L864,480L920,536L837,620L920,704L864,760L780,677L696,760L640,704Z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorPrimary">
<path
android:fillColor="@android:color/white"
android:pathData="M280,880L280,514Q229,500 194.5,458Q160,416 160,360L160,80L240,80L240,360L280,360L280,80L360,80L360,360L400,360L400,80L480,80L480,360Q480,416 445.5,458Q411,500 360,514L360,880L280,880ZM680,880L680,560L560,560L560,280Q560,197 618.5,138.5Q677,80 760,80L760,880L680,880Z"/>
</vector>

View File

@ -0,0 +1,151 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/verdnatura_black">
<include
android:id="@+id/main_toolbar"
layout="@layout/toolbar_fragment"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/scan_input"
style="@style/ScanLineTextSearch"
android:layout_width="match_parent"
android:hint="@string/Escaneaetiqueta"
android:inputType="textVisiblePassword"
android:lines="1"
android:maxLines="1"
android:textColorHint="@android:color/white"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/main_toolbar" /> <!-- Ajustar a la toolbar -->
<!-- Primer botón debajo del scan_input -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/scan_input">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/scan_input">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<Button
android:id="@+id/button1"
style="@style/DefaultButton.DynamicButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/layout_margin_min"
android:onClick="generateQr"
android:tag="1"
android:text="@string/lunch"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/scan_input" />
<Button
android:id="@+id/button2"
style="@style/DefaultButton.DynamicButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_bottom_dynamic"
android:onClick="generateQr"
android:tag="2"
android:text="@string/halfLunch"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/scan_input" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<Button
android:id="@+id/button3"
style="@style/DefaultButton.DynamicButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/layout_margin_min"
android:onClick="generateQr"
android:tag="3"
android:text="@string/menu"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/scan_input" />
<Button
android:id="@+id/button4"
style="@style/DefaultButton.DynamicButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_bottom_dynamic"
android:onClick="generateQr"
android:tag="4"
android:text="@string/halfMenu"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/scan_input" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="@dimen/layout_margin_prepicker"
android:layout_weight="1"
android:baselineAligned="false"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/scan_input">
<ImageView
android:id="@+id/imageQr"
android:layout_width="match_parent"
android:layout_height="336dp"
android:visibility="invisible" />
<TextView
android:id="@+id/txtOption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/verdnatura_white"
android:visibility="invisible">
</TextView>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@ -51,11 +51,12 @@
android:id="@+id/fragment_sacador_collections" android:id="@+id/fragment_sacador_collections"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="8dp" android:layout_marginTop="4dp"
tools:listitem="@layout/item_article_row_fragment" /> tools:listitem="@layout/item_article_row_fragment" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<include <include
android:id="@+id/main_toolbar" android:id="@+id/main_toolbar"
layout="@layout/toolbar_fragment" layout="@layout/toolbar_fragment"

View File

@ -31,15 +31,7 @@
android:id="@+id/item_row_layout" android:id="@+id/item_row_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical">
>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvHeadlines"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:visibility="visible"
/>
<LinearLayout <LinearLayout
@ -48,14 +40,12 @@
android:background="@color/verdnatura_white" android:background="@color/verdnatura_white"
android:orientation="vertical" android:orientation="vertical"
android:padding="@dimen/layout_margin_min" android:padding="@dimen/layout_margin_min"
android:textColor="@color/verdnatura_black" android:textColor="@color/verdnatura_black">
>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal">
>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -100,22 +90,24 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/ivArrow" android:id="@+id/ivArrow"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:rotation="180"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginEnd="20dp" android:layout_marginEnd="20dp"
android:src="@drawable/ic_arrow_down" android:contentDescription="@string/selectAction"
android:contentDescription="@string/selectAction"/> android:rotation="180"
android:src="@drawable/ic_arrow_down" />
<ImageView <ImageView
android:id="@+id/imageErrorMessage" android:id="@+id/imageErrorMessage"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
app:srcCompat="@drawable/emoticon_error_fragment" android:contentDescription="@string/error"
android:contentDescription="@string/error"/> app:srcCompat="@drawable/emoticon_error_fragment" />
<View <View
android:id="@+id/item_article_row_semaforo_pre" android:id="@+id/item_article_row_semaforo_pre"
@ -155,7 +147,6 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/layout_margin_min" android:layout_marginEnd="@dimen/layout_margin_min"
android:text="@{sale.agencyName}" android:text="@{sale.agencyName}"
android:textSize="@dimen/h8" android:textSize="@dimen/h8"
@ -183,9 +174,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"></LinearLayout>
>
</LinearLayout>
<!--CONTENIDO=================================================--> <!--CONTENIDO=================================================-->
<!--app:layout_constraintEnd_toStartOf="@+id/item_article_quantity_picked"--> <!--app:layout_constraintEnd_toStartOf="@+id/item_article_quantity_picked"-->
@ -226,9 +215,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/layout_margin_min" android:layout_marginEnd="@dimen/layout_margin_min"
android:text="@string/de" android:text="@string/de"
android:visibility="gone"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body1" android:textSize="@dimen/body1"
android:visibility="gone"
app:layout_constraintEnd_toStartOf="@+id/item_article_quantityOld" app:layout_constraintEnd_toStartOf="@+id/item_article_quantityOld"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
@ -239,12 +228,12 @@
android:layout_marginEnd="22dp" android:layout_marginEnd="22dp"
android:paddingStart="10dp" android:paddingStart="10dp"
android:paddingEnd="10dp" android:paddingEnd="10dp"
android:visibility="gone"
android:text="@{Integer.toString(sale.quantity)}" android:text="@{Integer.toString(sale.quantity)}"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body1" android:textSize="@dimen/body1"
android:textStyle="bold" android:textStyle="bold"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tool:text="10" /> tool:text="10" />
@ -354,8 +343,8 @@
android:text="@{sale.cel2}" android:text="@{sale.cel2}"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body3" android:textSize="@dimen/body3"
android:visibility="gone"
android:textStyle="bold" android:textStyle="bold"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="@+id/item_article_quantity_line2" app:layout_constraintEnd_toEndOf="@+id/item_article_quantity_line2"
app:layout_constraintTop_toTopOf="@+id/item_article_quantity_line2" app:layout_constraintTop_toTopOf="@+id/item_article_quantity_line2"
tool:text="cel2" /> tool:text="cel2" />
@ -365,17 +354,16 @@
android:id="@+id/item_article_quantity" android:id="@+id/item_article_quantity"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="@dimen/layout_collection_quantity"
android:paddingTop="@dimen/layout_margin_minest" android:paddingTop="@dimen/layout_margin_minest"
android:paddingBottom="@dimen/default_layout_margin" android:paddingBottom="@dimen/default_layout_margin"
android:paddingStart="@dimen/layout_collection_quantity"
android:text="@{Integer.toString(sale.quantity)}" android:text="@{Integer.toString(sale.quantity)}"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body3" android:textSize="@dimen/body3"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintEnd_toEndOf="@+id/item_article_quantity_line2" app:layout_constraintEnd_toEndOf="@+id/item_article_quantity_line2"
app:layout_constraintTop_toTopOf="@+id/item_article_quantity_line2" app:layout_constraintTop_toTopOf="@+id/item_article_quantity_line2"
tool:text="100" tool:text="100" />
/>
<TextView <TextView
android:id="@+id/item_article_quantity_line3" android:id="@+id/item_article_quantity_line3"
@ -449,7 +437,7 @@
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/item_article_placements" android:id="@+id/item_article_placements"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:background="@color/verdnatura_background_item_picker" android:background="@color/verdnatura_background_item_picker"
android:clipToPadding="false" android:clipToPadding="false"

View File

@ -27,12 +27,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvHeadlines"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:visibility="visible" />
<LinearLayout <LinearLayout
@ -173,7 +167,8 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/layout_margin_prepicker"> android:layout_height="@dimen/layout_margin_prepicker"
android:orientation="horizontal">
<TextView <TextView
android:id="@+id/item_parking_code" android:id="@+id/item_parking_code"
@ -181,7 +176,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="1dp" android:layout_marginStart="1dp"
android:layout_marginEnd="@dimen/layout_margin_min" android:layout_marginEnd="@dimen/layout_margin_min"
android:layout_weight="0.5"
android:maxLines="1" android:maxLines="1"
android:text="" android:text=""
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
@ -189,22 +183,8 @@
android:textStyle="bold" android:textStyle="bold"
tool:text="A-01-1" /> tool:text="A-01-1" />
<TextView
android:id="@+id/item_first_to_picker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="1dp"
android:layout_weight="0.5"
android:gravity="end"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body1"
android:textStyle="bold"
android:visibility="invisible"
tool:text="25 x 5" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@ -262,7 +242,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/layout_margin_min_to_modify" android:layout_marginStart="@dimen/layout_margin_min_to_modify"
android:layout_weight="2" android:layout_weight="2"
android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:text="@{Long.toString(sale.itemFk)}" android:text="@{Long.toString(sale.itemFk)}"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
@ -456,15 +435,30 @@
android:id="@+id/layout_error" android:id="@+id/layout_error"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone"> android:visibility="gone"
tool:visibility="visible">
<TextView <TextView
android:id="@+id/txt_error" android:id="@+id/txt_error"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="5"
android:background="@color/verdnatura_red" android:background="@color/verdnatura_red"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
tool:text="Cantidad original 100" /> tool:text="Cantidad original 100" />
<ImageView
android:id="@+id/delete_reserve"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/verdnatura_red"
android:gravity="end"
android:src="@drawable/ic_delete_black_24dp"
android:visibility="invisible"
tools:visibility="visible" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/verdnatura_black"
android:orientation="horizontal"
android:padding="8dp">
<TextView
android:id="@+id/toast_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/verdnatura_orange_salix"
android:textSize="16sp" />
</LinearLayout>

View File

@ -9,9 +9,9 @@
<string name="Pallet">Pallet</string> <string name="Pallet">Pallet</string>
<string name="Ruta">Ruta</string> <string name="Ruta">Ruta</string>
<string name="Cajas">Cajas</string> <string name="Cajas">Cajas</string>
<string name="Nivel">Nivel:</string> <string name="Nivel">Niv:</string>
<string name="de">de</string> <string name="de">de</string>
<string name="Ticket">Ticket</string> <string name="Ticket">T:</string>
<string name="Concepto">Concepto</string> <string name="Concepto">Concepto</string>
<string name="SinServir">SinServir</string> <string name="SinServir">SinServir</string>
<string name="Aparcado">Aparcado</string> <string name="Aparcado">Aparcado</string>
@ -848,7 +848,7 @@
<string name="errorRepeatedShelving">Carro ya introducido</string> <string name="errorRepeatedShelving">Carro ya introducido</string>
<string name="errorGetData">errorGetData</string> <string name="errorGetData">errorGetData</string>
<string name="errorSector">No tienes sector seleccionado. Ve a pantalla ajustes y selecciona uno</string> <string name="errorSector">No tienes sector seleccionado. Ve a pantalla ajustes y selecciona uno</string>
<string name="errorBoxPicking">La expedición ya ha sido revisada. Pregunta encargado por si se ha preparado dos veces.</string> <string name="errorBoxPicking">La expedición ya ha sido revisada.</string>
<string name="errorUserId">No se podido obtener tu id. Vuelve a intentarlo</string> <string name="errorUserId">No se podido obtener tu id. Vuelve a intentarlo</string>
<string name="errorScanItem">Error al escanea el artículo. Inténtalo de nuevo</string> <string name="errorScanItem">Error al escanea el artículo. Inténtalo de nuevo</string>
<string name="errorSignActivity">Vuelve a pulsar para intentar firmar</string> <string name="errorSignActivity">Vuelve a pulsar para intentar firmar</string>
@ -866,6 +866,22 @@
<string name="addItemMultipleShelving">Añade artículo en varios carros</string> <string name="addItemMultipleShelving">Añade artículo en varios carros</string>
<string name="addItemMultipleShelvings">Añade artículos en varios carros</string> <string name="addItemMultipleShelvings">Añade artículos en varios carros</string>
<string name="errorInputBuyFk">Revisa que el elemento escaneado sea un código de compra (buyFk)</string> <string name="errorInputBuyFk">Revisa que el elemento escaneado sea un código de compra (buyFk)</string>
<string name="expeditionPrepared">Expedición ya preparada</string>
<string name="boxDuplicated">Caja duplicada</string>
<string name="reviewNew">Revisar nuevo</string>
<string name="preControlNew">Pre control nuevo</string>
<string name="deleteSale">Borrar la línea</string>
<string name="deleteSaleDescrip">Asegúrate de tener desmarcada la línea y devolver el producto a su carro</string>
<string name="titleRestaurant">Comedor</string>
<string name="resturantDescrip">Genera Qr para el comedor</string>
<string name="lunch">Almuerzo</string>
<string name="halfLunch">Medio Almuerzo</string>
<string name="menu">Menú</string>
<string name="halfMenu">Medio menú</string>
<string name="selectMenu">Elige opción comedor</string>
<string name="deleteExpedition">Borrar expedición</string>
<string name="deleleExpeditionDescrip">Borrar expedición de reparto ,MRW o ViaExpress</string>
<string name="errorBoxpicking">Caja preparada no válida.</string>
</resources> </resources>

View File

@ -9,9 +9,9 @@
<string name="Pallet">Pallet</string> <string name="Pallet">Pallet</string>
<string name="Ruta">Route</string> <string name="Ruta">Route</string>
<string name="Cajas">Cajas</string> <string name="Cajas">Cajas</string>
<string name="Nivel">Nivel:</string> <string name="Nivel">Niv:</string>
<string name="de">de</string> <string name="de">de</string>
<string name="Ticket">Ticket</string> <string name="Ticket">T:</string>
<string name="Concepto">Concepto</string> <string name="Concepto">Concepto</string>
<string name="SinServir">SinServir</string> <string name="SinServir">SinServir</string>
<string name="Aparcado">Aparcado</string> <string name="Aparcado">Aparcado</string>
@ -848,7 +848,7 @@
<string name="shelvingsLocate">Carros a ubicar</string> <string name="shelvingsLocate">Carros a ubicar</string>
<string name="errorGetData">Fallo al intentar obtener datos. Avise a Informática</string> <string name="errorGetData">Fallo al intentar obtener datos. Avise a Informática</string>
<string name="errorSector">No tienes sector seleccionado. Ve a pantalla ajustes y selecciona uno</string> <string name="errorSector">No tienes sector seleccionado. Ve a pantalla ajustes y selecciona uno</string>
<string name="errorBoxPicking">La expedición ya ha sido revisada. Pregunta encargado por si se ha preparado dos veces.</string> <string name="errorBoxPicking">La expedición ya ha sido revisada.</string>
<string name="errorUserId">No se podido obtener tu id. Vuelve a intentarlo</string> <string name="errorUserId">No se podido obtener tu id. Vuelve a intentarlo</string>
<string name="errorScanItem">Error al escanea el artículo. Inténtalo de nuevo</string> <string name="errorScanItem">Error al escanea el artículo. Inténtalo de nuevo</string>
<string name="errorSignActivity">Vuelve a pulsar para intentar firmar</string> <string name="errorSignActivity">Vuelve a pulsar para intentar firmar</string>
@ -866,5 +866,21 @@
<string name="addItemMultipleShelving">Añade artículo en varios carros</string> <string name="addItemMultipleShelving">Añade artículo en varios carros</string>
<string name="addItemMultipleShelvings">Añade artículos en varios carros</string> <string name="addItemMultipleShelvings">Añade artículos en varios carros</string>
<string name="errorInputBuyFk">Revisa que el elemento escaneado sea un código de compra (buyFk)</string> <string name="errorInputBuyFk">Revisa que el elemento escaneado sea un código de compra (buyFk)</string>
<string name="expeditionPrepared">Expedición ya preparada</string>
<string name="boxDuplicated">Caja duplicada</string>
<string name="reviewNew">Revisar nuevo</string>
<string name="preControlNew">Pre control nuevo</string>
<string name="deleteSale">Borrar la línea</string>
<string name="deleteSaleDescrip">Asegúrate de tener desmarcada la línea y devolver el producto a su carro</string>
<string name="titleRestaurant">Comedor</string>
<string name="resturantDescrip">Genera Qr para el comedor</string>
<string name="lunch">Almuerzo</string>
<string name="halfLunch">Medio Almuerzo</string>
<string name="menu">Menú</string>
<string name="halfMenu">Medio Menú</string>
<string name="selectMenu">Elige opción comedor</string>
<string name="deleteExpedition">Borrar expedición</string>
<string name="deleleExpeditionDescrip">Borrar expedición de reparto ,MRW o ViaExpress</string>
<string name="errorBoxpicking">Caja preparada no válida.</string>
</resources> </resources>

View File

@ -11,7 +11,7 @@
<string name="Cajas">Cajas</string> <string name="Cajas">Cajas</string>
<string name="Nivel">Nivel:</string> <string name="Nivel">Nivel:</string>
<string name="de">de</string> <string name="de">de</string>
<string name="Ticket">Ticket</string> <string name="Ticket">T:</string>
<string name="Concepto">Concepto</string> <string name="Concepto">Concepto</string>
<string name="SinServir">SinServir</string> <string name="SinServir">SinServir</string>
<string name="Aparcado">Aparcado</string> <string name="Aparcado">Aparcado</string>
@ -848,7 +848,7 @@
<string name="shelvingsLocate">Carros a ubicar</string> <string name="shelvingsLocate">Carros a ubicar</string>
<string name="errorGetData">Fallo al intentar obtener datos. Avise a Informática</string> <string name="errorGetData">Fallo al intentar obtener datos. Avise a Informática</string>
<string name="errorSector">No tienes sector seleccionado. Ve a pantalla ajustes y selecciona uno</string> <string name="errorSector">No tienes sector seleccionado. Ve a pantalla ajustes y selecciona uno</string>
<string name="errorBoxPicking">La expedición ya ha sido revisada. Pregunta encargado por si se ha preparado dos veces.</string> <string name="errorBoxPicking">La expedición ya ha sido revisada.</string>
<string name="errorUserId">No se podido obtener tu id. Vuelve a intentarlo</string> <string name="errorUserId">No se podido obtener tu id. Vuelve a intentarlo</string>
<string name="errorScanItem">Error al escanea el artículo. Inténtalo de nuevo</string> <string name="errorScanItem">Error al escanea el artículo. Inténtalo de nuevo</string>
<string name="errorSignActivity">Vuelve a pulsar para intentar firmar</string> <string name="errorSignActivity">Vuelve a pulsar para intentar firmar</string>
@ -866,6 +866,22 @@
<string name="addItemMultipleShelving">Añade artículo en varios carros</string> <string name="addItemMultipleShelving">Añade artículo en varios carros</string>
<string name="addItemMultipleShelvings">Añade artículos en varios carros</string> <string name="addItemMultipleShelvings">Añade artículos en varios carros</string>
<string name="errorInputBuyFk">Revisa que el elemento escaneado sea un código de compra (buyFk)</string> <string name="errorInputBuyFk">Revisa que el elemento escaneado sea un código de compra (buyFk)</string>
<string name="expeditionPrepared">Expedición ya preparada</string>
<string name="boxDuplicated">Caja duplicada</string>
<string name="reviewNew">Revisar nuevo</string>
<string name="preControlNew">Pre control nuevo</string>
<string name="deleteSale">Borrar la línea</string>
<string name="deleteSaleDescrip">Asegúrate de tener desmarcada la línea y devolver el producto a su carro</string>
<string name="titleRestaurant">Comedor</string>
<string name="resturantDescrip">Genera Qr para el comedor</string>
<string name="lunch">Almuerzo</string>
<string name="halfLunch">Medio Almuerzo</string>
<string name="menu">Menú</string>
<string name="halfMenu">Medio Menú</string>
<string name="selectMenu">Elige opción comedor</string>
<string name="deleteExpedition">Borrar expedición</string>
<string name="deleleExpeditionDescrip">Borrar expedición de reparto ,MRW o ViaExpress</string>
<string name="errorBoxpicking">Caja preparada no válida.</string>
</resources> </resources>

View File

@ -9,7 +9,7 @@
<dimen name="layout_margin_min_to_modify">2dp</dimen> <dimen name="layout_margin_min_to_modify">2dp</dimen>
<dimen name="layout_margin_minest">1dp</dimen> <dimen name="layout_margin_minest">1dp</dimen>
<dimen name="layout_margin_min">4dp</dimen> <dimen name="layout_margin_min">4dp</dimen>
<dimen name="layout_margin_1">8dp</dimen> <dimen name="layout_margin_1">4dp</dimen>
<dimen name="layout_collection_quantity">10dp</dimen> <dimen name="layout_collection_quantity">10dp</dimen>
<dimen name="default_layout_margin">16dp</dimen> <dimen name="default_layout_margin">16dp</dimen>
<dimen name="layout_end_ticket_color">20dp</dimen> <dimen name="layout_end_ticket_color">20dp</dimen>
@ -118,7 +118,7 @@
<!-- Pintar ticket --> <!-- Pintar ticket -->
<dimen name="ticketColor_height">90dp</dimen> <dimen name="ticketColor_height">80dp</dimen>
<dimen name="ticketColor_width">10dp</dimen> <dimen name="ticketColor_width">10dp</dimen>
<!-- Elements of RecyclerViewer --> <!-- Elements of RecyclerViewer -->

View File

@ -12,9 +12,9 @@
<string name="cmr">CMR</string> <string name="cmr">CMR</string>
<string name="Ruta">Route</string> <string name="Ruta">Route</string>
<string name="Cajas">Boxes</string> <string name="Cajas">Boxes</string>
<string name="Nivel">Level:</string> <string name="Nivel">Lev:</string>
<string name="de">of</string> <string name="de">of</string>
<string name="Ticket">Ticket</string> <string name="Ticket">T:</string>
<string name="tickets">Tickets:</string> <string name="tickets">Tickets:</string>
<string name="showTickets">Tickets</string> <string name="showTickets">Tickets</string>
<string name="Concepto">Concept</string> <string name="Concepto">Concept</string>
@ -850,7 +850,7 @@
<string name="shelvingsLocate">Carros a ubicar</string> <string name="shelvingsLocate">Carros a ubicar</string>
<string name="errorGetData">Fallo al intentar obtener datos. Avise a Informática</string> <string name="errorGetData">Fallo al intentar obtener datos. Avise a Informática</string>
<string name="errorSector">No tienes sector seleccionado. Ve a pantalla ajustes y selecciona uno</string> <string name="errorSector">No tienes sector seleccionado. Ve a pantalla ajustes y selecciona uno</string>
<string name="errorBoxPicking">La expedición ya ha sido revisada. Pregunta encargado por si se ha preparado dos veces.</string> <string name="errorBoxPicking">La expedición ya ha sido revisada.</string>
<string name="errorUserId">No se podido obtener tu id. Vuelve a intentarlo</string> <string name="errorUserId">No se podido obtener tu id. Vuelve a intentarlo</string>
<string name="errorScanItem">Error al escanea el artículo. Inténtalo de nuevo</string> <string name="errorScanItem">Error al escanea el artículo. Inténtalo de nuevo</string>
<string name="errorSignActivity">Vuelve a pulsar para intentar firmar</string> <string name="errorSignActivity">Vuelve a pulsar para intentar firmar</string>
@ -869,5 +869,21 @@
<string name="addItemMultipleShelving">Añade artículo en varios carros</string> <string name="addItemMultipleShelving">Añade artículo en varios carros</string>
<string name="addItemMultipleShelvings">Añade artículos en varios carros</string> <string name="addItemMultipleShelvings">Añade artículos en varios carros</string>
<string name="errorInputBuyFk">Revisa que el elemento escaneado sea un código de compra (buyFk)</string> <string name="errorInputBuyFk">Revisa que el elemento escaneado sea un código de compra (buyFk)</string>
<string name="expeditionPrepared">Expedición ya preparada</string>
<string name="boxDuplicated">Caja duplicada</string>
<string name="reviewNew">Revisar nuevo</string>
<string name="preControlNew">Pre control nuevo</string>
<string name="deleteSale">Borrar la línea</string>
<string name="deleteSaleDescrip">Asegúrate de tener desmarcada la línea y devolver el producto a su carro</string>
<string name="titleRestaurant">Comedor</string>
<string name="resturantDescrip">Genera Qr para el comedor</string>
<string name="lunch">Almuerzo</string>
<string name="halfLunch">Medio Almuerzo</string>
<string name="menu">Menú</string>
<string name="halfMenu">Medio menú</string>
<string name="selectMenu">Elige opción comedor</string>
<string name="deleteExpedition">Borrar expedición</string>
<string name="deleleExpeditionDescrip">Borrar expedición de reparto ,MRW o ViaExpress</string>
<string name="errorBoxpicking">Caja preparada no válida.</string>
</resources> </resources>