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
android:name="android.hardware.telephony"
android:required="false" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.PREVENT_POWER_KEY" />
<uses-permission android:name="android.permission.LAUNCH_APPS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<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"/>-->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!--<queries>
<provider android:authorities="oem_info" />
</queries>-->
<application
android:name=".MobileApplication"
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
android:name=".MobileApplication"
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.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" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
<provider
android:name="androidx.core.content.FileProvider"
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>
<provider
android:name="androidx.core.content.FileProvider"
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>

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.ENTRYOBSERVATIONORIGINAL
import es.verdnatura.domain.ConstAndValues.ENTRYOBSERVATIONS
import es.verdnatura.domain.ConstAndValues.ITEMPACKING
import es.verdnatura.domain.ConstAndValues.NUMBEROFWAGONS
import es.verdnatura.domain.ConstAndValues.PRINTERFK
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.SECTORFK
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.SECTORISONRESERVATIONMODE
import es.verdnatura.domain.ConstAndValues.SUPPLIERID
import es.verdnatura.domain.ConstAndValues.SUPPLIERNAME
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.presentation.view.feature.login.model.OperatorSalix
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.first
import kotlinx.coroutines.flow.map
@ -98,10 +101,90 @@ class DataStoreLocal(var mobileApplication: MobileApplication) {
editDataStoreKey(
NUMBEROFWAGONS, operator.numberOfWagons
)
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 {

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.category.ChangeCategoryViewModel
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.CollectionViewModelCheckerPreviosNew
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoViewModel
import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewModel
import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleViewModel
@ -137,6 +139,12 @@ val viewModelModule = module {
viewModel {
CollectionViewModel(androidContext())
}
viewModel {
CollectionViewModelCheckerPreviosNew(androidContext())
}
viewModel {
CollectionCheckerViewModel(androidContext())
}
viewModel {
ParkingViewModel(androidContext())

View File

@ -12,13 +12,13 @@ object ConstAndValues {
const val SERIALNUMBER = "SERIALNUMBER"
const val ON_CHECKING = "ON_CHECKING"
const val PRECHECKER = "PRECHECKER"
const val PRECHECKERNEW = "PRECHECKERNEW"
const val MAINACTIVITY = "MAIN"
const val VERTICKET = "SHOWTICKET"
const val SECTORFKDEFAULT = -1
const val PRINTERFKDEFAULT = -1
const val WAREHOUSEFKDEFAULT = 60
const val SECTORFK = "sectorFk"
const val SECTORISONRESERVATIONMODE = "sectorIsOnReservationMode"
const val TAG = "VERDNATURA::"
const val USERFK = "userFk"
const val USER = "user"
@ -27,6 +27,7 @@ object ConstAndValues {
const val TTL = "ttl"
const val TOKENCREATED = "tokenCreated"
const val SECTORDESCRIP = "sectordescrip"
const val HOLDPOSITION = "holdPosition"
const val NUMBEROFWAGONS = "operatorNumberOfWagons"
const val PRINTERNAME = "printername"
const val PRINTERFK = "printerFk"
@ -67,11 +68,6 @@ object ConstAndValues {
const val LIMITRECORDSSHELVINGLOG = 50
const val RESERVATIONMODE = "operatorReservationMode"
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 es.verdnatura.presentation.common.ExpeditionPrintOut
import es.verdnatura.presentation.common.ItemBarCodeSalix
import es.verdnatura.presentation.common.ItemShelving
import es.verdnatura.presentation.common.PackingSiteSalix
import es.verdnatura.presentation.common.SaleTrackingSalix
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.login.model.AccessConfigSalix
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.LoginSalixVO
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.RenewToken
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.ItemSupplier
import es.verdnatura.presentation.view.feature.packaging.model.NotificationQueue
@ -105,8 +105,8 @@ interface SalixService {
@POST("Devices/handleUser")
fun handleUser(
@Body params: LoginApp
): Call<LoginAppData>
@Body params: MutableMap<String, Any>
): Call<WorkerData>
@GET("VnUsers/getCurrentUserData")
fun getCurrentUserData(
@ -218,6 +218,12 @@ interface SalixService {
@Query("schema") schema: String = "vn", @Query("params") params: Any? = null
): 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")
fun collectionGet(
@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"
): 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")
fun machineGetWorkerPlate(
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
@ -854,8 +865,11 @@ interface SalixService {
@GET("Suppliers")
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>>
@GET("Entries")
@ -966,6 +980,11 @@ interface SalixService {
@Path("id") id: Number, @Body params: Any
): Call<Any>
@GET("ItemShelvings/{id}")
fun itemShelvingGet(
@Path("id") id: Number
): Call<ItemShelving>
@POST("ItemShelvingSales/itemShelvingSale_addByCollection")
fun itemShelvingSaleAddByCollection(
@Body params: Any,
@ -997,6 +1016,21 @@ interface SalixService {
@Body params: Any
): 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")
fun workerMistakesAdd(
@Body workerMistake: WorkerMistakeSalix

View File

@ -1,7 +1,10 @@
package es.verdnatura.presentation.base
import android.content.Context
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.os.Bundle
import android.provider.Settings
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -143,6 +146,24 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(
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 {

View File

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

View File

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

View File

@ -1,8 +1,11 @@
package es.verdnatura.presentation.view.feature.ajustes.fragment
import android.app.AlertDialog
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.graphics.Color
import android.graphics.drawable.Drawable
import android.os.Build
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
@ -13,6 +16,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentAjustesBinding
import es.verdnatura.domain.ConstAndValues.ANDROID_ID
import es.verdnatura.domain.ConstAndValues.HOLDPOSITION
import es.verdnatura.domain.ConstAndValues.ITEMPACKING
import es.verdnatura.domain.ConstAndValues.MENUBYDEFAULTSELECTED
import es.verdnatura.domain.ConstAndValues.NUMBEROFWAGONS
@ -99,14 +103,14 @@ class AjustesFragment :
getString(R.string.version) + ":\t" +
requireActivity().packageManager.getPackageInfo(
requireActivity().packageName, 0
).versionName!! + "\n" +
).versionName!! + "(${getVersionCode()})" + "\n" +
getString(R.string.user) + ":\t" +
mobileApplication.userName + "\n" +
getString(R.string.androidid) + ":\t" +
mobileApplication.dataStoreApp.readDataStoreKey<String>(
ANDROID_ID
) + "\n" +
if (!mobileApplication.serialNumber.isNullOrBlank() ) {
if (!mobileApplication.serialNumber.isNullOrBlank()) {
getString(R.string.serialNumber) + "\t" +
mobileApplication.serialNumber
} else ""
@ -122,6 +126,27 @@ class AjustesFragment :
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() {
with(viewModel) {
@ -241,6 +266,7 @@ class AjustesFragment :
.setDescription(getString(R.string.Noprinters))
.setOkButton(getString(R.string.Close)) {
customDialog.dismiss()
handleUserCall()
}.show()
}
@ -271,19 +297,40 @@ class AjustesFragment :
private fun getUserData() {
loginViewModel = LoginViewModel(requireActivity().applicationContext)
try {
loginViewModel.operatorGetData(mobileApplication.userId!!)
} catch (_: Exception) {
ma.messageWithSound(
message = getString(R.string.errorGetData), isError = true, isPlayed = true
)
}
loginViewModel.workerOperator.observe(this@AjustesFragment) { iti ->
runBlocking { mobileApplication.dataStoreApp.saveDataOperator(iti) }
/* try {
loginViewModel.operatorGetData(mobileApplication.userId!!)
} catch (_: Exception) {
ma.messageWithSound(
message = getString(R.string.errorGetData), isError = true, isPlayed = true
)
}
loginViewModel.workerOperator.observe(this@AjustesFragment) { iti ->
runBlocking { mobileApplication.dataStoreApp.saveDataOperator(iti) }
}*/
handleUserCall()
loginViewModel.handleUserResponse.observe(this@AjustesFragment) { iti ->
runBlocking { mobileApplication.dataStoreApp.saveWorkerData(iti) }
}
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() {
pasilleroViewModel.inititializeDefaultDataInit()
@ -311,9 +358,10 @@ class AjustesFragment :
mobileApplication.dataStoreApp.readDataStoreKey<String>(ITEMPACKING),
menuDefault = mobileApplication.dataStoreApp.readDataStoreKey(
MENUBYDEFAULTSELECTED
)
),
holdPosition = mobileApplication.dataStoreApp.readDataStoreKey<Boolean>(HOLDPOSITION),
)
)
}
binding.splashProgress.visibility = View.GONE
}
@ -483,6 +531,7 @@ class AjustesFragment :
labelerFk = id
)
settingsAdapter!!.notifyItemChanged(2)
handleUserCall()
}

View File

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

View File

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

View File

@ -68,9 +68,16 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
warehouseFk: Int,
shipped: String,
isShowedByType: Boolean,
daysInforward: Int = 0,
) {
salix.getItemSimilar(
params = arrayListOf(itemFk, warehouseFk, shipped, isShowedByType).formatWithQuotes()
params = arrayListOf(
itemFk,
warehouseFk,
shipped,
isShowedByType,
daysInforward
).formatWithQuotes()
).enqueue(object : SalixCallback<List<ItemProposal>>(context) {
override fun onSuccess(response: Response<List<ItemProposal>>) {
_itemProposalList.value = response.body()?.let {
@ -196,7 +203,7 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
}
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) {
override fun onSuccess(response: Response<List<AddressLoses>>) {
_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.databinding.FragmentGeneralBlackBinding
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.ExpeditionPrintOut
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.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) :
BaseFragment<FragmentGeneralBlackBinding, BoxPickingViewModel>(BoxPickingViewModel::class) {
BaseFragment<FragmentGeneralBlackBinding, DeliveryViewModel>(DeliveryViewModel::class) {
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
private var isBoxScanned: Boolean = false
private lateinit var customDialogInput: CustomDialogInput
private var codeStateId: Number = 0
override fun getLayoutId(): Int = R.layout.fragment_general_black
companion object {
@ -25,6 +30,7 @@ class BoxPickingFragment(var title: String) :
binding.mainToolbar.toolbarTitle.text = title
setEvents()
customDialogInput = CustomDialogInput(requireContext())
viewModel.getExpeditionStateId("CHECKED")
super.init()
}
@ -36,15 +42,28 @@ class BoxPickingFragment(var title: String) :
binding.scanInput.hint = getString(R.string.scanLabelExpedition)
binding.scanInput.requestFocus()
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()) {
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("")
@ -65,6 +84,7 @@ class BoxPickingFragment(var title: String) :
expeditionFk = expeditionFk,
customDialogInput.getValue()
)
}
customDialogInput.dismiss()
}
@ -76,15 +96,15 @@ class BoxPickingFragment(var title: String) :
}.setValue("").show()
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()) {
viewModel.isBoxPickingInPrintOut(
expeditionFk = expeditionFk,
customDialogInput.getValue()
itemScanValue(
customDialogInput.getValue(), arrayOf("buy"), "more"
).toString()
)
}
customDialogInput.dismiss()
@ -97,40 +117,61 @@ class BoxPickingFragment(var title: String) :
} catch (ex: Exception) {
getString(R.string.errorInput)
}
customDialogInput.getEditText().requestFocus()
}
override fun observeViewModel() {
with(viewModel) {
/*isBoxPickingInPrintOut.observe(viewLifecycleOwner) {
responseExpeditionStateId.observe(viewLifecycleOwner) {
codeStateId = it
}
responseFindExpeditionId.observe(viewLifecycleOwner) { it ->
if (it != 0) {
showScanBarcode(it.toLong())
} else {
ma.messageWithSound(
message = getString(R.string.errorInput),
isError = !it,
isPlayed = true,
isToasted = null
getString(
R.string.errorBoxPicking
), isError = true, isPlayed = true, isToasted = true
)
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) {
if (it.isChecked){
if (it.expeditionFk.toInt() == 0) {
ma.messageWithSound(
message = getString(R.string.errorBoxPicking),
message = getString(R.string.errorBoxpicking),
isError = true,
isPlayed = true,
isToasted = false
)
}else{
viewModel.updateExpeditionPrint(it.expeditionFk, expeditionPrintOut = ExpeditionPrintOut(it.expeditionFk,it.itemFk, true))
} else {
viewModel.expeditionStateAddSalix(
expeditions = Expeditions(
arrayListOf(
ExpeditionSalix(
expeditionFk = it.expeditionFk.toInt(),
stateCode = "CHECKED",
isScanned = 1
)
)
)
)
}
}
binding.scanInput.requestFocus()
hideKeyboard()
}
responseCode.observe(viewLifecycleOwner) {
ma.messageWithSound(

View File

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

View File

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

View File

@ -146,7 +146,7 @@ class CollectionFragment(
mperror = MediaPlayer.create((activity as MainActivity), R.raw.error)
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
//Tarea #4280
viewModel.ticketIsOutClosureZone(
@ -162,7 +162,7 @@ class CollectionFragment(
}
if (collection.tickets.isEmpty()) {
if (collection.tickets.isEmpty() && collection.collectionFk != 0) {
viewModel.collectionTicketGet(
collection.collectionFk,
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
@ -179,7 +179,6 @@ class CollectionFragment(
}
override fun init() {
customDialogList = CustomDialogList(requireContext())
customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext())
@ -204,12 +203,15 @@ class CollectionFragment(
private fun setToolBar() {
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
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 iconPrint = ImageView(context)
iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
@ -406,7 +408,7 @@ class CollectionFragment(
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 (!binding.scanInput.text.toString().isNullOrEmpty()) {
binding.mainToolbar.toolbarIcons.visibility = VISIBLE
//sergio:para ver si ha marcado dos veces el mismo ticket
binding.scanInput.setText(textScanned_filterDouble(binding.scanInput.text!!.toString()))
@ -438,7 +440,6 @@ class CollectionFragment(
}
buttonPushedGetCollection = false
}
binding.scanInput.setText("")
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(
if (it.isError) it.errorMessage else getString(R.string.Aparcado),
it.isError,
true
)
ma.messageWithSound(
if (it.isError) it.errorMessage else getString(R.string.Aparcado),
it.isError,
true
)
}
}
})
}
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)
} else {
ma.messageWithSound(getString(R.string.previousCollected), false, true)
ma.messageWithSound(it.errorMessage, true, true)
} else {
ma.messageWithSound(getString(R.string.previousCollected), false, true)
viewModel.collectionTicketGet(
collection.collectionFk,
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
print = "0",
type
)
viewModel.collectionTicketGet(
collection.collectionFk,
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
print = "0",
type
)
}
}
})
}
placementSuppleyList.observe(viewLifecycleOwner, Observer {
if (!goBack) printShelvingResult(it)
@ -603,33 +607,34 @@ class CollectionFragment(
goBack = false
})
responseNew.observe(viewLifecycleOwner, Observer {
loadAddNew.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull { it ->
// if (!goBack) {
if (it.isError) {
customDialog.setTitle(getString(R.string.disponibility))
.setDescription(getString(R.string.errorCollectionNew) + it.errorMessage)
.setKoButton(getString(R.string.close)) {
scanRequest()
customDialog.dismiss()
}.show()
} else {
// if (!goBack) {
if (it.isError) {
customDialog.setTitle(getString(R.string.disponibility))
.setDescription(getString(R.string.errorCollectionNew) + it.errorMessage)
.setKoButton(getString(R.string.close)) {
scanRequest()
customDialog.dismiss()
}.show()
} else {
if (!goBack) {
if (!goBack) {
viewModel.collectionTicketGet(
collection.collectionFk,
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
print = "0",
type
)
viewModel.collectionTicketGet(
collection.collectionFk,
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
print = "0",
type
)
}
}
goBack = false
}
goBack = false
})
}
responseCode.observe(viewLifecycleOwner, Observer {
@ -655,71 +660,76 @@ class CollectionFragment(
goBack2 = false
})
responseTicketState.observe(viewLifecycleOwner) {
loadTicketState.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull { it ->
if (!goBack) {
if ((it.code == "ON_CHECKING" || it.code == "CHECKED") && it.user.id != mobileApplication.userId) {
var customDialogWarningChecking = CustomDialog(requireContext())
customDialogWarningChecking.setTitle(getString(R.string.info))
customDialogWarningChecking.setDescription(
if (it.code == "ON_CHECKING") {
getString(R.string.checkingByUser, it.user.username)
} else {
getString(R.string.checkedByUser, it.user.username)
}
).setOkButton(getString(R.string.aware)) {
customDialogWarningChecking.dismiss()
}.show()
if (!goBack) {
if ((it.code == "ON_CHECKING" || it.code == "CHECKED") && it.user.id != mobileApplication.userId) {
var customDialogWarningChecking = CustomDialog(requireContext())
customDialogWarningChecking.setTitle(getString(R.string.info))
customDialogWarningChecking.setDescription(
if (it.code == "ON_CHECKING") {
getString(R.string.checkingByUser, it.user.username)
} else {
getString(R.string.checkedByUser, it.user.username)
}
).setOkButton(getString(R.string.aware)) {
customDialogWarningChecking.dismiss()
}.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) {
incresaseSuccesful()
} else {
goBack = false
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()
}
}
}
}
})
loadIncQuantity.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull { it ->
responseSaleMistakeAdd.observe(viewLifecycleOwner, Observer {
if (!goBack) {
if (it.isError) {
ma.messageWithSound(it.errorMessage, isError = true, true)
} else {
ma.messageWithSound(
getString(R.string.errorRegistered), isError = false, false
)
goBack = true
if (!goBack) {
incresaseSuccesful()
} else {
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 {

View File

@ -6,6 +6,8 @@ import android.graphics.drawable.Drawable
import android.media.MediaPlayer
import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.os.Parcelable
import android.text.InputType
import android.util.Log
@ -123,6 +125,7 @@ class CollectionFragmentPicker(
private var itemShelvingTracking_mark: Int = 0
private var recylerViewState: Parcelable? = null
private var isScanned: Boolean? = null
private var myPosition: Int = 0
private lateinit var myGroupList: List<SaleVO>
private var canChangeState = true
@ -288,6 +291,9 @@ class CollectionFragmentPicker(
when (type) {
CONTROLADOR -> markLine(indice, type)
SACADOR -> {
//jose antonio
myPosition = myGroupList.indexOfFirst { it.saleGroupFk == saleGroupScanned }
println("previa $saleGroupScanned posicion $myPosition")
viewModel.saleTrackingAddPreparedSaleGroup(
saleGroupScanned.toInt()
)
@ -546,7 +552,7 @@ class CollectionFragmentPicker(
ma.messageWithSound(it.errorMessage, true, true)
} else {
ma.messageWithSound(getString(R.string.previousCollected), false, true)
viewModel.collectionTicketGet(
collection.collectionFk,
mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK),
@ -835,6 +841,7 @@ class CollectionFragmentPicker(
} else {
// pintar línea
saleAdapter!!.notifyDataSetChanged()
myPosition = storedPosition
ReviewQuantityForRefreshingAndSorting(
sales[storedPosition].quantity!!.toInt(),
@ -1378,6 +1385,13 @@ class CollectionFragmentPicker(
}
isMarking = true
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() {
@ -1415,7 +1429,7 @@ class CollectionFragmentPicker(
}
private fun setListPosition(position: Int, isFromBack: Boolean) {
lm!!.scrollToPositionWithOffset(storedBackPosition, 0)
lm!!.scrollToPositionWithOffset(myPosition, 0)
// lm!!.scrollToPositionWithOffset(position, 0)
/* storedPosition = position
@ -1523,6 +1537,7 @@ class CollectionFragmentPicker(
}
}
storedBackPosition = position
myPosition = position
setListPosition(position, false)
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.OnPackingClickSaleListener
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.common.OnQuantityClickSaleListener
import es.verdnatura.presentation.common.OnSaleClickSaleListener
import es.verdnatura.presentation.common.OnTicketClickSaleListener
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
@ -345,18 +344,28 @@ class CollectionFragmentPickerNew(
}
}
responseExistsItemShelvingSale.observe(viewLifecycleOwner) {
if (!goBack) {
if (it.exists) {
markLine(it.position, it.quantity, true)
} else {
loadExistsResponse.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull {
getString(R.string.updateSalesReserve).toast(
requireContext()
)
updateScreen()
}
}
loadFindItemShelvingResponse.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull {
if (it.shelvingFk != myGroupList[it.position].code) {
getString(R.string.updateSalesReserve).toast(
requireContext()
)
viewModel.collectionTicketGetSalix(collection.collectionFk, false)
updateScreen()
} else {
markLine(it.position, it.quantity, true)
}
}
}
responseParking.observe(viewLifecycleOwner) {
@ -398,46 +407,37 @@ class CollectionFragmentPickerNew(
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].reservedQuantity = quantityConfirm
viewModel.collectionTicketGetSalix(
collection.collectionFk, print = false
)
lm!!.scrollToPositionWithOffset(positionConfirm, 0)
ma.messageWithSound(
getString(R.string.operationSuccess), it.isError, !it.isError, isToasted = false
)
saleAdapter!!.notifyDataSetChanged()
lm!!.scrollToPositionWithOffset(storedPosition, 0)
/* viewModel.collectionTicketGetSalix(
collection.collectionFk, print = false
)*/
}
responseItemShelvingSaleUnPicked.observe(viewLifecycleOwner) {
myGroupList[positionUnmarked].isPicked = 1
myGroupList[positionUnmarked].reservedQuantity = quantityConfirm
viewModel.collectionTicketGetSalix(
collection.collectionFk, print = false
)
lm!!.scrollToPositionWithOffset(positionUnmarked, 0)
ma.messageWithSound(
getString(R.string.operationSuccess), it.isError, !it.isError, isToasted = false
)
/*
responseItemShelvingSale.observe(viewLifecycleOwner) {
myGroupList[positionConfirm].isPicked = 1
myGroupList[positionConfirm].reservedQuantity = quantityConfirm
viewModel.collectionTicketGetSalix(
collection.collectionFk, print = 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) {
@ -512,24 +512,7 @@ class CollectionFragmentPickerNew(
saleAdapter = SaleAdapterNew(
myGroupList,
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 {
override fun onSaleClick(mySale: Sale) {
myGroupList.forEachIndexed { index, sale ->
@ -886,13 +869,22 @@ class CollectionFragmentPickerNew(
}.setOkButtonTwo(getString(R.string.no)) {
scanRequest()
customDialogThreeButtonsQuantity.dismiss()
if (quantity == 0) {
viewModel.itemShelvingSaleExists(
myGroupList[position].itemShelvingSaleFk, position, quantity
)
} else {
markLine(position, quantity, true)
}
viewModel.itemShelvingSaleExists(
myGroupList[position].itemShelvingSaleFk,
myGroupList[position].itemShelvingFk,
position,
quantity
)
/* if (quantity == 0) {
viewModel.itemShelvingSaleExists(
myGroupList[position].itemShelvingSaleFk,
myGroupList[position].itemShelvingFk,
position,
quantity
)
} else {
markLine(position, quantity, true)
}*/
}.setKoButton(getString(R.string.cancel)) {
scanRequest()
customDialogThreeButtonsQuantity.dismiss()
@ -1170,7 +1162,8 @@ class CollectionFragmentPickerNew(
origin = value[0].origin,
size = value[0].size,
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

View File

@ -14,7 +14,7 @@ import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemExistsItemShelvingSale
import es.verdnatura.presentation.common.ItemShelving
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.common.SaleTrackingReplaceSalix
import es.verdnatura.presentation.common.SaleTrackingSalix
@ -44,14 +44,20 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val collectionTicketList: LiveData<CollectionVO>
get() = _collectionTicketList
private val _responseCollectionId by lazy { MutableLiveData<Int>() }
val responseCollectionId: LiveData<Int>
get() = _responseCollectionId
private val _responseExistsItemShelvingSale by lazy { MutableLiveData<ResponseItemExistsItemShelvingSale>() }
val responseExistsItemShelvingSale: LiveData<ResponseItemExistsItemShelvingSale>
private val _responseExistsItemShelvingSale by lazy { MutableLiveData<Boolean>() }
val responseExistsItemShelvingSale: LiveData<Boolean>
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>() }
val collectionTicketSalix: LiveData<CollectionTicket>
get() = _collectionTicketSalix
@ -63,10 +69,6 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val loadCollectionTicketSalix: LiveData<Event<CollectionTicket>> =
_collectionTicketSalix.map { Event(it) }
private val _collectionTicketListLocal by lazy { MutableLiveData<CollectionTicket>() }
val collectionTicketListLocal: LiveData<CollectionTicket>
get() = _collectionTicketListLocal
private val _placementSuppleyList by lazy { MutableLiveData<PlacementSupplyListVO>() }
val placementSuppleyList: LiveData<PlacementSupplyListVO>
get() = _placementSuppleyList
@ -78,6 +80,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
private val _responseSaleMistakeAdd by lazy { MutableLiveData<ResponseItemVO>() }
val responseSaleMistakeAdd: LiveData<ResponseItemVO>
get() = _responseSaleMistakeAdd
val loadSaleMistakeAdd: LiveData<Event<ResponseItemVO>> =
_responseSaleMistakeAdd.map { Event(it) }
private val _responseItemShelvingSaleSupplyAdd by lazy { MutableLiveData<ResponseItemVO>() }
val responseItemShelvingSaleSupplyAdd: LiveData<ResponseItemVO>
@ -91,33 +95,38 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val responseSaleTracking_mark: LiveData<ResponseItemVO>
get() = _responseSaleTracking_mark
private val _responseConfirmReservedItemShelvingSale by lazy { MutableLiveData<ResponseItemVO>() }
val responseConfirmReservedItemShelvingSale: LiveData<ResponseItemVO>
private val _responseConfirmReservedItemShelvingSale by lazy { MutableLiveData<Boolean>() }
val responseConfirmReservedItemShelvingSale: LiveData<Boolean>
get() = _responseConfirmReservedItemShelvingSale
val loadPicked: LiveData<Event<Boolean>> =
_responseConfirmReservedItemShelvingSale.map { Event(it) }
private val _responseItemShelvingSale by lazy { MutableLiveData<ResponseItemVO>() }
val responseItemShelvingSale: LiveData<ResponseItemVO>
get() = _responseItemShelvingSale
private val _responseItemShelvingSaleUnPicked by lazy { MutableLiveData<ResponseItemVO>() }
val responseItemShelvingSaleUnPicked: LiveData<ResponseItemVO>
private val _responseItemShelvingSaleUnPicked by lazy { MutableLiveData<Boolean>() }
val responseItemShelvingSaleUnPicked: LiveData<Boolean>
get() = _responseItemShelvingSaleUnPicked
val loadUnpicked: LiveData<Event<ResponseItemVO>> =
_responseItemShelvingSaleUnPicked.map { Event(it) }
val loadUnpicked: LiveData<Event<Boolean>> = _responseItemShelvingSaleUnPicked.map { Event(it) }
private val _responseCollectionAddItem by lazy { MutableLiveData<ResponseItemVO>() }
val responseCollectionAddItem: LiveData<ResponseItemVO>
private val _responseCollectionAddItem by lazy { MutableLiveData<Boolean>() }
val responseCollectionAddItem: LiveData<Boolean>
get() = _responseCollectionAddItem
private val _responseConfirmReservedUpdate by lazy { MutableLiveData<ResponseItemVO>() }
val responseConfirmReservedUpdate: LiveData<ResponseItemVO>
get() = _responseConfirmReservedUpdate
private val _responseItemShelvingSaleDelete by lazy { MutableLiveData<Boolean>() }
val responseItemShelvingSaleDelete: LiveData<Boolean> = _responseItemShelvingSaleDelete
val loadResponseDelete: LiveData<Event<Boolean>> =
_responseItemShelvingSaleDelete.map { Event(it) }
private val _responseParking by lazy { MutableLiveData<ResponseItemVO>() }
val responseParking: LiveData<ResponseItemVO>
get() = _responseParking
val loadParking: LiveData<Event<ResponseItemVO>> = _responseParking.map { Event(it) }
private val _responsePrint by lazy { MutableLiveData<ResponseItemVO>() }
val responsePrint: LiveData<ResponseItemVO>
get() = _responsePrint
@ -133,6 +142,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
private val _responseTicketState by lazy { MutableLiveData<TicketState>() }
val responseTicketState: LiveData<TicketState> = _responseTicketState
val loadTicketState: LiveData<Event<TicketState>> = _responseTicketState.map { Event(it) }
private val _responseUsedShelves by lazy { MutableLiveData<ResponseItemVO>() }
val responseUsedShelves: LiveData<ResponseItemVO>
get() = _responseUsedShelves
@ -141,26 +152,23 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val responseSaleGroup: LiveData<ResponseItemVO>
get() = _responseSaleGroup
val loadResponseSaleGroup: LiveData<Event<ResponseItemVO>> =
_responseSaleGroup.map { Event(it) }
private val _responseItemShelvingSaleGroup by lazy { MutableLiveData<ResponseItemVO>() }
val responseItemShelvingSaleGroup: LiveData<ResponseItemVO>
get() = _responseItemShelvingSaleGroup
private val _responsecheckfully by lazy { MutableLiveData<ResponseItemVO>() }
val responsecheckfully: LiveData<ResponseItemVO>
get() = _responsecheckfully
private val _responseTicketClosure by lazy { MutableLiveData<ResponseItemVO>() }
val responseTicketClosure: LiveData<ResponseItemVO>
get() = _responseTicketClosure
val loadTicketClousure: LiveData<Event<ResponseItemVO>> =
_responseTicketClosure.map { Event(it) }
private val _responseCollectionUnchecked by lazy { MutableLiveData<ResponseItemVO>() }
val responseCollectionUnchecked: LiveData<ResponseItemVO>
get() = _responseCollectionUnchecked
/* private val _responseMissingTrash by lazy { MutableLiveData<ResponseItemVO>() }
val responseMissingTrash: LiveData<ResponseItemVO>
get() = _responseMissingTrash*/
private val _responseSplit by lazy { MutableLiveData<ResponseItemVO>() }
val responseSplit: LiveData<ResponseItemVO>
get() = _responseSplit
@ -169,6 +177,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val responseNew: LiveData<ResponseItemVO>
get() = _responseNew
val loadAddNew: LiveData<Event<ResponseItemVO>> = _responseNew.map { Event(it) }
private val _responseCode by lazy { MutableLiveData<Int?>() }
val responseCode: LiveData<Int?>
get() = _responseCode
@ -176,6 +186,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
private val _responseIncQuantity by lazy { MutableLiveData<ResponseItemVO>() }
val responseIncQuantity: LiveData<ResponseItemVO>
get() = _responseIncQuantity
val loadIncQuantity: LiveData<Event<ResponseItemVO>> = _responseIncQuantity.map { Event(it) }
private val _mistakeList by lazy { MutableLiveData<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 loadResponseAddItem: LiveData<Event<ResponseItemVO>> =
val loadResponseAddItem: LiveData<Event<Boolean>> =
_responseCollectionAddItem.map { Event(it) }
val loadResponseSaleTrackingMark: LiveData<Event<ResponseItemVO>> =
@ -301,7 +312,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}
fun itemShelvingSaleExists(
itemShelvingSaleFk: Number, position: Int, quantity: Int
itemShelvingSaleFk: Number, itemShelvingFk: Number, position: Int, quantity: Int
) {
salix.itemShelvingSaleExists(
@ -309,9 +320,39 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
).enqueue(object : SalixCallback<JsonObject>(context) {
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
)*/
}
})
}
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(
params = arrayListOf(itemShelvingSaleFk, quantity, isItemShelvingSaleEmpty, sectorFk)
//salix.itemShelvingSaleSetQuantity(
// params = ItemShelvingSaleSalix(itemShelvingSaleFk, quantity, isItemShelvingSaleEmpty)
).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>) {
if (!response.isSuccessful) {
_responseConfirmReservedItemShelvingSale.value = ResponseItemVO(
isError = true, errorMessage = getMessageFromAllResponse(
nameofFunction(this), response.message()
)
)
} else {
_responseConfirmReservedItemShelvingSale.value =
ResponseItemVO(isError = false, response = "")
_responseConfirmReservedItemShelvingSale.value = true
if (isItemShelvingSaleEmpty == true)
_responseCollectionAddItem.value = true
}
}
})
}
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(
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) {
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
)
).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>) {
_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>) {
//Tarea 7926
updateParkingFromSaleGroup(saleGroupFk)
// updateParkingFromSaleGroup(saleGroupFk)
_responseSaleGroup.value = ResponseItemVO(isError = false)
}
})
@ -602,13 +604,11 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
saleGroupFk: Number
) {
salix.saleGroupUpdate(
id = saleGroupFk,
params = hashMapOf("parkingFk" to null)
)
.enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
}
})
id = saleGroupFk, params = hashMapOf("parkingFk" to null)
).enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
}
})
}
fun itemShelvingSaleSetSaleGroup(
@ -671,20 +671,19 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
SaleTrackingDelSalix(
saleFk = saleFk, stateCodes = listOf("CHECKED", "OK", "PREPARED")
)
)
.enqueue(object : SalixCallback<Any>(context) {
override fun onError(t: Throwable) {
_responseDel.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
).enqueue(object : SalixCallback<Any>(context) {
override fun onError(t: Throwable) {
_responseDel.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onSuccess(response: Response<Any>) {
_responseDel.value =
ResponseItemVO(isError = false, response = response.message())
}
})
override fun onSuccess(response: Response<Any>) {
_responseDel.value =
ResponseItemVO(isError = false, response = response.message())
}
})
}
fun itemShelvingUpdateFromSale(
@ -746,13 +745,12 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}
fun getIdFromCodeSalix(code: String) {
getItemFromBarcodeUseCase.execute(code)
.enqueue(object : SalixCallback<Int?>(context) {
override fun onSuccess(response: Response<Int?>) {
_responseCode.value = response.body()
getItemFromBarcodeUseCase.execute(code).enqueue(object : SalixCallback<Int?>(context) {
override fun onSuccess(response: Response<Int?>) {
_responseCode.value = response.body()
}
})
}
})
}
fun collectionIncreaseQuantitySalix(
@ -785,9 +783,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
salix.saleMistakeAdd(
SaleMistakeSalix(
userFk = (context as MobileApplication).userId!!,
saleFk = saleFk,
typeFk = typeFk
userFk = (context as MobileApplication).userId!!, saleFk = saleFk, typeFk = typeFk
)
).enqueue(object : SalixCallback<Any>(context) {
override fun onError(t: Throwable) {
@ -807,25 +803,23 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}
fun mistakeType() {
salix.getMistakeTypes()
.enqueue(object : SalixCallback<List<MistakeTypeVO>>(context) {
override fun onSuccess(response: Response<List<MistakeTypeVO>>) {
if (response.body() != null) {
_mistakeList.value =
response.body()?.let { MistakeTypeListVO(it) }
} else {
val listError: ArrayList<MistakeTypeVO> = ArrayList()
listError.add(MistakeTypeVO(0, ""))
_mistakeList.value = MistakeTypeListVO(listError)
}
}
override fun onError(t: Throwable) {
salix.getMistakeTypes().enqueue(object : SalixCallback<List<MistakeTypeVO>>(context) {
override fun onSuccess(response: Response<List<MistakeTypeVO>>) {
if (response.body() != null) {
_mistakeList.value = 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()
listError.add(MistakeTypeVO(0, ""))
_mistakeList.value = MistakeTypeListVO(listError)
}
})
}
fun ticketIsOutClosureZone(
@ -885,9 +879,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
override fun onSuccess(response: Response<Any>) {
_responseTicketClosure.value = ResponseItemVO(
isError = false,
response = response.body()!!.toString(),
errorMessage = ""
isError = false, response = response.body()!!.toString(), errorMessage = ""
)
}
@ -913,9 +905,7 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
if (response.body() != null) {
_responseCollectionUnchecked.value = ResponseItemVO(
isError = false,
response = response.body()!!,
errorMessage = ""
isError = false, response = response.body()!!, errorMessage = ""
)
} else {
_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() {
binding.scanInput.visibility = VISIBLE
binding.mainToolbar.toolbarTitle.text = getString(R.string.controlticket)
setEvents()
@ -107,7 +106,7 @@ class ControladorFragment :
}
responseTicketState.observe(
viewLifecycleOwner
viewLifecycleOwner
) {
if ((it.code == "ON_CHECKING" || it.code == "CHECKED") && it.user.id != mobileApplication.userId) {
val customDialogWarning = CustomDialog(requireContext())

View File

@ -182,11 +182,13 @@ class LoadUnloadFragment(
for (l in list) {
mlist.add(
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"
} else {
l.code
}, isScanned = l.isScanned
},
isScanned = l.isScanned
)
)
}
@ -459,7 +461,9 @@ class LoadUnloadFragment(
binding.expeditionloadunloadRecyclerview.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
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)

View File

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

View File

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

View File

@ -6,8 +6,10 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.map
import es.verdnatura.R
import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ExpeditionPrintOut
import es.verdnatura.presentation.common.ResponseSign
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicketList
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicketSalix
@ -36,6 +38,13 @@ import java.io.File
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>() }
val expeditionInfoList: LiveData<ExpeditionInfoList> = _expeditionInfoList
@ -64,6 +73,15 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
val responseStateAdd: LiveData<Boolean>
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>() }
val responseUpdateRoute: LiveData<Boolean>
get() = _responseUpdateRoute
@ -206,8 +224,6 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
}
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) {
override fun onSuccess(response: Response<Unit>) {
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(
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 {

View File

@ -2,8 +2,6 @@ package es.verdnatura.presentation.view.feature.login.fragment
import android.annotation.SuppressLint
import android.content.Intent
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.net.Uri
import android.provider.Settings
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.feature.login.adapter.WorkFormAdapter
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 kotlinx.coroutines.runBlocking
import java.util.Date
@ -64,6 +63,7 @@ class LoginFragment(private var imageUri: Uri?) :
customDialog = CustomDialog(requireContext())
customDialogInput = CustomDialogInput(requireContext())
//createFolderSerial()
setSwitch()
saveIdentifiers()
checkUser()
binding.buttonLogin.setOnClickListener {
@ -72,31 +72,12 @@ class LoginFragment(private var imageUri: Uri?) :
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)
.isNotBlank() && binding.switchRemember.isChecked
) {
if (getDevicePDA() != null) {
viewModel.getSerialNumber(getDevicePDA()!!)
} else {
viewModel.getCurrentUserData(
getString(R.string.logAppName),
getInfoVersionNameApp(),
mobileApplication.dataStoreApp.readDataStoreKey(ANDROID_ID),
)
}
handleUserCall()
}
@ -143,25 +124,46 @@ class LoginFragment(private var imageUri: Uri?) :
}
binding.edittextUsername.requestFocus()
binding.textviewRememberPassword.setOnLongClickListener {
if (getDevicePDA() == 19591) {
binding.edittextUsername.setText("sergiodt")
binding.edittextPassword.setText("delatorre.1234")
}
private fun handleUserCall() {
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? {
return try {
Settings.Global.getString(
mobileApplication.contentResolver, Settings.Global.DEVICE_NAME
).toInt()
} catch (ex: Exception) {
null
}
/* private fun getDevicePDA(): Int? {
return try {
Settings.Global.getString(
mobileApplication.contentResolver, Settings.Global.DEVICE_NAME
).toInt()
} catch (ex: Exception) {
null
}
}
}*/
/* private fun createFolderSerial() {
@ -311,7 +313,7 @@ class LoginFragment(private var imageUri: Uri?) :
private fun checkUser() {
if (mobileApplication.dataStoreApp.readDataStoreKey(REMEMBER)) {
if (mobileApplication.dataStoreApp.readDataStoreKey<Boolean>(REMEMBER)) {
binding.edittextUsername.setText(
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() {
with(viewModel) {
handleUserResponse.observe(viewLifecycleOwner) {
runBlocking {
mobileApplication.dataStoreApp.saveWorkerData(
it
)
}
reviewVersion(it)
}
versionAppItem.observe(viewLifecycleOwner) {
if (it.version == getInfoVersionNameApp()) {
@ -382,8 +428,8 @@ class LoginFragment(private var imageUri: Uri?) :
if (it.vIsAuthorized == "0") {
customDialog.setTitle(getString(R.string.error))
.setDescription(it.vMessage!!).setOkButton(getString(R.string.close)) {
customDialog.setTitle(getString(R.string.error)).setDescription(it.vMessage!!)
.setOkButton(getString(R.string.close)) {
customDialog.dismiss()
}.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) {
@ -483,15 +516,8 @@ class LoginFragment(private var imageUri: Uri?) :
)
}
if (getDevicePDA() != null) {
viewModel.getSerialNumber(getDevicePDA()!!)
} else {
viewModel.getCurrentUserData(
getString(R.string.logAppName),
getInfoVersionNameApp(),
mobileApplication.dataStoreApp.readDataStoreKey(ANDROID_ID),
)
}
//Tarea 6868
handleUserCall()
}
}
@ -524,12 +550,12 @@ class LoginFragment(private var imageUri: Uri?) :
Firebase.crashlytics.setUserId(userName)
}
private fun getInfoVersionNameApp(): String {
val manager: PackageManager = requireContext().packageManager
val info: PackageInfo = manager.getPackageInfo(requireContext().packageName, 0)
mobileApplication.versionName = info.versionName
return info.versionName
}
/* private fun getInfoVersionNameApp(): String {
val manager: PackageManager = requireContext().packageManager
val info: PackageInfo = manager.getPackageInfo(requireContext().packageName, 0)
mobileApplication.versionName = info.versionName
return info.versionName
}*/
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.AccessConfigSalixList
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.LoginSalixVO
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.RenewToken
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 kotlinx.coroutines.runBlocking
import retrofit2.Response
@ -40,8 +39,8 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) {
val loginSalixItem: LiveData<LoginSalixVO>
get() = _loginSalixItem
private val _loginApp by lazy { MutableLiveData<LoginAppData>() }
val loginApp: LiveData<LoginAppData> = _loginApp
private val _handleUserResponse by lazy { MutableLiveData<WorkerData>() }
val handleUserResponse: LiveData<WorkerData> = _handleUserResponse
private val _serialNumber by lazy { MutableLiveData<String?>() }
val serialNumber: LiveData<String?> = _serialNumber
@ -133,27 +132,17 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) {
})
}
fun loginApp(
login: LoginApp,
) {
salix.handleUser(login).enqueue(object : SalixCallback<LoginAppData>(context) {
override fun onSuccess(response: Response<LoginAppData>) {
_loginApp.value = response.body()
fun handleUser(
login: MutableMap<String, Any>
) {
salix.handleUser(login).enqueue(object : SalixCallback<WorkerData>(context) {
override fun onSuccess(response: Response<WorkerData>) {
app.userName = response.body()?.nickname
app.userId = response.body()?.id
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 = ""
)
data class LoginApp(
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,
data class WorkerData(
val numberOfWagons: Int,
var warehouseFk: Int,
val trainFk: Int,
val itemPackingTypeFk: String,
val warehouseFk: Int,
val labelerFk: Int,
val sectorFk: Int,
val sector: Sector?,
val printer: Printer,
val train: Train,
val sector: Sector,
val id: Int,
val name: String,
val nickname: String,
val serialNumber: String,
val isVersionCritical: Boolean,
val version: String,
val vIsAuthorized: String,
val vMessage: String,
val url: 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(
val id: Int? = null,
val name: String = "",
@ -76,12 +72,10 @@ data class Sector(
val id: Int = 0,
val description: String = "",
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(
val id: Number = 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.R
import es.verdnatura.databinding.ActivityMainBinding
import es.verdnatura.domain.ConstAndValues.CONTROLADOR
import es.verdnatura.domain.ConstAndValues.MAINACTIVITY
import es.verdnatura.domain.ConstAndValues.MENUBYDEFAULTSELECTED
import es.verdnatura.domain.ConstAndValues.PRECHECKERNEW
import es.verdnatura.domain.ConstAndValues.PREITEMPICKER
import es.verdnatura.domain.ConstAndValues.PREITEMPICKERTEST
import es.verdnatura.domain.ConstAndValues.PRINTERFK
import es.verdnatura.domain.ConstAndValues.PRINTERFKDEFAULT
import es.verdnatura.domain.ConstAndValues.RENEWINTERVAL
import es.verdnatura.domain.ConstAndValues.RENEWPERIOD
import es.verdnatura.domain.ConstAndValues.SACADOR
import es.verdnatura.domain.ConstAndValues.SECTORFK
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
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.ubication.ClaimUbicationFragment
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.CollectionFragmentPickerNew
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.CollectionFragmentPreCheckerNew
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.ControlVehiculoUsuarioFragment
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.packingHolland.fragment.PackingHollandFragment
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.ExpeditionPalletFragment
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.SectorCollectionReserveFragment
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.RoadMapSettingsFragment
import es.verdnatura.presentation.view.feature.roadmap.fragment.StopMapListFragment
@ -513,8 +516,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
}
getString(R.string.historicals) -> {
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(
WorkerActionSalix(
workerFk = mobileApplication!!.userId!!,
workerActivityTypeFk = "ON_CHECKING",
inTimed = (LocalDate.now()).toString()
)
)*/
getString(R.string.titleChecker) -> {
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) -> {
mainActivityPasilleroViewModel.workerActivityAdd(CodeWorkerAction.ON_PREPARATION)
addFragmentOnTop(
PasilleroFragment.newInstance(itemTitle, isInitMenu = false),
)
@ -658,7 +679,12 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
//Tarea 7855
getString(R.string.scanPreparedExpedition) -> {
addFragmentOnTop(ExpeditionPreparedStateFragment.newInstance())
addFragmentOnTop(
ExpeditionPreparedStateFragment.newInstance(
"PREPARED",
getString(R.string.scanExpeditions)
)
)
}
getString(R.string.titleAuto) -> {
@ -674,11 +700,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
}*/
getString(R.string.titlePickers) -> {
//addFragmentOnTop(SacadorFragment.newInstance())
addFragmentOnTop(ControlVehiculoFragment.newInstance(""))
mainActivityPasilleroViewModel.workerActivityAdd(CodeWorkerAction.ON_PREPARATION)
addFragmentOnTop(SacadorFragment.newInstance("PREPARED"))
//addFragmentOnTop(ControlVehiculoFragment.newInstance(""))
}
"Sacador Test" -> {
mainActivityPasilleroViewModel.workerActivityAdd(CodeWorkerAction.ON_PREPARATION)
addFragmentOnTop(SacadorFragmentNew.newInstance("PREPARED"))
}
@ -721,13 +749,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
addFragmentOnTop(PreControladorFragment.newInstance())
}
getString(R.string.titlePreControlTest) -> {
addFragmentOnTop(
CollectionFragmentPreCheckerNew.newInstance(
null,
type = PRECHECKERNEW
)
)
getString(R.string.preControlNew) -> {
addFragmentOnTop(CollectionFragmentCheckerPreviousNew.newInstance())
}
getString(R.string.titleShelvingHistorical) -> {
@ -747,6 +770,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
addFragmentOnTop(WorkermistakeFragment.newInstance(itemTitle))
}
getString(R.string.deleteExpedition) -> {
addFragmentOnTop(ExpeditionDeleteFragment.newInstance(itemTitle))
}
getString(R.string.titlePackingMistake) -> {
addFragmentOnTop(PackingMistakeFragment.newInstance(itemTitle))
}
@ -803,6 +830,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
addFragmentOnTop(PackingHollandFragment.newInstance(itemTitle))
}
getString(R.string.titleRestaurant) -> {
val i = Intent(this, RestaurantActivity::class.java)
startActivity(i)
}
getString(R.string.titleDelivery) -> {
mainActivityPasilleroViewModel.workerActivityAdd(CodeWorkerAction.DELIVERY)
addFragmentOnTop(
@ -900,6 +932,12 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
getString(R.string.reviewBoxPicking) -> {
addFragmentOnTop(BoxPickingFragment.newInstance(itemTitle))
/* addFragmentOnTop(
ExpeditionPreparedStateFragment.newInstance(
"CHECKED",
getString(item.title)
)
)*/
}
getString(R.string.pickerHelper) -> {
@ -1009,23 +1047,28 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
collection: CollectionTicket, type: String, hasPicking: Boolean, hasToAdd: Boolean
) {
when (type) {
"PREITEMPICKERTEST" -> {
PREITEMPICKERTEST -> {
println("test presacador")
//addFragmentOnTop(EndSacadorFragment.newInstance(collection, type))
addFragmentOnTop(
SectorCollectionReserveFragment.newInstance(
"PREITEMPICKERTEST", collection.collectionFk, hasToAdd
type, collection.collectionFk, hasToAdd
)
)
}
else -> {
//Misma pantalla para los dos scador y prescador
SACADOR -> {
addFragmentOnTop(
CollectionFragmentPickerNew.newInstance(
CollectionFragmentPickerPreviousNew.newInstance(
collection, type, hasPicking
)
)
/* addFragmentOnTop(
CollectionFragmentPickerNew.newInstance(
collection, type, hasPicking
)
)*/
}
}
@ -1054,6 +1097,15 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
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 -> {
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) }
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>>) {
_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
import android.content.pm.ActivityInfo
import android.os.Bundle
import android.view.KeyEvent
import android.view.View
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
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
class ExpeditionPreparedStateFragment :
class ExpeditionPreparedStateFragment(var codeState: String = "PREPARED", var title: String = "") :
BaseFragment<FragmentAutomaticAddExpeditionBinding, DeliveryViewModel>(
DeliveryViewModel::class
) {
@ -24,19 +26,33 @@ class ExpeditionPreparedStateFragment :
private var contador = 0
private var isScanned = false
private val listExpeditions: ArrayList<ExpeditionSalix> = arrayListOf()
private var expeditionStateTypeId: Number = 0
companion object {
fun newInstance(codeState: String, title: String) =
ExpeditionPreparedStateFragment(codeState = codeState, title = title)
fun newInstance() = ExpeditionPreparedStateFragment()
}
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 = getString(R.string.scanExpeditions)
binding.mainToolbar.toolbarTitle.text = title
setEvents()
setViews()
setToolBar()
viewModel.getExpeditionStateId(codeState)
super.init()
}
@ -46,7 +62,7 @@ class ExpeditionPreparedStateFragment :
private fun setSubtitle() {
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() {
@ -54,12 +70,12 @@ class ExpeditionPreparedStateFragment :
AutomaticAdapter(listExpeditions.map { it.expeditionFk.toLong() } as ArrayList<Long>,
object : OnAutomaticItemClickListener {
override fun onAutomaticItemClickListener(position: Int) {
contador -= 1
setSubtitle()
if (listExpeditions.size > position) {
listExpeditions.removeAt(position)
}
adapter!!.updateItems(listExpeditions.map { it.expeditionFk.toLong() } as ArrayList<Long>)
setSubtitle()
}
})
binding.itemsRecyclerview.adapter = adapter
@ -75,21 +91,25 @@ class ExpeditionPreparedStateFragment :
isScanned =
event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
if (binding.editMatricula.text.toString().isNotEmpty()) {
contador += 1
setSubtitle()
try {
listExpeditions.add(
ExpeditionSalix(
expeditionFk = itemScanValue(
textScanned_filterDouble(binding.editMatricula.text.toString()),
arrayOf("expedition"),
"id"
).toString().toLong(), stateCode = "PREPARED", isScanned = 0
val itemScaned = itemScanValue(
textScanned_filterDouble(binding.editMatricula.text.toString()),
arrayOf("expedition"),
"id"
).toString().toLong()
if (!(listExpeditions.any { it.expeditionFk == itemScaned })) {
viewModel.findExpedition(
itemScaned, expeditionStateTypeId
)
)
adapter!!.updateItems(listExpeditions.map { it.expeditionFk.toLong() } as ArrayList<Long>)
binding.itemsRecyclerview.scrollToPosition(0)
binding.itemsRecyclerview.scrollToPosition(0)
} else {
ma.messageWithSound(
message = getString(R.string.boxDuplicated),
isError = true,
isPlayed = true,
isToasted = true
)
}
} catch (ex: Exception) {
ma.messageWithSound(ex.message.toString(), isError = true, isPlayed = true)
}
@ -108,12 +128,12 @@ class ExpeditionPreparedStateFragment :
}
binding.buttonFinalizar.setOnClickListener {
if (listExpeditions.isNotEmpty()) viewModel.expeditionStateAddSalix(
Expeditions(
listExpeditions
)
) else ma.onMyBackPressed()
if (listExpeditions.isNotEmpty())
viewModel.expeditionStateAddSalix(
Expeditions(
listExpeditions
)
) else ma.onMyBackPressed()
}
binding.mainToolbar.backButton.setOnClickListener {
@ -126,8 +146,34 @@ class ExpeditionPreparedStateFragment :
responseStateAdd.observe(viewLifecycleOwner) {
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() {
ma.hideBottomNavigation(View.VISIBLE)
if (getString(R.string.main) == tagName) {
val myWorkSelected: String = mobileApplication.dataStoreApp.readDataStoreKey(
@ -47,7 +46,7 @@ class PasilleroFragment(
)
binding.mainToolbarDesign.layoutTool.visibility = View.GONE
if ( myWorkSelected != "Producción" && myWorkSelected != "") {
if (myWorkSelected != "Producción" && myWorkSelected != "") {
binding.pasillerosItems.setBackgroundColor(Color.RED)
binding.mainToolbarDesign.toolbarTitle.setBackgroundColor(Color.RED)
binding.mainToolbarDesign.toolbarTitle.text =
@ -88,9 +87,8 @@ class PasilleroFragment(
).ifBlank { tagName }
when (showMenu) {
getString(R.string.titleCorridors) -> {
getString(R.string.titleCorridors) ->
viewModel.inititializeDefaultData()
}
getString(R.string.titlePalletizers) -> viewModel.inititializeDefaultPallet()
getString(R.string.titleBufferManegement) -> viewModel.inititializeDefaultBuffer()
@ -117,7 +115,7 @@ class PasilleroFragment(
PasillerosItemVO(
R.drawable.ic_picker_ui,
R.string.titlePickers,
R.string.titlePickersDescrip
R.string.titlePickersDescrip
)
)
@ -127,7 +125,7 @@ class PasilleroFragment(
viewModel.inititializeDefaultDataInit()
}
}
super.onCreate(savedInstanceState)
}

View File

@ -5,11 +5,13 @@ import android.content.Context
import es.verdnatura.MobileApplication
import es.verdnatura.R
import es.verdnatura.domain.ConstAndValues.RESERVATIONMODE
import es.verdnatura.domain.ConstAndValues.SECTORISONRESERVATIONMODE
import es.verdnatura.domain.SalixCallback
import es.verdnatura.presentation.base.BaseViewModel
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.WorkerActionSalix
import kotlinx.coroutines.runBlocking
import retrofit2.Response
class PasilleroViewModel(context: Context) : BaseViewModel(context) {
@ -21,7 +23,19 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
val userId = (contextApp as MobileApplication).userId
private val isOnReservationMode =
(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() {
workerActivityAdd(CodeWorkerAction.STORAGE)
_pasillerositem.add(
@ -61,13 +75,13 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
)
//tarea 7855
/* _pasillerositem.add(
PasillerosItemVO(
R.drawable.ic_scan_prepared,
R.string.scanPreparedExpedition),
R.string.scanPreparedExpedition)
)
)*/
_pasillerositem.add(
PasillerosItemVO(
R.drawable.ic_scan_prepared,
R.string.scanPreparedExpedition,
R.string.scanPreparedExpedition
)
)
_pasillerositem.add(
@ -257,30 +271,30 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
R.string.titleCorridorsDescrip
)
)
//precontrol
_pasillerositem.add(
PasillerosItemVO(
R.drawable.ic_picker_ui, R.string.titlePickers, R.string.titlePickersDescrip
)
)
//val working_in_testMenu = false
if (userId == 19591) {
//sacador
if (isOnReservationModeSector == true || (!existSectorOnReservationMode && isOnReservationMode)) {
_pasillerositem.add(
PasillerosItemVO(
R.drawable.ic_picker_ui, R.string.sacador_test, R.string.sacador_test
)
)
if (userId == 19591) {
_pasillerositem.add(
PasillerosItemVO(
R.drawable.ic_picker_helper,
R.string.pickerHelper,
R.string.pickerHelperDescrip
)
} else {
_pasillerositem.add(
PasillerosItemVO(
R.drawable.ic_picker_ui, R.string.titlePickers, R.string.titlePickersDescrip
)
}
)
}
if (userId == 19591) {
_pasillerositem.add(
PasillerosItemVO(
R.drawable.ic_picker_helper,
R.string.pickerHelper,
R.string.pickerHelperDescrip
)
)
}
_pasillerositem.add(
@ -393,9 +407,8 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
fun inititializeDefaultPrevia() {
workerActivityAdd(CodeWorkerAction.PREVIOUS)
//lolass
if (isOnReservationMode) {
// if (userId == 19591 || userId == 18404 || userId == 9) {
if (isOnReservationModeSector == true || (!existSectorOnReservationMode && isOnReservationMode)) {
_pasillerositem.add(
PasillerosItemVO(
R.drawable.ic_previous_presacador,
@ -403,7 +416,6 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
R.string.titlePickerDescrip
)
)
//}
} else {
_pasillerositem.add(
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) {
_pasillerositem.add(
PasillerosItemVO(
R.drawable.ic_previous_precontrol,
R.string.titlePreControlTest,
R.string.titlePreControlDescrip
)
)
}
_pasillerositem.add(
PasillerosItemVO(
R.drawable.ic_previous_precontrol, R.string.preControlNew,
R.string.preControlNew
)
)
}*/
_pasillerositem.add(
PasillerosItemVO(
@ -451,6 +464,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
)
)
_pasillerositem.add(
PasillerosItemVO(
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(
@ -480,6 +500,14 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
fun inititializeDefaultOther() {
_pasillerositem.add(
PasillerosItemVO(
R.drawable.ic_restaurant,
R.string.titleRestaurant,
R.string.resturantDescrip
)
)
_pasillerositem.add(
PasillerosItemVO(
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.domain.ConstAndValues
import es.verdnatura.domain.notNull
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
import es.verdnatura.presentation.common.OnCollectionTicketSelectedListener
@ -38,6 +37,8 @@ class SectorCollectionReserveFragment(
private var listSaleGroupAdapter: BarcodeAdapter? = null
private var onBack = false
private var isReserved = false
private var listTickets: ArrayList<BarcodeVO> = ArrayList()
private var listTicketsAdapter: BarcodeAdapter? = null
val listIcons: ArrayList<ImageView> = ArrayList()
@ -146,9 +147,18 @@ class SectorCollectionReserveFragment(
try {
//Reservar colección
if (!hasToAdd) {
/* if (listTickets.isNotEmpty()) {
listTickets.forEach { item ->
viewModel.getReserveBySectorCollection(item.code!!.toInt())
}
}*/
viewModel.getReserveBySectorCollection(collectionFk)
} else {
gotoPicker()
hasToAdd = false
viewModel.getReserveBySectorCollection(collectionFk)
//gotoPicker()
}
} catch (ex: Exception) {
ma.messageWithSound(
@ -235,27 +245,27 @@ class SectorCollectionReserveFragment(
}
binding.scanInput.requestFocus()
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
/* binding.scanInput.setOnEditorActionListener { v, actionId, event ->
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 {
navigateToCollectionList(binding.scanInput.text.toString().toInt())
try {
navigateToCollectionList(binding.scanInput.text.toString().toInt())
} catch (ex: Exception) {
ex.message!!.toast(requireContext())
} catch (ex: Exception) {
ex.message!!.toast(requireContext())
}
}
binding.scanInput.setText("")
ma.hideKeyboard(binding.scanInput)
}
return@setOnEditorActionListener true
}
return@setOnEditorActionListener false
}
binding.scanInput.setText("")
ma.hideKeyboard(binding.scanInput)
}
return@setOnEditorActionListener true
}
return@setOnEditorActionListener false
}*/
}
@ -310,7 +320,7 @@ class SectorCollectionReserveFragment(
listSaleGroupAdapter!!.notifyItemInserted(listSalesGroup.size - 1)
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)
if (type == "PREPARED") {
listIcons.add(iconVehicleIn)
//listIcons.add(iconVehicleIn)
} else {
listIcons.add(iconPrint)
}

View File

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

View File

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

View File

@ -30,6 +30,7 @@ data class Ticket(
data class Sale(
val itemShelvingSaleFk: Int,
val itemShelvingFk: Int,
val ticketFk: Int,
val saleGroupFk: 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:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="8dp"
android:layout_marginTop="4dp"
tools:listitem="@layout/item_article_row_fragment" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<include
android:id="@+id/main_toolbar"
layout="@layout/toolbar_fragment"

View File

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

View File

@ -27,12 +27,6 @@
android:layout_height="wrap_content"
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
@ -173,7 +167,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/layout_margin_prepicker">
android:layout_height="@dimen/layout_margin_prepicker"
android:orientation="horizontal">
<TextView
android:id="@+id/item_parking_code"
@ -181,7 +176,6 @@
android:layout_height="wrap_content"
android:layout_marginStart="1dp"
android:layout_marginEnd="@dimen/layout_margin_min"
android:layout_weight="0.5"
android:maxLines="1"
android:text=""
android:textColor="@color/verdnatura_white"
@ -189,22 +183,8 @@
android:textStyle="bold"
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
@ -262,7 +242,6 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/layout_margin_min_to_modify"
android:layout_weight="2"
android:ellipsize="end"
android:maxLines="1"
android:text="@{Long.toString(sale.itemFk)}"
android:textColor="@color/verdnatura_white"
@ -456,15 +435,30 @@
android:id="@+id/layout_error"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
android:visibility="gone"
tool:visibility="visible">
<TextView
android:id="@+id/txt_error"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="5"
android:background="@color/verdnatura_red"
android:textColor="@color/verdnatura_white"
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

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="Ruta">Ruta</string>
<string name="Cajas">Cajas</string>
<string name="Nivel">Nivel:</string>
<string name="Nivel">Niv:</string>
<string name="de">de</string>
<string name="Ticket">Ticket</string>
<string name="Ticket">T:</string>
<string name="Concepto">Concepto</string>
<string name="SinServir">SinServir</string>
<string name="Aparcado">Aparcado</string>
@ -848,7 +848,7 @@
<string name="errorRepeatedShelving">Carro ya introducido</string>
<string name="errorGetData">errorGetData</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="errorScanItem">Error al escanea el artículo. Inténtalo de nuevo</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="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="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>

View File

@ -9,9 +9,9 @@
<string name="Pallet">Pallet</string>
<string name="Ruta">Route</string>
<string name="Cajas">Cajas</string>
<string name="Nivel">Nivel:</string>
<string name="Nivel">Niv:</string>
<string name="de">de</string>
<string name="Ticket">Ticket</string>
<string name="Ticket">T:</string>
<string name="Concepto">Concepto</string>
<string name="SinServir">SinServir</string>
<string name="Aparcado">Aparcado</string>
@ -848,7 +848,7 @@
<string name="shelvingsLocate">Carros a ubicar</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="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="errorScanItem">Error al escanea el artículo. Inténtalo de nuevo</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="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="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>

View File

@ -11,7 +11,7 @@
<string name="Cajas">Cajas</string>
<string name="Nivel">Nivel:</string>
<string name="de">de</string>
<string name="Ticket">Ticket</string>
<string name="Ticket">T:</string>
<string name="Concepto">Concepto</string>
<string name="SinServir">SinServir</string>
<string name="Aparcado">Aparcado</string>
@ -848,7 +848,7 @@
<string name="shelvingsLocate">Carros a ubicar</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="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="errorScanItem">Error al escanea el artículo. Inténtalo de nuevo</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="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="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>

View File

@ -9,7 +9,7 @@
<dimen name="layout_margin_min_to_modify">2dp</dimen>
<dimen name="layout_margin_minest">1dp</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="default_layout_margin">16dp</dimen>
<dimen name="layout_end_ticket_color">20dp</dimen>
@ -118,7 +118,7 @@
<!-- Pintar ticket -->
<dimen name="ticketColor_height">90dp</dimen>
<dimen name="ticketColor_height">80dp</dimen>
<dimen name="ticketColor_width">10dp</dimen>
<!-- Elements of RecyclerViewer -->

View File

@ -12,9 +12,9 @@
<string name="cmr">CMR</string>
<string name="Ruta">Route</string>
<string name="Cajas">Boxes</string>
<string name="Nivel">Level:</string>
<string name="Nivel">Lev:</string>
<string name="de">of</string>
<string name="Ticket">Ticket</string>
<string name="Ticket">T:</string>
<string name="tickets">Tickets:</string>
<string name="showTickets">Tickets</string>
<string name="Concepto">Concept</string>
@ -850,7 +850,7 @@
<string name="shelvingsLocate">Carros a ubicar</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="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="errorScanItem">Error al escanea el artículo. Inténtalo de nuevo</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="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="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>