This commit is contained in:
Sergio De la torre 2023-05-31 15:57:59 +02:00
parent 491a4f8762
commit 44b8713915
11 changed files with 161 additions and 243 deletions

View File

@ -2,10 +2,12 @@ package es.verdnatura.db
import android.content.Context import android.content.Context
import androidx.room.* import androidx.room.*
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLoadUnload
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoPending
// Clase que representa la base de datos // Clase que representa la base de datos
@Database(entities = [Expedicion::class], version = 1) @Database(entities = [ExpeditionInfoLoadUnload::class,ExpeditionInfoPending::class], version = 1)
abstract class ExpedicionDatabase : RoomDatabase() { abstract class ExpedicionDatabase : RoomDatabase() {
abstract fun expedicionDao(): ExpedicionDao abstract fun expedicionDao(): ExpedicionDao
@ -18,7 +20,7 @@ abstract class ExpedicionDatabase : RoomDatabase() {
val instance = Room.databaseBuilder( val instance = Room.databaseBuilder(
context.applicationContext, context.applicationContext,
ExpedicionDatabase::class.java, ExpedicionDatabase::class.java,
"expedicion_database" "expedition_database"
) )
.fallbackToDestructiveMigration() .fallbackToDestructiveMigration()
.build() .build()
@ -29,24 +31,22 @@ abstract class ExpedicionDatabase : RoomDatabase() {
} }
} }
// Clase que representa la entidad Expedicion
@Entity(tableName = "expediciones")
data class Expedicion(
@PrimaryKey val id: Int,
val nombre: String,
val fecha: Long
)
// Interfaz que define los métodos de acceso a datos para Expedicion // Interfaz que define los métodos de acceso a datos para Expedicion
@Dao @Dao
interface ExpedicionDao { interface ExpedicionDao {
@Query("SELECT * FROM expediciones") @Query("SELECT * FROM expedition e WHERE e.routeFk = :parametro1")
suspend fun getAll(): List<Expedicion> suspend fun getAll(parametro1:Int): List<ExpeditionInfoLoadUnload>
@Query("SELECT * FROM expeditionPending")
suspend fun getAllPending(): List<ExpeditionInfoLoadUnload>
@Insert(onConflict = OnConflictStrategy.REPLACE) @Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insert(expedicion: Expedicion) suspend fun insert(expedition:MutableList<ExpeditionInfoLoadUnload>)
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertPending(expeditionPending:MutableList<ExpeditionInfoPending>)
@Delete @Delete
fun delete(expedicion: Expedicion) fun delete(expedition: ExpeditionInfoLoadUnload)
} }

View File

@ -16,10 +16,12 @@ import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding import androidx.databinding.ViewDataBinding
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import androidx.room.Room
import com.google.gson.Gson import com.google.gson.Gson
import com.google.gson.reflect.TypeToken import com.google.gson.reflect.TypeToken
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.ToolbarFragmentBinding import es.verdnatura.databinding.ToolbarFragmentBinding
import es.verdnatura.db.ExpedicionDatabase
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.presentation.view.feature.login.model.WorkForms import es.verdnatura.presentation.view.feature.login.model.WorkForms
@ -54,6 +56,8 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
protected val TRAINNAME = "trainName" protected val TRAINNAME = "trainName"
protected val TRAINFK = "trainFk" protected val TRAINFK = "trainFk"
protected val WORKFORMSELECTED = "workFormSelected" protected val WORKFORMSELECTED = "workFormSelected"
protected val SUPPLIERID = "SUPPLIERID"
protected val ITEMPACKING = "itemPackingType" protected val ITEMPACKING = "itemPackingType"
protected val ITEMPACKINGFK = "itemPackingTypeFk" protected val ITEMPACKINGFK = "itemPackingTypeFk"
@ -144,6 +148,8 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
} }
@LayoutRes @LayoutRes
abstract fun getLayoutId(): Int abstract fun getLayoutId(): Int
open fun init() {} open fun init() {}
@ -506,6 +512,7 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
WAREHOUSEFK -> prefs.getInt(name, WAREHOUSEFKDEFAULT) WAREHOUSEFK -> prefs.getInt(name, WAREHOUSEFKDEFAULT)
PRINTERFK -> prefs.getInt(name, 0) PRINTERFK -> prefs.getInt(name, 0)
USERFK -> prefs.getInt(USERFK, 0) USERFK -> prefs.getInt(USERFK, 0)
SUPPLIERID->prefs.getInt(SUPPLIERID,0)
else -> { else -> {
0 0
} }
@ -660,7 +667,7 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
urlSalix = "https://test-salix.verdnatura.es" urlSalix = "https://test-salix.verdnatura.es"
) )
) )
var working_in_test = false var working_in_test = true
if (working_in_test) { if (working_in_test) {
saveWorkForm( saveWorkForm(
WorkForms( WorkForms(
@ -830,94 +837,13 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
} }
fun database(myContext:Context): ExpedicionDatabase {
/*open fun wordToNumber(input: String?): Int { val db = Room.databaseBuilder(
var input = input myContext,
var isValidInput = true ExpedicionDatabase::class.java, "expediciones.db"
var result = 0 ).build()
var finalResult = 0 return db
if (input != null && input.length > 0) { }
input = input.replace("-".toRegex(), " ")
input = input.toLowerCase().replace(" and".toRegex(), " ")
val splittedParts =
input.trim { it <= ' ' }.split("\\s+".toRegex()).toTypedArray()
for (str in splittedParts) {
if (!es.verdnatura.warehouse.UTILS.Utils.allowedStrings.contains(str)) {
isValidInput = false
return -1
}
}
if (isValidInput) {
for (str in splittedParts) {
if (str.equals("cero", ignoreCase = true)) {
result += 0
} else if (str.equals("uno", ignoreCase = true)) {
result += 1
} else if (str.equals("dos", ignoreCase = true)) {
result += 2
} else if (str.equals("tres", ignoreCase = true)) {
result += 3
} else if (str.equals("cuatro", ignoreCase = true)) {
result += 4
} else if (str.equals("cinco", ignoreCase = true)) {
result += 5
} else if (str.equals("seis", ignoreCase = true)) {
result += 6
} else if (str.equals("siete", ignoreCase = true)) {
result += 7
} else if (str.equals("ocho", ignoreCase = true)) {
result += 8
} else if (str.equals("nueve", ignoreCase = true)) {
result += 9
} else if (str.equals("diez", ignoreCase = true)) {
result += 10
} else if (str.equals("once", ignoreCase = true)) {
result += 11
} else if (str.equals("doce", ignoreCase = true)) {
result += 12
} else if (str.equals("trece", ignoreCase = true)) {
result += 13
} else if (str.equals("catorce", ignoreCase = true)) {
result += 14
} else if (str.equals("quince", ignoreCase = true)) {
result += 15
} else if (str.equals("dieziseis", ignoreCase = true)) {
result += 16
} else if (str.equals("diezisiete", ignoreCase = true)) {
result += 17
} else if (str.equals("dieziocho", ignoreCase = true)) {
result += 18
} else if (str.equals("diezinueve", ignoreCase = true)) {
result += 19
} else if (str.equals("veinte", ignoreCase = true)) {
result += 20
} else if (str.equals("treinta", ignoreCase = true)) {
result += 30
} else if (str.equals("cuarenta", ignoreCase = true)) {
result += 40
} else if (str.equals("cincuenta", ignoreCase = true)) {
result += 50
} else if (str.equals("sesenta", ignoreCase = true)) {
result += 60
} else if (str.equals("setenta", ignoreCase = true)) {
result += 70
} else if (str.equals("ochenta", ignoreCase = true)) {
result += 80
} else if (str.equals("noventa", ignoreCase = true)) {
result += 90
} else if (str.equals("cien", ignoreCase = true)) {
result *= 100
} else if (str.equals("mil", ignoreCase = true)) {
result *= 1000
finalResult += result
result = 0
}
}
finalResult += result
return finalResult
}
}
return finalResult
}*/

View File

@ -50,11 +50,11 @@ class ExpeditionLoadUnloadAdapter(
) )
"PALLETIZED" -> expeditionView.setBackgroundColor( "PALLETIZED" -> expeditionView.setBackgroundColor(
getColor(expeditionView.context, R.color.verdnatura_black) getColor(expeditionView.context, R.color.verdnatura_black_5)
) )
else -> { else -> {
expeditionView.setBackgroundColor( expeditionView.setBackgroundColor(
getColor(expeditionView.context, R.color.verdnatura_black) getColor(expeditionView.context, R.color.verdnatura_black_5)
) )
} }

View File

@ -56,20 +56,6 @@ class ExpeditionSummaryAdapter(
}else{ }else{
res.getColor(R.color.verdnatura_black) res.getColor(R.color.verdnatura_black)
} }
/* if (item.lost == item.total || (item.lost!! > 0 && item.lost == item.total))
{
fondo.setBackgroundColor(
res.getColor(R.color.verdnatura_pumpkin_orange)
)
}
if (item.delivered != null && item.delivered == item.total
) {
fondo.setBackgroundColor(
res.getColor(R.color.verdnatura_black)
)
}*/
showExp.setOnClickListener { showExp.setOnClickListener {
onItemImageLoadRowClickListener.onItemImageLoadRowClickListener(item) onItemImageLoadRowClickListener.onItemImageLoadRowClickListener(item)
} }

View File

@ -1,5 +1,6 @@
package es.verdnatura.presentation.view.feature.delivery.fragments package es.verdnatura.presentation.view.feature.delivery.fragments
import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.pm.PackageInfo import android.content.pm.PackageInfo
import android.content.pm.PackageManager import android.content.pm.PackageManager
@ -9,14 +10,10 @@ import android.view.View
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import android.widget.ImageView import android.widget.ImageView
import android.widget.Toast import android.widget.Toast
import androidx.activity.OnBackPressedCallback
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.room.Room
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentExpeditionLoadunloadDeliveryBinding import es.verdnatura.databinding.FragmentExpeditionLoadunloadDeliveryBinding
import es.verdnatura.db.Expedicion
import es.verdnatura.db.ExpedicionDatabase import es.verdnatura.db.ExpedicionDatabase
import es.verdnatura.domain.toast import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
@ -25,9 +22,6 @@ import es.verdnatura.presentation.common.ToolBarAdapterTooltip
import es.verdnatura.presentation.view.feature.delivery.adapters.ExpeditionLoadUnloadAdapter import es.verdnatura.presentation.view.feature.delivery.adapters.ExpeditionLoadUnloadAdapter
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLoadUnload import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLoadUnload
import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewModel import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.json.JSONObject import org.json.JSONObject
@ -47,6 +41,7 @@ class LoadUnloadFragment(
private var counterResponse = 0 private var counterResponse = 0
private var route = 0 private var route = 0
private var addressFk = 0 private var addressFk = 0
private lateinit var db: ExpedicionDatabase
companion object { companion object {
fun newInstance(title: String, state: String, entryPoint: String) = fun newInstance(title: String, state: String, entryPoint: String) =
@ -57,51 +52,25 @@ class LoadUnloadFragment(
@RequiresApi(Build.VERSION_CODES.O) @RequiresApi(Build.VERSION_CODES.O)
override fun init() { override fun init() {
try {
route = JSONObject(entryPoint).get("route").toString().toInt() route = JSONObject(entryPoint).get("route").toString().toInt()
addressFk = JSONObject(entryPoint).get("address").toString().toInt() addressFk = JSONObject(entryPoint).get("address").toString().toInt()
} catch (ex: Exception) {
}
setEvents() setEvents()
setToolBar() setToolBar()
setSwitchButon()
binding.scanInput.requestFocus() binding.scanInput.requestFocus()
viewModel.getExpeditionFromRoute(route) viewModel.getExpeditionFromRoute(route)
super.init() super.init()
database()
} }
private fun database() { override fun onAttach(context: Context) {
super.onAttach(context)
val db = Room.databaseBuilder( // db = database(requireContext().applicationContext)
requireContext().applicationContext,
ExpedicionDatabase::class.java, "expediciones.db"
).build()
// Para insertar una expedición en la base de datos, puedes hacer lo siguiente:
/* val expedicion = Expedicion(12345, "Mi expedición", System.currentTimeMillis())
db.expedicionDao().insert(expedicion)*/
// val myViewModel = ViewModelProvider(this).get(DatabaseViewModel::class.java)
lifecycleScope.launch {
withContext(Dispatchers.IO) {
val expedicion = Expedicion(12345, "Mi expedición", System.currentTimeMillis())
db.expedicionDao().insert(expedicion)
var expediciones = db.expedicionDao().getAll()
for (e in expediciones) {
println("la exp es " + e.nombre)
}
}
}
// Para obtener todas las expediciones de la base de datos, puedes hacer lo siguiente:
/* db.expedicionDao().getAll().observe(viewLifecycleOwner) { expediciones ->
// actualizar la vista con las expediciones
}
val expediciones = db.expedicionDao().getAll()
for (e in expediciones) {
println("El nombre de la exp es " + e.nombre)
}*/
} }
@RequiresApi(Build.VERSION_CODES.O) @RequiresApi(Build.VERSION_CODES.O)
@ -109,6 +78,7 @@ class LoadUnloadFragment(
ma.hideBottomNavigation(View.GONE) ma.hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.visibility = View.VISIBLE binding.mainToolbar.toolbarTitle.visibility = View.VISIBLE
binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE
binding.mainToolbar.toolbarSubtitle.setTextColor(requireContext().getColor((R.color.verdnatura_pumpkin_orange)))
binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE
binding.mainToolbar.switchButton.visibility = if (state != "DELIVERED") { binding.mainToolbar.switchButton.visibility = if (state != "DELIVERED") {
View.VISIBLE View.VISIBLE
@ -132,8 +102,6 @@ class LoadUnloadFragment(
when (item) { when (item) {
iconConfirm.drawable -> { iconConfirm.drawable -> {
// openAppDelivery()
//requireActivity().finish()
setExpeditionsState(myList, state) setExpeditionsState(myList, state)
} }
} }
@ -150,22 +118,21 @@ class LoadUnloadFragment(
if (list.filter { it.code == state }.size == list.size) { if (list.filter { it.code == state }.size == list.size) {
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.expeditionState_add(list.filter { it.code == state }, state) viewModel.expeditionState_add(list.filter { it.code == state }, state)
counterCalls = 1 counterCalls = 1
} else { } else {
val alertDialog = android.app.AlertDialog.Builder(requireContext()).create() val alertDialog = android.app.AlertDialog.Builder(requireContext()).create()
alertDialog.setTitle("Información") alertDialog.setTitle(getString(R.string.info))
alertDialog.setMessage("El total de expediciones escaneadas es diferente al total de la ruta. ¿ Quieres guardar las expediciones escaneadas o buscar la/s expedición/es ?") alertDialog.setMessage(getString(R.string.expeditionTotal))
alertDialog.setButton( alertDialog.setButton(
android.app.AlertDialog.BUTTON_NEUTRAL, "GUARDAR" android.app.AlertDialog.BUTTON_NEUTRAL, getString(R.string.save)
) { dialog, which -> ) { dialog, which ->
counterCalls = 2 counterCalls = 2
viewModel.expeditionState_add(list.filter { it.code == state }, state) viewModel.expeditionState_add(list.filter { it.code == state }, state)
viewModel.expeditionState_add(list.filter { it.code != state }, "LOST") viewModel.expeditionState_add(list.filter { it.code != state }, "LOST")
} }
alertDialog.setButton( alertDialog.setButton(
android.app.AlertDialog.BUTTON_POSITIVE, "ORDENAR" android.app.AlertDialog.BUTTON_POSITIVE, getString(R.string.ordenar)
) { dialog, which -> ) { dialog, which ->
createList(list.sortedByDescending { it.code }) createList(list.sortedByDescending { it.code })
} }
@ -192,21 +159,13 @@ class LoadUnloadFragment(
"verdnatura.es.repartoverdnatura.ExpeditionSummaryActivity" "verdnatura.es.repartoverdnatura.ExpeditionSummaryActivity"
) )
} }
// i.putExtra("routeId", binding.route.text)
i.putExtra("app", "picking") i.putExtra("app", "picking")
startActivity(i) startActivity(i)
} }
private fun setEvents() { private fun setEvents() {
binding.mainToolbar.backButton.setOnClickListener { binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed() requireActivity().onBackPressed()
/*val callback = object : OnBackPressedCallback(true /* enabled by default */) {
override fun handleOnBackPressed() {
println("volviendo antras")
}
}
requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner, callback)*/
} }
binding.scanInput.setOnEditorActionListener { _, actionId, _ -> binding.scanInput.setOnEditorActionListener { _, actionId, _ ->
@ -214,7 +173,6 @@ class LoadUnloadFragment(
if (!binding.scanInput.text.isNullOrEmpty()) { if (!binding.scanInput.text.isNullOrEmpty()) {
try { try {
//viewModel.expeditionLoadUnload_get(binding.scanInput.toInt())
markExpedition( markExpedition(
binding.scanInput.text.toString().toInt(), binding.scanInput.text.toString().toInt(),
if (!binding.mainToolbar.switchButton.isChecked) { if (!binding.mainToolbar.switchButton.isChecked) {
@ -265,10 +223,7 @@ class LoadUnloadFragment(
ma.messageWithSound("", true, true, isToasted = null) ma.messageWithSound("", true, true, isToasted = null)
} }
} }
updateCount(myList, state) updateCount(myList, state)
} }
@RequiresApi(Build.VERSION_CODES.O) @RequiresApi(Build.VERSION_CODES.O)
@ -294,7 +249,8 @@ class LoadUnloadFragment(
if (!it.isError) { if (!it.isError) {
counterResponse = counterResponse + 1 counterResponse = counterResponse + 1
if (counterResponse == counterCalls) { if (counterResponse == counterCalls) {
viewModel.getExpeditionFromRoute(route) // viewModel.getExpeditionFromRoute(route)
requireActivity().onBackPressed()
counterResponse = 0 counterResponse = 0
counterCalls = 0 counterCalls = 0
} }
@ -306,13 +262,12 @@ class LoadUnloadFragment(
@RequiresApi(Build.VERSION_CODES.O) @RequiresApi(Build.VERSION_CODES.O)
private fun setSwitchButon() { private fun setSwitchButon() {
binding.mainToolbar.switchButton.tooltipText = getString(R.string.expeditionMarkLost)
binding.mainToolbar.switchButton.setOnCheckedChangeListener { buttonView, isChecked -> binding.mainToolbar.switchButton.setOnCheckedChangeListener { buttonView, isChecked ->
binding.mainToolbar.switchButton.tooltipText = if (isChecked) binding.mainToolbar.switchButton.tooltipText = if (isChecked)
getString(R.string.expeditionMarkLost) else getString(R.string.expeditionMarkLost) else
getString(R.string.expeditionMarkFound) getString(R.string.expeditionMarkFound)
binding.splashProgress.visibility = View.VISIBLE
if (isChecked) { if (isChecked) {
binding.mainToolbar.toolbarTitle.text = binding.mainToolbar.toolbarTitle.text =
@ -326,8 +281,9 @@ class LoadUnloadFragment(
private fun createList(list: List<ExpeditionInfoLoadUnload>) { private fun createList(list: List<ExpeditionInfoLoadUnload>) {
myList = list as MutableList<ExpeditionInfoLoadUnload> myList = list as MutableList<ExpeditionInfoLoadUnload>
if (addressFk!=0){ if (addressFk != 0) {
myList= list.filter{it.addressFk==addressFk} as MutableList<ExpeditionInfoLoadUnload> myList =
list.filter { it.addressFk == addressFk } as MutableList<ExpeditionInfoLoadUnload>
} }
adapter = ExpeditionLoadUnloadAdapter(myList) adapter = ExpeditionLoadUnloadAdapter(myList)
binding.expeditionloadunloadRecyclerview.adapter = adapter binding.expeditionloadunloadRecyclerview.adapter = adapter
@ -335,9 +291,27 @@ class LoadUnloadFragment(
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
binding.mainToolbar.toolbarSubtitle.text = binding.mainToolbar.toolbarSubtitle.text =
getString(R.string.summaryCount, myList.filter { it.code == state }.size, myList.size) getString(R.string.summaryCount, myList.filter { it.code == state }.size, myList.size)
setListPosition(list) setListPosition(list)
} }
/* private fun updateExpeditionTable(list: MutableList<ExpeditionInfoLoadUnload>) {
lifecycleScope.launch {
withContext(Dispatchers.IO) {
for (l in list) {
println("la route es $route y $addressFk")
if (l.addressFk == addressFk) {
var newList =
db.expedicionDao().insert(list.filter { it.routeFk == route }.filter { it.addressFk == addressFk } as MutableList<ExpeditionInfoLoadUnload>)
}
}
}
}
}*/
private fun setListPosition(list: MutableList<ExpeditionInfoLoadUnload>) { private fun setListPosition(list: MutableList<ExpeditionInfoLoadUnload>) {
for (i in list.indices) { for (i in list.indices) {
if (list[i].code != state) { if (list[i].code != state) {
@ -348,8 +322,12 @@ class LoadUnloadFragment(
} }
private fun updateCount(list: MutableList<ExpeditionInfoLoadUnload>, state: String) { private fun updateCount(list: MutableList<ExpeditionInfoLoadUnload>, state: String) {
val countMarked = list.filter { it.code == state }.size/list.filter { it.code == state }.size
binding.mainToolbar.toolbarSubtitle.text = getString(R.string.summaryCount, countMarked, list.size) val countMarked =
list.filter { it.code == state }.size
binding.mainToolbar.toolbarSubtitle.text =
getString(R.string.summaryCount, countMarked, list.size)
if (countMarked == list.size) { if (countMarked == list.size) {
setExpeditionsState(list, state) setExpeditionsState(list, state)
} }

View File

@ -1,5 +1,7 @@
package es.verdnatura.presentation.view.feature.delivery.model package es.verdnatura.presentation.view.feature.delivery.model
import androidx.room.Entity
import androidx.room.PrimaryKey
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
class FreeLanceDeliveryInfoList( class FreeLanceDeliveryInfoList(
@ -55,18 +57,33 @@ class ExpeditionList(
var list: List<ExpeditionInfoLoadUnload> = listOf() var list: List<ExpeditionInfoLoadUnload> = listOf()
) )
@Entity(tableName = "expedition")
class ExpeditionInfoLoadUnload( class ExpeditionInfoLoadUnload(
var id: Int, @PrimaryKey var id: Int,
var ticketFk: Int, var ticketFk: Int,
var routeFk: Int, var routeFk: Int,
var addressFk: Int, var addressFk: Int,
var itemPackingTypeConcat: String, var itemPackingTypeConcat: String?,
var city: String, var city: String,
var street: String, var street: String,
var code: String?, var code: String?,
var nickname: String, var nickname: String,
var postalCode: Int var postalCode: Int
) )
@Entity(tableName = "expeditionPending")
class ExpeditionInfoPending(
@PrimaryKey var id: Int,
var ticketFk: Int,
var routeFk: Int,
var addressFk: Int,
var itemPackingTypeConcat: String?,
var city: String,
var street: String,
var code: String?,
var nickname: String,
var postalCode: Int
)
class ExpeditionSummaryList( class ExpeditionSummaryList(
var list: List<ExpeditionInfoSummary> = listOf() var list: List<ExpeditionInfoSummary> = listOf()

View File

@ -110,11 +110,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
if (extras != null && extras.containsKey("menu")) { if (extras != null && extras.containsKey("menu")) {
comeFromDelivery = true comeFromDelivery = true
val option = extras.getString("menu") val option = extras.getString("menu")
saveDataInt("USERFK", extras.getString("userfk")!!.toInt()) saveDataInt("USERFK", extras.getString("userfk")!!.toInt())
saveUserAccesPref( saveUserAccesPref(
extras.getString("user").toString(), extras.getString("user").toString(),
extras.getString("password").toString() extras.getString("password").toString()
) )
when (option) { when (option) {
@ -142,6 +142,35 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
), getString(R.string.titleInfo) ), getString(R.string.titleInfo)
) )
"summary"->{
onPasillerosItemClickListener(
PasillerosItemVO(
30,
R.drawable.ic_info,
getString(R.string.titleDeliverySummary),
R.string.titleDeliverySummary,
getString(
R.string.titleDeliverySummary
)
),extras.getString("route").toString()
)
}
"unload"->{
onPasillerosItemClickListener(
PasillerosItemVO(
30,
R.drawable.ic_info,
getString(R.string.titleInfo),
R.string.titleInfo,
getString(
R.string.titleInfoDescription
)
), getString(R.string.titleInfo)
)
}
} }
@ -670,7 +699,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
getString(R.string.titleDeliverySummary) -> { getString(R.string.titleDeliverySummary) -> {
addFragmentOnTop( addFragmentOnTop(
SummaryFragment.newInstance(item.title, "ON DELIVERY"), SummaryFragment.newInstance(item.title, "ON DELIVERY",entryPoint.toInt()),
if (comeFromDelivery == true) { if (comeFromDelivery == true) {
getString(R.string.titleDeliverySummary) getString(R.string.titleDeliverySummary)
} else { } else {
@ -724,7 +753,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
getString( getString(
R.string.titleInfo R.string.titleInfo
) )
) ) || backEntry!!.contains(getString(R.string.titleDeliverySummary))
) { ) {
finish() finish()
} }

View File

@ -9,13 +9,13 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent"
>
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:id="@+id/scan_input" android:id="@+id/scan_input"
@ -25,16 +25,24 @@
android:inputType="text" android:inputType="text"
android:lines="1" android:lines="1"
android:maxLines="1" android:maxLines="1"
/> app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/main_toolbar"/>
<LinearLayout <LinearLayout
android:id="@+id/lineMenu"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_marginTop="@dimen/layout_margin_min" android:layout_marginTop="@dimen/layout_margin_min"
android:layout_marginBottom="@dimen/layout_margin_1" android:layout_marginBottom="@dimen/layout_margin_1"
android:paddingLeft="@dimen/layout_margin_1" android:paddingLeft="@dimen/layout_margin_1"
android:paddingRight="@dimen/layout_margin_1"> android:paddingRight="@dimen/layout_margin_1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/scan_input">
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -66,25 +74,7 @@
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/verdnatura_white"/>
<LinearLayout
android:id="@+id/itemcard_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical"
tools:ignore="ExtraText">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants">
<!--android:id="@+id/itemexpeditionstate_recyclerview"-->
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/expeditionloadunload_recyclerview" android:id="@+id/expeditionloadunload_recyclerview"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -92,20 +82,8 @@
android:clipToPadding="false" android:clipToPadding="false"
android:visibility="visible" android:visibility="visible"
tools:listitem="@layout/item_expedition_loadunload_row" /> tools:listitem="@layout/item_expedition_loadunload_row" />
</RelativeLayout>>
</LinearLayout>
</LinearLayout>
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</LinearLayout>
</ScrollView>
<include <include
android:id="@+id/main_toolbar" android:id="@+id/main_toolbar"

View File

@ -48,7 +48,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="2" android:layout_weight="2"
android:text="Ruta" android:text="@string/Ruta"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:textSize="14sp" android:textSize="14sp"
android:textStyle="bold" android:textStyle="bold"
@ -60,7 +60,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="Cajas" android:text="@string/boxes"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:textSize="14sp" android:textSize="14sp"
android:textStyle="bold" /> android:textStyle="bold" />
@ -70,7 +70,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="Tipo" android:text="@string/type"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:textSize="14sp" android:textSize="14sp"
android:textStyle="bold" /> android:textStyle="bold" />
@ -80,7 +80,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="Escan" android:text="@string/scanAbrev"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:textSize="14sp" android:textSize="14sp"
android:textStyle="bold" /> android:textStyle="bold" />
@ -90,7 +90,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="Perdidas" android:text="@string/lost"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:textSize="14sp" android:textSize="14sp"
android:textStyle="bold" /> android:textStyle="bold" />
@ -100,7 +100,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="Entregadas" android:text="@string/deliveredMenu"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:textSize="14sp" android:textSize="14sp"
android:textStyle="bold" /> android:textStyle="bold" />
@ -152,7 +152,6 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
</ScrollView> </ScrollView>
<include <include

View File

@ -17,7 +17,14 @@
android:layout_margin="@dimen/ef_item_padding" android:layout_margin="@dimen/ef_item_padding"
> >
<LinearLayout <LinearLayout
android:id="@+id/expeditionDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/verdnatura_white"
android:orientation="horizontal" />
<LinearLayout
android:id="@+id/expeditionConsign" android:id="@+id/expeditionConsign"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -98,9 +105,6 @@
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/verdnatura_white" />
</LinearLayout> </LinearLayout>
</layout> </layout>

View File

@ -18,6 +18,7 @@
<color name="verdnatura_red">#e74c3c</color> <color name="verdnatura_red">#e74c3c</color>
<color name="verdnatura_warm_brown">#8b4200</color> <color name="verdnatura_warm_brown">#8b4200</color>
<color name="verdnatura_pumpkin_orange">#f7931e</color> <color name="verdnatura_pumpkin_orange">#f7931e</color>
<color name="verdnatura_pumpkin_light">#f77956</color>
<color name="verdnatura_sunflower_yellow">#ffd400</color> <color name="verdnatura_sunflower_yellow">#ffd400</color>
<color name="verdnatura_dark_sky_blue">#4ab4e6</color> <color name="verdnatura_dark_sky_blue">#4ab4e6</color>
<color name="verdnatura_dark_green_verdnatura">#a3d131</color> <color name="verdnatura_dark_green_verdnatura">#a3d131</color>